Can I stack more than one (specifically 2) GrovePi? I need more digital ports for my app than a single GP provides.
All the GrovePi’s come from the with the I2C address 0x04 from the factory and the software is also programmed to interact with address 0x04.
You can use all the ports for Digital I/O, so you can have 11 Digital I/O ports if you want.
We haven’t tried this but if you still want to stack two GrovePi’s, you will have to update the firmware on one of the GrovePi’s. The address here has to be changed https://github.com/DexterInd/GrovePi/blob/b36652eed8d76f6bf92fe65c6bcfea68c2bbe417/Firmware/Source/v1.1/grove_pi_v1_1/grove_pi_v1_1.ino#L9 . After this you compile and upload the code using Arduino IDE to the GrovePi.
You will also have to make another Python library or update the current one to make it work with 2 GrovePi’s. If you just go for 2 libraries, then you’ll have to change the address just here https://github.com/DexterInd/GrovePi/blob/b36652eed8d76f6bf92fe65c6bcfea68c2bbe417/Software/Python/grovepi.py#L26 .
Thanks! I can use the “all ports as digital” solution - that provides plenty for my project.
I’m intrigued by updating the address. Firmware updates like the 2-wire support we’d discussed elsewhere are beyond my skills at present, but this might be a way to learn about firmware changes with a simple problem. Seems that the update to the GrovePi python lib could be approached by parameterizing with a default if no param were supplied. Will noodle on this.
Where is the library source located? (Sorry, the Pi with the Grove is in the barn, and the wireless link is down this morning - otherwise could search for it.) I have examined grovepi.py to update with error raising, but I am pretty sure the library is a different file that contains the low level io routines that kick out the IOError messages?
You should be able to use the D0 on the Serial Port, D2-D8 digital ports and the three analog ports too. Use pin numbers as 14,15 and 16 for ports A0,A1,A2 when using them as digital ports.
The changes on the firmware are pretty simple and should be a great learning experience if you decide to take a dig at it. Using parameters sounds like a great solution for setting everything up in the Python Library. Send us a pull request on Github if you are able to get everything to work. We’ll be happy to merge them our repository.
The Firmware source is in
GrovePi/Firmware/Source/v1.1/grove_pi_v1_1 folder in your GrovePi Folder, which should be on the Desktop if you are using our SD card.