Engineers Garage

  • Electronics Projects and Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

The Arduino or Raspberry, when to use which and the Ultimate Combination

By Shlomo Schwarcz February 5, 2016

A lot of has been written on these two popular systems. Arduino had become probably the most used makers board for electronic and robotic projects and raspberry is one of the best choices when it comes to credit card sized computers.

But what one use in his project?

Well, it depends. Arduino is a micro controller. Its SOC (System On Chip) is based on the Atmel Cotrex-M ARM processors. They have a 32 Bit CPU, a small RAM memory (32K for example) and a tiny bin of Flash for uploading your compiled code. But one of the most important things is that Arduino doesn’t run an Operating System. Actually, that’s not exactly true. It runs a RTOS (Run Time Operating System) but unlike OS’s like: Linux, Windows, Android, etc the Arduino pretty much runs your code as the main and only code in the processor which means you have full control of what the processor runs.

This is great for controlling hardware devices like motors, sensors, etc and that’s why is popular in robotic projects.

The problem with Arduino is that it has very small computation power (CPU and Memory). So you can run simple code but whenever you need something a bit heavier, even like storing one single camera photo in memory it will not be possible.

Raspberry Pi however, is much more like your PC or to be more accurate, like your smart phone. It runs a regular standard OS (Linux, or Windows) and has a Quad Core Processor similar to what you will find in phones and tablets. Although all the computation power, the Pi can’t output analog (which is required by many hardware devices), and the Linux Operating System it runs is not real time meaning it can schedule your code, delay commands, and generally you don’t know exactly when your code is executed and therefore impossible to use with hardware that requires real time actions.

So what if you want a Robot that also controls motors and sensors but is also “smart” and can “think” by itself?

The answer is use both! Arduino and a Pi and that’s what we have done in our robot project: Robit

The connection is quite simple and can be done in different ways like SPI or USB. We chose the USB mainly since it’s out of the box on both sides (Arduino and the Pi).

So you connect the Arduino USB to the Pi with a simple USB cable. The USB I/O on the Arduino side is easy since it doesn’t care it it’s connected to a PC or PI or whatever.

On the Raspberry Pi once you identify the Arduino path (like /dev/ttyACM0) the communication is easy from a Python script using libraries like pyserial or any language that has a proper library for serial communication.

Next you develop a protocol that will be the language the two communicated with each other. This is typically done by defining commands that the Pi sends to the Arduino to tell him what to do. For example: mov1,200 will tell him to run on motor number 1 on speed 200.

Now the interesting question is what things to perform where?

So it’s obvious that analog input and output and real time stuff is done with Arduino. It’s also obvious that those high level stuff like HTTP server, video and image processing is done on the Pi. But it’s those little things in the middle that make it difficult.

Let’s say I’m moving a robot on wheels and I want him to move for 2 seconds. One way is having the Pi tell Arduino to start move, and after 2 seconds tell him to stop. The problem is that the Pi might miss a little because of the non-real time OS. So instead of 2 seconds we can get 2.01. In some cases that wouldn’t be a big deal.

Now, let’s say we have wheel encoders counting the number of wheel spins. Each full round (360) is 1200 encoder units (so it can count 1/1200 of a wheel spin!). Now if I want it to move exactly 60,000 units (so that’s 50 wheel spins) I need to turn the motor on, then read 60,000 encoder interrupts and then stop. This whole journey takes about 2 seconds. So we need to have 30,000 input commands read and processed a second. Unfortunately, that will never work. Two things will happen: First, Pi running a few lines of Python on each iteration will probably be too slow. Second, if you enter an output command in the Arduino’s main loop (on each iteration) it will slow down the Arduino and it will never be able to read those 60,000 rounds.

The solution is to create a more sophisticated command saying: “move motor 1 at speed 200 and for 60000 rounds”.

But what happens if we want to put in more logic? Like have an ultrasonic sensor prevent the robot running into walls? So we need another command saying: “move motor 1 at speed 200 and for 60000 rounds, but if you sense there is a wall stop”

Now, we want the pi to be able to stop the robot, say if the user sends a stop command via his smart phone (using HTTP over WiFi). So we need the Arduino to be able to terminate a command by a signal received from the USB.

The more sensor we have it gets harder and harder. At Robit, We wanted to allow a high level developer (Python, C, Java or JavaScript) tell the robot what to do. But for that to work we need a rich library of Arduino commands with priorities between them and an understatement of what and how Raspberry tells Arduino what to do.


Filed Under: Reviews

 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Amperage changes in DC-DC conversion
  • Colpitts oscillator
  • What are the advantages and disadvantages of a differential structure compared to a single-ended structure?
  • Audio Switching
  • BOM sent to Contract assemblers doesnt correspond to schem

RSS Electro-Tech-Online.com Discussions

  • LED circuit for 1/6 scale diorama
  • stud mount Schottky diodes
  • using a RTC in SF basic
  • Hi Guys
  • Can I use this charger in every country?

Featured – Designing of Audio Amplifiers part 9 series

  • Basics of Audio Amplifier – 1/9
  • Designing 250 Milli Watt Audio Power Amplifier – 2/9
  • Designing 1 Watt Audio Power Amplifier – 3/9
  • Designing a Bass Boost Amplifier – 4/9
  • Designing a 6 Watt Car Audio Amplifier – 5/9
  • Design a low power amplifier for headphones- 6/9

Recent Articles

  • Fischer connector system adds ratchet locking system designed for 300g shock resistance
  • Littelfuse introduces tactile switch with enhanced bracket peg design for mounting strength
  • Infineon releases GaN switch with monolithic bidirectional design
  • Sienna Semiconductor data converters feature sample rates from 20 to 250 Msps
  • Delta’s 5,500 W power supplies achieve 97.5% energy efficiency for AI servers

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronics Projects and Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe