Displaying V & I samples as graphs

To help with the design of sensor circuits, I've constructed a sketch which may be of interest to others.  Some of the code has been lifted from calcVI() in EmonLib, so thanks Tristan :)

After a few seconds to allow the dc-blocking filters to settle, it records all voltage and current samples that are taken during one complete cycle of the mains.   It then displays this data to the Serial window in graphical form for the user to inspect.  Press any key followed by [cr] to repeat the process.

As written, it is in 'debug' mode which allows the sketch to run without any hardware.  In this mode, voltage and current samples are synthesized.  A screenshot of the display that appears is attached. 

If the  #ifdef DEBUG  statement near the top is commented out, it runs in 'normal' mode.  This allows raw voltage and current samples using standard V&I sensor circuits to be recorded and displayed.   Without access to an ocsilloscope, I found it most interesting to inspect the shape of our mains voltage - it is by no means sinusoidal.  The second screenshot is of the current taken by our 3kW kettle, as measured with the standard 30A YHDC current-clamp and a burden resistor of 150R.

  

To compress a whole mains cycle into a single screenshot, only alternate samples are displayed.  To display every sample, modify the line which reads     if ((index % 2) == 0) // change this to "% 1" for full resolution

calypso_rae

 

 

TrystanLea's picture

Re: Displaying V & I samples as graphs

 Wow, very nice and neat way of getting a quick waveform, thankyou for sharing it!

calypso_rae's picture

Re: Displaying V & I samples as graphs

Thanks for the feedback Trystan.  It's just a quick way of checking sensor operation, not to be compared with RW's colourful traces of great precision & beauty.

While checking its operation, it was interesting to discover how my 2-speed hot air blower operates.  For half-speed, they only use one half of each cycle!!!  Is this acceptable and/or allowed I wonder?  Dunno, all enquires to Robert Bosch ...

kllsamui's picture

Re: Displaying V & I samples as graphs

i just finished PoorManScope2, a arduino code run under arduino uno ( also with chipKIT max32) and can also use processing.

pls see Volt and Amp ( with my new powermonitor testshield )

 

emonscope

can it pls be tested on original EMON hardware?

download from kll.byethost7.com/kll_en7/downloads.php

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.