emonpi avrdude update failure - sync

I'm seeing vrms stuck at 230v despite the screen at startup confirming that I have a 9v ac supply plugged in. I saw that the 2.20 firmware might have been buggy and it seems that's what I've got. 

Running minicom, pressing v shows

Welcome to minicom 2.6.1

OPTIONS: I18n 
Compiled on Apr 28 2012, 19:24:31.
Port /dev/ttyAMA0

Press CTRL-A Z for help on special keys

OK 5 217 1 0 0 217 1 216 89 10 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (-0)
[emonPi.2.20] E i5 g210 @ 433 MHz USA 0 

Since I'd just run the update script, this made me suspicious that I was stuck on 2.2 - it seems that my nice shiny new emonpi does not seem to be able to update the firmware - when I run

sudo service emonhub stop

avrdude -v -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 115200 -U flash:w:/home/pi/emonpi/Atmega328/emonPi_RFM69CW_RF12Demo_DiscreteSampling/compiled/emonPi_V2.3.hex

I see:

avrdude: Version 6.1, compiled on Jul  7 2015 at 13:18:47
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/home/pi/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyAMA0
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xfc
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x8e
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x1c
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x8e
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x8e
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xfc
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x70
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xe0

avrdude done.  Thank you.

 

I searched and don't see any (obvious) way to fix this - suggestions welcomed..

 

fubar's picture

Re: emonpi avrdude update failure - sync

update:

changed the scale and now see around 245v which seems more consistent with the ups

[[5]]
    nodename = emonpi
    [[[rx]]]
        names = power1,power2,power1pluspower2,vrms,t1,t2,t3,t4,t5,t6,pulsecount
        datacodes = h, h, h, h, h, h, h, h, h, h, L
        scales = 1,1,1,0.0116,0.1,0.1,0.1,0.1,0.1,0.1,1
        units = W,W,W,V,C,C,C,C,C,C,p

 

 

Ah. Wetware error I suspect. Fixed with a proper reinstall of avrdude-autoreset enabled me to get to the updated firmware. vrms is at last working.

Wrong but working.  I'm in Australia so our nominal vrms is 240 - my ups says 247v right now but my emonpi says about 212v so about 16% low.

Can I just change the scale factor 

All the calibration docs I've seen refer to the tx but I'm running an emonpi - do I need to do calibration?

Advice appreciated...

glyn.hudson's picture

Re: emonpi avrdude update failure - sync

Glad you managed to get the update working. I'm assuming you saw this thread regarding the bug in V2.2. An V2.3 firmware fixed this.

What do you mean by 'changed the scale'? No calibration should be needed. Are you using a UK / Euro plug AC-AC adapter bought through the shop? If you do want to calibrate the emonPi firmware can be found here:

https://github.com/openenergymonitor/emonpi/tree/master/Atmega328/emonPi...

How did you re installed avr dude autoreset? This should not have been necessary, if it is I would be interested to find the root cause of the issue. 

fubar's picture

Re: emonpi avrdude update failure - sync

I think I reinstalled avrdude at some point without thinking it might have been, ahem, adjusted :)

So, I did a clean reinstall and then updated the avrdude-rpi git repo and reran install

It really did work finally.

On the odd voltages, unfortunately, I ordered a us plug so got a 110 v to 9v - doh! Shoulda got a 240v uk one.

I found one in my spares box that claimed to have 9vac output which I measured as 9.6vac under no load. 

I've got one of these coming next week..http://www.altronics.com.au/p/m9233-powertran-9v-ac-1.33a-appliance-powerpack/ which should do the trick.

Meanwhile the updated scale does what passes for the trick. I'm guessing that the actual voltage scale doesn't matter for real power calculation - it's in both numerator and denominator although measured different ways - scale is same? 

Thanks for caring!

glyn.hudson's picture

Re: emonpi avrdude update failure - sync

emonPi has been calibrated to work with the power adapters we stock in the shop. You will probably need to calibrate to use a different adapter

Robert Wall's picture

Re: emonpi avrdude update failure - sync

"I'm guessing that the actual voltage scale doesn't matter for real power calculation - it's in both numerator and denominator although measured different ways - scale is same? "

I don't know where you got that idea from, but I'm afraid you're quite wrong. Power is proportional to V².

Your adapter output of 9.6 V on no-load is indeed responsible for the low readings - the 'Shop' adapter gives 11.6 V ±3% on no-load at 240 V input, so that, given a bit for tolerances, accounts for your error. If you wish to reprogram the sketch, how to calculate the calibration coefficient is in Resources > Building Blocks.

Comment viewing options

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