Frequency measurement with EasyESP

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Olbi
New user
Posts: 4
Joined: 16 Oct 2017, 12:37

Frequency measurement with EasyESP

#1 Post by Olbi » 16 Oct 2017, 13:45

A very very low cost soil moisture sensor with NE555 Timer IC and EasyESP

It's very simple to get soil moisture dependent frequency by using some isolated wires, two resistors and a NE555 Timer IC (see Attachement-Picture). The great problem is, to measure this frequency with a NodeMCU or a simple ESP8266!
kapazitiver Sensor.jpg
kapazitiver Sensor.jpg (157.49 KiB) Viewed 11604 times

Yes, it's possible to take a low pass filter, a voltage devider and so on for using the ADC Pin. But in reality without spetial calibrating the usable Range of the 10bit resolution was very very small, in my case:

ideal
Air: 32 kHz (19 pF) 1,34 V ADC 404
Water: 8 kHz (60 pF) 1,17 V ADC 347

real
dry soil 10,7 kHz (45,1 pF) 1,21 V ...
wet soil 9,4 kHz (51,2 pF) 1,19 V ...

... that's not fine and it's not my target to use the ADC ;-)


I would like to (direct) measure the frequncy with EasyESP (see Attachement Circuit Diagram). It does not have to be 100% accurate!

If I use the "Pulse Counter" Device, it's counting ..., but it's counting without end! Is there a possibility to count the pulses within a special time? ... with "Rules"...? Or is there a other possibility?
555 and NodeMCU.png
555 and NodeMCU.png (19.02 KiB) Viewed 11604 times

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Frequency measurement with EasyESP

#2 Post by toffel969 » 16 Oct 2017, 19:31

Olbi wrote: 16 Oct 2017, 13:45 A very very low cost soil moisture sensor with NE555 Timer IC and EasyESP

It's very simple to get soil moisture dependent frequency by using some isolated wires, two resistors and a NE555 Timer IC (see Attachement-Picture). The great problem is, to measure this frequency with a NodeMCU or a simple ESP8266!
kapazitiver Sensor.jpg


Yes, it's possible to take a low pass filter, a voltage devider and so on for using the ADC Pin. But in reality without spetial calibrating the usable Range of the 10bit resolution was very very small, in my case:

ideal
Air: 32 kHz (19 pF) 1,34 V ADC 404
Water: 8 kHz (60 pF) 1,17 V ADC 347

real
dry soil 10,7 kHz (45,1 pF) 1,21 V ...
wet soil 9,4 kHz (51,2 pF) 1,19 V ...

... that's not fine and it's not my target to use the ADC ;-)


I would like to (direct) measure the frequncy with EasyESP (see Attachement Circuit Diagram). It does not have to be 100% accurate!

If I use the "Pulse Counter" Device, it's counting ..., but it's counting without end! Is there a possibility to count the pulses within a special time? ... with "Rules"...? Or is there a other possibility?
555 and NodeMCU.png
May be an arduino via i2c/serial?
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

rayE
Normal user
Posts: 144
Joined: 12 Oct 2017, 12:53
Location: Philippines

Re: Frequency measurement with EasyESP

#3 Post by rayE » 17 Oct 2017, 03:08

Dont you just set up a pulse counter device and set it to be delta/total/time? iv not tried it but im presuming the delta value will be pulses per second?

rayE
Normal user
Posts: 144
Joined: 12 Oct 2017, 12:53
Location: Philippines

Re: Frequency measurement with EasyESP

#4 Post by rayE » 17 Oct 2017, 10:38

I gave the pulse counter a try today. Set up as follows.

My setup:
v2.0.0-dev12

Device = Pulse Counter
I/O = CH5
Type = delta/total/time
Mode = Rising
Delay = 10s

I injected a 3.3V p-p 1Hz signal into the I/O pin. For the first minute or so it seemed to work, the time variable gave an accurate representation of the frequency. Im not quite sure what delta does, it just seemed to count up and reset at some random point. It looks like it can only measure very low frequency's as the resolution of the time variable is 1ms.

Then after running for a short while the ESP started rebooting frequently. I disabled the Pulse Counter device and no more reboots so it looks to me like there is a problem in the device code?

Here is a dump of a reeboot.

Code: Select all

