Giovanni Carrera
Published © GPL3+

How to Make a Supersize Thermometer with an RGB LED Strip

The proposed application uses a temperature sensor, an Arduino and a smart LED strip to create a large thermometer.

IntermediateFull instructions provided10 hours6,670
How to Make a Supersize Thermometer with an RGB LED Strip

Things used in this project

Hardware components

220 ohm ±5%
×1
47 kohm ±1% metal film
×1
Trimmer Potentiometer, 5 kohm
Trimmer Potentiometer, 5 kohm
×1
100 MF,25V electrolytic capacitor
×1
100 nF ceramic capacitor
×3
RGB LED strip type WS2812B
×1
Arduino Nano R3
Arduino Nano R3
×1
LM35 temperature sensor
×1
Linear Regulator (7805)
Linear Regulator (7805)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

arduledtemplm_1kOeSzXss7.jpg

Code

ArduTempLedLM.ino

Arduino
/* program ArduTempLedLM.ino Arduino strip led thermometer
 use a LM35 or TMP35 as temperature sensor 
 Giovanni Carrera, rev. 11/05/2019 */
#include <Adafruit_NeoPixel.h>

int Temp;
float NtomV;
const float VREF = 1050;// in mV, this value can be read on VREF pin 

#define PIN  2 // used for strip led data
#define NUMPIXELS 30  // number of leds in strip (5 to 34C)
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
#define DELAYVAL 500 // Time (in milliseconds) to pause between pixels

void setup() {
  Serial.begin(9600);
  pixels.begin();// INITIALIZE NeoPixel strip object delay( 500 );
  analogReference(INTERNAL); // internal ADC reference input = 1100V
  NtomV = VREF/1023;// constant of conversion into millivolts
}

void loop() {
  int val = analogRead(A0);// read the LM35 sensor
  float temperature = NtomV*val/10.0;// convert to Celsius
  val = analogRead(A1);// read the potentiometer for T correction
  float corr = NtomV*val/10.0 - 3;// adjusting factor, about -3 to +6
  temperature -= corr;// Temperature correction
  Serial.print("  Temperature = ");
  Serial.print(temperature,1);
  Serial.println(" C");
  Temp = (int)temperature;
  if (Temp < 5){
    pixels.setPixelColor(0, pixels.Color(100, 0, 150));// bright violet color
    pixels.show();
    delay(1000);
    pixels.setPixelColor(0, pixels.Color(0, 0, 0));
    pixels.show();
    }
  else if (Temp < 18){// blue led for T<18
    pixels.clear(); // Set all pixel colors to 'off'
    // pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(Temp-5, pixels.Color(0, 0, 70));// moderately bright blue color
    pixels.show();
    } 
  else if (Temp >= 18 && Temp <= 24){
    pixels.clear(); // Set all pixel colors to 'off'
    pixels.setPixelColor(Temp-5, pixels.Color(0, 70, 0));// moderately bright green color
    pixels.show();
    } 
  else if (Temp > 24 && Temp <= 34){
    pixels.clear(); // Set all pixel colors to 'off'
    pixels.setPixelColor(Temp-5, pixels.Color(70, 0, 0));// moderately bright red color
    pixels.show();
  } 
  else {
    pixels.setPixelColor(29, pixels.Color(150, 50, 0));// bright yellow color
    pixels.show();
    delay(1000);
    pixels.setPixelColor(29, pixels.Color(0, 0, 0));
    pixels.show();
  }
  delay(5000);

}

Credits

Giovanni Carrera
14 projects • 50 followers
Electronic Engineer
Contact

Comments

Please log in or sign up to comment.