[MAGEEC] Accuracy of the power measurement shield

Jeremy Bennett jeremy.bennett at embecosm.com
Wed Mar 14 17:12:07 GMT 2018

Hash: SHA1

On 14/03/18 17:01, Mark Kettner wrote:
> Hi Jeremy,
> many thanks for the fast update!
> But I discovered a bug (i guess) when using the pyenergy tool. I
> tried to use a 5 Ohm resistor. Thus I changed the jumper on the
> board and told the host computer tool the new resistor value (via
> energytool setup). However the value seems to be ignored and I got
> really wrong data (the script assumed R=1, i guess). After
> modifying the python file and setting the new resistor value on my
> own, I still got wrong values. I played around with Gain, and
> eventually got almost valid data again (using R=5 and Gain=26). But
> here I misuse gain to cancel out another error in the
> calculation(?)[0] I guess.
> I am by far not familar with this. Did anyone already ran the
> python script with different resistor settings and can reproduce
> this?

Hi Mark,

I'm pretty certain I have used this in the past with different
resistor values successfully. Since the project has completed three
years ago, I have done little work with the energy measurement board.

One thing I notice is that you are using the v2 code, while my
repository has the pyusb branch checked out. I don't know if this is

I don't read Python well enough to check for a bug, but I'm happy to
take patches as pull requests.

Best wishes,


> [0]https://github.com/jpallister/stm32f4-energy-monitor/blob/v2/pyenergy/src/pyenergy/pyenergy.py#L501
- --
> Mit freundlichen Gruessen / Best Regards
> Mark Kettner
> On Fri, Mar 9, 2018 at 3:24 PM, Jeremy Bennett 
> <jeremy.bennett at embecosm.com> wrote: Hi Mark,
> You'll see I have updated the Wiki in line with my email. Looks
> like the ADCs are actually 12-bit.
> Best wishes,
> Jeremy
> On 06/03/18 16:48, Jeremy Bennett wrote:
>>>> On 06/03/18 16:26, Mark Kettner wrote:
>>>>> Hello everyone,
>>>>> could someone please tell me the accuracy of the
>>>>> measurement shield. How can I assume really low power
>>>>> (milli or micro) are still valid measurements and not just
>>>>> noise? Or is this purely affected by the selected
>>>>> resistor?
>>>> Hi Mark,
>>>> Good to hear from you. James Pallister and Simon Hollis
>>>> reckoned the measurement is accurate to 1%.
>>>> I'm out of the office at the moment, so don't have a board to
>>>> look at. - From memory it uses a 10 bit ADC. To measure the
>>>> current, the inserted resistor aims to create a maximum 50mV
>>>> drop. The largest resistor on the board is 5R, which would
>>>> therefore be for a peak current of 10mA. There is an option
>>>> to insert a larger resistor if you wish. Voltage range is
>>>> fixed I think at 0-6V.
>>>> The circuit was designed to sample at up to 2MHz on each
>>>> sample point, although at that frequency I would expect
>>>> inductive and capacitive affects to impact on the accuracy.
>>>> The standard tool is written in Python and in my experience
>>>> struggles to sample at much more than 10kHz. However the
>>>> design is fully open, so there is no problem with modifying
>>>> the tool and/or the firmware to sample at these higher rates.
>>>> You can find the software on GitHub.
>>>>> Unfortunately I couldn't find anything about that in the
>>>>> wiki.
>>>> Since the MAGEEC work finished some time ago, I've been less 
>>>> proactive in updating the wiki. However I'm happy to add some
>>>> notes about this. I'll check the facts against the board when
>>>> I get back.
>>>> Best wishes,
>>>> Jeremy
>>>>> -- Mit freundlichen Gruessen / Best Regards
>>>>> Mark Kettner
>>>>> _______________________________________________ mageec
>>>>> mailing list mageec at mageec.org 
>>>>> http://mageec.org/cgi-bin/mailman/listinfo/mageec
> _______________________________________________ mageec mailing
> list mageec at mageec.org 
> http://mageec.org/cgi-bin/mailman/listinfo/mageec

- -- 
Tel:     +44 (1590) 610184
Cell:    +44 (7970) 676050
SkypeID: jeremybennett
Twitter: @jeremypbennett
Email:   jeremy.bennett at embecosm.com
Web:     www.embecosm.com
PGP key: 1024D/BEF58172FB4754E1 2009-03-20


More information about the mageec mailing list