Things used in this project

Hardware components:
A000066 iso both
Arduino UNO & Genuino UNO
×1
12002 04
Breadboard (generic)
×1
11026 02
Jumper wires (generic)
×11
Thermistor
×1
Mfr 25frf52 10k sml
Resistor 10k ohm
×1
08377 02 l
Resistor 330 ohm
×1

Schematics

Wiring
Img 20140427 114301

Code

sketch.cC/C++
sketch.c
#define TEMP_PIN A0
#define RED_PIN 9
#define GREEN_PIN 10
#define BLUE_PIN 11

int adc = 0;
int blue = 0, red = 0;

double ReadThermistor(int adc) {

  double resistance = ((1024.0/adc) - 1);    //calculate from voltage divider, for 10k resistor
  double Temp = log(resistance);

  // calculate the temperature, in K, using 4 thermistor model/material specific parameters A, B, C, D
  // here we use the values for the Sparkfun/Hactronics version of the Vishay 10k NTC thermistor
  Temp = 1 / (0.003354016 + 0.0002569850 * Temp + 0.000002620131 * Temp * Temp + 0.00000006383091 * Temp * Temp * Temp);
  Temp = Temp - 273.15;            // Convert Kelvin to Celsius
  return Temp;
}

void setLED(int blue, int red){
  analogWrite(BLUE_PIN, blue);
  analogWrite(RED_PIN, red);
}

void setup(){
  Serial.begin(9600);
  pinMode(BLUE_PIN, OUTPUT); 
  pinMode(RED_PIN, OUTPUT); 
  pinMode(GREEN_PIN, OUTPUT);  
  pinMode(TEMP_PIN, INPUT);
}

void loop(){
  adc = analogRead(TEMP_PIN);
  int temp = ReadThermistor(adc);
  Serial.println(temp);
  
  red = map(temp, 20, 40, 0, 255);
  blue = 255 - red;
  
  setLED(blue, red);
}

Credits

K6ebqf e
Benjamin Larralde

Founder @hackster.io, hardware and crowdfunding enthusiast

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Laser Stuff
Easy
  • 467
  • 3

A laser module that makes light patterns.

LEDog Collar
Easy
  • 708
  • 10

Full instructions

The LEDog collar lights up when it gets dark, helping you locate your dog from far away.

Handheld Infinity Kaleidoscope Group Kit
Easy
  • 2,491
  • 30

Full instructions

Use the orientation sensor in your Arduino 101 to control a cool Petri dish infinity-mirror illusion. This project is great for groups.

Arduino 101 BLE RGB Lamp
Easy
  • 499
  • 7

Full instructions

Create your own RGB controlled lamp with Arduino 101 using BLE.

SECURITY SYSTEM AND ACCESs CONTROL WITH ARDUINO AND RFID
Easy
  • 628
  • 8

Full instructions

To enter passwords and to allow access to a door or to drive an electronic device, now we will use a RFID device

A Tone Generator with LCD Display!
Easy
  • 209
  • 3

Full instructions

This is a tone selector with the ability to change the buzzer frequency by a potentiometer and to see the result on a 16x2 display.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Feedback