Denny I said I wanted to measure power not energy. I can find the amount of energy used by reading the little numbers on the meter :-) Since the lamp flashes 1000 time per kWh of energy consumed then the instantaneous power is inversely proportion to the instantaneous power. So measuring the time between flashes and calculating the reciprocal is the approach I am taking. I thought that I could avoid ADCs by squaring up the output of photodiode with a schmitt trigger and using it as an interrupt to the PIC Russell I anticipate no problem in substantially excluding a substantial amount of the ambient light. The photo element will be mounted in a small box an peer out through a hole. The box will be taped to the meter with the hole over the LED Since you are far and away more learned than I am, I am worried that you think that this is a difficult project. As I say above I thought that it was just a matter of calculating the reciprocal of the time between flashes. That does have the disadvantage of a very slow update time: 3.6seconds at 1kW and 36 seconds at 100W. That might incline me to go the other route of measuring current (with a current transformer which is legal not a series device which would involve illegal disturbing the wiring) and measuring voltage (isolated by a small transformer). By selecting components so that 250 volts gives and ADC count of 1000 and 50 amps also gives a count of 1000 the calculation is reduced to a single multiplication and some scaling. __________________________________________ 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* On 20 February 2018 at 12:09, Denny Esterline wrote: > 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 y= ou > 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 al= l > 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 i= s > 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 senso= r > line could reduce the necessary > sampling frequency considerably. > > CDS cells are considered a "Hazardous Substance" nowadays and consequentl= y > are getting harder to find. > I likely would not include them in a "product for sale" but they still ma= ke > 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 mak= e > 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 > time > > 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 ligh= t > > 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 > > > -- > 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 .