Puck Lite + Light #4147
Replies: 1 comment
-
Posted at 2023-02-22 by @gfwilliams Sorry for the delay... The Posted at 2023-02-22 by user153457 Wow that is amazing, I am guessing the dynamic range is not that great? Posted at 2023-02-22 by @gfwilliams No, it's not fantastic, but as far as detecting the difference between night and day or whether a door is open goes, it's fine Posted at 2023-02-22 by user153457 Great I will give it a try, I want to see if it can pickup the light pulses of my energy meter. Posted at 2023-02-23 by @gfwilliams
Ahh, right - you mean like this? https://www.espruino.com/Smart+Meter The code that's there works because using the LDR allows the IO voltage to change enough that it's detected as a 3.3v IO pin changing state - the LED won't generate enough voltage for that. However, you can use the low power comparator:
You'll get 'pin changed' written when the value goes high and low, so the actual number of pulses is 1/2 the amount of times that gets called. We're comparing against VCC/16 here - and in my quite dark room I'm getting about VCC/4 - so to make this work you'll want to ensure it's quite dark and the Puck's LED sits right over the smart meter's LED. For testing I'm just covering and uncovering the Puck with my hand. It may be you're unlucky and the wavelength of light from the smart meter isn't detected by the Puck's red LED, but hopefully it'll work ok. Posted at 2023-02-23 by @gfwilliams Just to add that this is actually preferable to the LDR solution as it uses amazingly little power when idle. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2023-02-11 by user153457
Hi there,
I have the Espruino Puck Lite and would like to know when I call the Puck.light() which pins is reading?
Do I always need to add a light dependent resistor?
Cheers.
Beta Was this translation helpful? Give feedback.
All reactions