SOLVED: Vrms stuck on 230v after emonpi update

Hi all,

I updated my emonpi yesterday to v2.2 and when booting i get "AC Wave detected", however, the Vrms reporting is flat-lining at 230v.

If i unplug the AC transformer i lose power calculations so i assume this is working for real power calc, but i have no visibility of Vrms.

Any ideas? I've tried all reboot patterns etc.

Iain

ajsicek's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

I am in the exact same situation :)

would be great if anyone can help

Cheers

Petr

glyn.hudson's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

Oh dear, very sorry to hear. I will investigate this immediately. In the meantime you can revert back to V2.0 by running the following shell commands once logged in via SSH:

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.0.hex

sudo service emonhub stop

Note: If another emonPi update is triggered via local Emoncms Admin the emonPi will revert back to the latest (V2.2) firmware.  

glyn.hudson's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

Bug has been fixed, thanks a lot for posting. Please run update to pull in the latest update. 

Commit with the fix: 

https://github.com/openenergymonitor/emonpi/commit/db973b781c59d683cd12d...

Please confirm this fixes the issue

glyn.hudson's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

Just been notified that the V2.3 update I pushed fixed this issue but due to an new version of Arduino compiling issue  results in the LCD text on the emonPi at bootup being garbled. I have just pushed an update to fix this. Please hit update again to pull in the latest changes. 

ajsicek's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

Thanks everyone for quick response. :)
I am having troubles to update. log is attached

Westerner's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

After running an emonPi update from Emoncms low-write-8.5 my LCD display is stuck with the message "Raspberry Pi Booting.." I gather this message was introduced in the v 2.2 firmware update. Is there a bug, or something I can do to fix it? Thanks.

glyn.hudson's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

@ajsicek, are you running an emonPi or an RFM69Pi? It looks like the update has worked apart from uploading the new firmware to the ATmega328 microcontroller in the emonPi. If you are running an RFM69Pi then this is not needed, there is no firmware update for the RFM69Pi. However, running update is still useful for you since you have updated Emoncms to the latest version. If you are running an emonPi, then there must be a hardware fault. 

@ Westerner, I have just tested updating the 17June15 image. The "Raspberry Pi Booting" popped up for a few seconds then disappeared. Can you access the emonPi via the web interface? If so, please try updating again and rebooting the unit. Please let me know if this fixes the issue. 

Westerner's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

I can access the emonPi via the web interface, and the update takes place, but the LCD display then gets stuck at "Raspberry Pi Booting". My emoncms is working fine, all the feed data is coming through, and everything seems to be working ok - it is just the display that seems to be the problem. If I run emonPiLCD it tells me it is not running, and emonPiLCD start doesn't improve the situation. Until a fix is found, can I turn the display off?

glyn.hudson's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

It seems that the emonPi LCD python service is having an issue

$ sudo service emonPiLCD restart

or if it's not running:

$ sudo service emonPiLCD start 

Can you take a look at the emonPi LCD log?

$ cat /var/log/emonpilcd.log

or if it's very big 

$ tail /var/log/emonpilcd.log

 

Westerner's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

Here is the contents of emonpilcd.log

2016-02-25 18:17:53,781 INFO emonPiLCD Start
2016-02-25 18:17:53,924 INFO I2C LCD Detected on 0x27
2016-02-26 09:47:53,121 INFO emonPiLCD Start
2016-02-26 09:47:53,228 INFO I2C LCD Detected on 0x27
2016-02-26 09:52:35,496 INFO emonPiLCD Start
2016-02-26 09:52:35,596 INFO I2C LCD Detected on 0x27
2016-02-26 12:16:26,198 INFO emonPiLCD Start
2016-02-26 12:16:26,296 INFO I2C LCD Detected on 0x27

It seems emonPiLCD.py is not running ...

pi@emonpi ~ $ sudo service emonPiLCD status
[FAIL] /usr/share/emonPiLCD/emonPiLCD.py is not running ... failed!

and trying to to start it gets no further than this ...

pi@emonpi ~ $ sudo service emonPiLCD start
[ ok ] Starting system emonPiLCD daemon:.

glyn.hudson's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

Thanks, what errors do you see if you run the LCD script directly?:

$ emonpi/lcd/./emonPiLCD.py

Check that you have the latest version with 

$ rpi-rw

$ cd emonpi 

$ git pull 

$ rpi-ro

Westerner's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

Running LCD script directly:

