Discussion:
[EE} Detecting a flashing LED
David C Brown
2018-02-20 10:28:40 UTC
Permalink
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 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 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: ***@gmail.com
SK23 7ND web: www.bings-knowle.co.uk/dcb
<http://www.jb.man.ac.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
Clint Jay
2018-02-20 10:34:46 UTC
Permalink
In all the energy monitor projects I remember seeing I've not seen a CdS
cell used, not that I think there is anything wrong with that idea, they've
all used a phototransistor or photodiode, I seem to remember one that used
an LED...

The late John Becker had one or two published in EPE that were Pic based,
might be worth seeking those out?

On 20 Feb 2018 10:29, "David C Brown" <***@gmail.com> 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 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 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: ***@gmail.com
> SK23 7ND web: www.bings-knowle.co.uk/dcb
> <http://www.jb.man.ac.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
Neil
2018-02-20 21:12:55 UTC
Permalink
Photodiodes & phototransistors should be much faster than
photoresistors, so cleaner edges. I believe photodiodes have the
fastest transistions so a schmitt trigger may not be needed (other than
the I/P of the microcontroller).

I like this project idea... would be nice to see how things change as my
3D printer, fridge, A/C, etc comes on, without having to move around a
plug-in power monitor.

Cheers,
-Neil.





On 2/20/2018 5:34 AM, Clint Jay wrote:
> In all the energy monitor projects I remember seeing I've not seen a CdS
> cell used, not that I think there is anything wrong with that idea, they've
> all used a phototransistor or photodiode, I seem to remember one that used
> an LED...
>
> The late John Becker had one or two published in EPE that were Pic based,
> might be worth seeking those out?
>
> On 20 Feb 2018 10:29, "David C Brown" <***@gmail.com> 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 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 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: ***@gmail.com
>> SK23 7ND web: www.bings-knowle.co.uk/dcb
>> <http://www.jb.man.ac.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
David C Brown
2018-02-20 22:51:51 UTC
Permalink
As i now realise he response is far too slow to give that information
usefully.

I think I will measure the amps and volts directly using transformers

__________________________________________
David C Brown
43 Bings Road
Whaley Bridge
High Peak Phone: 01663 733236
Derbyshire eMail: ***@gmail.com
SK23 7ND web: www.bings-knowle.co.uk/dcb
<http://www.jb.man.ac.uk/~dcb>



*Sent from my etch-a-sketch*

On 20 February 2018 at 21:12, Neil <***@narwani.org> wrote:

> Photodiodes & phototransistors should be much faster than
> photoresistors, so cleaner edges. I believe photodiodes have the
> fastest transistions so a schmitt trigger may not be needed (other than
> the I/P of the microcontroller).
>
> I like this project idea... would be nice to see how things change as my
> 3D printer, fridge, A/C, etc comes on, without having to move around a
> plug-in power monitor.
>
> Cheers,
> -Neil.
>
>
>
>
>
> On 2/20/2018 5:34 AM, Clint Jay wrote:
> > In all the energy monitor projects I remember seeing I've not seen a CdS
> > cell used, not that I think there is anything wrong with that idea,
> they've
> > all used a phototransistor or photodiode, I seem to remember one that
> used
> > an LED...
> >
> > The late John Becker had one or two published in EPE that were Pic based,
> > might be worth seeking those out?
> >
> > On 20 Feb 2018 10:29, "David C Brown" <***@gmail.com> 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
> 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 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: ***@gmail.com
> >> SK23 7ND web: www.bings-knowle.co.uk/dcb
> >> <http://www.jb.man.ac.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
>
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
RussellMc
2018-02-21 12:13:14 UTC
Permalink
On 21 February 2018 at 11:51, David C Brown <***@gmail.com> wrote:

> As i now realise he response is far too slow to give that information
> usefully.
>
> ​Can you comment on that.
You may have come up against the "not hard but annoying" aspect I mentioned.


Russell
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http:
David C Brown
2018-02-21 12:35:46 UTC
Permalink
As usual you are right Russell. Some days I hate you :-)

__________________________________________
David C Brown
43 Bings Road
Whaley Bridge
High Peak Phone: 01663 733236
Derbyshire eMail: ***@gmail.com
SK23 7ND web: www.bings-knowle.co.uk/dcb
<http://www.jb.man.ac.uk/~dcb>



