ESP8266 investigation and an internet connected Galvanometer

The ESP8266 is a very cheap (£3 delivered in single quantities) WIFI chip that makes it easy to add internet connectivity to a microcontroller. I got excited when I found you can also flash your own firmware and do everything on the one chip.

I first heard about it on hackaday, and since then it’s been used in tons of IOT projects (10 pages worth!). It’s been on my radar as something to investigate for nearly a year.

I think the best way to learn is to do, so I recently ordered some ESP8266-01 modules from ebay. The first task was to make a breakout board which was also a good opportunity to start learning KiCad (love that push and shove routing!).

This resulted in my first project, a simple temperature logger, using Sparkfun’s service to store the data.

I quickly discovered the limitations of the ESP8266-01: it’s lack of pins. There are some issues to bear in mind with attaching peripherals to the ESP; 3 pins need to have the correct state to boot or to be able to load firmware.

This meant that my second project; a hackspace dust monitor wouldn’t boot with the dust sensor connected. I fixed that by building a simple transistor based NOT gate to ensure that the pin from the sensor was usually low instead of high.

There are a few different ESP modules; each feature the same chip from Espressif, but they have different form factors and numbers of pins available. This blog post is a good summary.

The ESP8266-12 is a good candidate for projects because it has lots of GPIOs broken out, including those needed for SPI and deep sleep mode. I wanted to try an SPI RFID card reader, and this worked with the 12.

So I ordered a few of the ESP8266-12 modules and built 2 breakout boards for the ESP8266-12, an easy to fabricate through hole version and a smaller SMT version I ordered through OSHPark.

I used that to build a nice internet connected meter based on an antique Galvanometer.

I took the opportunity to investigate MQTT, and found a library that worked with the Arduino ESP8266 environment. I’m running an MQTT broker called mosquitto on a Raspberry Pi. I think MQTT works well for this kind of project because I can have a simple Python script on a cronjob publishing new data to display every minute, and something else that subscribes to some info from the dial guage like WIFI signal strength, uptime, free memory.

I mapped the dial from 0 to 1000, and started off just sending the minute of the hour (mapped 0-60 to 0-1000). This made it easy to check how well the system was working. It’s really nice having it as a clock though, so I’m leaving it like this for now, but it’s cool to know I could easily have it telling me the number of minutes till the next 25 bus arrives!

One thought on “ESP8266 investigation and an internet connected Galvanometer

Leave a Reply

Your email address will not be published. Required fields are marked *