Map temperature to colour - part 2

A project log for No point IR camera

There are point and click cameras, but there is no point in existence of this one

SzajaSzaja 02/10/2019 at 22:100 Comments

I made some nice progress in last few days. First of all I rebuild the circuit on smaller breadboard using new LED matrix with additional 8 pixel strip. Connections are rather straightforward: IR sensor is connected to SDA and SCL ItsyBitsy M4 pins and LEDs are connected to pin 5. Afterwards I went back to code. I wrote a rather simply procedure to map temperatures to colours. First of all maximum represented temperature is defined, which will be displayed as red colour (RGB value 255, 0, 0). If sensor will measure higher temperatures than this defined value they will be also shown as red colour. Temperature 0 °C is represented as blue (0, 0, 255), and green is in the middle. Temperatures laying between these three values are linearly interpolated as mixes of two nearest colours.

In the last step I added a button which allows to change maximum represented temperature value in range from 10 °C to 80 °C (which is a maximum for used sensor). Button is connected to pin 10 with internal pull up enabled. Colour to temperature legend is displayed on the previously mentioned additional strip of 8 LEDs: leftmost pixel presents colour for temperature of 10 °C and rightmost for 80 °C with the remaining values in between them. This allows user to estimate temperatures of visible objects by cycling through eight settings in search for optimal one for current conditions. Code is on GitHub.

I should now move on to next steps in the project, but I got an interesting idea. I was trying to think out a way to make this device a tiny bit less useless. I realized that it might be quite fun to be able to save an image when device is connected to PC. To do this I plan to replace the button with a rotary encoder, in which rotation will cycle through temperatures to colour map modes and click will trigger data export by serial port. Then Python script can be used to export an image (in 8x8 resolution or higher with interpolation).

I also learned something the hard way. It's really hard to take a photo or record a movie of light up LEDs. Still no solution to that, but I will do my best to solve this issue.