Using the Raspberry Pi to make a winter thermometer with snow alert.
Next I decided I wanted to make something using Raspberry Pi which was more useful and considering the time of year, at the same time festive. Designing a Festive thermometer using the Raspberry Pi and DS18B20 temperature sensor seemed like a good idea as I had worked with these two not long ago.
I planned to use LEDs connected to the GPIO pins of the RPi to indicate varying temperature readings from the DS18B20. This would be used to create a display which would indicate from -5ºC to +5ºC. When there is the highest chance of snow there will be an additional 6 LEDs which flash for a number of times once the temperature has reached 0º.
Since this was a festive thermometer I thought it would be appropriate to house it in something like a snowflake. I made a rough hand drawn sketch of what it would look like and I had an idea in my mind of how it would connect.
I had to ensure that the Raspberry Pi was in close proximity to the acrylic snowflake and decided the best way would be to mount this on the reverse. However, this needed to be concealed so that the snowflake design would be aesthetically pleasing. To achieve this I used a snowflake template with a large centre so I could mount a circular panel stood off from the back.
I had figured out I would need 13 GPIO pins from the Pi; this accounted for the 11 temperature indicating LEDs, the six LEDs which would illuminate when there was a high chance of snow and the temperature sensor.
The main part of this project was going to be writing the Python script. For someone who has little experience in Python and needing to write multiple functions this was going to be a challenge!
The first function I created was the easiest, since I just needed this to take readings from the DS18B20. I had done exactly this previously when I built a Raspberry Pi 1-Wire thermostat and I used the code from this project as the basis for the first function.
I then tested the function before starting work on the next one. To do this I used print with my getTemp() function in the while loop. As this correctly displayed temperature readings from the DS18B20 it reassured me that this function was working fine, therefore I could move onto my next function.
Read More: A Fabulous Festive Raspberry Pi Thermometer