Raspberry Pi B+ and Arduino


#1

Hello everyone!

I am working on a project and want to understand if its doable or my direction is not correct.

I am just getting started with Raspberry Pi. I have the B+ model. This will be my first code.

I have written a communication sketch for Arduion Megas using SimpleModbus Library. So basically you can tie like 32 megas as slave and make one master and then create a communication mechanism between the boards using RS-485 driver.

I want to use Raspberry Pi as the master. I was thinking of somehow connecting Arduino Mega with my Raspberry Pi and then accessing the data by setting up a webserver on Raspberry Pi. While researching how to do this, i came across Arduberry. It quickly felt like its something i am trying to do already. So i have few questions regarding this. Please kindly answer them:

  1. Is it possible to program the Arduberry other than Raspberry Pi GUI? I feel raspberry is a great product but its kinda slow for coding. Can i somehow upload my sketch using USB or ICSP interface?

  2. I am not sure how the data between the webserver and the Arduino will be shared. I want to be able to access the Arduino data over the internet somehow

  3. I am a fairy good coder in PHP language (which is used for webprogramming). Can i create a bare minimum sketch in Arduino or Raspberry Pi that enables most of the code logic in PHP?

Thanks in advance


#2

Hi,

  1. There are various other ways to upload the code to Arduberry. You can compile the code on your own machine and send the hex file to the Raspberry Pi using something like Filezilla, and burn the code using this command: avrdude -c gpio -p m328p -U flash:w:firmware.hex.

If you want to set up a workflow without these many steps, then you can configure your IDE or Notepad++ or Sublime Text to edit files over network using SFTP. Also select Use external editor in the Arduino IDE on the Pi. This way you will be able to edit the files over the network and when you want to compile or upload the code, you can just press the Upload button on the Arduino IDE.

2 & 3) You can access the data from the Arduberry on the Raspberry Pi via I2C or Serial Interface. You can write scripts in any language that you are comfortable with to read this data and send it to the Internet. There should be a lot of information on “how to access the data from an Arduino” and it should be the same for the Arduberry too. This might help http://stackoverflow.com/questions/13114275/php-serial-port-data-return-from-arduino and we have a tutorial in Python too, https://www.dexterindustries.com/Arduberry/how-to-program-the-arduberry/python-communicating-arduberry/ .

Let us know if this helped or if you need any more help.

-Karan