NeoPixel Thermometer!

NeoPixel Thermometer! © CERN-OHL

Transform a NeoPixel ring into a cool thermometer

  • 1,796 views
  • 2 comments
  • 10 respects

Components and supplies

About this project

My project is very simple and easy to accomplish. I chose this project to monitor the temperature of my room because having a guinea pig I should know the temperature because too low or too high could die U_U.

My NeoPixel has 12 LEDs, the base temperature is 11 ° C and the maximum is 30 ° C, each LED has a temperature range of 1.5 (ie the first LED will light if it is at a temperature Between 11 and 12.5 degrees). To understand the temperature I printed on a sheet of temperature and then after bending I put it in the NeoPixel.

To detect the temperature use a TMP36 sensor and the temperature is updated every 5 seconds by sending NeoPixel to the serial computer as well.

I hope the project you would like!

Code

CodeC/C++
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
  #include <avr/power.h>
#endif
// named constant for the pin the sensor is connected to
#define PIN            6

// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS      12

// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.
// Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest
// example for more information on possible values.
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

const int sensorPin = A0;
// room temperature in Celcius
const float baselineTemp = 20.0;

void setup() {
  // open a serial connection to display values
  Serial.begin(9600);
  pixels.begin();
  // set the LED pins as outputs
  // the for() loop saves some extra coding
  for (int pinNumber = 2; pinNumber < 5; pinNumber++) {
    pinMode(pinNumber, OUTPUT);
    digitalWrite(pinNumber, LOW);
  }
}

void loop() {
  
  // read the value on AnalogIn pin 0
  // and store it in a variable
  int sensorVal = analogRead(sensorPin);


  float voltage = (sensorVal / 1024.0) * 5.0;


  Serial.print(", degrees C: ");
  float temperature = (voltage - .5) * 100;
  Serial.print(temperature);

  if (temperature > 11 && temperature < 12.5  ) {
    Serial.println("cold-01");
    for(int i=0;i<2;i++){

    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(49,0,225)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware.

  }
  }
  
  if (temperature > 12.6 && temperature < 14  ) {
    Serial.println("cold");
    for(int i=0;i<2;i++){

    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(0,106,225)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware.

  }
  }
  if (temperature > 14.1 && temperature < 15.5 ) {
    Serial.println("cold1");
for(int i=0;i<3;i++){

    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(0,203,225)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware

  }
  }
  if (temperature > 15.6 && temperature < 17 ) {
    Serial.println("cold2");
for(int i=0;i<4;i++){

    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(0,225,148)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware.

  }
  }
  if (temperature > 17.1 && temperature < 18.5 ) {
    Serial.println("cold3");
for(int i=0;i<5;i++){

    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(0,225,21)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware.


  }
  }
  if (temperature > 18.6 && temperature < 20 ) {
    Serial.println("cold4");
for(int i=0;i<6;i++){

    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(115,225,0)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware.


  }
  }
  if (temperature > 21.1 && temperature < 22.5 ) {
    Serial.println("cold5");
for(int i=0;i<7;i++){

    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(216,225,0)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware.


  }
  }
  if (temperature > 22.6 && temperature < 24 ) {
    Serial.println("cold6");
for(int i=0;i<8;i++){

    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(225,179,0)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware.


  }
  }
  if (temperature > 24.1 && temperature < 25.5 ) {
    Serial.println("cold7");
for(int i=0;i<9;i++){

    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(225,62,0)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware.



  }
  }
  if (temperature > 25.6 && temperature < 27 ) {
    Serial.println("cold8");
for(int i=0;i<10;i++){

    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(225,0,0)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware.



  }
  }
  if (temperature > 27.1 && temperature < 28.5 ) {
    Serial.println("cold9");
for(int i=0;i<11;i++){

    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(225,0,0)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware.


  }
  }
  if (temperature > 28.6 && temperature <30) {
    Serial.println("cold10");
for(int i=0;i<12;i++){

    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(225,0,0)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware.



  }
  }
delay(5000);
pixels.clear();

}

Schematics

Schematics of project
Useful to know how to wiring the parts
neopixel_scheme_wfk1fcMkYZ.fzz
Measure Sheet
sheetmeasure_4TuyfLRBoj.xcf

Comments

Similar projects you might like

VU Meter on Steroids: Arduino Nano and NeoPixel WS2812B

Project in progress by Team WannaDuino

  • 21,875 views
  • 84 comments
  • 81 respects

Simple Arduino-based Thermometer

Project showcase by circuito.io team

  • 3,509 views
  • 0 comments
  • 11 respects

Making LCD Thermometer With Arduino And LM35/36

Project tutorial by Konstantin Dimitrov

  • 68,713 views
  • 17 comments
  • 64 respects

NeoPixel LEDs: Arduino Basics

by Alex Glow

  • 43,234 views
  • 1 comment
  • 46 respects

Arduino - Web-Based Thermometer

Project tutorial by khanhhs

  • 10,042 views
  • 12 comments
  • 37 respects
Add projectSign up / Login