You may have never used Raspberry Pi or Arduino, but chances are you’ve heard of them. Raspberry Pi has been the best-selling British computer for years now and Arduino has been transforming the DIY community one board at a time. There’s no shortage of options designed to provide you with a little electronic control over your projects, but the budget-friendly Raspberry Pi and the plethora of solutions under the Arduino brand are certainly two of the most popular.
But comparing the two can be like judging a lineup of cats and dogs. They’re both animals — they both lick themselves — but they each dig holes for very different reasons.
OddWires - the Bay Area Supplier of IoT, Arduino and Raspberry Pi. Since 2012 oddWires has been based in the San Francisco East Bay close to the hub of Oakland and Berkeley for fast, low-cost shipping throughout the USA and World-wide. With the Arduino Adapter For Raspberry Pi, there's a way for the Raspberry Pi GPIO interface to adapt to Arduino pinouts, it is now possible to use the Pi together with vast Arduino shields and hardware/software resources.
So lets pit Arduino vs. Raspberry Pi to help you identify what to purchase for your next project.
Say Hi To Raspberry Pi
For all intents and purposes, the Raspberry Pi is a fully functional computer. It has all the trappings of a computer, with a dedicated processor, memory, and a graphics driver for output through HDMI. It even runs an optimized version of the Linux operating system called Raspbian. Most Linux software is easy to install, and lets you use the Raspberry Pi as a functioning media streamer or video game emulator with a small amount of effort.
Though the Raspberry Pi doesn’t offer built-in on-board storage, you can use microSD cards to store whatever operating system you choose, whether its Raspbian, Ubuntu Mate, or even the Internet of Things version of Windows 10. You can essentially install different operating systems on different microSD cards for swapping platforms, testing updates, and debugging software. And because the card includes Wi-Fi and Ethernet-based connectivity, you can also set it up for access via SSH, or transfer files to it using FTP.
Technically, there are six versions of the Raspberry Pi board you can purchase right now, but overall there are only two form factors: full-size and miniature. The most recent Raspberry Pi boards are the full-size third-generation Model B for $35, and the miniature Raspberry Pi Zero for a mere $5. For the latter, you can purchase a version with Wi-Fi and Bluetooth for $10. The other three Raspberry Pi boards on the market are older-generation full-size models: Gen2 Model B ($30), Gen1 Model B+ ($25), and Gen1 Model A+ ($20).
Here’s a comparison between the two major models with built-in Wi-Fi:
Raspberry Pi 3 Model B | Raspberry Pi Zero W | |
Processor: | Broadcom BCM2837 | Broadcom BCM2835 |
Processor cores: | 4 | 1 |
Processor speed: | 1.2GHz | 1.0GHz |
Memory: | 1GB | 512MB |
Storage: | MicroSDHC | MicroSDHC |
Connectivity: | Wireless N Bluetooth 4.1 | Wireless N Bluetooth 4.1 |
Ports: | 4x USB-A 2.0 1x HDMI 1.3 1x Micro USB 1x stereo/composite video 1x 40-pin GPIO 1x CSI camera port 1x DSI display port | 1x Mini HDMI 1x Mini USB OTG 1x Micro USB 1x 40-pin GPIO 1x CSI camera port 1x Composite video header 1x Reset header |
Dimensions: | 3.370 x 2.224 x 0.669 inches | 2.56 x 1.18 x 0.20 inches |
Price: | $35 | $10 |
As shown, Raspberry Pi products are the brain of your project. For instance, the Piper Computer Kit we reviewed last year is a Linux-based laptop powered by the Raspberry Pi 3, as is Kano’s Computer Kit Complete that kids can assemble to create a Linux-based all-in-one PC.
Those are two examples of kits you can purchase, but there’s a large community that can steer you in the right direction to build projects from scratch, such as Game Boy Zero, a working miniature Macintosh, Pip-Boy from Fallout 4, and more.
Meet Arduino
Unlike Raspberry Pi, Arduino boards are micro-controllers, not full computers. They don’t run a full operating system, but simply execute written code as their firmware interprets it. You lose access to the basic tools an operating system provides, but on the other hand, directly executing simple code is easier, and is accomplished with no operating system overhead.
The main purpose of the Arduino board is to interface with sensors and devices, so it’s great for hardware projects in which you simply want things to respond to various sensor readings and manual input. That might not seem like a lot, but it’s actually a very sophisticated system that allows you to better manage your devices. It’s great for interfacing with other devices and actuators, where a full operating system would be overkill for handling simple read and response actions.
But because Arduino isn’t the “brain” of your project, solutions aren’t locked to a handful of boards. Instead, there are more than 50 solutions for entry-level products, advanced devices, Internet of Things projects, education, wearables, and 3D printing. Of course, they all have processors, memory, and in some cases storage, but they’re designed to serve as controllers, not miniature computers.
Great examples of Arduino projects can be found here. One project is the Arduino Servo Catapult that fires off a bowl full of food when a cat walks onto a pressure sensor mat seated under its dish. Another project transforms a Nerf Vulcan gun into a sentry turret that can track its enemies. Arduino devices can even be used to add a fingerprint scanner onto a garage door opener. As we reported earlier, many robot kits for kids you can buy on Amazon are based on the Arduino software and hardware platform.
Arduino vs. Raspberry Pi: Power
The two systems have very different power requirements. For starters, the Raspberry Pi 3 Model B board uses 1.5 watts when idle, and up to 6.7 watts when a monitor, keyboard, and mouse is connected. The smaller Raspberry Pi Zero W consumes 0.5 watts of power when idle, and 1.75 watts when a monitor, keyboard, and mouse is attached.
Both Raspberry Pi boards require five volts to remain on, so you need a wall adapter or rechargeable battery pack with a higher voltage. For instance, both Raspberry Pi-based kits we reviewed provided an internal rechargeable battery that connected directly to the board. These batteries included an additional Micro USB port for recharging via a wall adapter, or using the device like any other electrically tethered PC.
Meanwhile, Arduino devices begin executing code when turned on, and stop once you pull the plug. To add functionality, you either wire directly into the pins on the Arduino board, or stack chips called “shields” on top of the base unit. There are hundreds of shields, each of which is designed to perform a different task, interface with certain sensors, and work with one another to build a complete control unit.
Thus, for Arduino, you merely need a battery pack that keeps the voltage above a certain level, along with a basic shield to manage the power. Even if the power drops on the Arduino, you won’t end up with a corrupt operating system or other software errors: it will just start running code when it’s plugged back in. For Raspberry Pi, you must shut it down within the operating system like any other computer, or else risk corruption and software problems.
Arduino vs. Raspberry Pi: Networking
The Raspberry Pi 3 has both a built-in Ethernet port and Wireless N connectivity, which allows easy access to any network with little setup. Once you’re connected, you can use the operating system to connect to web servers, process HTML, or post to the internet. You can even use it as a VPN or print server.
Unfortunately, Arduino devices typically aren’t built for network connectivity directly out of the box. Though it’s possible, they require a bit more tinkering to set up a proper connection. You’ll need an extra chip outfitted with an Ethernet port, and you’ll need to do some wiring and coding to get everything up and running just right, which is enough of a process in itself that some vendors sell comparable Arduino devices with a built-in Ethernet component.
Arduino vs. Raspberry Pi: Sensors
While Raspberry Pi and Arduino devices have a number of interface ports, connecting analog sensors to Arduino devices is an easier process. The micro-controller can easily interpret and respond to a wide range of sensor data using the code you put on it, which is great if you intend to repeat a series of commands or respond to sensor data as a means of making adjustments to servos and devices.
Raspberry Pi boards, on the other hand, require software to effectively interface with these sorts of devices, which isn’t always what you need if you’re just trying to water plants or keep your beer at the right temperature. Using both in a project isn’t all that uncommon, as the Arduino device could act as a control board that executes commands issued by the Raspberry Pi’s software before the sensor information is fed back for recording or acknowledgement.
Match made in DIY heaven?
So which solution is right for you? The answer will depend heavily on your project.
You should take the Arduino route if the main task involves reading sensor data and changing values on motors or other devices. Given the low power requirements and upkeep of Arduino devices, they’re also a good choice if your project will continuously run, and require little to no interaction.
You should go with a Raspberry Pi board if your project involves a task you would otherwise accomplish on a personal computer. Raspberry Pi boards make a slew of operations easier to manage, whether you intend to connect to the internet to read and write data, view media of any kind, or connect to an external display.
But given the two devices accomplish different tasks, using both in some instances is ideal. As one optional example, Raspberry Pi could give you client-side access to the settings and code, while the Arduino gadget could handle the actuation of devices, and gather data from the sensors. There are a number of ways to go about making the connection, whether you prefer USB, a local network, or by running some of the I/O ports on the Arduino device into the Raspberry Pi board.
Editors' Recommendations
In previous tutorial we interfaced the XBee module with Arduino Uno and made them communicate wirelessly using XBee module. Now we will interface XBee module with Raspberry Pi which will act as a receiver and make it communicate wirelessly with another XBee module (XBee explorer board) which is serially connected with the laptop.
Hardware Requirements
- 1 x Raspberry Pi with Raspbian Installed in it
- 2 x XBee Pro S2C modules (any other model can be used)
- 1 x XBee explorer board (optional)
- 1 x Xbee Breakout board (optional)
- USB cables
- LEDs
It is assumed that your Raspberry Pi is already flashed with an operating system. If not, follow the Getting started with Raspberry Pi tutorial before proceeding. Here we are using Rasbian Jessie installed Raspberry Pi 3.
Here External Monitor using HDMI cable is used as display to connect with Raspberry Pi. If you don’t have monitor, you can use SSH client (Putty) or VNC server to connect to Raspberry pi using Laptop or computer. Learn more about setting up Raspberry Pi headlessly here.
Configuring XBee Modules using XCTU
As we have learnt in previous tutorial of ZigBee Introduction that the XBee module can act as a Coordinator, Router or an End device but it need to be configured to work in desired mode. So, before using the XBee modules with Raspberry Pi, we have to configure these modules using XCTU software.
To connect XBee module with the laptop, a USB to serial converter or specifically designed explorer board is used. Just hook up the XBee module to the Explorer board and plug it with the laptop using USB cable.
If you don’t have any converter or explorer board, then an Arduino board can be used as a USB to serial device which can easily communicate with the XBee and laptop. Just upload blank sketch in Arduino board and now it can behave like a USB to Serial converter.
Configuring XBee Modules:
Here in this tutorial, an Explorer board is used to configure the XBee modules.
Download the XCTU software from this link and install it. After downloading and installing the XCTU software, open it and make sure your XBee module is properly connected. Check the COM port of the Arduino board in device manager.
1. Now, click on the search button. This will show you all the RF devices connected with your laptop. In our case, it will show only one XBee module.
2. Select the Serial port of the Explorer board/Arduino board and click on Next.
3. In the next window, set the USB port parameters as shown below and click on Finish.
4. Select the Discovered device and click on Add selected device. This process will add your XBee module to XCTU dashboard.
5. Now, you can configure your XBee module in this window. You can use either AT commands or put the data manually. As you can see, there is R showing on the left panel which means XBee is in router mode. We have to make it Coordinator for the transmitter part.
First, update the Firmware by clicking on the Update firmware.
6. Choose the Product family of your device which is available on back of your XBee module. Select function set and firmware version as highlighted below and click on Update.
7. Now, you have to give ID, MY and DL data to make connection with other XBee. ID remains same for both the modules. Only MY and DL data interchange i.e. MY for the receiver XBee becomes DL of the transmitter XBee (coordinator) and DL for the receiver XBee becomes MY of the transmitter XBee. Make CE as Coordinator and then hit the Write button. As shown below.
ATDL | ATMY | ATID | |
XBee 1 coordinator | 1234 | 5678 | 2244 |
XBee 2 end device | 5678 | 1234 | 2244 |
8. After writing the above data to the transmitter part, plug out it from the explorer board and plug in the second XBee module in it. Repeat the same process as above only changes are the DL, MY, and CE. As we will make the second XBee as End device so in CE drop down menu, select the End device and hit the Write button.
9. Now, our XBee modules are ready to interface with the Raspberry Pi. We will connect the transmitter XBee to the laptop and receiver XBee with the Raspberry Pi. Then give commands to the receiver part using laptop. laptop.
Circuit Diagram for Receiver Part
Connections for interfacing ZigBee module with Raspberry PI are shown in the circuit diagram.
Connections:
- Tx (pin2)of XBee -> Tx of pin Raspberry Pi
- Rx(pin3) of XBee -> Rx of pin Raspberry Pi
- Gnd (pin10) of XBee -> GND of pin Raspberry Pi
- Vcc (Pin1) of XBee -> 3.3v of pin Raspberry Pi
- Led is connected to GPIO 23
Setup Raspberry Pi for Serial communication
Now, we will setup the Raspberry Pi for the Serial communication. By default, the hardware serial port of Pi is disabled. So, we have to enable it before starting the connection.
1. In the terminal, run the command raspi-config.
2. Go to option 5 Interfacing options and hit the enter. Now, select the P6 Serial option and Enable it and then save.
Exit the terminal and you are all set to make the connection between Raspberry Pi and XBee. GPIO14 and 15 will act as Tx and Rx respectively and these are available at /dev/ttyS0 port of raspberry pi.
Now, we will write a python script to ON the LED whenever we receive ‘a’ from the transmitter side XBee.
Programming Raspberry Pi for XBee communication
Complete python program for interfacing XBee with Raspberry Pi is given at the end.
First, we have to import the time, serial and RPi.GPIO libraries using import function.
Now, write the properties of serial connection, define port, baudrate and parities as below.
Write all the send and receiving elements in the while loop.
You can use ser.write function to send the messages to the transmitter side. Uncomment the below lines to send countings.
For receiving the messages we have to use ser.readline() function. Store the incoming message in a variable and check the condition. If incoming message is ‘a’ then turn ON the LED for 3 seconds and then turn OFF the LED.
Complete Python code with a Demonstration Video is given at the end of the tutorial. Paste the code in any text editor of the Pi and save it. Run the script in the terminal using sudo python script_name.py OR you can use Python IDE and Shell to execute the script.
Testing the wireless XBee communication using Raspberry Pi
Now, we all set to test our XBee transmitter and receiver. To give command to the transmitter part, we will use XCTU’s console terminal. Click on the Console icon near the settings option. Then, click on Open button to connect the XBee to the laptop.
![Buy Arduino Or Raspberry Pi Buy Arduino Or Raspberry Pi](http://data.designspark.info/uploads/JeeNode.jpg)
Enter ‘a’ in Console log. You will see that LED will turn ON for 3 seconds and then it turn OFF.
In this way you can also connect the transmitter XBee to the Arduino board as described in the previous tutorial, and make the Raspberry Pi and Arduino to communicate with each other.
#!/usr/bin/env python
import time
import serial
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(23,GPIO.OUT)
ser = serial.Serial(
port='/dev/ttyS0',
baudrate = 9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1
)
counter=0
while 1:
#ser.write(str.encode('Write counter: %d n'%(counter)))
#time.sleep(1)
#counter += 1
x=ser.readline().strip()
print(x)
if x 'a':
GPIO.output(23,GPIO.HIGH)
time.sleep(3)
else:
GPIO.output(23,GPIO.LOW)
import time
import serial
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(23,GPIO.OUT)
ser = serial.Serial(
port='/dev/ttyS0',
baudrate = 9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1
)
counter=0
while 1:
#ser.write(str.encode('Write counter: %d n'%(counter)))
#time.sleep(1)
#counter += 1
x=ser.readline().strip()
print(x)
if x 'a':
GPIO.output(23,GPIO.HIGH)
time.sleep(3)
else:
GPIO.output(23,GPIO.LOW)