Sensor for blinking LED of washing machine

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
soldfingr
New user
Posts: 4
Joined: 04 Jan 2020, 20:17

Sensor for blinking LED of washing machine

#1 Post by soldfingr » 04 Jan 2020, 21:18

Hello,

this is my first post on this board. I use ESPEASY (mostly on Wemos D1) for my house automation on FHEM and I'm completly excited. Recently I moved all of my sensors from the Mysensors-project to ESPEASY (using MQTT and FHEM HTTP) because it is much easier to implement new sensors.

Here is my issue:
At the moment I build a sensor for a washing machine, which is located in the basement. It should inform me about a finished washing. It is a BOSCH wasching machine which has an LED for showing the status. The LED is always on when the machine is running. The same LED blinks every second when the washing machine has finished it's program.
I have build a LUX-sensor (BH1750) which is placed over the LED and reads the light intensity. When the light of the LED is off, the lux sensor gives a value of "0" and if the LED is on it gives values about 70 and higher. When refreshing the ESP-Device in the browser i can comprehend that the LED is blinking (values are changing from 0 to 7x).
But when sending the values to the controller (home automation FHEM) it could be that only values about 70 are provided, because the reading interval could only be set to intger values and it is catching the LED exactly when it is on and never when the LED is off.

Is there a possibility to set the reading interval for the I2C Interface for example to 2.5 sec (or any other delay of some 100s of milliseconds) so it would read the LED off phase as well sometime?

I created some "dummy devices" in the ESP-Webconsole on the same physical sensor and if there is load on the microcontroller some of the readings were delayed and I also get 0 values sometime. But this is not a reliable workaround.

What do you suggest? Is there a way with espeasy or do I have to programm my own Arduino? I know there are many solutions with and voltmeter, but i want a solution involving the status LED of the washing machine.

Thanks,
soldfingr

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Sensor for blinking LED of washing machine

#2 Post by ThomasB » 04 Jan 2020, 21:57

Is there a possibility to set the reading interval for the I2C Interface for example to 2.5 sec (or any other delay of some 100s of milliseconds) so it would read the LED off phase as well sometime?
Unfortunately the timer rule resolution is one sec. Hopefully someone has a workaround on how to perform 100mS times.

But if not, I have an idea. A bit clumsy, but practical. Instead of the BH1750 you could use a traditional photo sensor. Connect the photo sensor using a Switch Input device. Also connect it to a Pulse Counter device. The switch input would tell you the logic state of the LED. The counter would tell you if it was blinking.

Mind you, I haven't done this myself. But the proposed concept seems valid.

- Thomas

soldfingr
New user
Posts: 4
Joined: 04 Jan 2020, 20:17

Re: Sensor for blinking LED of washing machine

#3 Post by soldfingr » 05 Jan 2020, 12:15

Thank you. This is a valid approach. I will try it out and give feedback if it works.

soldfingr
New user
Posts: 4
Joined: 04 Jan 2020, 20:17

Re: Sensor for blinking LED of washing machine

#4 Post by soldfingr » 06 Jan 2020, 10:32

I connected a traditional photoresistor and a potentiometer to analog Port A0 and also to the digital port D5, which I configured as input interface. With this voltage devider I could adjust the range of voltage the photo resistor could reach. So I managed the digital port to be "1" when the LED of the washing machine is lit-up and "0" when it's off. The data is also send to my controller FHEM where I could manage to detect the blinking.
I tried also the advice of ThomasB to use a "Generic Pulse counter" but it never counts a change of the digital port, howerver I tried with all possible mode settings (FALLING,CHANGE,RISING,LOW). The debounce time was set to 100ms. It looks like it is not enough to set the digital port to 1 and 0 again to trigger the pulse counter?

Anyway the solution withe the digital port is not perfect but it works. As long nobody has a better idea I can live with it.

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Sensor for blinking LED of washing machine

#5 Post by ThomasB » 06 Jan 2020, 17:19

Hard to say why the counter is not working (would need exact details about your circuit and ESPEasy setup). But keep in mind that the counter plugin enables the Internal PullUp resistor, which would affect the bias on your photo sensor circuit.

I will assume that your Switch input and Generic Counter both use the same GPIO pin. Enable the PullUp in the switch input, then adjust the Pot as needed. This will ensure that the switch input's PullUp setting matches the counter's default PullUp setting.

Also, some ESP boards have attenuator resistors on the A0 input and they could adversely affect the achievable logic levels from the LDR sensor. So remove the A0 connection for now; You can try it again after the switch and counter devices are working.

If these things do not help then the light sensor output probably needs to be conditioned to create true digital logic levels. You could use a transistor or a comparator. For example, something like this (the photo-resistor could be remotely mounted from the PCB if desired):
https://www.aliexpress.com/item/4000103796384.html

Regarding the counter setup, I would suggest starting with: 25mS, Delta, Change, 4 seconds.
Counter Value #1 will contain the count value that is measured in four second periods. If the LED is blinking, the value will be greater than one. Alter the settings if you need different behavior.

- Thomas

soldfingr
New user
Posts: 4
Joined: 04 Jan 2020, 20:17

Re: Sensor for blinking LED of washing machine

#6 Post by soldfingr » 13 Jan 2020, 21:01

ThomasB wrote: 06 Jan 2020, 17:19 I will assume that your Switch input and Generic Counter both use the same GPIO pin. Enable the PullUp in the switch input, then adjust the Pot as needed. This will ensure that the switch input's PullUp setting matches the counter's default PullUp setting.
Of course I do use the same GPIO pin for both devices, the "Switch Input" and the "Generic Counter". Your advice to enable the PullUp in the switch input was exactly the right step. Since then the Generic Counter is working (with all possible modes). Unfortunately I can't reproduce the previous situation. The Generic Counter is still working, even if I disable the PullUp again.
Nevertheless I'm happy (with enabled PullUp or not :-) because ESPEasy does what it's supposed to do: Counting the LED blinking and sending it to my controller.

Thanks again for your friendly help!

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Sensor for blinking LED of washing machine

#7 Post by ThomasB » 13 Jan 2020, 23:08

You are welcome; It's great to hear you resolved the counter problem.

- Thomas

Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests