Running Arduino sketches on the Pi

Running Arduino sketches on the Pi

Postby kolban » Wed Feb 03, 2016 2:09 am
A new project can be found on Github here:

GitHub - me-no-dev/RasPiArduino: Arduino Framework for RaspberryPI

Which provides the ability to compile Arduino sketches using the Arduino IDE on either Windows or Linux and run the resulting binaries on the Raspberry Pi.

A video tutorial has been built which illustrates getting the solution up and running. That video can be found here:

https://www.youtube.com/watch?v=lZvhtfUlY8Y

In the video, we only show getting it going for the B+ and Pi 2 but we can also run the solution on the Pi Zero and other variants.

In another video, we show how to write binaries directly to the Pi file system:

https://www.youtube.com/watch?v=sd5NLSKp1QU

I think that is interesting and useful.

Now if the Arduino IDE was running on the Pi, the extra features were added via the Boards Manager, and sketches wrote were deposited as executables in some directory on the Pi instead of "uploading" or transferring via Samba that would be fabulous. It would be similar to the way PCduino is supposed to work.

To take it one step further, having an option to run the sketch on the Pi as bare metal and only boot up Linux on the Pi if a particular IO pin is grounded, that would be even better.

I agree, Linux user space is not a blessing - it's actually a curse.

Now I have a reason for getting a Pi Zero! That is awesome!

Isaac96:
Now I have a reason for getting a Pi Zero! That is awesome!

I have one, but I'm not a fan of the Pi zero.
It seems crazy to make a linux device that has no network connectivity.
To me it could have been a great IoT device if it just had built in wifi.
But not having a standard USB port and no network connectivity makes it not very useful to me.
I'd rather use the other models.

--- bill

in a way ONLY network connectivity although its not that difficult to get a console up too over ssh or serial. by some miracle i managed to get 4 now with two in constant use over internet (security and media server). one of the others as desktop pc running arduino ide, firefox, cad, 3d printer, etc but thats not its strong point.

in reality it has exactly one standard usb which can be expanded to 4 for less than a dollar with cheap ebay hubs. some even smaller than the pi.

considering one can have half dozen of these for cost of one of the other models they are very popular where cost IS a consideration. half the power and 1/4 the size too. so popular in fact you cannot buy more than one at a time anywhere and and even then only a couple sources. so popular the waiting list may be months or years for some. quite the phenomenon.

but imo its silly to compare with arduino like so many do. bananas and oranges. speaking of which pi "clones" are hardly competition in terms of cost, popularity, or support.

I personally would never purchase a Zero, not even a B+:
just the Pi 2B quadcore is powerful enough for all tasks, because Linux brakes down the whole computational performance which overtaxes a single-core.

But with my 2B I'm absolutely fine, I just purchased a 2nd one.
It costs 40 EUR incl. VAT and shipping (original, made in GB).
:slight_smile:

bperrybap:
I have one, but I'm not a fan of the Pi zero.
It seems crazy to make a linux device that has no network connectivity.
To me it could have been a great IoT device if it just had built in wifi.
But not having a standard USB port and no network connectivity makes it not very useful to me.
I'd rather use the other models.

--- bill

For wifi, try the C.H.I.P. $9.

Pi Zero single core, 512kB RAM, 700 MHz, plus shipping plus USB hub plus external LAN = 30 EUR
Raspi 2 model B quadcore, 1GB RAM, 900 MHz, LAN, Wifi-ready, costs 40 EUR incl. shipping.

so what...?

Pi Zero single core, 512kB RAM, 700 MHz, plus shipping plus USB hub plus external LAN = 30 EUR

What?

Raspberry Pi Zero is sold for 5$ + 5$ shipping from thepihut.com and pimoroni.com (they limit order to 1pc).

Only cable needed is USB to micro USB cable that every Arduino user should have plenty of.

You ssh into Pi Zero over USB (OTG), and with internet connection sharing Pi Zero has internet access as well (for "sudo apt-get ..."). Of course Arduino SPI ethernet module does work as well ( I did that before I was able to get internet connection sharing right, SPI ethernet gives 4.7 Mbps, internet connection sharing 19Mbps and Ubuntu over same cable give 91Mbps):

Yesterday I installed "Raspberry" board into Arduino IDE following the corresponding chapter in Kolban's book:

Arduino Blink sample worked immediately:

Btw, Pi Zero is 1GHz, not 700MHZ. So "Raspberry" board for Arduino IDE makes "1GHz Arduino" available!

Hermann.

I personally would never purchase a Zero, not even a B+:
just the Pi 2B quadcore is powerful enough for all tasks, because Linux brakes
down the whole computational performance which overtaxes a single-core.

Then "NanoPi Neo", quad core 1.2GHz A7 for just 8$ might be interesting:

"I did order two NanoPi Neo, with 7$ shipping for 23$ in total"
http://forum.arduino.cc/index.php?topic=412642.msg2842531#msg2842531

How are the pins specified in the arduino IDE beeing translated to the Raspberry pi GPIO pins? I mean what is the matching? Is there a link that i can see something lik: arduino pin 11 corresponds to raspberry GPIO pin 4