Exception (0):<CR><LF>
epc1=0x40218600 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000<CR><LF>
<CR><LF>
ctx: sys <CR><LF>
sp: 3ffffc20 end: 3fffffb0 offset: 01a0<CR><LF>
<CR><LF>
>>>stack>>><CR><LF>
3ffffdc0:  00000005 c0032025 00000000 40218614  <CR><LF>
3ffffdd0:  40107334 00000005 00000000 40107382  <CR><LF>
3ffffde0:  ffffffff 00000020 00000001 40107382  <CR><LF>
3ffffdf0:  ffffffff 00000020 00000000 00000022  <CR><LF>
3ffffe00:  3fffc200 401072fc 3fffc258 4000050c  <CR><LF>
3ffffe10:  400042e4 00000030 00000016 ffffffff  <CR><LF>
3ffffe20:  60000200 00000000 3fffff00 08000000  <CR><LF>
3ffffe30:  400042db 00000000 00000000 00000000  <CR><LF>
3ffffe40:  0000ffff 3fffc6fc 3ffeee3c 3fff76fc  <CR><LF>
3ffffe50:  000002f4 003fc000 60000600 00000030  <CR><LF>
3ffffe60:  000002f4 0848ddde 60000600 00000030  <CR><LF>
3ffffe70:  40243578 00000030 0000001c ffffffff  <CR><LF>
3ffffe80:  40243633 00000008 ffffffff fffffffb  <CR><LF>
3ffffe90:  3ffea854 40243620 00000000 bfffffff  <CR><LF>
3ffffea0:  ffffffff 3fffc6fc 3ffeee3c 3ffeed74  <CR><LF>
3ffffeb0:  3ffeee60 0848ddde 60000600 00000030  <CR><LF>
3ffffec0:  40000f58 00000000 00000020 00000000  <CR><LF>
3ffffed0:  00000013 40243620 3ffeee3c 00000001  <CR><LF>
3ffffee0:  ffffffff 3fff37d8 3ffeee3c 3fffdab0  <CR><LF>
3ffffef0:  00000000 3fffdcb0 3ffeee88 00000030  <CR><LF>
3fffff00:  00000000 400042db 00000064 60000600  <CR><LF>
3fffff10:  40004b31 3fff76fc 000002f4 003fc000  <CR><LF>
3fffff20:  40104e5e 3ffeee60 3ffeecc0 40107dbc  <CR><LF>
3fffff30:  402430e5 3ffeecc0 3ffeee60 0848ddde  <CR><LF>
3fffff40:  3fff76fc 00001000 40243586 00000008  <CR><LF>
3fffff50:  4010561c 00000000 40243633 3ffeed74  <CR><LF>
3fffff60:  3ffeee60 02969f0f 3ffeee60 60000600  <CR><LF>
3fffff70:  40246331 3ffeed74 3ffeee60 0848a2a7  <CR><LF>
3fffff80:  40246376 3fffdab0 00000000 3fffdcb0  <CR><LF>
3fffff90:  3ffeee70 00000000 40000f65 3fffdab0  <CR><LF>
3fffffa0:  40000f49 00033e03 3fffdab0 40000f49  <CR><LF>
<<<stack<<<<CR><LF>
bBÊdžBrûΦjzÿÿR†ÃgrBec<DEL>¤çüINIT : Free RAM:26032<CR><LF>
INIT : SPI not enabled<CR><LF>
Regards
Ray

Domosapiens
Normal user
Posts: 307
Joined: 06 Nov 2016, 13:45

Re: Frequency measurement with EasyESP

#5 Post by Domosapiens » 17 Oct 2017, 12:02

How about, first dividing by 100 with a 555 circuit
http://www.talkingelectronics.com/proje ... ts.html#I2
and then a a rule that counts for 100 seconds?
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.

rayE
Normal user
Posts: 144
Joined: 12 Oct 2017, 12:53
Location: Philippines

Re: Frequency measurement with EasyESP

#6 Post by rayE » 17 Oct 2017, 13:02

Even /100 would give you a very poor resolution! as i said from my brief experiment when the pulse counter worked it looked to me like the minimum resolution is 1mS. So i would think divide by 1000 BUT the pulse counter looks like it still has a problem? maybe someone else with a frequency generator can try it out? I could be wrong :-)

Ray

Olbi
New user
Posts: 4
Joined: 16 Oct 2017, 12:37

Re: Frequency measurement with EasyESP

#7 Post by Olbi » 18 Oct 2017, 10:38

Now, after some experiments I learned:
  • "Delta" in Counter Type equals to "Count" in Values Name,
  • Counter Type "Delta" counts pulses per "Delay" seconds in Values Name "Count",
  • max. frequency with "Debounce Time" 0 is 1000 Hz,
  • "Mode Type" LOW don't count, RISING and FALLING counts normal, CHANGE counts double
Example
Debounce Time: 0
Counter Type: Delta
Mode Type: CHANGE
Delay: 5 [seconds]
GPIO pulses with 200 Hz
Count = pulses * CHANGE * Delay = 200 * 2 * 5 = 2000

Ok, max. 1000 Hz is very low. So I have to use a / some frequency devider ... :roll:

rayE
Normal user
Posts: 144
Joined: 12 Oct 2017, 12:53
Location: Philippines

Re: Frequency measurement with EasyESP

#8 Post by rayE » 19 Oct 2017, 07:00

Hi Olbi,
What firmware version are you using? i take it you had no problems with the esp rebooting?

Olbi
New user
Posts: 4
Joined: 16 Oct 2017, 12:37

Re: Frequency measurement with EasyESP

#9 Post by Olbi » 19 Oct 2017, 07:37

I'm using GPIO 10 on a NodeMCU V2 with firmware v2.0.0-dev12 without deep sleep connection and I think there are no reboots.

Drum
Normal user
Posts: 300
Joined: 07 Feb 2016, 11:56

Re: Frequency measurement with EasyESP

#10 Post by Drum » 20 Oct 2017, 13:02

I have a few of these:
https://www.tindie.com/products/aprbrot ... or-rev-21/

They do work, but it is not a perfect solution. Putting a PCB in wet soil will eventually cause it to fail without really god sealant, and to be accurate you need good voltage control. (in air at 3.3V readings are 860 to 900, at 2.8V readings are 710 to 740). Of course coatings also affect the readings, and it is a little short for my use as well.

I need something with at least 2 different sensors at different depths and external antenna. Finding an inexpensive and reliable sensor is the biggest challenge so far.

harada57
New user
Posts: 3
Joined: 03 Dec 2017, 10:28

Re: Frequency measurement with EasyESP

#11 Post by harada57 » 03 Dec 2017, 10:57

A space is missing after -m! And a host name with -h would be nice....

วิธีเล่นบาคาร่า

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests