Jim Mayhugh, of TeensyNet and ButtCrack Brewery fame, has done a lot of work on developing 1-Wire networks for microcontrollers over the past few years. In Jim’s case, the bias of these projects has been towards home-brewing, but most of his ideas, software/firmware and boards can easily be adapted for other uses. Jim has made almost all of his boards and designs available to other hobbyists, with an extensive GitHub repository and various blogs (detailing the evolution of his remote monitoring and control projects over the years), as well as adding his boards to the “shared projects” library on OSH Park (a low-cost PCB supplier). Jim has based most of the more recent versions of his controllers on the versatile little “Teensy” board from Paul J. Stoffregen. However, like many of us in the embedded world, he recently discovered the ESP8266 and the last couple of boards which have popped up in his OSH Park queue have been based on the ESP-01 and ESP-12.
Why should this be worth a mention? Well the 1-wire series of sensors and switches have been around for a long time now, with improvements and additions to the range having come along at regular intervals, so it’s a mature, proven product line with a good track record. Individual units (and the prime example is the DS18B20) are relatively cheap in small quantities, so a lot of people have experience of using them and, importantly, of stringing them together to provide a low-cost, multi-node sensor network. That part is important because, while an LM35 may be cheaper, one-off, than a DS18B20, every single one of them needs the support circuitry to actually read and process the output of the sensor. You still need that support circuitry for a DS18B20, but once you have it, the same circuitry reads the 1-wire bus, whether that bus has one, two or twenty individual DS18B20 sensors on it. Cost wise, that starts to make a big difference when you need, for instance, to have a temperature sensor in every cabinet of a data centre, or one in every freezer in a frozen-food shop. While many in the hobbyist community only ever need a single sensor, many more will have applications where multiple, remote sensors are ideal (air conditioning or heating controllers where you might want to have multiple sensors in one room, monitoring outdoor pipe heater temperatures in winter, monitoring temperatures of livestock stalls, etc). It’s also easy to overlook the 1-Wire output capability. The bus isn’t limited to temperature sensors or other input devices. As mentioned earlier, the range of available devices includes output switches, too. These can be used to drive transistor or MOSFET switches, or opto-isolator triggers for mains-powered switching. This may seem superfluous when you have a microcontroller on the board, but actually fits quite well with the I/O pin limited ESP modules. With a 1-Wire bus and DS2406 switches, you have the capability to drive a large number of individually addressable output ports (with the limiting factor being the speed of the 1-Wire serial bus, of course).
The 1-wire bus itself was well supported from the start with interface chips which would allow you to run your sensors from an RS232 or USB port on an existing machine, but it has always been a fun challenge for embedded folks to come up with new, smaller and cheaper ways of getting the 1-wire data on-line. Jim has certainly outdone his Teensy version in the cheaper and smaller departments (although only a little more than a year ago we would still have been quite happy to call the Teensy cheap). This latest addition to his designs adds a very low-cost entry point into the world of remote, multi-drop sensor and control networks. It’s also through-hole, so nice and easy to assemble for those people who, like me, have poor eyesight, shaky hands and a metric ton of 1/4-watt resistors in their parts cabinet.
I should probably also mention that Jim has broken out the UART and I2C connections through level-shifters to allow easy interfacing with 5v devices (for instance, he uses an I2C enabled LCD character display in one of his other projects).
Jim is using the Arduino-Core for the ESP8266 for programming (which also happens to be my go-to environment at the moment, despite the incredibly clunky IDE) and his code for the temperature sensor, including SQL set-up and other, helper utilities, is available from his GitHub repository.
Even if you’re not into home brewing, the ESP8266 Temperature Controller project can still be used as a solid base for many other home control projects. Definitely worth checking out for any ESP8266 hobbyist.