GrovePi with Arduino IDE?

Hi everybody,
Sorry for my bad English, i am french :frowning: !

i just bought one grovepi card for my raspberry B+.

i had some problems with arduino IDE:

In first: can we program GrovePi with arduino ?
Wich port set? (i have /dev/ttyS0)
Wich card is grovepi ? (arduino uno, getboard with atmegaā€¦)

when i try to burn initialise sequence i have some problem.

When i do :
Sudo avrdude -c gpio -p m328p no card detected,
so i follow the ā€œupdate firmwareā€ link, all ok but no card detect with sudo avrdudeā€¦if i release the wire.
But now when i put the jumper wire on grovepi for (RESET)
and i do sudo avrdude -c gpio -p m328p , the card is detected and ready !

Can i programming with the wire connected ?

I dont know if you can understand what i write ^^ but if someone can help me in arduino i thanks a lot this man ! ^^

Hey,
To upload the firmware on to the ATMEGA328, the only way possible is to burn the firmware from SPI. There is no bootloader on it so you cannot upload it with Serial.

What you can do is enable the verbose mode on the Arduino IDE from the ā€œPreferencesā€ for ā€œCompileā€. There would be a hex file which is generated for the board. Just use avrdude -c gpio -p m328p -U flash:w:firmware_name.hex to upload the code.

Sorry, but there is no way to directly upload the code for now.

-Karan

Hi, thanks for your answer :), I just updating the firmware with the terminal : avrdude -c gpio -p m328p -U flash:w:grove_pi_firmware.hex, with success. ok now the board is updated.
What you mean ā€œSPIā€ ?
Can you help me to configure arduino ? wich board is GrovePi ? wich programmer, wich serial port (dev/ttyS0 ?), only select compile in preference ?


I only wqnt to use the serial monitor in arduino wich an easy program for saying ā€œhelloā€, but the serial monitor dont say anything. Its possible to use the serial monitor ?

And i have ā€œcontent mismatchā€ in error , i think something is not installed correctly.

Hey,
Is there any specific reason that you are using an Arduino IDE. The way that we have built the GrovePi is so that you donā€™t have to use the Arduino IDE and can simply access the sensor data from a language like Python.

Check out this example here to see how to get started:http://www.dexterindustries.com/GrovePi/projects-for-the-raspberry-pi/raspberry-pi-led-tutorial/ .

If you still want to change the firmware let us know but rarely does anyone want to tinker with the firmware.

-Karan

Ok =, I just wanted to use arduino for command ā€œserialprintln(digitalRead(A0))ā€ can I use python for see the sensors states in real time ? automatically refresh every second ?

Hey,
It pretty easy to read from an analog sensor in Python. Just call the analogRead() function for the Pin that you want to read from. Hereā€™s an example that should help you out: https://github.com/DexterInd/GrovePi/blob/master/Software/Python/grove_light_sensor.py .

You might have also corrupted the firmware of the GrovePi, so please make sure that you do a firmware update before you start: http://www.dexterindustries.com/GrovePi/get-started-with-the-grovepi/updating-firmware/ .

-Karan

Hello, Karan
iā€™m french too. sorry for my english

i use grove shield with my arduino mega.
i would like to use grove pi with the arduino IDE because :

  • i use ardublock who is plugin to arduino iDE.
    ardublock is a visual programming.
  • I use ardublock with my student.
  • i need a visual programming for my student.
  • i use many lib developpe for the arduino iDE (i need those lib)

so did you think that it s possible to use arduino ide with grovepi ?

i ve seen some tuto to set up arduino IDE on rasberry.
but which kind of card an which serial port is grove pi from the arduino IDE.
should i configure some new hardware ?

thanks a lot
karl

I have written my own custom firmware for the GrovePi many times now.

I do it slightly differently, but the end result is the same.

I use Arduino IDE on my iMac because I find it too laggy both VNC-ing into my RasPi and using it directly.

I make changes to the firmware.ino file, just like any other Arduino sketch, then I click Verify to compile into firmware.hex.

In my Arduino IDE settings, I have [x] show verbose output ticked, so in the footer console, it shows me which temp folder the .hex file is generated in.

I then scp the .hex file alone to my RasPi, and run the avrdude command mentioned above. D14 and ISP reset are connected with a jumper wire, as per the instructions on the website.