pi@emonpi ~ $ emonpi/lcd/./emonPiLCD.py
Traceback (most recent call last):
  File "emonpi/lcd/./emonPiLCD.py", line 63, in <module>
    loghandler = logging.handlers.RotatingFileHandler("/var/log/emonpilcd.log",'a', 1000*1024, 1)
  File "/usr/lib/python2.7/logging/handlers.py", line 117, in __init__
    BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib/python2.7/logging/handlers.py", line 64, in __init__
    logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib/python2.7/logging/__init__.py", line 901, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib/python2.7/logging/__init__.py", line 924, in _open
    stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: '/var/log/emonpilcd.log'

pi@emonpi ~/emonpi $ git pull
Already up-to-date.

glyn.hudson's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

Ah I see the issue, /var/log is not writable from the pi user. This can be fixed with 

$ sudo chown pi /var/log 

Please try and manually re-run the LCD python script as you did before after making the change. Please confirm this works. This change will be lost after a reboot since /var/log is mounted as tempfs

To make this persistent on boot you need to add the line above into the rc.local file 

$ sudo nano /etc/rc.local/ 

What SD card version are you running? This should have been set by default. What is the output of:

$ sudo ls -l | grep emonSD

Westerner's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

No luck with:

pi@emonpi ~ $ sudo chown pi /var/log
pi@emonpi ~ $ emonpi/lcd/./emonPiLCD.py
Traceback (most recent call last):
  File "emonpi/lcd/./emonPiLCD.py", line 63, in <module>
    loghandler = logging.handlers.RotatingFileHandler("/var/log/emonpilcd.log",'a', 1000*1024, 1)
  File "/usr/lib/python2.7/logging/handlers.py", line 117, in __init__
    BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib/python2.7/logging/handlers.py", line 64, in __init__
    logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib/python2.7/logging/__init__.py", line 901, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib/python2.7/logging/__init__.py", line 924, in _open
    stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: '/var/log/emonpilcd.log'

SD card version query produces no result:

pi@emonpi ~ $ sudo ls -l | grep emonSD
pi@emonpi ~ $

glyn.hudson's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

@ Westerner do you have ssh access? 

If so running this should fix the issue. It's due to the python LCD script hitting a permission error when trying to save a log file in /var/log. Allowing the pi user to write to /var/log should fix this

$ sudo chown pi /var/log

The the my reply above regarding how to run the python script manually to test this. 

glyn.hudson's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

Ah sorry, just realised the permission error we got was due to me forgetting that the python script needs to be ran as root. Try again with: 

$ sudo emonpi/lcd/./emonPiLCD.py

I also missed out the /boot directory in the commend to return you SD card version. Try:

$ sudo ls -l /boot | grep emonSD

Westerner's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

Hello Glyn,

I am running those commands from a terminal in SSH.

pi@emonpi ~ $ sudo chown pi /var/log

then when I run the python script I get:

 emonpi/lcd/./emonPiLCD.py
Traceback (most recent call last):
  File "emonpi/lcd/./emonPiLCD.py", line 63, in <module>
    loghandler = logging.handlers.RotatingFileHandler("/var/log/emonpilcd.log",'a', 1000*1024, 1)
  File "/usr/lib/python2.7/logging/handlers.py", line 117, in __init__
    BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib/python2.7/logging/handlers.py", line 64, in __init__
    logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib/python2.7/logging/__init__.py", line 901, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib/python2.7/logging/__init__.py", line 924, in _open
    stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: '/var/log/emonpilcd.log'

Am I doing something incorrectly?

Westerner's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

Hello Glyn,

Running that results in:

pi@emonpi ~ $  sudo emonpi/lcd/./emonPiLCD.py
Traceback (most recent call last):
  File "emonpi/lcd/./emonPiLCD.py", line 91, in <module>
    sd_image_version = subprocess.check_output("ls /boot | grep emonSD", shell=True)
  File "/usr/lib/python2.7/subprocess.py", line 544, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command 'ls /boot | grep emonSD' returned non-zero exit status 1
pi@emonpi ~ $

sudo ls -l /boot | grep emonSD returns nothing, but that looks like a result of the last line of the above.

glyn.hudson's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

Ah, I see what the error is. The emonPi LCD script is looking for a file beginning with emonSD-XX in the /boot directory. This file contains the SD card version e.g. emonSD-20Feb16. It sees you don't have this file. 

Did you build the SD card setup yourself? Or are you running a very old setup?

Either way the emonPi LCD should be able to work on systems without this file. I will add some more error checking into the code. 

In the meantime you can make the script work by creating the file it's looking for:

$ sudo touch /boot emonSD-XXX

glyn.hudson's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

Python script needs to be ran as sudo:

$ sudo emonpi/lcd/./emonPiLCD.py

