I am trying to connect/run the following sensors to my GoPiGo:
Grove 16x2 LCD
Grove 4-Digit Display
Grove Relay
I have found very little documentation on how to do this so I wanted to ask here. Should I be using the serial port, AD1 or AD2 to connect these? Also it would be great if you have any starter code to help me with these.
There are three “Grove Relay” drivers and the “Grove_4_digit_display” driver in the GrovePi repo, which I believe is available on the GoPiGo OS image 3.0.3 (latest), probably at /home/pi/Dexter/GrovePi/Software/Python/
There are some other displays listed, not sure if any of those match your 16x2 LCD.
Perhaps in those drivers it will say “connect to ___”.
Very few things connect to the serial port nowadays, though there are some serial displays from SparkFun.
The description for the sensor should tell you what kind of signal it produces.
A “Grove” sensor means it has a Grove-type connector to attach it to other things. (SparkFun has a smaller Grove-type connector it calls a Qwik connector. Grove connector pins are on 0.1 centers and qwik connectors are on 0.03 centers like the tiny connectors in laptops and things like that. Adafruit has a similar tiny connector with a different name.)
Grove connectors are (usually) +5v logic, and these other connectors are +3v logic.
Grove connectors can (usually) accommodate one of i2c, analog, or discrete switch-like inputs.[1]
SparkFun’s and Adafruit’s special connectors are (almost?) exclusively intended for i2c connections.
You have to look at the description for the sensors, some are analog, some are discrete switch-like on/off sensors, and many will be i2c sensors as that’s the primary interface for Grove connectors.
Once you know what kind of interface a particular sensor uses, you can decide how/where to connect it.
Important notes about the GoPiGo’s Grove interfaces:
All four of the GoPiGo robot’s Grove I/O connectors can handle i2c connections and the two analog connectors can accept NC or NO switch inputs, pulled up to +5 with a 10k resistor.
All of the GoPiGo’s Grove connectors are +5v logic.
The two "i2c connectors connect to the Raspberry Pi’s hardware i2c interface.
The two “Analog” connectors can be used for software-based i2c or analog/switch inputs.
The hardware based, (i2c), Grove interfaces use the Raspberry Pi’s internal hardware based i2c interface. Due to the way the Raspberry Pi’s i2c interface is implemented, the i2c signal is not exactly conforming to the main i2c specification. This is fine for many i2c devices, but some require a more rigidly standardized signal and have trouble with the hardware based i2c.
The software based i2c interface is used for devices that are extremely picky about the i2c signal timing, as the Raspberry Pi’s hardware i2c interface has problems with clock stretching.
The "analog"inputs support analog, on/off, and i2c signal inputs, but only one type per input.
My robot Charlie makes use of one of the analog inputs to implement a front bumper - which is a metal strip attached to two NC switches.
If you’re using any i2c interface, you should be particularly careful handling i2c communication errors. Some devices, (like the Dexter Industries Inertial Navigation board), are extremely fussy and challenging to work with, and you need to be very careful how you handle the programming and exception handling.