Hey All,
First of all let me congratulate you guys on building the nicest coolest framework I've ever seen for the esp8266.
Now I have a little problem. Currently I'm trying to read my watermeter with a TCRT5000 connected to my esp8266.
My water meter is a Elster with a little mirror that rotates every 0.001m3. The mirror takes half of the circle.
The problem I have is that with that mirror my TCRT5000 can have 2 states. Or D0 is on or D0 is off (reflecting at the mirror or not reflecting at the mirror).
What I want to read is when that state switches. So when the mirror comes at the led or when it leaves the led.
The pulse counter is not for me in this scenario cause it keeps counting as long as the state of the TCRT5000 is on (pointed at the mirror).
So what I need is some kind of switch counter. Is that possible?
I could build it myself in arduino but I would really like to use this framework cause it has more possibilities that my arduino skills :p
Thanks,
Br,
Nico
Switch Counter
Moderators: grovkillen, Stuntteam, TD-er
Re: Switch Counter
Alright to answer my own question. The problem is that somehow the TCRT5000 is triggering the CHANGE interrupt.
I think this might be triggered by some noise.
Is there a solution for that? For now I've just connected D0 of the TCRT5000 to GPIO14 of the esp8266.
I could copy the plugin and build myself a new one where I just check every 1 second what the value of the pin is and if it changes I can add the necessary values.
However I don't really like that solution. Aren't there any better solutions?
Thanks,
Br
Nico
I think this might be triggered by some noise.
Is there a solution for that? For now I've just connected D0 of the TCRT5000 to GPIO14 of the esp8266.
I could copy the plugin and build myself a new one where I just check every 1 second what the value of the pin is and if it changes I can add the necessary values.
However I don't really like that solution. Aren't there any better solutions?
Thanks,
Br
Nico
Re: Switch Counter
Noise like that is often an electronics issue.
So please show some drawing indicating how the input is connected and what kind of signal is to be expected.
The extra electronics needed can range from nothing (internal pull-up resistor activated in ESPeasy) to some kind of low-pass filter (rsistor + capacitor) or some inverter chip to brush up the signal.
So please show some drawing indicating how the input is connected and what kind of signal is to be expected.
The extra electronics needed can range from nothing (internal pull-up resistor activated in ESPeasy) to some kind of low-pass filter (rsistor + capacitor) or some inverter chip to brush up the signal.
Re: Switch Counter
Hey, thanks for the reply,
I connected D0 of the TCRT5000 directly with GPIO14. I was also thinking about using a capacitor as a low-pass filter.
But I would prefer to keep the electronics as simple as possible.
I will investigate in the possibilities. Maybe hook up a scope to it so I could see the noise. Will take some time to investigate but I will post my results.
edit:
Apparently the Internal pullup is already activated in the code:
pinMode(Settings.TaskDevicePin1[event->TaskIndex], INPUT_PULLUP);
I connected D0 of the TCRT5000 directly with GPIO14. I was also thinking about using a capacitor as a low-pass filter.
But I would prefer to keep the electronics as simple as possible.
I will investigate in the possibilities. Maybe hook up a scope to it so I could see the noise. Will take some time to investigate but I will post my results.
edit:
Apparently the Internal pullup is already activated in the code:
pinMode(Settings.TaskDevicePin1[event->TaskIndex], INPUT_PULLUP);
Who is online
Users browsing this forum: Ahrefs [Bot] and 6 guests