When it comes to hacking hardware there’s an easy way and there’s a hard way.
The hard way involves connecting peripherals direct to one of the standard buses supported by your Raspberry Pi, Arduino, Beaglebone or whatever. Buses like I²C, SPI, UART and 1-Wire. You’ll need to take care with your wiring: have you got the right pull-up or pull-down resistor? Is there too much capacitance in the line?
Now you have to swot up on the peripheral’s datasheet and write the code that will get your platform to successfully communicate with the gadget you’ve connected to it. The standard buses are different, and have their pros and cons. But whichever one you pick, it usually takes a bit of debugging to read the sensor data right, or display the correct text on the OLED display. That done, you’re ready to focus on your application code: the part of the control program that uses the peripherals to solve the problem you’re addressing.
These days, a fair few of the most commonly used data sources – light-level sensors, temperature and pressure readers, motion detectors and such – are well supported with open source driver libraries written by the many companies who mount the raw components on break-out boards, add some interface logic and sell the result as a unit rather than a raw component.
Adafruit and SparkFun, for example, both offer dozens of such modules, all accessible in your project software through driver code you cut and paste out of code repositories on websites like GitHub. Add them wholesale to your project, or use fine-tune for the needs of your specific application. Most libraries are written for the Arduino, but if you’re basing your device on another popular platform, the code is usually sufficiently well commented for you to work out what’s going on and adapt it accordingly.
The really hard way, of course, is to grab a component and its datasheet, and work it into your project without the help of folk with a greater knowledge and experience of electronics and/or software than you. That’s where you want to get to, of course, because it allows you to work with any off-the-shelf sensor or display. But it’s difficult, and a less time-consuming approach is to limit your choice of device and pay a little extra for it, but get a nice, well-supported module.
Or you can go the really easy way, and use a product that integrates a bunch of sensors (light, sound, ultrasonics, temperature and pressure), readouts (LED and LCD) and inputs (button and potentiometer) and control (relay); hooks them all up through a common connector to a board that drops right onto your platform’s GPIO pins – and makes all the modules accessible through a simple software interface.
That’s what China’s Seeed Studios and America’s Dexter Industries would like you to do, and they’ve jointly devised the Grove system to provide what they call a Lego-like approach to developing electronics projects: just build it up, functional block by functional block. All of the component modules designed by Dexter and sold by Seeed connect to a board, the GrovePi+, using the same type of four-wire cable: two wires for data, one for power, the fourth for Ground. That means you can grab any Grove cable, fix it to any Grove sensor and plug in into pretty much any port on the GrovePi+ board.
No prizes for guessing this product is for the Raspberry Pi, but there’s an equivalent Shield for Arduino and Cape for Beaglebone. The plus symbol indicates this is issue two of the GrovePi: a new board with revised, cheaper-to-manufacture electronics.
The GrovePi+ board has seven digital, three analogue, three I²C and two serial ports, all designed to take said standard four-wire cable. On the base of the board is a female connector the fits onto the original Pi’s 26 GPIO pins, and it rises sufficiently high for B+ and Pi 2 owners to access those products’ extra GPIO pins, though not easily. However, the board does include 26 GPIO pass-through pins on its upper surfaces, though the pins are thin and easily bent. That said, I was was able to connect without difficulty both the GrovePi+ and the Pimoroni PiGlow I use as a system monitor.
The Grove modules themselves are notionally standard across all platforms, though Seeed says all of them have been tested with the GrovePi+. Seeed’s wiki lists 12 out of 93 that have been, but since the GrovePi+ Starter Kit reviewed here contains modules not on that list, it’s probably safe to assume that most of them will work.
The Starter Kit includes a reasonable set of basics: RGD-backlit character LCD, red and blue LEDs, buzzer, button, ultrasonic ranger, variable resistor, relay switch, light sensor and a combined temperature and pressure sensor (the widely used DHT11). Some, like the light sensor, use an analog port on the GrovePi+, others, such as the LCD, I²C. The rest use any of the five side facing or two upward facing digital ports.
Dexter Industries has a custom Linux distro pre-loaded with the GrovePi+ software, but I chose – and I suspect most users will select – to clone the library files from the Dexter GitHub repo. This provides you with plenty of example scripts, and the necessary Python libraries. Depending on the module(s) you want to utilise in your project, you just need to import one or two libraries at the start of your application code. All the heavy lifting has been done for you: all you need to add to your code are the some basic port configuration commands – is it an input or an output? – and lines to read and write data from the module, as appropriate. The documentation is meagre, but the Python library files should be sufficient to get you going.
It’s quick and easy. I built a simple Pi protection system with the ultrasonic ranger and a red LED in just a few minutes and with a handful of lines of code. Then I plugged in the buzzer and set that to sound when the LED lit up – and pretty pronto a button to reset the system and turn off the noise. It took me longer to wrack my brains for Python’s string formatting syntax than it did to hook up and code the character LCD as a simple time-stamped alarm incident log.
The Starter Kit costs £38.99, the GrovePi+ on its own £15.60. Most of the modules cost around £1.24. All the bits used in my test project came to more than the price of the Starter Kit, so the bundle is certainly a good place to start. And if adopting the Grove systems ties you in to the board and module selection, at least that selection is extensive and the modules inexpensive. It does seem good value.
That said, the jury is still out. I tested a pre-release version of the GrovePi+, which communicates with the Pi via I²C. I experienced a number of IO errors, all related to I²C communications, during the time I spent with the Kit. Dexter Industries Forum posts relating to the GrovePI+’s predecessor suggest this is not uncommon but at least can be caught and managed in the core Python code. Dexter reckons that’s a job for the application developer – only you know how much of a problem such errors are for your specific project. Still, given that GrovePi+ is pitched as the easy approach, Dexter really should have made this more intuitive or worked to eliminate the problem altogether.
So, the easy way or the hard way? For me, the GrovePi+ way is too easy: it’s all done for you, so you learn nothing that will help you when you come to connect a peripheral that isn’t included in the selection of GrovePi sensors. Hooking up an LCD via one of the GrovePi+’s I²C ports tells you nothing about how that LCD is controlled, or about how to make use of the I²C bus. Surely that is what the Pi is all about: learning how devices work?
The other side of the coin cell is that if you have a gadget you want to build and you just want to get it made and working as quickly as possible, the GrovePi+ system’s ease of use will be really attractive. It’s good for schools who want to teach how programs affect the real world but don’t want to get bogged down in electronics.
Price £38.99 (TBC)
More Info Seeed Studio
Pingback: GrovePi+ Starter Kit For Raspberry Pi Available From $90
Pingback: Review of the GrovePi+ starter kit | Raspberry Pi Pod