Hey everyone, I've got a Genuine Arduino, i've setup a DHT11 to it, i received accurate readings and the degree was fine, what i am trying to make is linking up a water sprinkler so per say when the degree is above 27 Celsius, my water sprinkler will start giving water, the water sprinkler will start immediately after the Degree i set has been reached i am still a beginner in coding so i just do not understand how will i be doing this overall.
First thing I'd do is use an led to mimic the sprinkler being on; use an "if" to check the temp against your target of 27 and turn the led off and on.
It's normal in these things to add a little hysteresis. That means, don't use 27 as the target for turning on and off; allow a couple of degrees wiggle room, else if the temp is hovering just on 27 the thing will be turning off and on like a maniac.
So, turn it on at 27, but only off at (say) 25. Here's what happens:
- Temp is at say 20 in the morning and rising, no sprinklers
- Temp passes lower threshold of 25, nothing happens, still no sprinklers
- Temp passes upper threshold of 27, sprinklers on
- (Now, if it dropped below 27 immediately, and we were only checking against 27, sprinkler would go off immediately, and perhaps on again if temp went a tiny bit above 27)
- Temp rises above 27, sprinklers stay on... 28... 29... 30
- Temp starts to drop in the evening... cools to 29, 28....
- Temp cools past 27, sprinklers stay on
- Temp cools past 25, sprinklers go off
Just a simple if to go on if >=27, and another one to go off if <= 25.
Of course, for better help you will need to:
- provide the code you have already, and
- provide details of the sprinkler system so folk can advise on how to connect to it electrically... perhaps some kind of relay will fit the bill, or a solenoid valve in the pipe, but who knows- details are required.