The Best Brain for IoT Projects – Raspberry Pi Zero W, Arduino and NodeMCU Compared!

Raspberry Pi Zero W vs Arduino vs NodeMCU Compared

IoT has taken off in a big way with companies like Intel, Google and Samsung all rushing for a piece of the pie. The existence of devices such as the Raspberry Pi and NodeMCU has also led to the existence of a significant hobbyist community. Since the kind of sensors used are pretty much standardized, the microcontroller (or in case of the raspberry pi the processor) make all the difference when it comes to factors such as ease of use, power draw, hardware and software support. This post will look into some of the most commonly available development boards to get your IoT project up and running.

 

Overview and Pinouts of Raspberry Pi Zero vs Arduino Nano vs NodeMCU

            Component

 Physical Size

Cost

           Pinout

Max Current Per I/O Pin

 Raspberry Pi Zero W

65mm x 30mm

[2.56 in x 1.18 in]

 $5.00

40 pins ( 28 of which are GPIO, 12 for power)

       50 mA

Arduino Nano

43.18 mm x 18.54 mm 

 [1.70 in x 0.73 in]

 $22.00

22 pins (14 digital with 6 PWM and 8 Analog)

40mA

ESP8266  Node MCU Wifi Devkit

49 mm x 24.5 mm

[1.92 in x 0.96 in]

 $10.00

16 pins (11 usable digital, 1 Analog)

12 mA

 

 

Raspberry Pi Zero W pinout Diagram

 

Raspberry Pi Zero W 

The Raspberry Pi Zero W is the largest of the three boards which is no surprise since it is a complete computer on a chip. The Pi's 40 GPIO pins at first glance may seem to be a lot, but this is offset by the fact that the Pi does not have any analog pins. For sensors requiring analog I/O an external ADC will have to be used with the Pi, alternatively one can use the GPIO pins as PWM. The pins are 3.3V tolerant, which rules out 5V sensors being used unless logic level shifters are used. Although 3.3V sensors are becoming more common, there are still plenty of 5V sensors around. The $5 cost is also misleading, as it is hard to find the board retailing for $5 and the fact that the board is practically useless without a microSD card.

We previously done many Iot based Raspberry Pi Projects.

 

Arduino Nano 

Since almost all Arduino boards use the same microcontrollers (ATMEGA 328P) and are programmed the same way, the Arduino Nano is taken here for comparison. It is the smallest board of the bunch. The Nano has 22 pins, which includes 14 digital pins (6 of which provide PWM) and 8 analog pins. The pins are 5V so 3.3V sensors may not work depending on the sensor. $22 is the cost for the official board, while Chinese clones/knockoffs that perform just as well can be had for as little as $4. The Arduino has very extensive library support for almost all sensors, so interfacing anything is just a matter of looking it up on the web.

 

Arduino Nano Pinout Diagram

Check here how a Arduino can be used to make Iot projects.

 

NodeMCU 

The NodeMCU has 11 usable digital (9 if two pins are used as TX/RX) and only 1 analog pin, although here it is worth noting that the single analog pin can be multiplexed and several sensors can be connected with it. It costs around $8- $10 in retail.

 

All the three boards support SPI (Serial Peripheral Interface) and I2C (Inter IC) Bus. The SPI bus allows for simple, high speed interfacing of sensors while I2C allows 100s of sensors to be connected using only two wires!

NodeMCU ESP8266 is the most popular Wi-Fi module to be used to make Iot applications, here are some NodeMCU based practical applications.

 

Node MCU Pinout Diagram

 

Hardware Specifications of Raspberry Pi Zero, Arduino Nano and NodeMCU

The Raspberry Pi Zero W has a Broadcom BCM2835 SoC which runs at a stock clock speed of 1 GHz and has 512 MB of RAM. Needless to say this is probably overkill for most IoT based projects. The processing power of the Pi Zero can be put to good use if the data needs to be 'processed' locally instead of just being sent to the cloud. The Zero W can run a full version of Linux and by extension, Python. It can even run implement machine learning in a limited fashion. All this comes at a cost however, the Pi Zero W requires a 5V, 2A power supply which means it can chew through even a large battery pretty quickly. It idles at ~170 mW of power and cannot be started immediately (It has to boot up, which can take about 30 seconds). It has built in Bluetooth and Wifi.

 

The Arduino Nano does not have Bluetooth or Wifi by default. But because it has such a low power draw of 0.17 mW at idle condition and roughly 1.4 W at full load, and adding to the fact that by programming it to enter 'deep sleep' mode and making it 'wake up' only at certain set intervals, it can be powered by as little as a coin cell for over a year. Networking can be provided by HC-05 Bluetooth modules or with standalone ESP8266EX modules (Note: The ESP modules can also be used on their own as microcontrollers, but without the benefit of a development board it requires considerably more effort to set up).

 

The NodeMCU is a veritable beast when compared to other microcontrollers. It runs at a stock clock speed of 80-160 MHz and can be run at clock speeds upto 160 MHz. It includes Wifi by default. The module consumes around 170 mW of power typically and has three 'sleep modes' called light sleep, medium sleep and deep sleep. With a few hacks, some users have been able to get the NodeMCU's idle power consumption to less than 1mW.

 

Community Support and Closing Remarks

The Raspberry Pi is one of the most popular SBCs out there, however it has less extensive hardware documentation than the Arduino or NodeMCU. More experienced developers can leverage the power it provides, however for a beginner dealing with Python can be daunting although the Raspberry Pi foundation has been working on gradually bridging the gap. The Magpi magazine is a great resource to get started with hardware projects using the Pi Zero W. Cameras can also be interfaced with the Pi Zero W, which is something the Arduino and NodeMCU cannot do. The board is also supported by online IOT platforms such as My devices Cayenne and Blynk which makes it trivial to get the project onto the cloud. The Pi can also do a significant amount of processing locally and for the price, there is nothing else quite like it.

 

The Arduino Nano is a part of the broader family of Arduino devices which have been around for a long time. Community support is extensive and there are libraries for each and every sensor which makes it very easy for beginners to get started. The Arduino is a rare example of copyleft hardware. Open source software projects are many and flourishing, but open source hardware projects are so rare and few that Arduino may be the only one to have taken off. Even the Raspberry Pi for all its talk of being open is not completely open source – The processor has binary blobs because they are at the mercy of Broadcom who has refused to make these details public. The Arduino has spawned many boards some of which have inbuilt radio and networking capabilities to get on cloud quickly. As of February 2019, Arduino has also launched its own cloud platform. The Arduino IDE has its own quirks, but using C is easy and Circuitpython can also be used.

 

The NodeMCU brings a unique value proposition with being fairly powerful and cheap. It can run off the Arduino IDE with a few minor modifications and can also be programmed in LUA for those who are more technically inclined. The built in Wifi module makes it very easy to connect to MQTT servers and to cloud. Community support is rapidly growing and there are several different modules built on both ESP8266 and its more powerful successor, the ESP32. Much like the Pi and Arduino, it is also compatible with all IoT platforms.

 

All the three platforms have their own pros and cons, and depending on what the user prioritizes- speed, power consumption or ease of connectivity, any of them can be used. The Raspberry pi is better at 'talking' to the web, while the Arduino and NodeMCU are better at 'real time' applications. Also it is possible to use a Raspberry Pi and Arduino to get the best of both worlds- the Arduino can wake/sleep the Pi to save power and drive low level hardware, while the Pi can be used for tasks that require more power. The possibilities are endless!