Assessing EmonPi Damage - Repair or replace

A thunder storm just took out a number of devices on our home network. The extensive cable runs in the roof space and I discovered too late that ethernet ports are sensitive to electromagnetic pulses. Having replaced 3 switches the network is working again but our emonPi is not functioning fully. I am trying to access exactly what the situation is, if I can repair it or if a new device is needed how I can keep the past years of data etc.

So here’s what I’ve got having power cycled:

  • The LCD is illuminated showing a row of squares
  • It is communicating across our network, I can logon locally to the cms
  • Historic Data is viewable on the desktop, but nothing added since the storm
  • All services are running except emonPiLCD (shows “exited”)
  • All inputs are shown “N/A”

My guess would be that the measurement board (ATmega328 microcontroller) is busted, hence no LCD and no longer communicating with the sensors. Is there a way to confirm that? Can I replace it? Or is there some other diagnostics, explanation and fix?

uggestions welcome, let me know if I can provide any extra data.

@Robert.Wall is your man for this bit.

If it is the daughter board, I think the Shop can sort out a replacement.

I think your guess may well be right. It might also be the serial port of the RPi, which is how the front end communicates. And the LCD might also be damaged, and that communicates with both the RPi and the '328P via the I²C bus (SDA/SCL). One or more ports onto that might be damaged.

I’d suggest first stripping the emonPi apart - take off the end plate nearest the push-button, then everything will slide out. Unplug the display & pushbutton, noting the connections. The “emon” part is secured to the RPi by 3 screws (obvious) then carefully prise the GPIO connector apart. If you’re able to test the Pi on its own, then I suggest you check the serial port and the I²C bus. (You need to power the Pi separately of course - and it’s a Pi standard connector, not the OEM one.)

If that appears to be OK, the “emon” front end can also be tested on its own - if you have a programmer, because it’s the same as an emonTx. It needs the normal external power supply, it won’t take its power from the programmer. If you’re lucky, it’s lost its sketch and uploading the sketch will put it right. If it’s more serious, I think you’ might be stuck because I don’t know the availability of the “emon” analogue front end.

If you’re not able to do this, I suggest emailing The Shop and mention this topic.

I’d ignore the hardware for a moment, it’s the data that’s the important bit.
Does the SD card still read OK in computer?

:thinking:

Thanks @Robert.Wall
Took the emonPi apart, and yes the RPi “works” on its own. At least it behaves as the whole thing does - I can see it on my network and logon to it via emoncms to see the old data etc. I’m electronically competent (designed and built audio power amps) but not sure how to check the serial port and the I²C bus.

For checking the front end unfortunately I don’t have a programmer. There is no obvious damage on the board, but that doesn’t say much. Would emp down the ethernet cause the sketch to corrupt? Bah, no way to know, damn storm!

Because of seeing the data via RPi I assume the SD card reads OK, so I have not checked it separately.

I’ll contact the shop and see what they say. If I have to replace the entire emonPi then so be it, but that seems wastefull if only one bord has gone. Hoping that I’ll be able to transfer the historic data somehow - plug in the SD card and away I go?

Probably not - but capacitive pickup on the c.t. lead, or via the a.c. adapter would be an alternative and more likely route, I think.

That should be OK, BUT I wouldn’t. Your SD card might have been damaged or had its life reduced. What I think would be a safer option is image it onto your laptop, then back up the data, write a clean new downloaded image onto a new SD card, and restore the backed-up data. For a few minutes work, you then have two safety nets - the original SD card plus the image.

There’s little you can do with the front end without a programmer - all you could do is plug in the 5 V d.c power supply (still without the Pi attached) and see if the LED flashes - it should flash once every 5 s (or maybe 10 s - I’m not sure if/when the default changed from 5 s to 10 s).

No LED flashing, I strongly think something on it is bust. The Shop have kindly supplied a board, so I’ll install that once it arrives and hope that solves everything.

Yes, sound advice. That SD card has been in use for many years, it may well be near end of life anyway. What I’m not clear on is separating the data from the image. I lost my first 3 years data by going about backup the wrong way - I “exported” and that a) only grabbed some data as .csv, and b) there is no matching import facility. By time I discovered that fundamental misunderstanding I had already flashed the SD card with a new image and wiped the files. I’ll search for information on how to backup/restore correctly this time.

If you use Linux, “dd” is the way to make an image - you’ll end up with an exact image of the SD card as a file on your computer/laptop. If you run under Windoze, I can’t help you - I gave up with Win8. I have an SD card slot in this laptop, and I run Ubuntu Linux, so imaging the SD card is easy. Backup
uses your LAN to make a backup file on your computer.

I believe you should be able to run ‘dd’ on the RPi if you use a USB drive, I’ve never tried that way.

When you do use the export/backup in emonCMS Setup, beware that the default is to restore.
I strongly suggest making the image first, because “Export” makes a file on the (potentially damaged) SD card first, then you have the opportunity to download it to another computer via your LAN.

