Connecting relays to Pycom devices

Can I connect relays such as the solid state one below directly to the Pycom GPIO pins?

If it is mechanical relay like the one below what do you recommend to limit the current draw and protect the Pycom device?

1 Like

Hi Clint,

I’d take a look at this topic where I run through some code and calculations: Asset Tracking device - #7 by Liam120347

I believe all of the Pycom devices use the same base microcontroller so it should transfer across their range.

Thanks Liam
Sounds like the logic converter should be used to limit the current from the GPI pin?

1 Like

Hi Clint,

Depending on which module you use there is most likely some sort of current limiting - the relay module that I used in the previous topic uses optocouplers with a current limiting resistor to make sure the pin isn’t overdriven. I recall Robert (Not mentioning to not bump this topic) reverse-engineering the circuit of one a while ago but couldn’t find the topic.

In short, they definitely can be though, but the power has to come from somewhere.

Just read the first sentence again - you’ll want a dedicated power supply to run the mechanical relays, I imagine 60mA is the nominal current, depending on how fast the driver FET switches on the relay there will be some inrush - definitely overspec the power supply and don’t power from the internal LoPy 3v3 or 5V pins.

Hi Clint

NO. A logic converter is just that, a logic converter. It converts 5V logic signals to 3.3V and vice versa. Use where you have a 5V logic device connected to a 3.3V device or a 3.3V device connected to a 5V device. They are bi-directional. As the “pull up” resistor is typically 10kΩ they will not supply any current to speak of and are only suitable for high impedance inputs.
Cheers Bob
EDIT. By the way that solid state relay is only for AC loads. It will not switch DC.


Thanks Bob - what I would like to do is connect the Pycom (Lopy4) device’s GPIO pin directly to the SSR’s input without exceeding the current rating for the pin but wanted to check if I need a resistor or some current limiting circuit to protect the Lopy4 pin. I understand that the SSR is only for AC loads but having read the commentary below and the spec sheet it looks like it is not suitable for my use case i.e. 24 VAC irrigation valves etc.

1 Like

Thanks Liam