Grove Sensors with the Hummingbird
Learn how to use Grove Sensors with the Hummingbird.
Snap! Level 4, Scratch
Maker Tools, Science
Hummingbird kits come with their own sensors, but there are a lot of other sensors that you might want to try out. Seeed Studio makes a wide variety of inexpensive sensors, and their Base Shield V2 will enable you to use their analog sensors with the Hummingbird. This tutorial will show you how to use this shield with several different Grove sensors.
Important Notes: The Base Shield V2 is an Arduino Shield. It can be used with the Hummingbird Duo, but not the original Hummingbird. Also, you can only use analog Grove sensors, not digital ones.
Start by pushing the shield into the Arduino side of the Hummingbird. The shield pins do not go all the way into the ports.
Next, connect a Grove analog sensor to analog port A1, A2, or A3 on the shield. These are the only ports that you can use with the Hummingbird. In the picture below, the Grove moisture sensor is connected to analog port A1.
Programming in Scratch
Analog ports A1, A2, and A3 on the shield correspond to sensor ports 1, 2, and 3 on the Hummingbird. In Scratch, you can access the value of a sensor using the HB voltage block. The script below continually updates a variable that contains the value of the moisture sensor and also makes the sprite state the value of the variable. The math blocks are used to round the sensor value to two decimal places.
You may also want to make decisions based on the value of the sensor. The script below uses the value of the moisture variable to judge how wet a plant’s soil is.
It may also be helpful to graph the value of the sensor so that you can see how its value changes over time. An example script is shown below. This script uses a variable x that corresponds to a location on the x-axis. A repeat block plots the value of a sensor or each value of x and then increases the value of x by 1. The value of the sensor is scaled by 100 to make it easier to see changes in the graph.
We decided to use three Grove gas sensors to test the air quality around our 3D printer. We used the MQ2, MQ3, and HCHO sensors. These sensors enabled us to detect a number of chemicals, including alcohol, smoke, and methane. We plotted the mean value of each sensor over time. The graph below shows the response of the sensors to a bowl of rubbing alcohol placed nearby.
We tested our setup for rubbing alcohol, water, Listerine, vinegar, and smoke. Then we tried it out while we 3D printed a gear. Check out our results in the video below!