Thus far in the book, we have learned how to use two discrete components to build electronics projects on a breadboard without a lot of soldering. We saw several examples and three projects that demonstrated how to build electronic solutions with discrete components and modules.
While we can continue to build our electronics projects with breadboards and jumper wires, there are better alternatives available to us. There are component systems designed to unify wiring by providing a modular cabling system to connect modules. One such component system that has been around for a while and is available for use with the Pico is called Grove.
The Grove component system has a rich host of modules we can use to build our projects simply by connecting the hardware together using polarized connectors (you can’t plug them in incorrectly). Grove expands your opportunities for building more complex projects, freeing you to concentrate on the code for your project.
In this chapter and the next three chapters, we will explore the third component system named Grove from Seeed Studio (https://wiki.seeedstudio.com/Grove/).
Overview
In this section, we will discover the Grove component system. We will learn about the capabilities and limitations of the systems as well as examples of the components available. The chapter also includes details on how to start using the components in projects.
Grove is designed to make building projects faster using pluggable modules containing sensors, input, output, and other functions. Unlike other component systems, the Grove component system supports a variety of protocols1 that operate over the same set of wires!
Grove supports the analog, digital, I2C, SPI, and universal asynchronous receiver-transmitter (UART2) protocols. Furthermore, Grove supports all of these protocols using the same wiring and connectors, so there’s no need to remember what cables go with what protocols. Cool!
Now that we know what protocols Grove supports and how the cables are wired, let’s see how easy the Grove component system makes using the modules.
The Grove Component System
Grove was created and released in 2010 by Seeed Studio (seeedstudio.com). They wanted to create an open source, modular component system to simplify rapid prototyping. But they didn’t stop there. They continued to refine and develop more modules to include an impressive array of modules that contain small circuits that include sensors, input devices, output devices, and more. They also produce host adapters for many platforms.
Seeed Studio also uses the term breakout board for host adapters.
Each host adapter supports many Grove connectors that match the capabilities of the host board. If the host board supports all of the protocols that Grove supports, the host adapter will have several connectors for each of the protocols.
These host adapters simply connect to your host board enabling the use of Grove modules without the need for additional electronics such as breadboards and discrete components without soldering.
The Grove cabling system is not designed for daisy chaining. Rather, Grove modules are connected to the host adapter directly. So, connections form a “star” layout where the modules plug into one of the connectors on the host adapter. That’s why most host adapters have so many Grove connectors. We will see some examples of host adapters in a later section.
Each Grove module is self-contained; all of the supporting electrical components are on the module mounted on a small PCB (most come in a pretty blue color in fact) of various sizes. All you need to do is connect the modules to your host adapter using a Grove cable, and your hardware is done.
Capabilities
Modularized cabling supporting four protocols (I2C, digital, analog, and UART)
Easy, polarized connectors (no incorrect or reversed connections3)
No soldering required!
How Does It Work?
We will discuss how the cables are used for each of the protocols; let’s discuss each of these in more detail.
I2C
Grove Cable (I2C)
Pin | Color | Description |
---|---|---|
1 | Yellow | SCL |
2 | White | SDA |
3 | Red | VCC (power) |
4 | Black | GND (ground) |
Digital
Grove Cable (Digital)
Pin | Color | Description |
---|---|---|
1 | Yellow | D0 – primary signal line |
2 | White | D1 – secondary signal line |
3 | Red | VCC (power) |
4 | Black | GND (ground) |
Analog
Grove Cable (Analog)
Pin | Color | Description |
---|---|---|
1 | Yellow | A0 – primary analog line |
2 | White | A1 – secondary analog line |
3 | Red | VCC (power) |
4 | Black | GND (ground) |
UART
Grove Cable (UART)
Pin | Color | Description |
---|---|---|
1 | Yellow | RX – serial receive |
2 | White | TX – serial transmit |
3 | Red | VCC (power) |
4 | Black | GND (ground) |
Having all of the cables wired the same means you don’t need to have any special cables for each of the four protocols, but there are some cases where we may need a slightly different cable. We will discuss the available Grove cables in a later section.
Grove modules come in a variety of sizes, and most have only a single Grove connector but may host a number of other connectors depending on the features supported. Grove modules are designed to support a single function using a dedicated circuit.
Grove Module Sizes (Courtesy of seeedstudio.com)
Format | Size | Example |
---|---|---|
1x1 | 20x20mm | |
1x2 | 20x40mm | |
1x3 | 20x60mm | |
2x2 | 40x40mm | |
2x3 | 40x60mm |
The host adapter has multiple Grove connectors that you can use to connect modules (depending on the protocol as their dedicated connectors for each protocol). There are a variety of host adapters available for a growing list of host boards. This includes several for the Arduino, NodeMCU, Raspberry Pi Pico, and many more. You can discover the latest offerings by visiting https://wiki.seeedstudio.com/Grove_System/#how-to-connect-grove-to-your-board.
Now that we know what the Grove system is and how it works, let’s examine some of the limitations.
Limitations
Like most systems, there are some limitations. Fortunately, there are few and only the largest or most complex projects may need to heed. The limitation you may encounter for larger projects is that the maximum number of modules that can be supported is limited to the number of connections available on the host adapter, which is often limited by the host device or by the size of the host adapter.
For example, if you want to use the Grove Pico host adapter, it has only two Grove I2C connectors and thus can use only two I2C modules. Similarly, most Grove host adapters have limited numbers of digital and analog connectors. However, there are some things you can do to mitigate some of these limitations. Seeed Studio offers a number of modules that can help out (called interfaces).
You can discover the latest interface boards available for a variety of uses at https://www.seeedstudio.com/category/Grove-c-1003.html.
See https://www.seeedstudio.com/category/Grove-c-1003/accessories-c-945/cables-c-949.html for the list of Grove cables from Seeed Studio.
Now that we know more about Grove, let’s see what components (host adapters and modules) are available.
Components Available
While you may encounter older versions of some Grove components, the older versions are still usable and can sometimes be found used for a discount.
Host Adapters
Aside from the impressive list of modules, the list of host adapters available from Seeed Studio is very impressive. Since we are working with Arduino and Raspberry Pi in this book, let’s look at versions of each for these platforms.
Notice the most commonly used GPIO pins are exposed on the upper-left corner. This allows you to use the header for additional connections. Another cool feature!
Modules
Categories of Grove Modules
Category | Description | Category Link |
---|---|---|
Sensors | Modules that allow you to sample the world around us | Sensor-for-Grove-c-24.html |
LEDs | Modules that contain various forms of LEDs | leds-c-891.html |
Input | Modules that contain devices that permit input of data or input actions like buttons | Input-c-21.html |
Wireless | Modules that support wireless technologies | wireless-c-899.html |
Displays | Modules with output devices | displays-c-929.html |
Actuators | Modules with devices that produce movement, drive motors, or produce sound | actuators-c-940.html |
Accessories | Grove accessories such as cables, headers, and more | accessories-c-945.html |
Sensors: Typically contain a single sensor that produces output (readings or values) on the I2C bus. Examples include temperature, humidity, pressure, distance, magnometer, light, and environmental (gases) sensors.
Displays: Modules that contain an output device for displaying data. Examples include OLED and LED displays.
Relays: Modules that contain relays that permit you to switch higher power devices on or off.
Motors: Modules that permit you to control small electric motors.
Input: Modules that contain one or more buttons, potentiometers, keypads, or switches.
ADC/DAC: Modules that provide analog-to-digital conversion (ADC) or digital-to-analog conversion (DAC) that permit incorporation of other circuits into your project.
Accessory: Various modules that provide handy operations such as data loggers, cryptographic operations, and more.
Now, let’s look at a sample of the Grove modules we will be using in the upcoming chapters as we explore how to write the code for IoT projects using the Grove system beginning with an output device.
Notice this module has additional pins for advanced users. In this case, we see the I2C pins broken out on the right side of the module. Modules with these features typically come without headers mounted.
Once again, there are many modules available. These are just a sampling of the modules available from Seeed Studio. A compact list of all Grove devices and modules is available at www.seeedstudio.com/category/Grove-c-1003.html.
Cabling and Connectors
The Grove system includes cables of various lengths including 5, 20, 30, 40, and 50cm. Most modules produced by Seeed Studio include a 20cm cable or longer. The 5cm cables are great for projects that include modules mounted in close proximity or inside an enclosure.
There are also special cables available for a variety of uses such as a branch or “Y” cable that lets you connect two modules to a single source, a Grove to servo cable for using servos connected directly to a host, and even cables for connecting directly to your host board with a Grove connector on one side and the other side broken out with individual male or female pins.
See www.seeedstudio.com/cables-c-949.html for a list of cables and connectors to support the Grove system.
Where to Buy Grove Components
You can purchase Qwiic components directly from Seeed Studio (seeedstudio.com), which is based in China. They often ship products quickly, but shipping may take longer than expected. Fortunately, you can often find Grove modules on popular online retail sites such as amazon.com and online auction sites. In fact, I have seen select starter kits in brick-and-mortar stores that sell electronic components. If you live in the United States, check out the online retail stores first or buy in bulk to save on shipping from Seeed Studio.
Now, let’s discuss how to use these systems in your projects.
Using the Components with Your Pico
Plugging your choice of Grove host adapter onto your host board and plugging the modules together with the cables is pretty easy. Recall, the connectors only go one way, so you can’t cross-connect anything.
However, Grove modules are not designed to be hot pluggable. You should not connect and disconnect modules while your board is powered on. This could lead to damaging the module(s) or your host board.
Do not plug or unplug Grove modules while your board is powered on.
Once the hardware is plugged together, the next step is to start working on the code to enable your modules and complete your project. To do so, you are likely required to load one or more software libraries.
Like the vast array of modules, the software libraries required for the Grove modules vary and depend on the module itself. Fortunately, Seeed Studio is very good about providing samples for use of each of their hundreds of modules.
The following summarizes the steps necessary for the Pico. The following does not include all of the steps needed for all of the projects in the book; rather, the section is an overview of what you can expect to configure your PC to implement the projects. Specific details for each example are included in each chapter.
Fortunately, most Grove modules have examples on how to use them that include, at a minimum, sample code for the Arduino. For example, there is a Wiki page for the OLED Display 0.96 module that shows you how to get started using it (https://wiki.seeedstudio.com/Grove-OLED_Display_0.96inch/).
Software libraries for the Pico are available for download to your PC, but some Python libraries are designed for use with the Raspberry Pi, not the Pico. So, you may need to copy/download one or more additional code modules to the Pico to get them to work. Be aware that some libraries may require changes in order to work with the Pico.
Most often, this is changing the use of I2C to SoftI2C, but sometimes you may need to change additional things in the code modules (library) to accommodate the Pico hardware. This makes using the Grove system a bit more of a challenge, but not burdensome once you experience how to make a few work as we will see in the next three chapters. Most can be used with little or no changes.
If you encounter a Grove module where there isn’t a Python library, do not despair. Again, most Grove modules have a Wiki page that will show you how to get started. But if there isn’t a specific Python library, you most likely can find a similar one from the Internet that you can use. All it takes is a bit of exploring, and you can find Python libraries for what you need.
Summary
Grove provides a simple, no-error connector that you can use to connect a variety of components together using several protocols – all from the same board.
Now that the hardware challenges have been nearly eliminated, we can turn our attention back to learning how to write the code for our projects. As you saw in this chapter, this may require installing software libraries to support the modules you are using or adapting existing libraries to suit your needs.
The next chapter begins a series of projects that use Grove components to teach you how to work with the systems for the Pico. As you will see, except for the hardware itself, the pattern of building the projects is the same as the previous project chapters.