dwyl / learn-iot

:seedling: Learn how to build Internet of Things (IoT) Apps using Arduino and/or Raspberry Pi in plain old JavaScript!
13 stars 1 forks source link

Pros and cons of raspberry pi vs arduino for johnny five project #11

Open naazy opened 6 years ago

naazy commented 6 years ago

When I first started learning Johnny Five, I found some of the pros/cons of using an arduino vs pi were not clear. It wasn't clear to me for example that raspberry pis do not have analog inputs and therefore you need to solder on an analog-digital converter (ADC) in order to use any analog sensors. Also I was also unaware that only certain ADCs are compatible with johnny-five. Arduinos on the other hand have both digital and analog inputs which I think makes life a lot easier for a beginner (especially because if you mess up soldering your ADC then your breadboard is a write off :cry:).

Also Johnny five uses firmata to run node js scripts on the arduino via the serial port. Sadly this means that unless you hook up the arduino to run via wifi, it has to be connected to a computer. Also as far as I'm aware, you can't actually run node scripts on the arduino directly (hence why it has to be connected to a computer). With raspberry pis on the other hand, you can run the node js script on raspbian (lite or full) and therefore there is no need for a separate machine.

When using raspberry pis and johnny five, you need to use https://github.com/nebrius/raspi-io as well as johnny five (although I found it much harder to configure and get started quickly than by using an arduino).

Another (cheat) option to get up and running quickly is to run the node script on the pi and connect via usb to the serial port of the Arduino. That way you get access to all of the analog pins on the arduino without needing to solder and you don't need to keep your arduino connected to your computer 😄

I've also found more helpful tutorials generally for arduinos than raspberry pis but it's possibly because I'm not looking in the right place.

The pins are also clearly labelled on an arduino but not at all on a pi. However arduinos can only run one thing at a time whereas raspberry pis can handle doing lots of things at once

andrew-j-roberts commented 4 years ago

Old post but still useful, thanks for tossing this on the internet 👍

nelsonic commented 4 years ago

@andrew-j-roberts we are stoked you found it useful. 🎉 Thanks for sharing your appreciation. ❤️ @dwyl we strongly advocate for sharing as much (non sensitive info) on GitHub as possible 📝 because some day it will be useful to someone else. 💭

We have all felt like this XKCD comic at some point: https://xkcd.com/979 🤷‍♂

image

Thanks again to @naazy for opening this issue! 🥇