glyn.hudson's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

You may also need to create a dummy image version file the script is looking for:

$ sudo touch /boot emonSD-XXX

​See my post above. This will be fixed very soon. Thanks for alerting me

Westerner's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

Thanks Glyn, I will go through this and let you know the outcome. My EmonPi came ready configured - I bought it from you in May 2015. Apologies for delayed replies - we are on the Superslow Highway here.

glyn.hudson's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

Ah, you have the very first emonPi image release, before we thought to add version control! Thanks for helping me fix this. I have just pushed a fix to the emonpi 'testing' branch. I will do some more testing then push update tomorrow morning. Thanks again for you help and patience. 

Westerner's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

Glyn, I have tried what you suggest. It seems I can't create the emonSD file in the boot directory while the emonPi is stuck in "Raspberry Pi Booting.." mode. The button to shut down or reboot does not work; the only thing I can do is switch the power off, but when the power is turned back on it goes into "Raspberry Pi Booting.." mode again.

This is what I get when running emonPiLCD.py now:

pi@emonpi ~ $ sudo emonpi/lcd/./emonPiLCD.py
Traceback (most recent call last):
  File "emonpi/lcd/./emonPiLCD.py", line 91, in <module>
    sd_image_version = subprocess.check_output("ls /boot | grep emonSD", shell=True)
  File "/usr/lib/python2.7/subprocess.py", line 544, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command 'ls /boot | grep emonSD' returned non-zero exit status 1

Is it the non-zero exit status that is causing the problem?

In my boot directory I already have a file called emonpi-28May2015 (rather than emonSD-28May2015).

Westerner's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

Glyn,

I am not sure whether this has any bearing on a solution, but this is a section from the beginning of my emonpiupdatelog:

Stopping system emonPiLCD daemon:start-stop-daemon: warning: failed to kill 2399: No such process
No process in pidfile '/var/run/emonPiLCD.pid' found running; none killed.
 failed!

Then when the system restarts after the update it reports that (an unspecified) Job is already running:

Emoncms update finished
=================================

 

Job is already running!
Start emonPi LCD service
Starting system emonPiLCD daemon:.

...................
emonPi update done

glyn.hudson's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

@Westerner

I have added support for detecting your older image ID, you should now see 'emonpi-28May2015' displayed at startup. I have pushed these changes and the other fixed I made yesterday to the master branch. Please can you update to pull in the changes and let me know if the issues has been fixed. 

Thanks. 

Westerner's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

Thanks Glyn, that is working fine now. Great stuff.

Westerner's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

Glyn, just to let you know that on starting emoncms, I get the following message:

 Undefined variable: result in /var/www/emoncms/Modules/admin/admin_controller.php on line 82

It has no practical effect.

ajsicek's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

@Glyn,

> @ajsicek, are you running an emonPi or an RFM69Pi? It looks like the update has worked
> apart from uploading the new firmware to the ATmega328 microcontroller in the emonPi. If
> you are running an RFM69Pi then this is not needed, there is no firmware update for the 
> RFM69Pi. However, running update is still useful for you since you have updated Emoncms 
> to the latest version. If you are running an emonPi, then there must be a hardware fault. 

- I am running emonpi - what kind of hardware fault can that be and what can I do about it?

- I got the same msg in update log as westerner

- the display is still stuck on either booting... or updating...

- the real voltage is still stuck at 230V

- rest of the emonpi seems working fine - I can use web access or ssh no problem

ajsicek's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

@Glyn,

some updates :)

- I did apt-get upgrade and emonpi update. The LCD seems to work fine now. :) Great. thanks.

- in emoncms the number of s from last update is now showing nonsense number ( like -3599s ) it is oscilating around that number as the nodes refresh and the nodes are updating fine (screenshot attached) 

- voltage still stuck on 230V

 

glyn.hudson's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

@ ajsicek could the date / time on your emonPi be incorrect? Try :

sudo service ntp restart

Also check your RasPi and Emoncms international setting 

$ sudo raspi-config 

Caution: don't run expand SD card partition from raspi-config! 

ajsicek's picture

Re: SOLVED: Vrms stuck on 230v after emonpi update

@Glyn,

thank you very much for all the help. It is amazing how helpful you guys are :)

I corrected the time as you suggested and it worked. But vrms was still stuck at 230V. So I decided to update to Jessie using apt-get dist-upgrade which broke everything :) So I downloaded release candidate emonSD-20Feb16 and vmrs is finaly working now and also avrdude error msg is gone :) there is other stuff broken, but this is for another thread :)

Cheers

ajs

Comment viewing options

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