The point about imaging and backing up the present SD card and then not touching it means you won’t be able to make the mistake you made - if you mess up with the backup, you could flash the old image to the new SD, then back that up, then reflash the new SD with the new emonCMS, then restore the backup. You still have two escape routes. It’s only if the emonCMS data itself is damaged that you have a problem - and from what you write, it isn’t, at the moment. The idea is to do minimal reads and no writes to it until you have an image safe on another machine.

If you run under Windoze,

One Win app available for disk image creation is Win32 Disk Imager.
(it can write images to disk, as well as create an image from a disk)

Ref:

2 Likes

I have installed my replacement front end “emon” board. Taken an image of the SD card using Win32 Disk Imager (yes Windows generally here, with some very limited Linux on RPi experience), thanks @Bill.Thomson. Reattached the sensors - power via CT onto PV and 4 temps from our thermal store.

Device started and the LCD came back to life, looked at via cms the power data is updating all fine, so it seems that the board was the broken part. It fundamentally works now, but my dashboard for temps shows all as zero. Why could that be?

Humm… differences in old board firmware to the replacment? Could all 4 temp sensors be toast? Just seems like a comms issue.

My plan was to see if I could get this working with the old card, then install new SD card flashed with latest software and restore my old data from the old SD card. Do I go ahead and do that, hoping that the temp sensors suddenly register, or is there something I can do on setup.

I really can’t remember from 2016 exactly how all this gest configured etc. so hand holding would be much appreciated.

Were the sensors connected when you applied the power - because they are only detected at power-up, NOT when you re-boot the Pi? If they were, it’s very likely they are casualties too - or at least one is. As all the sensors sit on the One-wire bus, if one is holding the bus down, then all are disabled.

It might be worth testing them individually if that’s possible - but you must either do a controlled power-down of the emonPi each time, or force a reset of the ATMega 328P so that the sensor is detected and initialised correctly.

I don’t think there’s been a recent change in that area. I think the temperature sensors are always enabled, except for the very latest emonPiCM version.

Yes.

Ah right. The sensors are connected via terminal block, I’ll try testing individually but maybe they are all blown. Thanks Robert.

On individual testing all of the temp sensors are blown too. Well that figures since they are all on the same wire from the emonPi. I’ve ordered some new ones from The Shop.

That storm certainly did some damage!

The only dealings I’ve had even moderately recently with anything like this was for a friend who ran a farmhouse B&B in rural Scotland. He lost two mains-borne Ethernet adapters and a portable TV, a neighbour lost the electronics of the central heating boiler, and the culprit was thought to be another neighbour switching a large induction motor that ran his milking machine. I installed a fairly large surge suppressor on the whole house. I think it was one of these https://library.e.abb.com/public/c1176f026e7b35d9c1256ef3004ff8fa/FRSOX_0101_03-GB.pdf from ABB, but I can’t remember the details now.

Something like that would probably be overkill for most people, but my colleague Brian here always recommends a normal surge suppressor for emonPis or Raspberry Pis.

2 Likes

Yes I am rural too, but the mains power supply does not seem to be involved in our thunderstorm experiences at all, if it was that route then as you point out there are protection measures we could take. As it happens we are the only property on a long spur from the 11kV network. No neighbours to mess up that, but could be exciting if the transformer got hit. But yes well earthed etc.

The voltage pulse isn’t on the power cables, it is on the cat5 data cables that comprise our LAN, and connect the phone points and the heating thermostats to the control unit. Weird sounding I know, and not where I first looked for an explanation, but the only thoinh that makes sense. Over the previous few years storms have killed the TV twice and the HDMI port on 2 RPi, a thermostat, multiple landline handsets, and 2 routers. Never any sign on sockets or power supplies. The emonPi came though those events, and it had seemed that since we had cut off the BT phone/ADSL line things were stable. So took the BT line, copper lines over head for 3 miles between house and cabinet, as the source of the problem. Well it has no earth, so for any pulse on that wire the shortest route to earth was through our internet connected devices.

Then the Tuesday storm hit, no BT copper lines to blame. However our roof space is full of hundreds of meters of cat5 (house is an odd shape and we have plenty of LAN and phone ports in every room), and the lightening stike was really near. I think all that wire up there, pinned to the roof trusses, simply picked up the emp (hence the routers lost, I had already unplugged the TV from everything). I don’t see how to stop that. Quite how that got the emonPi measurement board and sensors in the way it did is not so obvious. It is located near our PV inverter and that did cut out too, so maybe something off that hit the emonPi?

The next sound of thunder I’m unpugging all devices from the network and all the phones espeically the VoIP SPA, I can’t do much for the thermostats.

Just to close this by reporting that having replaced the measurement board and 4 temp sensors I now have my emonPi functioning fully again. Thanks all for the help.

2 Likes