*Sent from my etch-a-sketch*

On 21 February 2018 at 12:13, RussellMc <***@gmail.com> wrote:

> On 21 February 2018 at 11:51, David C Brown <***@gmail.com> wrote:
>
> > As i now realise he response is far too slow to give that information
> > usefully.
> >
> > ​Can you comment on that.
> You may have come up against the "not hard but annoying" aspect I
> mentioned.
>
>
> Russell
> --
> 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://mailm
RussellMc
2018-02-21 21:53:50 UTC
Permalink
On 22 February 2018 at 01:35, David C Brown <***@gmail.com> wrote:

> As usual you are right Russell. Some days I hate you :-)
>

​Many days I manage to hate myself at various stages.

________________________________

As I recall / 'Now it comes back to me ...'

- it was possible to create a "fake" power signal that indicated the result
which would have been correct at that moment if nothing changed.
- The fake signal is kept in long term sync with the LED signal by
accumulating 1/delta-t energy increments for both.
- Significant changes tended to make the 'fake' output wrong and
corrections to the fake power setting are needed which also must make
assumptions about the still unknown level.
- Long term the fake signal can be made to accurately track the energy of
the LED signal but power levels at any time may be incorrect. This is
usually only liable to matter at power levels below say 500 Watts if you
care about actual power levels.

eg for a 3600 Watt-seconds per flash system.

100 W = 3600/100 = 36 seconds per flash.
Setady 100 W = 36s between flashes.

Change to 200W 18 seconds after last flash.
18s x 100 W = 1800 Ws.
Remainder before flash = 3600 - 1800 = 1800
1800/200 = 9 seconds.

So next flash is at 18+9 = 27 seconds.
System sees 27s dt and declares 3600/27 = 133 Watts.

However, this "step" to 133 W occurs 9s after the actual 100/200 step.

If power is now steady at 200W the next flash is at 3600/200 = 18s later.


ie true power steps from 100W to 200W at T=18
LED derived fake power

- still shows 100W from 18s to 27s
- steps to 133W at T=27s to 45s
- steps to true 200W at T=45s

Integrated energy from fake signal is correct BUT power is shown as

100W should be 200W for 9s
133W should be 200W for 18S

"Intelligent" [tm] assumptions may be made when dT rises or falls so that
fake signal can change faster in new direction BUT the assumptions may be
wrong and can make the results worse.

What fun we have.



Russell​
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/
Brent Brown
2018-02-21 22:46:07 UTC
Permalink
On 22 Feb 2018 at 10:53, RussellMc wrote:
> - it was possible to create a "fake" power signal that indicated the result
> which would have been correct at that moment if nothing changed.

An "other" way would be to add, say, a 3.6kW constant load ;-)

The pulses from the 1000 pulse/kWh energy meter would then never be more than
1s apart. Micro measures time between pulses, calculates power, subtracts the
3.6kW offset, and now even light loads will have a much more acceptable update
rate. Problem solved ;-)

All you need to do then is convince the electricity supplier they need to also need to
subtract the 3.6kW (3.6kW x 24h = 86.4kWh per day) from their meter readings, for
"technical" reasons, before charging you...

--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Van Horn, David
2018-02-21 23:12:45 UTC
Permalink
Good application for bitcoin mining.

-----Original Message-----
From: piclist-***@mit.edu [mailto:piclist-***@mit.edu] On Behalf Of Brent Brown
Sent: Wednesday, February 21, 2018 3:46 PM
To: Microcontroller discussion list - Public. <***@mit.edu>
Subject: Re: [EE} Detecting a flashing LED

On 22 Feb 2018 at 10:53, RussellMc wrote:
> - it was possible to create a "fake" power signal that indicated the
> result which would have been correct at that moment if nothing changed.

An "other" way would be to add, say, a 3.6kW constant load ;-)

The pulses from the 1000 pulse/kWh energy meter would then never be more than 1s apart. Micro measures time between pulses, calculates power, subtracts the 3.6kW offset, and now even light loads will have a much more acceptable update rate. Problem solved ;-)

All you need to do then is convince the electricity supplier they need to also need to subtract the 3.6kW (3.6kW x 24h = 86.4kWh per day) from their meter readings, for "technical" reasons, before charging you...

