Thermometers are useful things in general, but especially when printing ABS in an enclosure. Part of the point of an enclosure is temperature control, right?

When I built my IKEA enclosure I knew I was going to need a temperature monitor, but an off the shelf thermometer wasn’t going to be enough. I needed it to work over the internet!

Want to see exactly how I did it? Read on!

Here it is in action:

As you can see, I probably need to position it better 🙂 But it works!

As well as showing the temperature (which is handy in person and over the Octoprint webcam), using the ESP8266 it shoots the current temperature up to my website so I can monitor the temperature from anywhere.

I made an enclosure for it, but I made the enclosure contain the small breadboards because I am not done tinkering with it yet.

What you need

Of course if you buy through my links I get a small commission. Hey I have a site to run 🙂

Shop around, though, and you will be able to get all of this stuff pretty cheaply.

Getting the TM1637 LED display working with Arduino / ESP8266

All this assumes you already have your Node MCU (or equivalent) already working with your Arduino environment, or are using an Arduino. The Node MCU is cheaper (especially in quantity), but the Adafruit Huzzah has more support and is better made. Both are excellent ESP8266 modules, and both are Arduino compatible.

Starting with the display, I chose a very simple segmented display module based around the TM1637, this is because the Node MCU ESP8266 board doesn’t have a wealth of pins and also because I am lazy 🙂

Avishorp has kindly shared an Arduino library that makes it very easy. You can use any digital pins you choose. Just download the latest version of the library and put it in your Arduino libraries folder.

There are four pins to take care of:

Ground

Power

CLK

DIO

Ground and power are self explanatory, and the unit can be powered off 3.3v or 5v, whichever works for your situation. When you initialize your display you tell it which pins you are using for data, so in my case I set it up like:

#define CLK D5 #define DIO D4 TM1637Display display(CLK, DIO);

Once that is set up, in your loop you can display the number you want to show by just using:

display.showNumberDec(1234);

Easy eh?

Getting the temperature

You probably have a temperature sensor in your toolkit already, especially if you got an electronics starter kit at some point in your life.

Careful, they are small and delicate 🙂

These guys have three legs.

Power

Data (connect to analog input)

Ground

Again, power can be 3.3v or 5v. Just remember what these things read is whatever voltage between 0 and 1.75v reaches your analog input pin.

You can read more about temperature sensors and Arduino here. We are just going to use a basic equation to turn voltage into degrees C.

int reading = analogRead(sensorPin); // current voltage off the sensor float voltage = reading * 3.3; // using 3.3v input voltage /= 1024.0; // divide by 1024 float temperatureC = (voltage - 0.5) * 100 ; //converting from 10 mv per degree with 500 mV offset //to degrees C ((voltage - 500mV) times 100) temperature = temperatureC; display.showNumberDec(temperatureC); // send to the display

Sending the temperature to the web

If you are using an Arduino, congratulations, you are done!

BUT WAIT

We are using an “Internet of Things” device for a reason!

Sparkfun has a nice write up for how to write values up to a website. I will elaborate more about what I am doing on mine, including the website backend that receives these values, in a future article 🙂

Code (including a preview of the sending to the web stuff)