I’ve been wanting to build a room thermometer for a while now and since I recently installed
a new heating system, I think now is the right time to build one. You can obviously buy one
online or even use a multimeter to tell you what the temperature is, but I wanted something
that could sit at my desk all day and by building one I can also upgrade it later depending
on my needs. This video is going to be all about the build.
Let’s start by looking at the components we would be using. The first thing is the
display and you have numerous options available from 7 segment displays, to character LCDs
to OLEDs. I particularly liked the OLED module because it looks a bit modern, is easy to use
The module uses an I2C bus with a simple 4 wire interface for communication. We will
be using a white display for this build but you also get blue and yellow versions as well.
Do keep a note of the pin out when you are wiring it as some of the modules look identical
but have different pin configurations.
For the sensor, I was initially thinking of using the DHT11 temperature and humidity sensor,
but then I realized that I don’t really care about the humidity reading
and decided to use the DS18B20 which is a very nice temperature sensor that’s also
easy to obtain and is much smaller. It uses a 1-wire interface which is unique and has
a temperature range from -55degC to 125degC which is more than what we need.
For the Arduino board, I will be using the Piksey Pico, which is a custom board that
I designed and it is similar to the Piksey Nano but is about half the size. This should
dramatically cut down the final build size. The sketch we will be writing is compatible
with the UNO and Nano, so you don’t have to worry if you do not have the Piksey Pico.
The board will be powered over USB and it has a 5V I/O level so we need to keep this
in mind.
The DS18B20 has a maximum operating voltage of 5.5V so there are no issues in interfacing
it directly with the microcontroller. The OLED module however is a bit tricky. The module has
a 3.3V voltage regulator at the back so they can handle a 5V power supply but there is
uncertainty about the I/O as the SSD1306 which is the main display driver has a max rating
of 4V. I’ve seen projects where people connect it directly to a 5V microcontroller while
some others use resistors to take care of level conversion, but I will be using a level
shifter blob to take care of the voltage conversion.
The level shifter blob was supposed to part of BBox3, but that hasn’t been released
yet and so it is not available for sale. You can find similar modules online which do the
same thing or you can even build your own using MOSFETS. Here’s what the schematic
of the blob looks like. We have a small 3.3V low drop out voltage regulator along with
a total of 6 MOSFETS, one for each bit. The MOSFETs have pull-up resistors on the input
and outputs and when configured this way, they allow for bi-directional level shifting.
This means that a 3.3V signal at the input will be correctly converted to a 5V version
and the reverse conversion of a 5V signal input to a 3.3V signal output is also possible.
The I2C signals for the dispaly will pass through the level shifter blob before reaching
the OLED module.
This is what the final schematic looks like. We have the Piksey Pico and the DS18B20 sensor.
We apply 5V directly to the sensor and we connect the data pin to pin 2 of the microcontroller.
We also need to add a pull-up resistor of about 4.7K ohms as per the datasheet.
We then have the OLED module and the level shifter. We apply 5V to the level shifter
which produces an output of 3.3V that is connected to the OLED module. We then connect pin A5
which is also the I2C clock pin to the level shifter and then to the OLED module. We do
the same thing for pin A4 which is the I2C data pin.
We then connect all of this on a breadboard and proceed to writing the sketch. We need
to install two libraries in order to talk to the DS18B20 and these are the OneWire and
DallasTemperature libraries. For the OLED module we will be using the U8g2 library that’s
very versatile and has a lot of examples to get you started.
The sketch is based on the weather example and I’ve copied the logic from the draw
function. Interfacing the temperature sensor is not that difficult as well. We simply include
the libraries, create the necessary objects and call the begin function after initialization.
We obtain and print the temperature using the drawWeather function. Let’s upload and
test this code. Everything seems to be working fine and that’s a good start.
The graphics library has a few weather icon options like the sun, sun with clouds, rain,
thunder and clouds by themselves. Personally, using different icons doesn’t make a difference
to me and I’ll be sticking with the sun with clouds option as I kind of like it. You
could add a light dependent resistor to determine the ambient light and then maybe a humidity
or rain sensor to determine if it’s raining in order to change to the relevant icon. I
wouldn’t be doing this now because I’m only interested in keeping this at my desk.
Now that we have the electronics working, we can work on the enclosure. I was thinking
of designing an angled stand for the whole unit but then I found a very nice design on
Thingiverse and it made sense to use that. The model was originally designed to house
just the OLED module but I’ll trying to fit all the electronics into it and power
the unit using a microUSB cable. I went ahead and printed out the two parts of the case
and sure enough, it looked very promising. I then printed out the stand which didn’t
take that long.
The first step was to desolder the header pins from the OLED module as we will be connecting
it directly, using some wires. I then added some Kapton tape to the module for isolation.
I decided to use a new Piksey Pico, without the header pins, so downloading the sketch
to it was the next step. The 3D printed enclosure did not have a cut-out for the microUSB cable,
but it did have a narrow slot for the display header pins and we will be using that.
I then took a new microUSB connector and soldered the power pins to it and then inserted it
into the slot. The connector had metal mounting tabs which are designed to sit flush on the
PCB when surface mounted but since we won’t be using them as intended, I decided to twist
them a bit to help with the mounting. A bit of hot glue was used to mount the connector
in it’s final position. Next up was the DS18B20 and I soldered 3 wires to it as can
be seen here. Adding the pull-up resistor was next and I decided to add this directly
to the Pico and cover it with some Kapton tape. I then soldered the sensor to the Pico
and placed it into the enclosure and held it in place with some hot glue.
The wires from the USB connector were soldered in place next and both the halves were ready
to be merged. I soldered the 5V section of the level shifter to the Pico and then it
was time for a final test to make sure everything was working OK. The build was looking very
promising and I quickly started to assemble it in excitement and heard a cracking sound.
Sure enough, I broke the front half of the enclosure and also managed to break the OLED
module. If you look closely, you will notice a line across the display which was caused
by excessive force while I was closing the enclosure.
I didn’t want to repeat the same mistake so I decided to remove the microUSB connector
and the switch from the Pico to make some more room. I also removed a bit of the
hot glue just in case. I tested the setup with a new display and things looked promising
again. I then cleared up the wiring to the level shifter and flipped it as can be seen here
and it was ready for assembly.
Printing the front half of the enclosure was quick enough and once this was completed,
it was time to assemble it again, a little more carefully this time. Here’s the final
outcome. Everything fits really tightly so perhaps modifying the case to increase the
depth by a couple of millimeters would allow for a much more comfortable fit. The unit
does close well and looks pretty good for what I want to use it for, so I will stick
with the current version. Here’s the final assembly with the stand. I’m pretty pleased
with the final outcome. The USB cable does restrict the motion of the display but for
something that will pretty much sit at my desk in one place, I’m not too worried about
it.
So there you have it. One way to build a room thermometer. All the instructions for this
build are available on instructables. I will also be creating a post on the main website
later on as time permits. This is a very simple thermometer and you could also add more sensors
and perhaps a WiFi module to stream weather information from the internet and this is
perhaps for a future build. I just received the new Arduino Nano IoT board that has a
build in WiFi module so I might actually make a version of this that can stream weather
information from the internet while also displaying the actual room temperature. That should go
live in the coming weeks so do subscribe to stay updated.
Do feel free to leave suggestions for future builds and
I will add them to the list. Thank for your support and I will see you in the next one!