--
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
smplx
2018-02-22 00:36:37 UTC
Permalink
On Thu, 22 Feb 2018, Brent Brown wrote:

> On 22 Feb 2018 at 10:53, RussellMc wrote:
>> - it was possible to create a "fake" power signal that indicated the result
>> which would have been correct at that moment if nothing changed.
>
> An "other" way would be to add, say, a 3.6kW constant load ;-)
>
> The pulses from the 1000 pulse/kWh energy meter would then never be more than
> 1s apart. Micro measures time between pulses, calculates power, subtracts the
> 3.6kW offset, and now even light loads will have a much more acceptable update
> rate. Problem solved ;-)
>
> All you need to do then is convince the electricity supplier they need to also need to
> subtract the 3.6kW (3.6kW x 24h = 86.4kWh per day) from their meter readings, for
> "technical" reasons, before charging you...

Or you could use the "86.4kWh per day" to charge a battery then sell it
back to them as though you were generating it and hopefully the profit
should compensate you for the inefficency :-)
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Brent Brown
2018-02-22 02:35:18 UTC
Permalink
On 22 Feb 2018 at 0:36, smplx wrote:
> > All you need to do then is convince the electricity supplier they need to also need to
> > subtract the 3.6kW (3.6kW x 24h = 86.4kWh per day) from their meter readings, for
> > "technical" reasons, before charging you...
>
> Or you could use the "86.4kWh per day" to charge a battery then sell it
> back to them as though you were generating it and hopefully the profit
> should compensate you for the inefficency :-)

I wish that were the case, but no subsidies/incentives for self generation here. Buy
at ~$0.25/unit, sell back at $0.08/unit. Would only work out if somehow the meter
accidentally got reversed.

TV commercial, financial adviser talking to guy selling watermelons from the back of
a truck...
A: How much do you buy them for?
B: $1
A: How much do you sell them for?
B: $1
A: (Scratches chin and thinks for while) ...I think you need a bigger truck.


--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
David C Brown
2018-02-21 23:28:29 UTC
Permalink
I do not care if I hate myself so long as I fear myself :-)

Since it is the small variations around the 500watt level that i want to
detect I have abandoned the idea, seductive as your suggested method is.
(i don't need a meter to tell me the shower is drawing 10kW - the dimming
of the lights does that. It is the accumulation of smell loads - TVs on
standby and so on - that is impoverishing me)

__________________________________________
David C Brown
43 Bings Road
Whaley Bridge
High Peak Phone: 01663 733236
Derbyshire eMail: ***@gmail.com
SK23 7ND web: www.bings-knowle.co.uk/dcb
<http://www.jb.man.ac.uk/~dcb>



*Sent from my etch-a-sketch*

On 21 February 2018 at 21:53, RussellMc <***@gmail.com> wrote:

> On 22 February 2018 at 01:35, David C Brown <***@gmail.com> wrote:
>
> > As usual you are right Russell. Some days I hate you :-)
> >
>
> ​Many days I manage to hate myself at various stages.
>
> ________________________________
>
> As I recall / 'Now it comes back to me ...'
>
> - it was possible to create a "fake" power signal that indicated the result
> which would have been correct at that moment if nothing changed.
> - The fake signal is kept in long term sync with the LED signal by
> accumulating 1/delta-t energy increments for both.
> - Significant changes tended to make the 'fake' output wrong and
> corrections to the fake power setting are needed which also must make
> assumptions about the still unknown level.
> - Long term the fake signal can be made to accurately track the energy of
> the LED signal but power levels at any time may be incorrect. This is
> usually only liable to matter at power levels below say 500 Watts if you
> care about actual power levels.
>
> eg for a 3600 Watt-seconds per flash system.
>
> 100 W = 3600/100 = 36 seconds per flash.
> Setady 100 W = 36s between flashes.
>
> Change to 200W 18 seconds after last flash.
> 18s x 100 W = 1800 Ws.
> Remainder before flash = 3600 - 1800 = 1800
> 1800/200 = 9 seconds.
>
> So next flash is at 18+9 = 27 seconds.
> System sees 27s dt and declares 3600/27 = 133 Watts.
>
> However, this "step" to 133 W occurs 9s after the actual 100/200 step.
>
> If power is now steady at 200W the next flash is at 3600/200 = 18s later.
>
>
> ie true power steps from 100W to 200W at T=18
> LED derived fake power
>
> - still shows 100W from 18s to 27s
> - steps to 133W at T=27s to 45s
> - steps to true 200W at T=45s
>
> Integrated energy from fake signal is correct BUT power is shown as
>
> 100W should be 200W for 9s
> 133W should be 200W for 18S
>
> "Intelligent" [tm] assumptions may be made when dT rises or falls so that
> fake signal can change faster in new direction BUT the assumptions may be
> wrong and can make the results worse.
>
> What fun we have.
>
>
>
> Russell​
> --
> 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://mai
RussellMc
2018-02-22 10:45:32 UTC
Permalink
On 22 February 2018 at 12:28, David C Brown <***@gmail.com> wrote:

