Is 2.5V correct for Vref?

Although my Mk1 PV control system generates hot water when the sun shines, I'm not convinced that it's using the correct value for Vref. 

I have two Arduino Uno boards, both R3.  According to the H/W reference page, the ref. voltage for analogue inputs is configurable.  The default setting appears to be either 5V or 3.3V but it is not clear to me which value applies to the version that I have.  The R3 has both 3.3V and 5V rails.

If the default upper limit of the ADC range were to be 3.3V rather than 5V, then there would be just 0.8V of headroom above the standard ref level of +2.5V.  Because my system is only measuring small amounts of power at the supply point while suplus PV energy is being dumped, I'm fairly confident that my 'current' waveform won't be clipping  But for any boards with a 3.3V ADC range, users would be well advised to modify their Voltage and Current sensor circuits accordingly, or configure their board for 5V operation.

If anyone has a suitable sketch which could be run on an installed Arduino to record and display raw ADC values, I would be most pleased to hear from them ;)

 

calypso_rae's picture

Re: Is 2.5V correct for Vref?

Robert Wall has kindly supplied me with a 1-line sketch (!) which measures and displays raw samples.  The same sketch is attached in slightly expanded form.  For ease of use, it now displays the min and max values that have been taken since startup.  To start a new run, just press the Arduino's reset button.  

The results on my existing rig in the garage have been most revealing.  The good news (for me) is that my V & I data are both centred nicely within the ADC's range, so the 2.5 Vref level must be correct for my R3 board.  With the C/T hanging free, the background current value is a steady 511.  My voltage values also look fine, with a peak-to-peak range of around 480 steps.

But my readings for current are woefully low.  The current drawn by a 3kW kettle covers just 105 steps of the ADC's 1024-step range.  That's over 100 Amps for full scale coverage.  My system is intended to maintain a small export level of around 50W.  With my existing hardware, that 'current' signal covers less than 2 steps of the ADC's 1024-step range  :(

By playing around with burden resistors while the attached test sketch is running, I hope to be able to increase the size of the input signal somewhat.  It would be really helpful to know what other people's readings for AC current are like.  Any chance of posting some values?

 

 

Robert Wall's picture

Re: Is 2.5V correct for Vref?

Here is the original one-line sketch:

void setup(void) {Serial.begin(9600);} void loop(void) {Serial.println(analogRead(2));delay(100);}

I wrote "Just write a one-line sketch..." more as a figure of speech than anything else, meaning a very simple sketch that would extract just that one piece of information, then I realised that it might literally be possible to do it in one line. And the rest, as they say, is history.

calypso_rae's picture

Re: Is 2.5V correct for Vref?

Neat, but the numbers whizz round far too fast for my liking !!

Robert Wall's picture

Re: Is 2.5V correct for Vref?

Change the numbers (the "100") then!  And you can change the port number ("2") too - depending on which one you want to measure.

It wasn't intended as a textbook reference piece of software, you know. (And if I'd added that information as comments, it would have broken the 'one-line' part of the spec.

andyjc's picture

Re: Is 2.5V correct for Vref?

Robin,

Have just finished the soldering phase of building your Mk2 design, and thought I'd use the above sketch to do some initial checking.  Like yourself, I'm also finding that the current signal is very low compared to the voltage input.

I have the YHDC SCT-013-030 CT which has a built-in 39Ω burden.  This clearly deviates from the 150Ω in your circuit diagram, and I was wondering if this is what you arrived at after the 'playing around' you mention above?

Many thanks for posting your design, BTW.  It's an incredibly neat solution and provides a very enjoyable project!

Andy

calypso_rae's picture

Re: Is 2.5V correct for Vref?

Hi Andy,

With the standard YHDC CT, the internal 39R burden will give you around a 1V ptp signal with a 3kW load.  That's just 20% of the ADC's input range.  When just a few tens of Watts are flowing, your signal will only span a couple of the ADC's 1024 levels.  Increasing the burden to 150R allows the ADC's range to be more fully used, but the phase-shift is then significantly increased at high currents because the CT doesn't like being forced to produce this higher level of output.  Nothing will be damaged, but the linearity of your system will be likely be adversely affected.  Because this system serves to keep import and export in a state of precise balance, linearity is everything for this project.

Personally, I think the best approach is to use the INTERNAL(1.1V) mode for analogReference.  Having said which, my original version (with the 150R burden) has been happily working away for some months now with plenty of hot water to its credit.  It's not doing much today though :(

andyjc's picture

Re: Is 2.5V correct for Vref?

Thanks for your reply.  I agree that using the analogReference(INTERNAL) sounds the better way forward, and it has the bonus of not needing to butcher the CT.  I assume you fed the 3.3v rail to a separate vRef circuit, with a 2nd op-amp and voltage divider?

calypso_rae's picture

Re: Is 2.5V correct for Vref?

Good point, it's probably best not to dismantle the CT unless you really need to.  The standard of the internal assembly is not the best I've ever seen.

You still only need one reference voltage but it needs to be 0.55V rather than 2.5V.  That can be created from either of the Arduino's output rails.  0.55V is one sixth of 3.3V, so a pair of resistors in the ratio of 1:5 does the job nicely.  Because I only have E12 resistors, I used a 10K and two 100Ks in parallel.

If using my Mk2 sketch, it's important that only one (shared) reference is used.  That's because the dc-offset is only evaluated once and then subtracted from both sets of raw samples.

When the 1.1V reference is used, the component values for the voltage sensor will need to change.  Aim to use most of the ADC's range when measuring 240V AC and 3kW's worth of current (or whatever your dump load is rated at).  Either of the tools near the top of this thread should help with this setup.

From the Arduino's IDE, an excellent description of the hardware (including the power rails) can be found at Help -> Reference -> Hardware

Comment viewing options

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