Project tutorial
Positive Reinforcement Temp. Commentator

Positive Reinforcement Temp. Commentator © CERN-OHL

Project to implement basic inputs and outputs by commenting on the current temperature!

  • 1,171 views
  • 1 comment
  • 1 respect

Components and supplies

Apps and online services

About this project

Background

It was about time I made my first official hardware tutorial, so I thought what I can do that uses a fair amount of inputs and outputs, while still being fun.

I came up with the Temperature Commentator.

It senses that you are in-range, then turns a sign saying "Think warm thoughts" with a red LED if it's below 62F, and "All is going well" with a yellow LED if it is equal to or above 62F.



Demo


demo


Issues

I was moving it to a custom enclosure and generic arduino board, but I ran into some walls that I thought were unnecessary to try to overcome at this time. 

I just want to get to building my next project! :)

Although I do want to get a few kinks worked out...


Some issues I've been having:

  • Hardware - When 9V battery is connected to the Uno, the servo acts funny, oscillating in pulses
  • Code - When proximity is read, the voltage changes and temp is read higher than normal, and falls back down about 5 degrees F once removed.


If anyone can help, I'd be highly appreciative!

Code

tempCom_1.2.inoC/C++
#include <Servo.h>

Servo myservo;

#define trigPin 2
#define echoPin 3
#define led 13
#define led2 12
int sensorPin = A0;

void setup() {
  Serial.begin (9600);
  myservo.attach(9);
  myservo.write(90); 
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(led, OUTPUT);
  pinMode(led2, OUTPUT);
}

void loop() {
  long duration, distance;
  digitalWrite(trigPin, LOW); 
  delayMicroseconds(2); 
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration/2) / 29.1;
    Serial.print(distance);
    Serial.println(" cm"); 
    
 int angle = myservo.read();
 Serial.print("Angle: ");
 Serial.println(angle);
 
 int reading = analogRead(sensorPin);  

 float voltage = reading * 5;
 voltage /= 1024.0; 

 float temperatureC = (voltage - 0.5) * 100 ;  
        Serial.print(temperatureC); Serial.println(" degrees C");  
 float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
 Serial.print(temperatureF); Serial.println(" degrees F"); Serial.println("");
 
  if (distance < 80 ) 
  {  
    if (temperatureF < 62)
    {
      myservo.write(10);
      digitalWrite(led,HIGH);
      digitalWrite(led2,LOW);
    }
    else if (temperatureF >= 62)
    {
      myservo.write(180);
      digitalWrite(led,LOW);
      digitalWrite(led2,HIGH);
    }
  } else
  {
    myservo.write(90);
    digitalWrite(led, LOW);
    digitalWrite(led2, LOW);  
  }
  
 delay(1000);                                
}

Schematics

TempCom%20Sch.fzz
Tempcom sch
TempCom_Sch.png
Tempcom sch

Comments

Similar projects you might like

Know the Temp of Your Home From Anywhere with Arduino Cloud!

Project tutorial by Isaac100

  • 6,426 views
  • 2 comments
  • 16 respects

Portable Temperature Station

Project tutorial by Isaac100

  • 8,078 views
  • 8 comments
  • 35 respects

Perfect Parker

Project tutorial by scott mangiacotti

  • 2,872 views
  • 2 comments
  • 9 respects

MKR1000 Temp and Humidity Sensor

Project tutorial by Don Coleman

  • 18,140 views
  • 11 comments
  • 31 respects

On Table Clock & Temp

Project showcase by taha_vs

  • 2,619 views
  • 0 comments
  • 5 respects

Monitoring Health Station

Project tutorial by Diana Khalipina

  • 2,295 views
  • 2 comments
  • 25 respects
Add projectSign up / Login