> I do not care if I hate myself so long as I fear myself :-)
>
> Since it is the small variations around the 500watt level that i want to
> detect I have abandoned the idea, seductive as your suggested method is.
> (i don't need a meter to tell me the shower is drawing 10kW - the dimming
> of the lights does that. It is the accumulation of smell loads - TVs on
> standby and so on - that is impoverishing me)
>
> ​IF you can get a lower $/unit night rate and
IF you are allowed to use ​it for any purpose and
IF you have a storage tank hot water system (which you may well not have
from what you say)
THEN heating hot water during low cost periods will usually save money.

In NZ hot-water tank storage is the norm. In some countries this is rare
with caliphonts (gas or electric) being more usual.

With a low-cost heated tank you need adequate tank capacity for a days use
and good enough insulation to minimise one day losses.

Here there are power companies offering wholesale rates per unit + a fixed
fee. This can be very attractive with some usage patterns. They also supply
real time cost information so you can load shed if desired when "run of
river" rates soar.

Those with solar PV systems can also benefit from using them tpo heat water
with any energy "left over" after the AC load is met. Energy pit into water
heating then "saves" the otherwise cost of water heating. In solar PV
systems with energy buy back such systems will ideally heat at a rate such
as tpo "just not" transfer energy to the grid as grid injected energy is
usually paid for at very low rates.

Measuring house base load and tracking down all the "microloads" can pay
dividends. The combined load of TV standbys, clocks, towel rails, ... can
be significant.
Here I approximate cost as $2/year for 1 Watt continuous. (About 1
GBP/Watt/year). Adjust to suit your rates.
A friend of mine tracked down all small loads and eliminates as many as
reasonably possible and reduced base load by about 200 W continuous afair.
Not a fortune (for most) but useful.

______________________

500 W -> 3600/500 = 7.2s/flash.
600W = 6s
550 = 6.55s
525W = 6.86s.

Stopwatch single shot accuracy / resolution with conditioned reaction time
is probably around 0.25s with care.
So a 25W delta is marginal for a single flash cycle if hand timed but OK
for uC measurement

​510 W -= 7.06 s ​
500 - 510 delta = 0.14s
uC has no trouble with that BUT LED sensor has to be well designed.


R
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/ma
Neil
2018-02-21 04:10:11 UTC
Permalink
https://www.youtube.com/watch?v=DNAgJrnj4EM




On 2/20/2018 4:12 PM, Neil wrote:
> Photodiodes & phototransistors should be much faster than
> photoresistors, so cleaner edges. I believe photodiodes have the
> fastest transistions so a schmitt trigger may not be needed (other than
> the I/P of the microcontroller).
>
> I like this project idea... would be nice to see how things change as my
> 3D printer, fridge, A/C, etc comes on, without having to move around a
> plug-in power monitor.
>
> Cheers,
> -Neil.
>
>
>
>
>
> On 2/20/2018 5:34 AM, Clint Jay wrote:
>> In all the energy monitor projects I remember seeing I've not seen a CdS
>> cell used, not that I think there is anything wrong with that idea, they've
>> all used a phototransistor or photodiode, I seem to remember one that used
>> an LED...
>>
>> The late John Becker had one or two published in EPE that were Pic based,
>> might be worth seeking those out?
>>
>> On 20 Feb 2018 10:29, "David C Brown" <***@gmail.com> 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 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 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: ***@gmail.com
>>> SK23 7ND web: www.bings-knowle.co.uk/dcb
>>> <http://www.jb.man.ac.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
RussellMc
2018-02-20 11:30:08 UTC
Permalink
AFAIR I used a photodiode - I can check.
I found that having an opaque cover that extended a substantial distance
beyond the sensor helped substantially. (Even though I used 'substantial'
twice, it seemed the best choice, Fowler notwithstanding).

