
DIY Follow Me Robot
Here, you will learn how to make an autonomous robot which will follow the object in front of it.
Temperature is a significant part of our daily life. Too high Temperature and too Low temperature are not comfortable for human as well as electronics around us.
This can be controlled by having an airflow around our system. Airflow can cool down our system and also stable our temperature.
For temperature sensing, we use LM35 which is a low-cost and precise sensor with easy operations.
Detailed Temperature sensing can be found here
For proper operation, we have to average some samples of temperature so in this tutorial we are using 100 samples.
Connection:
/*temperature dependent fan * made for evive IoT tutorials * * Made by Nihar Shah * On 20 December 2017 */ #define lm35 A0 //ldr input pin #define fan_relay 2 //fan_relay shown in pin #define threshold 30 // thershold to turn on or off output #define samples 100 int state[samples] = {0}; int temp = 0; void setup() { // put your setup code here, to run once: pinMode(lm35, INPUT); pinMode(fan_relay, OUTPUT); } void loop() { int avg = 0; // this is used to start average function for (int i = 0 ; i < samples ; i++) // adding readings { state[i] = analogRead(lm35); avg += state[i]; } avg = avg / samples; // averaging readings temp = 0.48 * avg; // to get temperature in celcius at +5v multiply with 0.48 Serial.println(temp); // serial print data temp = 0.48 * avg; if (temp > threshold) { digitalWrite(fan_relay, HIGH); } else { digitalWrite(fan_relay, LOW); } }
As total Resolution of 0 – 5V is from 0 to 1023 we can have 4.88 mV ( 5/1023 V)
Now LM35 shows 10mV increase per degree Celsius so one reading of value ( 0 – 1023) shows 0.488 degree Celsius ( 4.88 / 10 degree Celsius)
Therefore total Temperature is 0.48 * Value.
0 items in the cart ($0.00)