Drive 3.3V relay from Photon/Electron

Hi,
From an Electron (and also testing on the Photon) I am trying to drive a 3.3V relay (to turn off connection to an external USB battery bank for a few seconds to trigger re-charging from a power bank which turned itself off due to low voltage) from the Electron:
http://www.ebay.com/itm/Single-1-Channel-Relay-Module-Board-and-Shield-For-Arduino-Raspberry-PI-MCU-/141597155395?

Unfortunately no luck. The led on the relay lights on, but the relay doesn’t turn.
Based on the description of the above relay, it would require 20-30mA and 3.3V. I was looking for the rating of the output pins on the Electron/Photon (like D0), but couldn’t find it in the datasheet.
What is the maximum current the digital pins can output?

Thanks

Probably not enough current, the photon I/O is only capable of supplying a max of 25mA, which is just on the edge of what your relay needs, try using the VIN pin instead and see if that works, VIN is capable of supplying theoretically 1A, though that is dependent on your supply side.

1 Like

THANKS!!!
That did it - using VIN pin it works!

1 Like

@obrien28, while using the VIN pin worked with the Photon, it doesn’t seem to work with the Electron, when the Electron is on battery power only (no USB connected).
Any way to supply 20-30mA from the Electron?

Actually I managed to connect it to an external source (the USB power bank), so it works now even with the Electron, but the question is now just for informational purposes - when the Electron runs from the battery, is the VIN pin down and no way to get 30mA out?

@evk02, like the Photon, Vin on the Electron is connected to Vusb meaning it is supplied only when USB power is applied. When battery powered, like the Photon, there is no 5v supply available on the Electron. You could use a boost regulator to step up the battery voltage available at pin LI+ to provide 5v for the relays. :grinning:

Thanks. Actually my relay works from 3.3V, so the problem was that it needs about 30mA to drive the relay, which I could only get from the VIN, which it seems is only one when the USB is connected, not when on battery-only.
Anyhow, as the relay is there to turn on charging from an external USB, by connecting the relay’s VCC to the USB and not to the Electron I can get the necessary 30mA, so it works now that way.

i was just curious whether I can get 30mA, 3.3V out of the Electron when on battery, but for my current scenario it turns out I don’t really need it.

1 Like

Actually your problem is two fold, not enough current and not enough voltage. The reason VIN worked was because it is both 5V and capable of supply more than 25mA.

If you check the eBay listing again you can see that your relay is rated at 5VDC, not 3.3 as it “claims” in the description (very common practice among Chinese sellers), your options are either 1) get 5V from somewhere else 2) Buy an actual 3.3V rated relay (make sure to check the case) 3) use a switching boost circuit (like the Adafruit MintyBoost which takes 3 volts and boosts it to 5V for phone charging).

I never realized that the VIN is actually 5V, I automatically assumed that it is 3.3V.

Thanks, I did check the relay and I saw that it was marked as 5V on the relay, but the seller claimed on the description page that it works with 3.3V too, so I have also emailed him and he confirmed, that yes, it would (he is a US seller).

In either case, even if the relay would work with 3.3V, as you noted, I would still have the problem with the current, needing 30mA, so anyhow I’ll need a separate solution. Thank’s for the suggestion.
I am planning to get a separate power source for the relay, similar to the MintyBoost.

Try using lower trigger relays…
https://www.amazon.com/GEREE-8-Channel-Module-Optocoupler-Arduino/dp/B00PU3JYZO

1 Like