If you wish to convert the flashing to a continuous analog voltage
indicating instantaneous Watts, it gets surprisingly hard to do well. Work
through what's involved and see if you agree or if I've missed a lightbulb
moment.

"Kill-a-Watt" LIKE (but far cheaper) power meters are now available at
lowish cost and contain ICs that are capable of good accuracy if adequate
sensors are used. A non contact current transformer can be added to your
switchboard cabling - legal here and may or may not be where you are and
Hall sensors are also available. Be aware that Hall ICs that pass the
current through a low resistance path in the module to allow a well defined
relationship between Hall cell and conductor, and which have good mains -
sense voltage isolation, may cease having such if the IC is overloaded and
catches fire - as can happen. In such a case a carbon and/or other
ionisation products bridge can form between high current circuit and logic
signals and supply. Ask me how I know. (In my case only 24V LiFePO4 supply
- damaging but not utterly fatal.)(YMMV).
I used two turns of the en-situ domestic cabling to increase the
sensitivity of the current transformer that I used for testing.

Russell
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Denny Esterline
2018-02-20 12:09:08 UTC
Permalink
I'm curious about how you believe the data is encoded. You said "1000
flashes = 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 <***@gmail.com> 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 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 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: ***@gmail.com
> SK23 7ND web: www.bings-knowle.co.uk/dcb
> <http://www.jb.man.ac.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
David C Brown
2018-02-20 12:49:36 UTC
Permalink
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: ***@gmail.com
SK23 7ND web: www.bings-knowle.co.uk/dcb
<http://www.jb.man.ac.uk/~dcb>



*Sent from my etch-a-sketch*

On 20 February 2018 at 12:09, Denny Esterline <***@gmail.com> wrote:

> I'm curious about how you believe the data is encoded. You said "1000
> flashes = 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 <***@gmail.com> 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
> 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 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: ***@gmail.com
> > SK23 7ND web: www.bings-knowle.co.uk/dcb
> > <http://www.jb.man.ac.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
>
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
RussellMc
2018-02-20 13:27:46 UTC
Permalink
On 21 February 2018 at 01:49, David C Brown <***@gmail.com> wrote:


> 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
>

​Sounds good. Box forms ​the extended opaque cover.


> Since you are far and away more learned than I am,


​Avoiding an overly extended negative-self-comparison match - we both
learned most of what we know from exposure to the real world, so are about,
as far as I can see ~~= learned. Which is not an issue here.


> I am worried that you
> ​ ​
> think that this is a difficult project.


​More "annoying".
I'd have to get my mind back around what the issues were, but for power,
not energy, display, the longer periods at lower power end up making it
hard yo provide a power display that reasonably accurately tracks or
displays true ​power. As I said, work through an example and see how it
comes out. A simple program in the language of your choice would suffice,
but for things like this a spreadsheet may be easier (some disagree).
Something like a base load of say != 300 Watts and adding a 1500 W kettle
for 3 minutes. How does that work in practice.

This may match your existing thinking. Or not.
A useful metric may be that rather than thinking of 1 Wh per 3.6 s you use
3600 Ws per flash. Then when power is fluctuating you establish mean W over
a time slice - say 1 s, and that tells you how much of the 3600 Ws you have
used.
eg 300 W for 3s = 900 Ws
200W for 5S = 1000 Ws, 1900 Ws total, 1700 Ws till flash due
170 W -> flash will be in 10s.
Or 1700W, flash will be in 1s.

I was sending "current Watts" via a serial link and recall finding that
"galloping" was easy to achieve.


Russell
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/pic
John Gardner
2018-02-20 20:19:47 UTC
Permalink
I'd be tempted to simply count the flashes per billing period

& correlate that metric with the Utility's claim... :)

Depends on what you're up to, I guess.

...


