I have a couple quick questions as I’m hoping to be able to use the GrovePi+ in conjunction with a Nerves project. I’m hoping to use the Firmata protocol to communicate between the Pi running the Elixir application that doing all the coordinating and data crunching and the Arduino
First, what is the communication method between the Pi and the Arduino processor? Is it UART based, and if so what’s the serial port?
Second, how do you go about uploading custom Arduino firmware to the processor? So if write the custom firmware to deal with all the commands I plan to send to the arduino via Firmata, how do I get it uploaded.
GrovePi is communicating with the Atmega 328(Arduino Microcontroller) via the I2C protocol. You can refer to the documentation here to know more about how the GrovePi communicates with Atmega328.
To upload the custom firmware to the Atmega328, you will have to do the following.
First go to the Arduino IDE on the Pi, open the Custom firmware which you wish to upload. Then goto File->Preferences and make sure that Show verbose output during: compilation is selected.
Then compile the Custom firmware (Do not upload). You’ll get a message with the path to the hex file in the black screen below the editor (…/tmp/build79…44.tmp/CustomFirmwareName.cpp.hex).
Next, goto that /tmp location and copy this file to a place where you can easily access it (/tmp folder gets erased during reboot, so it better to keep a copy).
To upload this firmware which is the binary file for your custom firmware, use this on the command line:
avrdude -c gpio1 -p m328p -U flash:w:CustomFirmwareName.cpp.hex from the folder where the CustomFirmwareName.cpp.hex is present. This will upload the firmware to the Atmega 328.
I don’t have any experience in using firmata and probably this discussion might give you some inputs.
Please let us know if this helps,