Assemble the Thermal Flashlight
Assembly is a bit easier in this new version (April 2019); below is the diagram both on and off of a mini breadboard; we've eliminated some unnecessary parts.
Parts list:
- 1 Melexis MLX90614 non-contact IR thermometer (3v)
- 1 RGB common-cathode LED
- 2 4.7k Ohm resistors (or close to that)
- a short wire (to extend one leg of the thermometer)
- a mini breadboard
- an Arduino Nano
- a mini USB cable to power it (and a USB battery)
(step-by-step coming soon!)
Program the Arduino
If it's not already programmed, you'll need to upload a program to your Arduino in the Arduino IDE (https://arduino.cc or the online editor at https://create.arduino.cc) using the following code:
https://gist.github.com/jywarren/1ad7dd997b6319ccb2525958709125ab
You'll need to install the Adafruit Melexis library here:
Using the Thermal Flashlight
You can use this program to "paint" colored light with your Thermal Flashlight:
- http://glowdoodle.com
- Also try (and modify) this version in p5js: https://editor.p5js.org/jywarren/full/dl7B2Upp-
See examples of use below!
All code and Fritzing files available here: https://github.com/publiclab/thermal-flashlight/
Old documentation:
https://gist.github.com/sdosemagen/1739961#file-thermalflashlight-ino
Based on a redrawn diagram of the thermal flashlight posted by @ad: http://publiclaboratory.org/notes/ad/11-28-2011/thermal-camera-arduino-uno-mlx90614-ir-thermometer
13 Comments
Illustration made in Fritzing (fritzing.org).
Reply to this comment...
Log in to comment
I've tweaked the code on the thermal flashlight a bit. In our testing, we were getting red for hot, but blue-green for cold (and figured 'blue' should be for the cold).
Here is a reference on how the color HSV (hue, saturation and value) converts to RGB:
http://en.wikipedia.org/wiki/HSV_color_space
Figure 24 shows the essence of what we are trying to do; 0 degrees = red; 240 degrees = blue.
The code in the sketch is almost correct; originally, the value was 360*0.6 = 216 degrees for the coldest value, which is blue-green. 240 degrees gives you blue, so you have:
// Regular ol' RGB LED: // original //int hue = map(state,0,255,(360.00*0.60),0); // not the whole color wheel // // 0 degrees is red, 240 degrees is blue // See http://en.wikipedia.org/wiki/HSV_color_space // Figure 24. // 0=cold is 240 degrees (blue) // 255=hot is 0 degrees (red) int hue = map(state,0,255,240,0);
setLedColorHSV(hue,1,1); //We are using Saturation and Value constant at 1
The other part of the code that will have to change is that if you use a common anode RGB LED (the LED from RadioShack is 276-0028 (common anode (+), which is at 5V), when the PWM output is at 255 for a particular color (5V is on all the time), that color in the LED will be off. So we have to invert the output (zero becomes 255, 255 becomes zero):
// Since we are using common anode, when value is 255 (on always) // the LED for that element is OFF, so, make a swap setLedColor(255-red,255-green,255-blue);
Reply to this comment...
Log in to comment