On 2/20/18, RussellMc <***@gmail.com> wrote:
> On 21 February 2018 at 01:49, David C Brown <***@gmail.com> wrote:
>
>
>> 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
>>
>
> ​Sounds good. Box forms ​the extended opaque cover.
>
>
>> Since you are far and away more learned than I am,
>
>
> ​Avoiding an overly extended negative-self-comparison match - we both
> learned most of what we know from exposure to the real world, so are about,
> as far as I can see ~~= learned. Which is not an issue here.
> ​
>
>> I am worried that you
>> ​ ​
>> think that this is a difficult project.
>
>
> ​More "annoying".
> I'd have to get my mind back around what the issues were, but for power,
> not energy, display, the longer periods at lower power end up making it
> hard yo provide a power display that reasonably accurately tracks or
> displays true ​power. As I said, work through an example and see how it
> comes out. A simple program in the language of your choice would suffice,
> but for things like this a spreadsheet may be easier (some disagree).
> Something like a base load of say != 300 Watts and adding a 1500 W kettle
> for 3 minutes. How does that work in practice.
>
> This may match your existing thinking. Or not.
> A useful metric may be that rather than thinking of 1 Wh per 3.6 s you use
> 3600 Ws per flash. Then when power is fluctuating you establish mean W over
> a time slice - say 1 s, and that tells you how much of the 3600 Ws you have
> used.
> eg 300 W for 3s = 900 Ws
> 200W for 5S = 1000 Ws, 1900 Ws total, 1700 Ws till flash due
> 170 W -> flash will be in 10s.
> Or 1700W, flash will be in 1s.
>
> I was sending "current Watts" via a serial link and recall finding that
> "galloping" was easy to achieve.
>
>
> Russell
> --
> 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/listi
David C Brown
2018-02-20 22:49:42 UTC
Permalink
The little numbers on the meter count the flashes for me and I mail those
numbers to the utility company so they always correlate.


__________________________________________
David C Brown
43 Bings Road
Whaley Bridge
High Peak Phone: 01663 733236
Derbyshire eMail: ***@gmail.com
SK23 7ND web: www.bings-knowle.co.uk/dcb
<http://www.jb.man.ac.uk/~dcb>



*Sent from my etch-a-sketch*

On 20 February 2018 at 20:19, John Gardner <***@gmail.com> wrote:

> I'd be tempted to simply count the flashes per billing period
>
> & correlate that metric with the Utility's claim... :)
>
> Depends on what you're up to, I guess.
>
> ...
>
>
> On 2/20/18, RussellMc <***@gmail.com> wrote:
> > On 21 February 2018 at 01:49, David C Brown <***@gmail.com> wrote:
> >
> >
> >> 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
> >>
> >
> > ​Sounds good. Box forms ​the extended opaque cover.
> >
> >
> >> Since you are far and away more learned than I am,
> >
> >
> > ​Avoiding an overly extended negative-self-comparison match - we both
> > learned most of what we know from exposure to the real world, so are
> about,
> > as far as I can see ~~= learned. Which is not an issue here.
> > ​
> >
> >> I am worried that you
> >> ​ ​
> >> think that this is a difficult project.
> >
> >
> > ​More "annoying".
> > I'd have to get my mind back around what the issues were, but for power,
> > not energy, display, the longer periods at lower power end up making it
> > hard yo provide a power display that reasonably accurately tracks or
> > displays true ​power. As I said, work through an example and see how it
> > comes out. A simple program in the language of your choice would suffice,
> > but for things like this a spreadsheet may be easier (some disagree).
> > Something like a base load of say != 300 Watts and adding a 1500 W kettle
> > for 3 minutes. How does that work in practice.
> >
> > This may match your existing thinking. Or not.
> > A useful metric may be that rather than thinking of 1 Wh per 3.6 s you
> use
> > 3600 Ws per flash. Then when power is fluctuating you establish mean W
> over
> > a time slice - say 1 s, and that tells you how much of the 3600 Ws you
> have
> > used.
> > eg 300 W for 3s = 900 Ws
> > 200W for 5S = 1000 Ws, 1900 Ws total, 1700 Ws till flash due
> > 170 W -> flash will be in 10s.
> > Or 1700W, flash will be in 1s.
> >
> > I was sending "current Watts" via a serial link and recall finding that
> > "galloping" was easy to achieve.
> >
> >
> > Russell
> > --
> > 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
>
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.ed
Loading...