Review 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 Arduino, Raspberry Pi, 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?
GrovePi+ Starter Kit hints at a range of possibilities
Now you have to swot up on the peripheral’s datasheet and write the code that will get your microcontroller to successfully communicate with the gadget you’ve connected it to.
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 the application part of your 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, 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.
Alternatively, 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.
Components include: button, buzzer, ultrasonic ranger, sensors and LEDs
That’s what China’s Seeed Studio 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.