How
IR sensor work....
after watching the above video you will know how sensor work, like to detect the object in particular direction we have to set our IR sensor in that direction and we can set the detection range using the potentiometer that is mounted on IR sensor pcb.
now lets see the connection for our project.
GND -> GND
+5V -> +5V
O/P -> A0
here all highlighted pins belongs to sensor and other to nodemcu.
so these are the hardware connection, that we have to make and then
STEPS->
1) google thingsio.ai
2) register yourself (or) make an account
3) click on new project button on top menu
4) go to sample code option's --> nodemcu -->LM35 --> copy
5) paste it on arduino ide
6)declare variable that you want to sent to server
int t; //comment the line "int t,t1,t2,t3;"
7) give your SSID and PASSWORD
if(!wifiManager.autoConnect("abcd","*****"))
//wifiManager.autoConnect("AP-NAME", "AP-PASSWORD"); (OR) wifiManager.autoConnect("AP-NAME"); only ID no password (OR) wifiManager.autoConnect(); this will generate a ID by itself
{ Serial.println("failed to connect and hit timeout"); //control comes here after long time of creating Access point "NodeMCU" by NodeMCU and still it has not connected //reset and try again, or maybe put it to deep sleep
ESP.reset();
delay(1000); }
//here in place of abcd give your ssid and in place of ******* give your password
8)in calculation part make all line comment except below two lines--> t=(analogValue/1024.0) * 5000;
Serial.println(t);
t=(analogValue/1024.0) * 5000;
// Serial.print("temp: "); comment line's
Serial.println(t);
//t2=(t1/10);
//Serial.print("celc: ");
// Serial.println(t2);
// t3=((t2 * 9)/5 + 32);
//Serial.print("fhrn: ");
//Serial.println(t3);
9) change celc to your parameter name and t2 to t, delete others
String PostValue = "{\"device_id\": 61121695818, \"slave_id\": 2";
PostValue = PostValue + ",\"dts\":" +timestamp;
PostValue = PostValue +",\"data\":{\"celc\":" + t2 +",\"fahr\":" + t3 +"}"+"}";
//+",\"fahr\":" + t3 <----- delete this part from above line
10) that's all we need to do now upload it to nodemcu board.
open your serial monitor and see whether http status is 200 or not if yes that means the data is successfully getting uploaded to the cloud and then check on cloud and analyse it.
Use'swe can use this kind of project in farming (field security), visitor counter, to keep a particular place secret.
if you have the knowledge of machine learning then you can also predict the future case's like in farming case -->
after so many days of implementing this system we will be having lot of data with us so we can make a nice dataset having feature's like time and "object entry"
and since this will be binary case like somebody is entering in your field or not (0 or 1) so by using logistic algorithm we can easily predict for the future time whether the person or animal will enter in field or not.
--> another example- take visitor counter
let's we keep this system on for months then we will get a good data history which will be having features like number of people's visit on which day and time.
so we can simply use linear regression or we can go with the poly also if dataset is more likely for poly, to predict how many peoples will visit tomorrow and accordingly we can arrange our place.
Comments