Automatically load StandardFirmata on Arduberry[SOLVED]

Dear All,

Every time that I reboot the raspberry PI 2, I need to re-upload the StandardFirmata sketch (open the Examples > Firmata > StandardFirmata sketch, and upload it to the Arduberry board). Do you know any way to automatically upload the StandardFirmata sketch. I am thinking that it might be a way to upload the sketch using a command in the terminal or maybe using a shell script that runs when the raspberry PI 2 is rebooting.

miguel

Hi miguel,
Why are you uploading the StarndardFirmata sketch. The Pi should be able to upload the code to the Arduberry using SPI.

-Karan

Dear Karan,

I am controlling the Arduberry with a racket script [1] using the StandardFirmata. However, everytime that I restart the PI, the StandardFirmata should be uploaded to work with the racket script. Can you elabore more about how to upload the code to the Arduberry using SPI?

What I want to do is to run a command in the terminal to upload any script to the Arduberry.

[1] http://jura.mdx.ac.uk/mdxracket/index.php/Raspberry_Pi,_Arduino_and_Firmata

Thank you,
miguel

Hi miguel,
I don’t know much about racket or StandardFirmata, however, if all you want to do is to upload that firmware from the terminal, i can help with that.

First go to the ArduinoIDE on the Pi, open the StandardFirmata example. The goto File->Preferences and make sure that Show verbose output during: compilation is selected.

The compile the standard firmata (Do not upload). You’ll get a message with the path to the hex file in the black screen below the editor (in the screenshot it is : /tmp/build79…44.tmp/StandardFirmwata.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 the StandardFirmwata, use this on the command line: avrdude -c gpio1 -p m328p -U flash:w:StandardFirmata.cpp.hex from the folder where the StandardFirmata.cpp.hex is present. This will upload the firmware to the Arduberry. You can automate this to run at boot too.

Do let us know if you need any more help and also let us know more about the project that you are doing with this.

-Karan

Dear Karan,

I really appreciate your time and help. I am building a robot, once I will have an updated version I will happily share with the comunitiy? Should I create a new ticket in the forum regarding my project?

Following your suggestions, I have created the hex file and when running the avrdude command I get an error with the gpio1. Any suggestions?

`$ avrdude -c gpio1 -p m328p -U flash:w:StandardFirmata.cpp.hex

avrdude: Can’t find programmer id “gpio1”

Valid programmers are:
c2n232i = serial port banging, reset=dtr sck=!rts mosi=!txd miso=!cts [/etc/avrdude.conf:691]
dasa3 = serial port banging, reset=!dtr sck=rts mosi=txd miso=cts [/etc/avrdude.conf:678]
dasa = serial port banging, reset=rts sck=dtr mosi=txd miso=cts [/etc/avrdude.conf:665]
siprog = Lancos SI-Prog <http://www.lancos.com/siprogsch.html> [/etc/avrdude.conf:652]
ponyser = design ponyprog serial, reset=!txd sck=rts mosi=dtr miso=cts [/etc/avrdude.conf:639]
gpio = Use sysfs interface to bitbang GPIO lines [/etc/avrdude.conf:606]
pavr = Jason Kyle’s pAVR Serial Programmer [/etc/avrdude.conf:589]
dragon_pdi = Atmel AVR Dragon in PDI mode [/etc/avrdude.conf:582]
dragon_dw = Atmel AVR Dragon in debugWire mode [/etc/avrdude.conf:574]
dragon_hvsp = Atmel AVR Dragon in HVSP mode [/etc/avrdude.conf:566]
dragon_pp = Atmel AVR Dragon in PP mode [/etc/avrdude.conf:558]
dragon_isp = Atmel AVR Dragon in ISP mode [/etc/avrdude.conf:550]
dragon_jtag = Atmel AVR Dragon in JTAG mode [/etc/avrdude.conf:542]
jtag2pdi = Atmel JTAG ICE mkII PDI mode [/etc/avrdude.conf:534]
jtag2avr32 = Atmel JTAG ICE mkII im AVR32 mode [/etc/avrdude.conf:526]
jtagmkII_avr32 = Atmel JTAG ICE mkII im AVR32 mode [/etc/avrdude.conf:518]
jtag2dw = Atmel JTAG ICE mkII in debugWire mode [/etc/avrdude.conf:510]
jtag2isp = Atmel JTAG ICE mkII in ISP mode [/etc/avrdude.conf:502]
jtag2 = Atmel JTAG ICE mkII [/etc/avrdude.conf:494]
jtag2fast = Atmel JTAG ICE mkII [/etc/avrdude.conf:486]
jtag2slow = Atmel JTAG ICE mkII [/etc/avrdude.conf:478]
jtagmkII = Atmel JTAG ICE mkII [/etc/avrdude.conf:470]
jtag1slow = Atmel JTAG ICE (mkI) [/etc/avrdude.conf:463]
jtag1 = Atmel JTAG ICE (mkI) [/etc/avrdude.conf:455]
jtagmkI = Atmel JTAG ICE (mkI) [/etc/avrdude.conf:447]
avr911 = Atmel AppNote AVR911 AVROSP [/etc/avrdude.conf:441]
avr109 = Atmel AppNote AVR109 Boot Loader [/etc/avrdude.conf:435]
butterfly = Atmel Butterfly Development Board [/etc/avrdude.conf:429]
usbtiny = USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/ [/etc/avrdude.conf:423]
usbasp = USBasp, http://www.fischl.de/usbasp/ [/etc/avrdude.conf:417]
avr910 = Atmel Low Cost Serial Programmer [/etc/avrdude.conf:411]
stk600hvsp = Atmel STK600 in high-voltage serial programming mode [/etc/avrdude.conf:405]
stk600pp = Atmel STK600 in parallel programming mode [/etc/avrdude.conf:399]
stk600 = Atmel STK600 [/etc/avrdude.conf:393]
stk500hvsp = Atmel STK500 V2 in high-voltage serial programming mode [/etc/avrdude.conf:387]
stk500pp = Atmel STK500 V2 in parallel programming mode [/etc/avrdude.conf:381]
stk500v2 = Atmel STK500 Version 2.x firmware [/etc/avrdude.conf:375]
mib510 = Crossbow MIB510 programming board [/etc/avrdude.conf:369]
stk500v1 = Atmel STK500 Version 1.x firmware [/etc/avrdude.conf:363]
stk500 = Atmel STK500 [/etc/avrdude.conf:357]
buspirate = The Bus Pirate [/etc/avrdude.conf:347]
avrisp2 = Atmel AVR ISP mkII [/etc/avrdude.conf:341]
avrispmkII = Atmel AVR ISP mkII [/etc/avrdude.conf:335]
avrispv2 = Atmel AVR ISP V2 [/etc/avrdude.conf:329]
avrisp = Atmel AVR ISP [/etc/avrdude.conf:323]
arduino = Arduino [/etc/avrdude.conf:317]

sorry, my bad, the programmer is gpio and not gpio1, can you use this: avrdude -c gpio -p m328p -U flash:w:StandardFirmata.cpp.hex

-Karan

Dear Karan,

Thank you again for your time and help. Binary file has been uploaded successfully using your suggestion.

P.S. I am in the documentation process of my project, I will therefore share my project one I have a decent version of the documentation.

Cybernetically Yours,
miguel ~https://twitter.com/mperezxochicale