My first design.

Hello!

I have made my first non-tutorial based schematic today, and just wanted to share it with you guys.
Sorry for the huge images.

  • Materials Used:
  • Potentiometer
  • Arduino Uno Rev 3
  • Temperature Sensor
  • LCD screen

Schematics:


Sorry for the dotted lines, first time use of Fritzing.

And here is the code:

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

const int temperaturePin = 0;

void setup() 
{

  lcd.begin(16, 2);
  
  lcd.print("Temperature:");
  
  Serial.begin(9600);
}

void loop() 
{
  float voltage, degreesC, degreesF;
  
  voltage = getVoltage(temperaturePin);

  degreesC = (voltage - 0.5) * 100.0;
  
  degreesF = degreesC * (9.0/5.0) + 32.0;
  
  lcd.setCursor(0, 1);
  
  lcd.print(degreesF);
  
  delay(1000);
}
float getVoltage(int pin)
{

  return (analogRead(pin) * 0.004882814);
  
}

Thanks for checking this out! I know it sucks, first time.

This is the code for the same thing, but with a RGB LED to alert me when the temperature is either higher, lower, or at the same level with a number I have predefined.

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

const int temperaturePin = 0;

int r = 9;
//I have g at 13 because I just want to make sure that
//the curcuits are wired correctly.
int g = 13;

int b = 10;

void setup() 
{
  pinMode(r, OUTPUT);
  
  pinMode(g, OUTPUT);
  
  pinMode(b, OUTPUT);
  
  lcd.begin(16, 2);
  
  Serial.begin(9600);
}

void loop() 
{
  float voltage, degreesC, degreesF;
  
  voltage = getVoltage(temperaturePin);

  degreesC = (voltage - 0.5) * 100.0;
  
  degreesF = degreesC * (9.0/5.0) + 32.0;
  
  if(degreesF > setDegreesF - 0.5)// - 0.5 is just roughing it out
  {
   alertR(); 
  }
  else if(degreesF < setDegreesF - 0.5)
  {
   alertB(); 
  }
  else
  {
   alertG(); 
  }
  
  lcd.setCursor(0, 0);
  
  lcd.write(degreesF + "F");
  
  delay(1000);
}
float getVoltage(int pin)
{
  return (analogRead(pin) * 0.004882814);
}
void alertR()
{
  digitalWrite(r, HIGH);
  delay(50);
  digitalWrite(r, LOW);
  delay(50);
}

void alertG()
{
  digitalWrite(g, HIGH);
  delay(50);
  digitalWrite(g, LOW);
  delay(50);
}

void alertB()
{
  digitalWrite(b, HIGH);
  delay(50);
  digitalWrite(b, LOW);
  delay(50);
}

Just a couple of things:

1) When posting code use the code (#) icon, not the quote one (the one next to it!).

2) In Setup configure the ledpin pinmode to OUTPUT.

pinMode(ledPin, OUTPUT);

and see if that makes a difference?

Please edit your post, select the code, and put it between [code][/code] tags.

You can do that by hitting the # button above the posting area.

dannable: Just a couple of things:

1) When posting code use the code (#) icon, not the quote one (the one next to it!).

2) In Setup configure the ledpin pinmode to OUTPUT.

pinMode(ledPin, OUTPUT);

and see if that makes a difference?

Thanks! That fixed the issue!