I'm curious about how you believe the data is encoded. You said "1000 flashes =3D 1kWh", but then you suggest needing to measure "time between flashes". Granted, I'm notoriously pedantic about such things, but why are you trying to measure _time_ of the _off_ period? Even if I missed something and you're looking for _period_ (as in 1/frequency) I don't understand. I would think you need to _count_ pulses, with one pulse being one watt-hour. Even if you're looking for consumption _rate_, I would think you would want to do that as a delta of counts over a period of time. There's several ways to approach this, but I'm not sure any are really all that much "better" than the others. My first thought would be CDS cell as half a voltage divider, strait into an ADC pin. In the software, keep a running average of perhaps 10 to 100 times your expected flash period. (not critical) Then compare the instantaneous value to this average. If the difference is larger than some threshold -> light on. I doubt you'll be able to get perfect coupling between the light on the meter and your device. Your background light levels will change with weather, time of day, etc. This method has the advantage of self compensating for anything that changes slower than your averaging time. FWIW, this is not "my" method, nor is it new. I first seen it in completely analog PIR motion detector lights from the 1970's, I suspect it was old then. To do it digitally, it has the downside that you need to sample the ADC several times faster than the shortest flash ON time to catch it reliably. But even modest micros have ADCs that are 10s of kHz, I don't see that as a major issue. Careful application of an RC time constant to the sensor line could reduce the necessary sampling frequency considerably. CDS cells are considered a "Hazardous Substance" nowadays and consequently are getting harder to find. I likely would not include them in a "product for sale" but they still make appearances in my more hobby-level activities. Phototransistor, PIN diode, small solar cell, or reverse biased LED are all possible sensor candidates as well. Driving details differ a bit, but software implementation is more or less the same. -Denny On Tue, Feb 20, 2018 at 3:28 AM, David C Brown wrote: > This is one of those so trivial problems that shouldn't need advice but, = as > so often with me, I have over researched to the point where Ic an't make = a > decision. > > Since I am not going to get a smart electricity meter real soon now I > intend to build my own power monitor. The meter has a red LED which > flashes 1000 times per kWh and the key to the project is measuring the ti= me > between flashes. > > But I can't decide the best way to detect the flashing LED. CDS photo > resistor followed by a Schmit trigger; photo transistor followed by a > transimpedance amp. There should be no problem excluding ambient light > and the LED flashes for about 1/2 second. > __________________________________________ > David C Brown > 43 Bings Road > Whaley Bridge > High Peak Phone: 01663 733236 > Derbyshire eMail: dcb.home@gmail.com > SK23 7ND web: www.bings-knowle.co.uk/dcb > > > > > *Sent from my etch-a-sketch* > -- > http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .