Jump to content

1S Wattmeter


Recommended Posts

Good news - the PCBs turned up.

Bad news - How many rookie errors is it possible to make in one PCB design? Let's get those out of the way. Then back to the good news.

So, I've no idea "where my head was" when drawing up this design.

  • In and out are swapped on the screen print. We know about that one.
  • I've got the screen printing well mixed up between top and bottom. It's all correct but some of each side should be on the opposite side.
  • Capacitor hole spacing doesn't match my capacitors. No Biggie.
  • Trimpot hole spacing is for smaller trimpots.
  • I went ahead and trusted the screen print when soldering in the first components and they were intended to be mounted on the other side.

Back to the good news then, it has built up and is electrically correct.

The current sensing tracks work a treat, I've put links in to use both in parallel.

I'm now tweaking the software now that I have a PCB unit to play with.

Photos to follow

Link to comment
Share on other sites

As you can see, I'm experimenting with 2 decimal places in the last pic. I'm not sure if this gives an impression of greater accuracy than we actually have?

There's also another couple of things to attend to.

  • Filtering could be better, especially when measuring at part throttle settings. I'm not sure if wecan fix that in software or whether to try bigger filter capacitors?
  • Grabbing of Max amps and Min voltage are triggered by whether amps are bigger than previous "max amps". This works fine as it shows what both readings were at the same time. The downside is that if I then run the battery down, "max amps" is not triggered at a later time, but the battery voltage can easily be run down lower than the reading that was taken for "min volts". At the end of the test the live volts can be lower than that recorded as minimum volts.
Link to comment
Share on other sites

Here, I'm sharing the current version of the arduino sketch.

Please be aware that I'm a real bginner at this.
Those that know what you're doing, once you've stopped laughing at the naivety of it, please be gentle with suggestions for improvement.

Hopefully this link will allow downloads OLEDPwrMtr V0.4.ino

Edit - to change link to later version

 

Edited By Chris Bott - Moderator on 02/06/2020 21:32:54

Link to comment
Share on other sites

Just a thought - there appears to be a part of the thread the suggests making this self-powered using a voltage boost board. Given that the unit is for testing small 1S lipos for indoor models, would this give rise to the current draw for the unit being a noticeable percentage of the load (motor) current draw? Would you therefore be getting false readings as to load power consumption?

Link to comment
Share on other sites

You are right Toni, all test probes added to a circuit affect the performance of the circuit.

But what is more important is that circuit is affected the same way each time so the changes in the readings are what helps us

Even up or down, red to green give us a good idea of what is going on

Edited By Denis Watkins on 26/04/2020 10:01:36

Link to comment
Share on other sites

Posted by Toni Reynaud on 26/04/2020 08:52:48:

Just a thought - there appears to be a part of the thread the suggests making this self-powered using a voltage boost board. Given that the unit is for testing small 1S lipos for indoor models, would this give rise to the current draw for the unit being a noticeable percentage of the load (motor) current draw? Would you therefore be getting false readings as to load power consumption?

Toni you're absolutely right, that was just another reason that I ended up going for a separately powered unit.

Others can of course modify as they see fit. The draw can be compensated for in software, I'd think, too.

Link to comment
Share on other sites

I've had a rather good idea sent in by PM. Thanks Paul.

Paul asked if it would be possible to add a discharger function that would take the little 1S cells down to discharge level. Well it's a very interesting idea and wouldn't take much extra hardware at all.

Of course it will take some time, effort and testing and a new PCB.

If we go that way I'd rather not do a complete redesign of the case to accommodate more hardware so I'm already thinking of a 3 position switch to give "ON", "OFF, "DISCHARGE" functions.

The display would continue to give live readings but also show that discharging was taking place and discharge would cut off at, say, 3.8V.

Obviously it would be useful, but is it worth extra time and effort?

Link to comment
Share on other sites

Toni, if any voltage buck/boost converter -ve supply was taken from the input -ve (circuit 0v) then the converter load current wouldn’t be included in the load amps/watts measurements.

However the extra load may affect the supply terminal voltage & would cause the supply battery to discharge quicker, although as Chris says, this would be a constant load & could probably be compensated for in software.

Note that the load sense resistor causes a voltage drop in any event, which would need to be subtracted from the measured supply voltage if you are looking for really accurate load side measurements (within the limits of the hardware used).

Edited By Peter Balcombe on 26/04/2020 11:28:13

Link to comment
Share on other sites

I built myself a wattmeter many years ago. I just looked up the logic I used for reading the analog values.

Two analog values are read. Every 4mS a single read is done, alternating which channel is read. 16 values for each input are accumulated. The average of these is calculated (add 8 then divide by 16).

Four of each of these averages are then accumulated and averaged. These resulting values are then used to calculate the voltage and current.

I did this in two steps because I'm using an external, 12-bit A2D chip and accumulating more than 16 values would overflow a 16-bit storage.

In summary, every 512mS, I read each analog input 64 times and use the average value. This gave a good, stable display.

My wattmeter also included an optical tachometer input and a pot used to generate a servo pulse for the ESC, so I could use it "standalone". It could also measure the receiver pulse width, and integrated the current to give used mAh.

Mike

Link to comment
Share on other sites

Using a suggestion from Peter Balcombe that improves the averaging a lot and using Mike Blandfords numbers from above, I've altered the measurements section in the software.

So now, having delcared the following integers:

int Vtemp = 0;
int Atemp = 0;
int loops = 16;
int loopdelay = 4;

The replacement section reads like this:

//Measure Volts and Amps
Vtemp = 0; //reset cumulative total
Atemp = 0; //reset cumulative total

for(int i=0; i<(loops); i++) { //Loop "loops" times
Vtemp += analogRead(A3); //adds each value to Vtemp
Atemp += analogRead(A2); //adds each value to Atemp
delay(loopdelay);
}
Volts = (Vtemp/(loops))*(1.1/1023.0)*((R1+R2)/R2)*TrimV;
Amps = (Atemp/(loops))*(1.1/1023.0)*45*TrimA ;

Next will be to give this a good test. I may well still alter the value of C1

Link to comment
Share on other sites

OK - thoughts about this section?

//Save new Maxes whenever live values are more than previous Max
if (Amps > Max_Amps){
Max_Amps = Amps;
Min_Volts = Volts;
}
if (Powr > Max_Powr){
Max_Powr = Powr;
}

This overwrites the value of Max Amps if Amps is greater than the saved value of Max Amps. That works fine.
At the moment I use the same trigger to save a new value of Min Volts. This is because I'm assuming that Min Volts will co-incide with max amps.

If I try to write a separate trigger for volts, then it always saves a value of zero volts.
Alternatively I tried capturing the first time current was sensed, then once that was true did a if (Volts < Min_Volts) trigger. This worked, but of course as the battery ran down, it kept saving lower and lower voltages which had no relation to the voltage nearer the start of the when we were also getting Max Amps.

So - what do we actually want it to do?

Would it be better if I just trigger all 3 saves of Max/Min parameters from if (Powr > Max_Powr) ?

Discuss...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...