2

I built a RFM69 hat for a Raspberry Pi 3 B+. It works perfectly as long as I do not use the GPIO to switch on the relay that drives a solenoid valve. Unfortunatelly a lot of times the switching cause the radio module to get stuck and I have to reset it, destroying the Radio object, to make it work again.

This is the global schematic:

RFSensor

Looking at the schematic of the relay module it seems that the GPIO should not be disturbed by the relay switching. I tried to power the radio module with a battery, but the problem remains. The RPI seems to be unaffected by the switching: nothing is reported in the logs. Maybe something gets wrong on the SPI bus or a sudden spike in the relay can disturbe the radio module? From the schematic of breakout board I see two bypass capacitors that should protect the module from noise.

I tried to detect the change of the pins 11 and 12 from the process controlling the radio module (which is different from the one that controls the relay) in order to reset the radio. It is not very realiable though, because sometimes the event is not fired (?). Maybe there is a more clever solution? It seems to me that the python library for the RFM69 does not expose a method to poll if the radio is working.

Edit1: if the valve is disconnected the radio module works properly.

Edit2: from the tests that I made it seems that the transformer is not doing a fair job with the noise coming in the RPI and the RF module. I am thinking to build a small board with a pair of big capacitors, say 470uF, in parallel with the supply of each device. I believe that the noise frequency should be low so the big capacity needed. I could leave space for a few smaller capacitors to put in parallel for the higher frequencies. Could it be a good idea?

Edit3: I’ve built this board board with capacitors but it is still not working!

Edit4: I've just bought an oscilloscope and this is what I see when the solenoid valve opens: Power spike With my brand new oscilloscope I discovered that there is a lot of noise in the line. I bought a new Mean Well power supply (RS-25-5) and it does a great job reducing the noise but unfortunatelly is not enought! I'll try with an EMI filter (CW1B-10A-L). Let's see what happens.

Update: I’ve discovered that when the radio module gets stuck, the register RegRssiThresh changes to 0xFF. Now I check every second if the register has this value and in this case a reset of the radio module solves the problem.

Main components: Main components Connections to RPI: Connections to RPI Hat: Hat on Power and relays connections (note the lack of the ground connection on the power supply. Could it be the cause of high interferences?): New connections

stenio
  • 319
  • 1
  • 9
  • I don't have time for full troubleshooting right now, but if you can answer these questions, it'll help other readers: (a) Please edit the question & add photos of your h/w (top, bottom, wiring etc.). (b) Have you tried disconnecting the solenoid valve load from the relay, so that you are only switching isolated relay contacts? Does the radio module still hang in that test? (c) What test equipment do you have e.g. oscilloscope? Or only a DMM? or nothing? (d) "*destroying the Radio object*" What "object" do you mean? (e) How is the solenoid valve powered? I can't tell from the schematic. Thanks – SamGibson Dec 07 '19 at 16:51
  • "*From the schematic of breakout board I see two bypass capacitors that should protect the module from noise.*" FYI you have the wrong expectations about those 2 capacitors on the RF module breakout board. However, with the extra details I requested, we might get closer to understanding the cause of the problem you described. – SamGibson Dec 07 '19 at 17:07
  • Moving the relay to it's own power supply and using an optoisolator to drive it wouldn't be a terrible idea, many relay modules already have the isolator, it is just largely defeated if you wire them to share a supply with the logic. Doing a clean reinitialization of the radio upon switching the relay or any SPI unexpected read would also make sense, if your libarary makes that difficult you may need to modify or replace it. It's not clear from the information presented that a pi is a good choice here vs a simple flashed based MCU. – Chris Stratton Dec 07 '19 at 17:08
  • @SamGibson I've added some images. (b) I've just tried: with the solenoid valve disconnected everything works fine! (c) I have a couple of DMM. (d) I meant an instance of the Radio class (https://github.com/jkittley/RFM69/blob/master/build/lib/RFM69/radio.py). (e) The valve are connected to the main outlets (230V). Thank you very much. – stenio Dec 08 '19 at 11:00
  • @ChrisStratton I tried to power the relay directly from the transformer but the problem remains. – stenio Dec 08 '19 at 11:01
  • @ChrisStratton I can crontrol the valves also with telegram and blynk. Their respective programs are unaware of the RF module. – stenio Dec 08 '19 at 11:14
  • That doesn't necessarily mean you wired it in a way that makes effective use of an optoosoator though. – Chris Stratton Dec 08 '19 at 12:52
  • @ChrisStratton I can try to power the relays with a different transformer. What do you think? – stenio Dec 08 '19 at 14:11
  • @ChrisStratton Unfortunately I don’t have an optoisolator handy. Is this what you meant? – stenio Dec 08 '19 at 14:55
  • But you do, on your relay board if you wire it correctly. – Chris Stratton Dec 08 '19 at 14:56
  • @ChrisStratton I have connected pins 1 and 4 of the relay to the transformer and pins 2 and 3 to RPI. Why it is not correct? – stenio Dec 08 '19 at 15:17
  • It sounds like you've bypassed the isolation. You have a 3 pin connector for the noisy side of the relay and a 4 pin for the quiet side. Nothing should be connected to both, but it sounds like you connected the supply for the noisy side to the quiet side. – Chris Stratton Dec 08 '19 at 15:20
  • @ChrisStratton Ok, I have connected the relay to the transformer using the 3 pin connector (pins 1 and 3). Pin 1, 2 and 3 of the 4 pin connector to pin 2, 11 and 12 on the RPI. Unfortunatelly nothing changed :( – stenio Dec 08 '19 at 16:47

0 Answers0