Hardware without Hardware or Lightning without Lighning

By Amos King

Elevator Pitch

Working with hardware is rewarding, but also quite tedious. So much time is spent moving SD cards, flashing memory, or waiting on new hardware. How can we stop all the tedious parts of hardware development? What if we could start developing for hardware that hasn’t even arrived in your hands?

Description

I love working on with embedded devices, and IoT. The biggest issues have been in waiting for hardware, buying hardware before I had a proven theory or use, and spending many hard hours slowly moving code to a device only to find out something wasn’t quite right. The good thing is that these are problems of the past. Using TDD I have been able to gain confidence in code working the first time it hits the hardware. I start developing ideas before hardware arrives at my home. I have even had code done and a use for hardware before I decided to waste my money on it.

Let me show you the tricks that I’ve learned working on GrovePi, an I2C sensor library for Dexter Industries popular (GrovePi)[https://www.dexterindustries.com/grovepi/] Raspberry Pi hat, and building professional home automation equipment. We will step through an example of how we utilized a lightning sensor and tested it with code before hardware. We can’t make lightning so it is our only choice.

Notes

I’ve been working with Frank Hunleth on the grovepi library from the beginning of my Nerves journey. I hated moving cards around and I’ve been working with TDD for years. I thought since I’m in a language that has first rate testing tools that I would work to use those tools to minimize the time it was taking to swap SD cards and test on hardware. What if I could develop without the hardware, and use tools to run tests on every file change? I dove in with this in mind and it worked! Frank Hunleth and Justin Schneck have encouraged me to start spreading how I do hardware development through testing and I thought this would be a good way to push the conversation forward.

Frank wants to work with a lightning sensor, but we can’t create lightning and the sensor says it has algorithms to make sure it isn’t detecting human phenomena. This presents an even bigger problem in testing the hardware. I don’t know if a mistake is made until after the thing I want to measure happens. I want to use this talk to step through the development of the lightning sensor part of grove pi as an example of TDD kicking butt in hardware development.