So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Janoshi
#85078 Hi.

I've made a setup where the impulse led on my powermeter is read by a photodiode and sent to a MQTT broker. This has worked for a few years now. There's a breadboard power supply, an ESP8266, pontentiometer as a pullup-resistor and a SDH300 photodiode. By fine-tuning the pullup I was able to pick out just the blinking of the impulse led and not the daylight surronding the meter. In the loop-code esp continuously checks if digitalRead(2) == LOW. Ie. the photodiode grounds the circuit when ever theres a blink. ESP calculates microsecs between blinks and sends out the data to MQTT server.

Now, something hapenned to my powersupply and the setup broke down. I wanted to switch from ESP to wemos, and not have a separate powersupply. Now basically everything should work as before, right? I put the same code to the new wemos, connected the photodiode and potentiometer. But the problem is that the diode cannot pull down the signal anymore with normal light. I have to dial the potentiometer down and shine a flashlight to the diode to have it trigger the circuit as LOW. If I put a switch to the circuit, it will trigger just fine.. I tried to replace potentiometer with the internal pullup resistor with wemos. Same thing, photodiode cannot pull down the circuit with normal daylight. Tried with different powersupplys (microusb) and even with a new photodiode.

I even tried to reverse the logic. Have the resistor grounded and changed the code to trigger on a HIGH signal. That doesnt work either.

...so, any help is appreciated. Basically the setup is the same, but theres no external powersupply. Dunno if the ground is somehow floating more etc.. Or could the "power" of the photodiode be somehow amplified with a capacitor or something. Final thing, I thought that I can mind as well purchase a "photodiode sensor module" that should work with wemos. But that basically does the same pullup and have it as adjustable, so will that work either?

Cheers,
Janoshi
User avatar
By Janoshi
#85112 Actually, since this post took a few days to be published, I managed to solve this already..

I put the whole setup to a breadboard and started to test various things. I noticed that even without any pulling up, the signal on GPIO2 was always firmly HIGH and the photodiode could not pull it down without really shining a light to it. This was even if I had not stated INPUT_PULLUP in the code. I suspect that GPIO2 builtin pullup resistor is on by default with Wemos.

Simple solution was that, I moved to using GPIO4. Now, I can adjust the pullup level to just right with the potentiometer, again.

Cheers,
Jarnoshi