#D1 Mini, photoresistor, pulse_counter
1 messages · Page 1 of 1 (latest)
I’m using a D1 Mini v3.1.0, photo resistor is fed with 3.3v and the input I’m using is GPIO0
I measured a max resistance of 20k through the photoresistor when completely dark. I’m using a 10k resistor to ground just like the example at https://esphome.io/cookbook/power_meter.html
Someone recommended a 100k resistor when using a 3.3v board. I THINK I understand why that would be more suitable but i tried a 100k and it didn’t help. pulse_counter keeps outputting 0 pulses so I guess it doesn’t register the input as LOW or HIGH or neither. I have verified with a voltage meter that the circuit returns <0.2v when completely dark though
Just looking for someone with the exact same setup that could possibly point me in the right direction 🥰
I know there is another sensor called pulse_meter that is more suitable for my end goal but I’m using pulse_counter for now since it has more verbose debug logs
i used a 10k resistor as a voltage divider with the 5v line
then used sensor:
- platform: pulse_meter
pin: D1
unit_of_measurement: 'kW'
name: 'Electricity Usage'
internal_filter: 100ms
accuracy_decimals: 3
filters:- multiply: 0.06
total:
name: "Electricity Total"
unit_of_measurement: "kWh"
accuracy_decimals: 3
filters:- multiply: 0.001
- multiply: 0.06
that gives me realtime usage
Is it safe to use the 5v on a D1 mini?
I mean it could theoretically send 5v to the gpio which has a logic level of 3.3v, but maybe that’s ok on this board? 🙂
Oh wait, it would never be 5v since it’s a voltage divider
Sorry, still learning this stuff
Hm no it would output 5v if there was no resistance through the photoresistor
I’m just rubber ducking on my own here 😅