The red light on the board lights up and the sketch is uploaded.

There might be an easier way, but this is pretty simple, automated and it works for me.

Next, I write some Python scripts which talk to the GrovePi over the I2C bus.

If I had a USB AVR programmer, I might be able to upload a sketch directly to the GrovePi by connecting to the ISP socket and soldering on 2x3 headers. Karan would probably be the man to talk to about this.

The benefit of writing your own firmware is that you can use existing Arduino C libraries to do the heavy lifting.

The GrovePi firmware contains all of the basic I/O functions you would expect with an Arduino but also caches their output so that you can issue I2C commands from the RasPi to retrieve/set their values. The GrovePi acts as a I2C based proxy between the digital RasPi world and analog Arduino world.

The GrovePi is connected to the RasPiā€™s I2C and SPI buses. I2C for I/O commands, which the firmware/sketch listens for. SPI for uploading new firmware/sketches. That avrdude command above is using the SPI bus.

If all you want to do is a digitalRead(), technically you donā€™t even need a GrovePi. RasPi can read a digital pin. Piece-o-cake. Get a Grove cable that breaks out into 4x male pins and connect them to the GPIO.

If you want to analogRead(), youā€™re going to need a separate ADC device, as the RasPi is digital only. An Arduino, a GrovePi, a Grove ADC module, or an ADC IC, eg MCP3008.

The GrovePi is basically a stripped down Arduino Uno R3 mixed with a Grove base shield in a smaller form factor and leverages the RasPi GPIO for power and communications.

If you are interesting in writing your own custom sketches, consider looking at the recent changes to the firmware on GitHub. Weā€™ve added support for a bunch of new Grove sensors using existing C libraries. If you compare the changes, youā€™ll see itā€™s pretty straight forward to add your own new functionality without replacing everything that is there.

Adding new functionality also benefits the community. Simply fork the repo, add some changes, commit, push and make a pull request to share your code. I think there is an article on the website that goes into more detail on how to contribute.

Hey Mike,
Thanks for the excellent explanation on how to make changes to the firmware and upload it.

I was earlier doing something similar but found another way which was a bit more easy.

I turned on the Edit with external editor option on Arduino Preference on VNC and then open the file on the Arduino IDE. I write the code in Notepad++ on my computer, and directly edit the files on the Raspberry Pi with the awesome SFTP plugin (I think other editors support this too). As soon as I save the file, the file is synced on the Pi. When I use Upload using programmer on the Arduino IDE, the code is refreshed and then compiled and loaded on the GrovePi.

I think that there is an option for compiling the code from command line too but I have never tried it and I have to try the IDE on Pi2, maybe that might be better.

-Karan

Thank you for you re explaination.
KarlTH

Hello,

Iā€™ve been editing the GoPiGo firmware and selecting Upload using programmer on the Arduino IDE for several months now, but after updating my firmware I no longer see the Raspberry Pi option in the Tools > Programmer menu. As a result of this I cannot upload to the pi.

Can someone offer guidance?

Can you connect to the GoPiGo outside of the IDE?

Hi @cjirvene

Do you mean a Dexter Software update? Can you post a screenshot what you see with Arduino IDE, Also can you do a Dexter software update once again and see if that helps.

-Shoban

Sorry, I donā€™t understand what you mean

This is what I see after moving /usr/share/arduino/hardware/arduino/programmers.txt into /usr/share/arduino/hardware/arduino/avr/

There used to be an option for RPi in this list. After running the software updates again nothing has changed

Hi @cjirvene,

I just wanted to check on what you meant by Firmware update. If you had done a firmware update to GoPiGo, it should not affect ArduBerry in anyway as there are independent. Can you again try doing a Dexter Software update, by clicking on DI Software update icon on the desktop and do a Software update.

If the update doesnā€™t help then can you try the following command on the terminal and then try opening the Arduino IDE fresh again

sudo cp /home/pi/Dexter/ArduBerry/script/programmers.txt /usr/share/arduinot/hardware/arduino/avr/programmers.tx

Please let us know if this helps,
-Shoban

Copying over the programmers.txt fixed it. Thanks @shoban

Hi @cjirvene,

Glad that we were able to help you.

-Shoban