Today's project: trying to switch mains power (230v here) with a tiny Trinket M0 and a relay board.

It's working great, I hear the relay clicking. Until I actually run power through the cable, then the Trinket keeps rebooting 😑

I'm sure there is just something I'm doing wrong, but I'm struggling to figure out what exactly 🤔 I feel like the relay is maybe pulling more power for a fraction of a second, and depriving the Trinket in that moment?

Follow

@kingannoy does your relay board have a FET and flyback diode? in general I leave anything with mains power to fully enclosed, EC/UL certified products...

@th
It probably doesn't?

I understand a bit of the 220 could bleed into the 5v circuit? I'm not too afraid about the hardware directly connected to that, the Trinket cost me under €10 IIRC. But I did test it while it was connected to my laptops USB port, in hindsight that may not have been the smartest move 😅

I'll look into that next session, thanks for the input!

@th
I did a tiny bit more of research, didn't have much time...

I think I have the board that is explained here:
youtube.com/watch?v=FWvEEtrTGR

It has a optocoupler on the board, and it seems that this should protect the signal line from voltage spikes, right?

So if I were to put a flyback diode like the 1N4001 between the DC+ and the Trinket M0 this should solve the issue? Most of what I read about the protective diode said to install it parallel to the coil in the relay, that's on the board?

@th
I just ordered a few of the 1N4001 diodes, they were cheap enough to gamble it, and I was ordering at kiwi-electronics.nl/ anyway (the Raspberry Pi Zero 2 W is back in stock). So I guess I will have something to test next session :)

@th
I tried this setup, this works better, but it still gave me reboots on the Trinket. Do you spot a obvious mistake here?

The capacitor I used is a 100uf 16v one. I have no idea if that should work here 🙈 on the back it says:
KS 105°C
1908

And it's not hooked up to valuable equipment anymore now 😃

@th
If you are tired of my ill-informed questions please let me know 😅

I've been meaning to look a bit deeper into this, but I haven't found the time for this deeper research yet. I will get around to this sooner or later 😃

@th
One more bit of info. The reboots always happen when the relay switches from NO to NC, that is "on" how I've wired it. I'm running a script that switches every 5 seconds.

The reboots don't happen when the power cord the relay is interrupting is not connected to the outlet. The switching goes well 100% of the time in that case.

When I put the power cord in the outlet that drops to about 80-90%. When I run a device on the mains power through the relay, that drops even further.

@th
I watched some more videos on working with these relay boards, and the more I learn the more I think that what I'm doing is basically correct, and should just work...

Together with the single relay board, I also bought a double, so just now I tested to see if the issues was maybe just caused by a malfunction in the board.

The double relay board had exactly the same issue. It's the same brand (and seemingly batch) so it may still be due to faulty boards, but less likely.

@th
I also understand a bit better what is going on with the signal wire in relation to the power source. It's basically blocking the power from flowing when it's set to high, and accepting current (and thus lighting the led in the opto-coupler) when it's on low.

I know that the signal wire on the Trinket can only supply a max output voltage of 3.3, and I suspect that is also it's max for incoming voltages. While I've had the DC+ connected to 5v. So that could also be a cause for problems...

@th
But switching to the trinket's 3.3v output for DC+ didn't solve the issue...

It did keep switching like that though, so good to know that the relay board that is rated for 5v also works at 3.3.

Sign in to participate in the conversation
(void *) social site

(void*)