Flourescent light crashes Scroll Phat HD

I’ve put my Pi3B+ in the cupboard under the stairs.
Scroll Phat HD is remote from the Pi, on about a metre or so of wiring.
Scroll Phat HD runs, for a while, until I turn the cupboard light on or off, when Scroll Phat crashes.
Error on terminal shows:

Traceback (most recent call last):
  File "scrolling1.py", line 46, in <module>
  File "/usr/lib/python2.7/dist-packages/scrollphathd/is31fl3731.py", line 594, in show
    self.i2c.write_i2c_block_data(self.address, _COLOR_OFFSET + offset, chunk)
IOError: [Errno 121] Remote I/O error

(program exited with code: 1)
Press return to continue

Runs OK again when .py file is retried.
Pi is on a a standard domestic ring-main circuit, flu-tube is on standard domestic lighting circuit.
Any ideas on why a flourescent light would cause Scroll Phat HD to stop?
Any what can I do to prevent it happening?

Thank you.

Best guess is noise (an emf pulse) is messing up the i2c signaling between the Pi and Scroll phat. One thing you could try is wrapping the wires going from the Pi to the scroll pHat in tin foil. Then ground one end of the tin foil. Strip back a couple of inches of bar wire and wrap that tightly around one end of the tinfoil. Then connect the other end to a ground pin on the Pi’s GPIO. Just make sure the tin foil doesn’t touch any other pins on the Pi or the scroll pHat.
If that doesn’t work you may have to get an AC Line filter to put between the Pi power supply and the AC mains.

Well I disabled the light by removing its starter, but still Scroll Phat stops. Cause currently unknown.

Current layout:

Pi continues to work OK
Envirophat still works OK

I’m no expert on how that light works, but it sounds like its still generating electrical interference. I do believe there is a high voltage transformer in there, not sure if it still does anything with the starter out though? Not my field of expertise. An io error is an i2c error, but I think you know that. ;)

If the wires going from your Pi to the scroll pHat are close to the AC electrical wires, I’d rout them a different way, if possible. As far as possible away from the electrical wires.

The light’s only a 600mm unit, and permanently switched off for now.
But yes, they all create a high voltage at startup I believe.

On the indoor side of the wall though is my ‘node zero’ - a very small patch-panel, 16 port switch, router, FTTC modem, Hue hub, satellite distribution amp etc etc.

You get the idea - a lot of electrical gear in a tiny, tiny space.

That said, though, it’s only Scroll Phat that dies, and not the Pi itself. (Enviro Phat is some 5 metres away.)

Also, they VNC window has shrunk, making things very difficult to work on.

My longest runs to other i2c devices has been about 7 inches. The 180mm long female to female jumper wires. I try to keep stuff like that as short as possible. Its also likely a good idea to keep the two wires for the i2c the same length

If your using twisted pair cable I’d make the two i2c pins one pair and the two power pins another pair. According to the pinout it only uses 4 pins and that would be all I wired up.

180mm is useless for my project! I need 5 metres+ between Pi and Phat(s).

I’m now wondering if S/FTP cable might help eliminate interference?

I was just mentioning that I haven’t tried what your doing with a Pi. Not yet anyway ;)
When I was still working, doing installs of electronic equipment, we often used shielded cable for data cable runs. You can get twisted pair cable with a foil wrapped shield around the outside of the wire bundle. And there will be a bare wire around the shield you use to ground the shield. You can get it with each pair shielded with a foil wrap too. It’s a bit pricy though. I haven’t done that type of work in many many years. This the type of cable we used.

S/FTP should work, had to Google it, lol. I’ve been out of the loop for quit a while now. Forced into early retirement with a bad back. =(

I’d probably wrap the scrollphathd.show() line in a try/except and call it a day. A little “If at first you don’t succeed, try again” can’t hurt in this case, since it’s just a display:

except IOError:

i2c definitely doesn’t lend itself well to long runs, though!

Could the data info be sent from one Pi to another over WIFI? Put a Pi Zero W on the Scroll Phat HD.
Or one on the Enviro pHat and move the other Pi so its connected directly to the Scroll pHat?

Possibly, possibly. But I wouldn’t have a clue how to do so.
And it seems overkill to have two Pis running a simple project.

Tempted to scrap the whole thing if it can’t work how I need it to.

I don’t know how to do it either, was just throwing options out there.
If the shielded cable doesn’t work I call it a day.

I’m happy-ish with Enviro Phat writing to Mysql, it’s just a shame that the same Pi can’t also reliably run the scrolling text too.

I’ll just have to fine some other use for Scroll PhatHD.

It can, just not with your setup;)
I feel your pian. I have one Pi that I have a push button wired to a GPIO pin to do a safe shutdown. I had to add my own pullup resister and a filter to keep power spikes from being detected as a signal to shut down. It runs on battery, and when I’d plug my power supply in to recharge it, it would shut down as if the button had been pressed. The Pi’s onboard pullup just wasn’t cutting it.

I now have the scroll phat on a separate Pi, reading from the envirophat db on the first pi.
Although it uses two Pis, the advantage is that they can both go anywhere (on the LAN), and there’s no need for any long wires whatsoever.

It’s a prototype at the moment, but it works.
Busy now writing down as much as I can remember from building it, taking image backups etc.
I don’t want to have to start this from scratch ever again.

I hear you, I try to remeber to make backup images on my cards. Especially if you’ve done a lot of setup from terminal etc.

It’s actually hit the buffers!
I can’t figure out how to keep the data fresh in the Scroll PhatHD.
The database is being updated, it’s just not playing ball at the other, scrolly showy end.
(I’ve raised a new topic for this, and hoping someone can help.)

I saw the new topic, but didn’t have anything to post though. =(