Using multiple GrovePi’s together

Using multiple GrovePi’s together

For a lot of projects you need a lot of I/O ports. The GrovePi has 15 I/O ports but even those may be less for some of the projects. The big advantage with the GrovePi is that you can use multiple GrovePi’s together with a small change in the firmware and software.

We are releasing a script which should let you use multiple GrovePi’s, as many as 5 currently but you can use a lot more.

The GrovePi uses I2C to communicate with the Raspberry Pi. The good thing about I2C is that it uses different addresses to differentiate between devices. So to use multiple GrovePi’s together, we are going to burn each GrovePi with a different firmware and use a library that works with that firmware.

Here are the steps to use multiple GrovePi’s with the Pi:

  1. The first thing to do to use multiple GrovePi’s is to install the firmware and software individually on each of them.Slide the first GrovePi on the Raspberry Pi and power it on.
  2. Update the GrovePi repository and goto multi_grovepi_installer folder:
     cd Desktop/GrovePi/Script/multi_grovepi_installer/

    Goto the multi script solder

  3. Make the install script executable:
     sudo chmod +x

    Make the script executable

  4. Run the script:
     sudo ./

    Run the multi GrovePi script

  5. You will see the menu as above. Select an address at which the GrovePi will be programmed. The default address that GrovePi’s come with is 0x04 so you can choose any of the other address.
  6. The installer will burn the firmware and also update the library
    Start the script
  7. If you can see the GrovePi being detected on the address that you have selected, then the process is completed. Make a not of the address on the GrovePi so that you do not forget which address if for which GrovePi.
    Multi GrovePi Installation complete
  8. Once you are done updating the software and firmware on each GrovePi individually. Stack them together and run:
     sudo i2cdetect -y 1

    Multiple GrovePi's connected
    and you should see all of them together

  9. The installer also installed a library which should work for each individual GrovePi. So for the GrovePi on address 0x03, you would have a library called grovepi3.
  10. Now you can simply use the libraries to use all the GrovePi’s together. Here is an example to get you started:import time
    import time
    import grovepi #GrovePi with address 4
    import grovepi3 #GrovePi with address 3
    led = 4
    while True:
     grovepi.digitalWrite(led,1) # Send HIGH to switch on LED on the GrovePi with addr 4
     grovepi3.digitalWrite(led,1) # Send HIGH to switch on LED on the GrovePi with addr 3
     grovepi.digitalWrite(led,0) # Send LOW to switch off LED on the GrovePi with addr 4
     grovepi3.digitalWrite(led,0) # Send LOW to switch off LED on the GrovePi with addr 3
  11. Similarly, you can modify the other scripts to make them work

Have a question or a suggestion?  Post it on the forums and we’ll help you out.