Counting the people in space with the ESP8266 and the internet

Continuing the theme of basic projects to do some learning with, I discovered that a while back I bought a grab bag of displays from Maplins.

I promptly burnt out one side of a double 7 segment display, leaving me with just a single display. Having a slight fascination with all things space travel it seemed obvious to me that wiring the display up to a teeny computer that could retrieve how many people were in space was a good idea. Unfortunately, the current maximum is 9 people at any time. Disappointing from a SPACE perspective, but perfect for a single 7 segment display.

Stage 1

The first task was to make something work using a computing unit that I already knew. Enter stage left an original Model B Raspberry Pi. Bought on the original launch and occasionally dragged out when I fancied doing a project like this. Fortunately, python is my day job and it was mostly just wiring some bits on a breadboard.

Wired and working

Unfortunately, the Pi is a bit large for what I was after, and the original B doesn’t have WiFi, which would make wiring it all together a bit more awkward. After staring into the box labelled ‘tiny computers’, I rediscovered the 5 ESP8266 (Wemos D1 Mini) that I had bought on a friends recommendation a couple of years ago and never really used.

No, really. That’s what I labelled it a while ago. Strong labelling game, past me.

The Wemos is basically a clone of the NodeMCU development board, which means it can also run micropython without too much of a hassle. Downloading the latest and flashing it to the board was pretty straightforward, and then rewriting the original code didn’t take that much longer.

The main problem at this point was understanding how to get scripts and files onto the Wemos board. The webrepl method of copying files was the most straightforward, but takes a little bit of bootstrapping. The machine has to be on the network before you can copy the boot.py file that means it will auto connect to the network. Lots of typing into picocom and some faffage later, I had it working.

The next challenge was building a map of what pins are connected to which parts of the 7 segment display, and figuring out what pins of the 7 segment display actually did anything. The internet turned up a datasheet, which I don’t fully understand, but it at least had a pin diagram label on it. The twist for this is that my display is a Common Anode display, so the joint leg is connect to 3.3V, while the display pins must be grounded (or low), in order for the display to light up.

A search of the internet turned up an awesome api for the people in space, which could be fed into the urequestslibrary shipped with micropython.

Code written, flashed to the ESP8266 gave me this:

Working ESP8266 version

Then, everything went on pause as I broke my soldering iron.

Diversion into 3d printing

Given that I couldn’t do much else with the electronics, I decided to try and build something using the new 3d printer at work. This involved spending a weekend watching Fusion 460 tutorials.

After that, I had this designed:

Version 1 of a case

And then printed:

Printer at work

Unfortunately, I was a little bit off in my measurements:

Bit hard to see, but the board is at an angle due to the pocket being too short

A redesign later seemed to solve that, but then I decided I’d be optimistic and order some 4 digit displays. These haven’t arrived yet, but…

Arrival of the soldering iron

My soldering iron arrived!

TS100 soldering iron

I have no real idea why a soldering iron needs an STM32 chip and an accelerometer, but it was recommended and seems pretty good from what little I can tell. Soldering is definitely something I need to practise a bit more. Or a lot. Lets go with a lot.

As the displays hadn’t arrived yet it seemed easier to build something temporary as soldering practise (see above). A bit of hook up wire, some foam core, a glue gun and some super glue led to this…

Mounted on some foam board

And then some scrap left over from another project, some more application of hot glue and this…

Stand

 

‘Finished’ product

I intend to rebuild this with a 4 digit display as I believe in optimism that we will eventually need it. And if I ever need more than 4 digits to display the number of people in space, I’ll happily call this project redundant.

Displayed in the corner of my workbench

Things learnt

  • I need more soldering practice
  • Measure a lot
  • Don’t assume the measurements are correct
  • Fusion 360 is kind of nice
  • ESP8266 get hot enough to melt hot glue

Future Plans

  • 4 digit display
  • Mountable display case
  • Experimenting with low power modes in micropython

Resources