Introduction: The (Freddie) Mercury Thermometer

About: Engineer, modelmaker and occasional eccentric.

Doesn't actually contain mercury!

This project was a fun way to expand basic Arduino and electronics knowledge into a more complete product, with custom PCBs, low power consumption and a focus on having a nice-looking and useful 'thing' at the end of it. However, it is still pretty simple to make, so feel free to take the ideas and run with them to make your own thing!

It uses a custom Arduino-based microcontroller to read signals from a temperature and humidity sensor, and outputs the information by using a servo to control the arm of the figure on the front.

This project could pretty easily be modified if you wanted to build something slightly different, with an alternative figure on the display, using LEDs or a screen instead of a servo arm and so on! The inspiration for the Mercury Thermometer came from a joke on the Tech Dif Reverse Trivia show, though I've changed it to make it visual rather than audio (the show is excellent, but not recommended for under 18s, as it gets a bit inappropriate at times).

This guide is written for someone with a basic working knowledge of electronics - but if you're new, don't be put off by that, just know that you may have to reference other Instructables or YouTube videos if you get stuck. Feel free to comment here as well and I will try to answer any questions.

Supplies

  • Basic electronic assembly toolkit (soldering equipment, wire, wire cutter/stripper, helping hand etc.)
  • Something to make a case from (oak boards, in my version, but could be anything - don't forget tools, glue and finishing supplies!)
  • Low-power servo (look for a 1s or 3-5V servo, to operate off a single li-po battery e.g. Kingmax Ultra-Micro 2g Servo)
  • Battery + holder (single cell rechargable li-po, I recommend something like the Ansmann 1307-0003 model with an integrated USB charging port)
  • Temperature sensor (I used the AdaFruit AHT20)
  • Microcontroller (I used a custom PCB based on an Arduino Uno - a normal Uno would work as well)
  • Front panel (the visual bit - I used a custom PCB, more on this later)

I've deliberately not been super-specific on the exact parts I used, to allow anyone following this Instructable to use their own creativity and resources - however, if you do want more info, feel free to comment any questions and I will try and answer.

Step 1: The Plan

A simplified block diagram is shown in the picture, with power connections in red, and signals in blue - the battery supplies power via the on switch to the microcontroller and transistor. When the microcontroller gives the signal to the transistor, it allows power to go to the servo and the sensor (this helps to reduce power consumption by only running these components when they are needed). If power consumption is not a concern to you, you can just wire the servo and sensor power connections straight to the on switch.

Simple enough? Next up is the front panel, which dictates where all the electronics needs to go.

Step 2: Front Panel Design

The front panel needs to:

  • look nice
  • hold the servo in place
  • display the temperature reading
  • display the humidity reading (if desired)

With that in mind, I chose to use a custom PCB as the front panel as I could incorporate space for LEDs for the humidity indicator, have clear graphics and relatively low cost.

I used KiCad (free) to design the PCB - this Instructable is not a guide to using KiCad, it would be too long otherwise, so check out other Instructables or YouTube tutorials for a better description than I could give! However, it is a pretty simple tool to use if you have used graphics software before.

I started with a 100mm by 100mm board - this is important, as the PCB supplier (JLC PCB in my case) has a special offer for cheap PCBs this size or smaller. A hole for the servo was added approximately in the middle, then four mounting holes round the outside, sized for #6 self-tapping screws. KiCad has a very useful image-to-footprint converter built in, which I used to produce the Freddie Mercury graphic, and lined the shoulder up with the hole for the servo axle.

The rest is up to the designer, add whatever graphics and readout you want! All the temperature descriptions are titles or lyrics from Freddie Mercury songs, either from Queen or solo albums. I also added footprints for a surface-mount power switch, a series of 0805 size LEDs, resistors for the LEDs and some solder pads to act as my power distribution area. Only the LED and the switch footprints were placed on the front of the PCB, all the tracking and additional components were done on the back to keep the front looking neat and professional. Some graphical text was placed on the back of the board so the manufacturer would know where to put their part number, so it wouldn't show up on the front. I ordered the PCB with black soldermask and white silkscreen text as I like the look this combination has.

The image for this step shows a screenshot of the PCB in KiCad, ready to send to the manufacturer. The red items are on the front of the board, green ones on the back, and the teal is the graphical layer on the front.

Alternative front panels could be made by laser-cutting, or even good old fashioned printed paper mounted on card or plywood.

Step 3: Assembly (Electronics)

The first picture shows the assembled prototype board, using an Arduino Nano Every as the microcontroller.

In the bottom left is the AHT20 temperature/humidity sensor. This communicates on I2C, so the SDA and SCL pins are connected to the Arduino's SCL/SDA (these vary depending on which Arduino is being used, so the builder will have to look up the pinout).

The servo is in the middle, and just needs power connecting, and the signal to an Arduino PWM pin (most Arduinos use pin 9).

The Arduino itself is mounted on a piece of felt to stop the pins on the back shorting on the ground plane on the front panel board below.

In the bottom right are the indicator LEDs for displaying the humidity - these are all connected directly between an output pin with a resistor inline, and the board ground.

At the top is a shared power area - pads for +ve from the switch (which can't be seen as it's on the other side of the front panel board) and the -ve connection to the battery. The Arduino and LED -ve connections are straight to this shared ground - but the servo and AHT20 are grounded via a transistor. In this case, a BC639. The transistor control pin is controlled by the Arduino, which allows the servo and AHT20 to be turned off whenever they are not active, which helps save battery life.

Using pre-made jumper wires in this way makes the whole thing pretty easy to put together and troubleshoot.

Stage 2 of the build involved replacing the Arduino Nano Every with my own version of an Uno board - shown in the second picture. This is a very simplified version focused on reducing power use - so there are minimal external components and no voltage regulators, so it will run off a single li-po battery. With coded-in sleep modes, this board uses less than a milliamp - lower power boards are possible, but this is a simple way to get 90% of the way there. However, the design of this Uno(ish) board is well beyond the scope of this Instructable, but may be the subject of a later build.

Step 4: The Outer Case

The case for this project is a simple mitre-cornered wooden box 100mm square on the inside dimensions (to match the front panel PCB), made from 4 identical oak strips, cut to length and with 45° cuts on the ends. I'm not a very good box-maker, so if you want detailed instructions on how to make something like this, search for other Instructables that will explain it better than I could!

The box was finished with a light sanding and several coats of Danish Oil. Small offcuts were glued into the corners, 10mm back from the front face of the box - this helps support the front panel at the right distance on all edges, and provides somewhere for the #6 self-tapping mounting screws to go (the picture was taken before I added these). Unless you use a very soft wood, the mounting screws will need pre-drilling to avoid splitting the wood.

https://en.makercase.com/ has some good templates for making laser cut boxes if you prefer!

Step 5: Making the Arm

The arm was 3D printed from a design done in Fusion360, though it could also be done with a laser cutter or printed paper.

The arm from the original Freddie Mercury graphic was isolated and imported into Fusion360 as a canvas - the canvas function is really useful for stuff like this, particularly how you can scale an image as you import it. Freddie on the front panel was 70mm tall, so the arm was scaled accordingly then sketched around and extruded to product the model. A short tube was extruded on the back at the shoulder to fit the servo axle, then the arm was exported and printed using a resin 3D printer. The arm was then painted with white primer, and the black sections carefully filled in with a fine paintbrush to match the front panel colour scheme.

Step 6: Assembly (Mechanical)

The servo was mounted to the front panel, through the hole and glued in place with plenty of 2-part epoxy - I wanted this join to be really strong, as it has to handle movement from the servo. The AHT20 sensor was glued to the front panel with a piece of felt in between to reduce the chance of any short-circuits. The same was done for the microcontroller board. This assembly was then placed into the case and the 4 #6 screws screwed down. Finally, the battery holder was glued to the inside of the case (the photo was taken before I did that!) and the arm was a slight push-fit onto the servo axle.

Step 7: Code and Calibration

The code used on the Uno version of this project is attached. My coding is by no means perfect, so there is some redundancy in there, and there is no error handling, so improvements could certainly be made.

The basic idea is to:

  1. Store variables and pin allocations
  2. Start and communicate with the AHT20
  3. Run the servo start-up sequence
  4. Get the current temperature and humidity
  5. Write the temperature (including calibration) and humidity to the servo and LEDs respectively
  6. Turn off the FET controlling the AHT20 and servo
  7. Sleep! For 30 seconds, then wake up and repeat steps 4-7

Another thing used in the code is delay - when turning components on and off, it's helpful to have a short delay to ensure they get booted up properly before being communicated with, which helps reduce errors and crashes. The sleep cycle is set to approximately 30 seconds, but the temperature of a room rarely changes that much in that time, so I considered it good enough. This also helps extend the battery life a lot, from a few days with the Nano Every, to a couple of weeks with the "Ohno" board. That makes it a much easier thing to live with, as you only need to take it down from the wall every other week to charge the battery, and you don't have to run a wire to a wall socket.

Some calibration was needed to get the servo sweep to correspond to the dial on the front panel. To do this, I had to multiply the temperature reading by 3.3 and offset this from 120 - your results may vary! It depends on the servo used and the angle between the temperature display. Since I'm based in the UK, the temperature rarely goes below -5°C or above 35°C, so I didn't have to use too much space to display all that.

Step 8: Finished!

Done!

I'm pretty happy with this, it's certainly more of a polished item than most of my more bodged projects. I still need to make a couple of brackets so I can mount it to the wall.

The video shows the start up sequence - I couldn't help coding in something fun.

The concept could certainly be used to make a more sensible thermometer, but I liked the challenge of finding a song for every temperature step! I wonder what other themes could be done with it... (feel free to comment your own idea!)

Electronics Contest

Participated in the
Electronics Contest