A Model Lighthouse

Designed and built at the Sheffield Hackspace using an arduino and bits and pieces of things that you might find lying around in your own home…

Here’s the setup:

An arduino (pro mini) for controlling the SG-90 servo motor
An ESP8266 for wifi access and neopixel control
A piece of gutter and downpipe for the main body
A plastic dome sourced from a solar powered garden lamp
An Aldi’s peanut butter jam jar lid (crucial)
Other bits and bobs scrounged from various unwanted poundland items

If you think this is cool wait until you see the boats!

A wi-fi and touch controlled NeoPixel ring using the Wemos D1 Mini ESP8266 module.

This project describes an easy way to control a strip or ring of WS2812 LEDs via a web page. It was originally based on the Arduino FastLED library.

Although the FastLed library code gives us a great example of how to control NeoPixel rings and strips, it doesn’t provide for user interaction. So it was decided to add the ability to control the device by wi-fi, and also have a touch switch for local control.

Materials required
A Wemos D1 Mini module was used as it consisted of a low-cost ESP8266 wifi chip and antenna, and it can be programmed by the familiar Arduino software. The Wemos module sits in a socket which is soldered to a matrix circuit board. This allows the module to be swapped out if needed, and also makes it easier to connect the touch-switch and neopixel wires.

A touch switch module was chosen rather than a discrete push-switch as it can be hidden behind the acrylic case and should also provide more reliable switching. The 100 x100 x 25mm square case was laser cut from 3mm acrylic, and was designed using the makercase on-line designer. This is the quickest software for making simple boxes. An extra 100mm square piece was cut for the front, with two circular cuts to accommodate the neopixel ring so it can lie flush with the front surface. Later, the touch-switch hole was cut so the sensor sits behind only one thickness of acrylic.

Laser cut acrylic case

The components fitted easily inside the box – it has plenty of room for a battery pack if you wanted to make it totally portable.

The touch switch sits in a rectangular cut-out.
Here is a view before the centre cover is glued on.

Software overview. The project uses websockets so that any web browsers connected can control (and be controlled) by the device. The touch-switch also controls the software and the settings are communicated to all connected browsers via websockets in real time.

User settings are stored in an object, derived from the ‘userDataClass’. This object stores settings for the brightness, colour, active pattern, demo pattern, provides functions for brightness gamma correction, etc.

The touch-switch code decides whether the switch received a tap or long press. A tap changes the pattern and a long press increases/decreases the brightness. Debouncing the switch was achieved by using a 32 bit integer and bit-shifting each switch reading into it. This method has both the advantage of being able to check for a steady switch state, and to discriminate between a short or long press. A future article will explain exactly how this is done.

Here’s a video of it working.

Indoor environment sensor with ESP8266

Burnell Bot Breadboard

As part of our hacking the space project, we’re building a network of sensors and effectors in our space. Communicating over WiFi using the MQTT protocol, the idea is to make lots of data about the hackspace easily available for members to use in their projects, and to make it easy for members to add their own data streams to the space’s network of things.

One of these is the Burnell Bot, responsible for monitoring motion and light intensity, plus temperature and humidity. These data will end up being used to automate the hackspace’s lights and heating, as well as forming part of our security system. In the meantime, they’re flying over the WiFi in our hackspace ready for members to monitor and use however they want.

At its heart is an ESP8266-12E, sitting on a handy breakout board; you can see its silver enclosure covering most of the board, plus the etched WiFi antenna. This takes input from a BH1750 light sensor over I2C, a passive infra-red motion sensor that sends a digital HIGH signal in response to movement, and the DHT22 temperature and humidity sensor. Thanks to the support for ESP8266 in the latest Arduino IDE, the BH1750 and DHT22 are used via their existing Arduino libraries. A couple of warning messages pop up when compiling, but the code runs without issue. The motion sensor, of course, is monitored by simply checking the status of a GPIO pin set to input. Data from each sensor are transmitted over MQTT in their appropriate topics, subject to dampening (e.g. change in light level must exceed a certain threshold before being reported) and throttling of message rates.

Now that our planning permission has gone through (the downside of being hosted in such a great, historic building is dealing with its listed status) and we’ve refurbished our ceilings ready for the wiring grids to be installed, expect to see a few of these appearing in the space and start thinking of things to do with the data!

Personally, I want to add sensors for carbon dioxide, carbon monoxide, nitrous oxide and particulates, to keep an eye on our air quality and to try to get a sense of whether the reported effects of high CO2 / low O2 in classrooms (impaired concentration, amongst other things) affects our hacking. If you want to get involved in this or other projects, get in touch or just look at our calendar and turn up to a session!

Sous Vide cooking with ESP8266

sousvide controller breadboard

