There have been some questions about how to directly connect a Kill A Watt to an Arduino or computer. It is unsafe to make a direct connection due to the ungrounded power supply used by the KAW. One solution is to use an optoisolator to provide a safe serial interface. The circuit is very simple...
Built by soldering components to an 18 pin DIP socket...
There is no need to modify the power supply of the KAW because average current draw is less than 1 milliamp. It sends one char per AC cycle to minimize drain on the power supply.
The protocol is the same as the Tweet A Watt so existing TAW software can be used.
I'll post more details this weekend when I have more time.
Serial port for Kill A Watt - Tweet A Watt compatible
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- opossum
- Posts: 636
- Joined: Fri Oct 26, 2007 12:42 am
-
- Posts: 12151
- Joined: Thu Apr 06, 2006 4:21 pm
Re: Serial port for Kill A Watt - Tweet A Watt compatible
oh hey that is super awesome!
- richms
- Posts: 558
- Joined: Tue Jan 20, 2009 3:05 am
Re: Serial port for Kill A Watt - Tweet A Watt compatible
Awesome.
I love the socket as a circuitboard idea.
Have you considered having the calcs done in the pic and it just sending raw watts/amps/volts data out to the PC instead?
I love the socket as a circuitboard idea.
Have you considered having the calcs done in the pic and it just sending raw watts/amps/volts data out to the PC instead?
-
- Posts: 1
- Joined: Thu Jun 17, 2010 3:54 am
Re: Serial port for Kill A Watt - Tweet A Watt compatible
This is a simple yet amazing idea! Great work! Simple option for those who do not need wireless option
would you be posting the code running on the PIC somewhere?
would you be posting the code running on the PIC somewhere?
- opossum
- Posts: 636
- Joined: Fri Oct 26, 2007 12:42 am
Re: Serial port for Kill A Watt - Tweet A Watt compatible
Yes. The PIC will do sum of squares and sum of VA using integer math. The PC will do mean and square root with floating point math to get the RMS.richms wrote:Have you considered having the calcs done in the pic and it just sending raw watts/amps/volts data out to the PC instead?
- opossum
- Posts: 636
- Joined: Fri Oct 26, 2007 12:42 am
Re: Serial port for Kill A Watt - Tweet A Watt compatible
Source code and more is here.karishmasinghal wrote:Would you be posting the code running on the PIC somewhere?
-
- Posts: 58
- Joined: Sun Dec 06, 2009 11:12 pm
Re: Serial port for Kill A Watt - Tweet A Watt compatible
This is a really great idea - but I would suggest you carefully insulate the electronics, especially on the optically-isolated output side.
Otherwise, if you have the components just sitting there it might still be possible for something to short out (which is a Bad Thing), which would defeat all the effort you have gone to building the galvanically isolated interface.
Otherwise, if you have the components just sitting there it might still be possible for something to short out (which is a Bad Thing), which would defeat all the effort you have gone to building the galvanically isolated interface.
-
- Posts: 127
- Joined: Mon May 10, 2010 8:24 pm
Re: Serial port for Kill A Watt - Tweet A Watt compatible
SWEEEEEEEEEEEEEEEET!!! Thanks oPossum!
This is exactly what I have been looking for. I ruined my first KAW trying to solder directly to the chip, and I have been researching ever since before tearing open the next one. Lucky for me I have the same version you used.
I am wanting to interface this to an Arduino-based Datalogger, and wanted the wired link so I can run power with it also. I am going to use a smaller wallwart and cannibalize as necessary to have it piggyback on the unmetered side of the 110V AC.
This is exactly what I have been looking for. I ruined my first KAW trying to solder directly to the chip, and I have been researching ever since before tearing open the next one. Lucky for me I have the same version you used.
I am wanting to interface this to an Arduino-based Datalogger, and wanted the wired link so I can run power with it also. I am going to use a smaller wallwart and cannibalize as necessary to have it piggyback on the unmetered side of the 110V AC.
Is this referring to TrueRMS calculation? I am hoping to do that onboard the arduino and datalog the result. I am going to explore your information a little more and see what I can learn.The PC will do mean and square root with floating point math to get the RMS.
- opossum
- Posts: 636
- Joined: Fri Oct 26, 2007 12:42 am
Re: Serial port for Kill A Watt - Tweet A Watt compatible
Yes, true RMS.
RMS = square ROOT of the MEAN of the SQUAREs.
The current firmware for the PIC just sends voltage and current samples like the TAW. I haven't written firmware to do sum of squares yet.
The idea is to have the PIC rapidly sample the ADC and do sum of squares as each sample is taken. This can be done quickly with integer math. The resulting data will be small for any sampling duration, and can be quickly sent over the serial port. Whatever device receives the info can calculate the mean (divide sum [of squares] by sample count) and square root while the PIC is busy doing sum of squares on a bunch more samples.
RMS = square ROOT of the MEAN of the SQUAREs.
The current firmware for the PIC just sends voltage and current samples like the TAW. I haven't written firmware to do sum of squares yet.
The idea is to have the PIC rapidly sample the ADC and do sum of squares as each sample is taken. This can be done quickly with integer math. The resulting data will be small for any sampling duration, and can be quickly sent over the serial port. Whatever device receives the info can calculate the mean (divide sum [of squares] by sample count) and square root while the PIC is busy doing sum of squares on a bunch more samples.
Last edited by opossum on Sat Jul 31, 2010 3:32 pm, edited 2 times in total.
-
- Posts: 127
- Joined: Mon May 10, 2010 8:24 pm
Re: Serial port for Kill A Watt - Tweet A Watt compatible
Alright! Thanks for the detailed info.
The sample referred to here is the voltage sample from the KAW, correct? Or does the current reading require manipulation also?
Sorry if these are NOOB questions, but I see I am missing some basic understanding. Thanks to all the help here, it is getting much clearer.
I see learning more about PIC controllers in my future
The idea is to have the PIC rapidly sample the ADC and do sum of squares as each sample is taken.
The sample referred to here is the voltage sample from the KAW, correct? Or does the current reading require manipulation also?
Sorry if these are NOOB questions, but I see I am missing some basic understanding. Thanks to all the help here, it is getting much clearer.
I see learning more about PIC controllers in my future
- opossum
- Posts: 636
- Joined: Fri Oct 26, 2007 12:42 am
Re: Serial port for Kill A Watt - Tweet A Watt compatible
Both, and more...
Sum of squares of voltage samples for RMS voltage.
Sum of squares of current samples for RMS current.
Sum of voltage sample * current sample for watts.
Once the mean and square of these values are calculated, then...
VA = RMS voltage * RMS current
Power Factor = watts / VA
So after all the math you get...
RMS Voltage
RMS Amperage
Watts
VA
Power Factor
Frequency could be measured, but that seems rather pointless.
Sum of squares of voltage samples for RMS voltage.
Sum of squares of current samples for RMS current.
Sum of voltage sample * current sample for watts.
Once the mean and square of these values are calculated, then...
VA = RMS voltage * RMS current
Power Factor = watts / VA
So after all the math you get...
RMS Voltage
RMS Amperage
Watts
VA
Power Factor
Frequency could be measured, but that seems rather pointless.
-
- Posts: 127
- Joined: Mon May 10, 2010 8:24 pm
Re: Serial port for Kill A Watt - Tweet A Watt compatible
I think I may finally understand. Thank you so much. So many things much clearer.
Squaring the reading 'eliminates' the negative readings that result during AC readings in both voltage and current.
Average out all the readings, take the square root of that and you have the RMS voltage/amperage.
RMS Voltage * RMS Current = Watts ( * {time} / 1000 to get kWH.. )
Sample frequently to accurately trace irregular waveforms.
I have another KAW already open on the workbench, and it is the same model. I may go get a couple more from HD just to make sure I have the same style.
Already had the split core transformers for the 220V lines, and now maybe the knowledge to use them. The KAW is great for testing 110V appliances, but I have 220V plans.
THANK YOU oPossum for taking the time to explain. ( And if I am miguided in any of my conclusions above, correction is accepted happily )
- richms
- Posts: 558
- Joined: Tue Jan 20, 2009 3:05 am
Re: Serial port for Kill A Watt - Tweet A Watt compatible
I was under the imporession that you only needed to RMS the voltage since that was the only one that had a square when calculating the wattage?
- opossum
- Posts: 636
- Joined: Fri Oct 26, 2007 12:42 am
Re: Serial port for Kill A Watt - Tweet A Watt compatible
No, that is VA.Volkemon wrote:RMS Voltage * RMS Current = Watts ( * {time} / 1000 to get kWH.. )
Watts requires each sample of current and voltage to be multiplied.
-
- Posts: 127
- Joined: Mon May 10, 2010 8:24 pm
Re: Serial port for Kill A Watt - Tweet A Watt compatible
Yup. My error. You did state that pretty clearly before. I was just running, dizzy with the new knowledge.
I was up until 4am playing. Thanks Agian!
I was up until 4am playing. Thanks Agian!
Please be positive and constructive with your questions and comments.