ADC, Generic HTTP Update by changing over / under values
Moderators: grovkillen, Stuntteam, TD-er
-
- Normal user
- Posts: 13
- Joined: 22 Sep 2019, 16:15
ADC, Generic HTTP Update by changing over / under values
Hi Forum Peoples
I have a question about ADC (Analog input) at my ESP8266
I get values in the range 0 to 400
However, these often change by +/- 5. That gives a lot of data traffic.
However, I only need a notification to my Generic HTTP Controller, when it goes below or above 100.
example: over 100 send a 1 or true and when goes under 100 send a 0 or false
Is for vehicle detection with a Metal Sensor (Garage it's bussy or not)
less than 100 = car is outside
greater than 100 = car is inside
(this value is variable due to the size of the car)
Is there a way to do this? possibly with a rule?
Thanks for your helps!
I have a question about ADC (Analog input) at my ESP8266
I get values in the range 0 to 400
However, these often change by +/- 5. That gives a lot of data traffic.
However, I only need a notification to my Generic HTTP Controller, when it goes below or above 100.
example: over 100 send a 1 or true and when goes under 100 send a 0 or false
Is for vehicle detection with a Metal Sensor (Garage it's bussy or not)
less than 100 = car is outside
greater than 100 = car is inside
(this value is variable due to the size of the car)
Is there a way to do this? possibly with a rule?
Thanks for your helps!
Re: ADC, Generic HTTP Update by changing over / under values
In that case you should disable the Controller in the Device configuration, and add a Rule with something like this:
Code: Select all
on ADC#Analog do
if %eventvalue1% > 100
sendtohttp,<ip>,<port>,<url,status=1>
else
sendtohttp,<ip>,<port>,<url,status=0>
endif
endon
/Ton (PayPal.me)
-
- Normal user
- Posts: 13
- Joined: 22 Sep 2019, 16:15
Re: ADC, Generic HTTP Update by changing over / under values
Hallo Ath
Thanks for your helps.
The Rule works, but, the problem its, when the Value change from 130 to 131 (example) than send esp this again.
I only need a message when the threshold is below or above 100. (Whit your example spam me the ESP my remote station full)
can i intercept this somehow?
Thanks for your helps.
The Rule works, but, the problem its, when the Value change from 130 to 131 (example) than send esp this again.
I only need a message when the threshold is below or above 100. (Whit your example spam me the ESP my remote station full)
can i intercept this somehow?
Re: ADC, Generic HTTP Update by changing over / under values
Please show your current rule, so I can adjust the code for you.
/Ton (PayPal.me)
Re: ADC, Generic HTTP Update by changing over / under values
I've re-used my earlier code to come up with a possible solution.
NB: Untested!
Code: Select all
on ADC#Analog do
if %eventvalue1% > 100
if %v1% = 0
sendtohttp,<ip>,<port>,<url,status=1>
let,1,1
endif
let,2,0
else
if %v2% = 0
sendtohttp,<ip>,<port>,<url,status=0>
let,2,1
endif
let,1,0
endif
endon
/Ton (PayPal.me)
Re: ADC, Generic HTTP Update by changing over / under values
Also please add a small capacitor close to the ESP over the A0 pin and the GND.
For example 100 nF is generally a good value to start with to filter out some noise.
But for slow changing voltages, you may want to combine a low capacitance value and a higher one.
e.g. 100 nF + 10 uF (note the polarity of the larger one!)
Enabling oversampling in the ADC is also a good idea to get a more stable reading.
For example 100 nF is generally a good value to start with to filter out some noise.
But for slow changing voltages, you may want to combine a low capacitance value and a higher one.
e.g. 100 nF + 10 uF (note the polarity of the larger one!)
Enabling oversampling in the ADC is also a good idea to get a more stable reading.
-
- Normal user
- Posts: 13
- Joined: 22 Sep 2019, 16:15
Re: ADC, Generic HTTP Update by changing over / under values
Hello Ath, thanks for this querry, after my first tests, work this fine! thank you verry much!Ath wrote: ↑24 Apr 2022, 19:36 I've re-used my earlier code to come up with a possible solution.NB: Untested!Code: Select all
on ADC#Analog do if %eventvalue1% > 100 if %v1% = 0 sendtohttp,<ip>,<port>,<url,status=1> let,1,1 endif let,2,0 else if %v2% = 0 sendtohttp,<ip>,<port>,<url,status=0> let,2,1 endif let,1,0 endif endon
-
- Normal user
- Posts: 13
- Joined: 22 Sep 2019, 16:15
Re: ADC, Generic HTTP Update by changing over / under values
Hallo TD-erTD-er wrote: ↑24 Apr 2022, 20:48 Also please add a small capacitor close to the ESP over the A0 pin and the GND.
For example 100 nF is generally a good value to start with to filter out some noise.
But for slow changing voltages, you may want to combine a low capacitance value and a higher one.
e.g. 100 nF + 10 uF (note the polarity of the larger one!)
Enabling oversampling in the ADC is also a good idea to get a more stable reading.
and you also a big thanks for this info. i must this make in a slow time window
Thank you!
Who is online
Users browsing this forum: No registered users and 32 guests