We have a couple of members interested in the geeky side of cookery, and our experimental foods day a little while ago was a great success.

Along these lines, I wanted to try sous vide cooking, a style of cooking in which foods are held at an accurately regulated temperature in order to favour some cooking reactions over others. It’s most commonly used when cooking meats, resulting in amazingly tender, juicy meat even from the toughest cuts. People with an interest in food chemistry — as a biologist by training, I’m definitely one of them — can also have a fascinating time experimenting with the cooking of, for example, the humble egg.

This project was to turn my slow cooker into a sous vide water bath. Along with several other SHH&M members, I’ve been playing with the ESP8266 microcontroller: a great little chip with easy WiFi connectivity, a decent number of GPIO pins and, fairly recently, support in the Arduino IDE, making it very easily accessible to anyone with some passing familiarity with using Arduino. As part of our hackspace renovation project we’re setting up a system of sensors and effectors that communicate using the excellent MQTT messaging protocol; there’s a great Arduino libraries for MQTT, so getting my sous vide controller to report its heating activity and my food’s temperature over WiFi was simple.

On the breadboard, you can see a ESP8266-12E with a silvery enclosure and the etched WiFi antenna. It takes input from a waterproof DS18B20 temperature probe using the standard Arduino library, which works perfectly with the ESP despite some warnings thrown up by the compiler. The ESP gets its power from a switch-mode (“bucky”) voltage regulator set to 3.3v; a second voltage regulator next to it provides 5v to the 240v AC relay. Both are fed from a 12v, 1A wall wart, not shown here. The relay, isolated from touch and moisture in its lunchbox housing, controls the power running through a short extension lead and happily accepts the 3.3v control signal from one of the ESP’s GPIO pins. The cluster of unused wires in the top right of the breadboard are in place to connect with my USB->serial board, in case I need to reflash firmware or debug over serial.

In use, the slow cooker is turned to “high” and plugged into the modified extension lead. The ESP8266 monitors the temperature in the slow cooker via the waterproof temperature probe and, by switching the relay, controls the heating. The logic is managed by a popular Arduino PID library, based heavily on their example code for relay-controlled systems.

Temperature data from about 20 hours of sous vide cooking

Temperature data from about 20 hours of sous vide cooking

PID algorithm output -- in each 10 second chunk of time, for how many seconds the heating element was receiving power, over about 20 hours of sous vide cooking

PID algorithm output — in each 10 second chunk of time, for how many seconds the heating element was receiving power, over about 20 hours of sous vide cooking

Data from the sous vide controller is reported over WiFi via MQTT, meaning that I could keep an eye on the two critical parameters (current temperature and how hard it was working to increase the temperature) using my laptop, phone, or, in principle, other ESP or Arduino devices connected to my flat’s WiFi. The excellent MQTT Spy even generates handy graphs from your incoming data in real time, bringing the food geekery to new heights. In future, also sending the data to something like data.sparkfun, to easily monitor and graph data when I’m out of the flat, should be straightforward.

The most important part of the post: The resulting food is amazing! So far I’ve only used it for meat, although there are plenty of interesting things like eggs and custards that I’m keen to try. Traditionally tough cuts of meat — shoulder of lamb, beef brisket — come out rare, tender, and juicy, with their distinctive flavours intact. More tender cuts, like sirloin steak, are done to perfection every time and, really, have to be tried to be believed. This was a quick and hacky project, but the results are fantastic. Definitely a success, and well worth making yourself.

The PID algorithm needs tweaking to improve temperature regulation to within a degree or two (easy but time consuming, and in the current warm weather I’m trying to avoid having a bath of hot water sitting in my well-insulated flat for hours on end), it needs to go in a case, and it needs a better control mechanism than re-flashing the firmware to change the target temperature. Getting the ESP to host a simple web page displaying controls — or even to just accept commands over MQTT — should be simple enough.

If you’re interested in learning to make this sort of project — or already know how, and want to meet up or work with others who do — come along to SHH&M! Get in touch with us here, or look at our calendar and just turn up to one of our scheduled meetings and introduce yourself.

RFID access system using ESP8266-01 (part 1)

ESP8266 closeup
[This post by SHH&M member Steve]

During the early discussions about our new space at Portland Works we decided it would be good to have an RfID access system, and that this would communicate with a server over the network. This immediately sparked my interest as I had recently taken delivery of some new modules that I had been dying to have a play with, the ESP8266-01.

The ESP8266 is a chip that enables wifi access, with communication over a simple UART (serial) connection. The main selling point of this chip is that it is very low cost compared to other Wifi solutions, typically £2-3 per module. Another huge advantage is its ability to act as a standalone microcontroller – more on that later…. Continue reading