cancel
Showing results for 
Search instead for 
Did you mean: 

Weird I2C problem stm32f4 switch 230V coil

kenny__84
Associate II
Posted on July 22, 2013 at 14:02

Hello everybody

I have the weirdest problem on my i2c....

I have some pcf8574's connected on my stm32f4Discovery and the work like a charm

(thanks Clive1.....)

But now i have connected some 5V relays which also work fine and they have to switch on some 24V relays and everything there works perfectly untill i let the 24v relays switch a 230VAC coil. Then my PCF will just switch all outputs high and when i switch a few times than the I2C hangs on EV6 flag...

This also happens when i switch the coil by pressing the relay so it's some kind of inductance :s

Any ideas?

#i2c-stm32f4
15 REPLIES 15
kenny__84
Associate II
Posted on July 25, 2013 at 12:28

Okay well the weird thing is that i only have i2c buswiring in a small box and the low voltage

relays are in the same box, than they go to another box with the 24v= relays that switch on the coils.

These boxes are made of plastic.

The problem only occurs when i switch on the 230v main power to the 24v relays and also when i put a coil on the piping from a different wall socket.

So that's why i ask, the i2c wires are short and not anywhere near the 230v circuit, the only thing is that the 24v wires go to the 23v relays.

When i switch off the 24v and i press the relay manual for the coil than the same thing happens.

the problem occurs when switching on or off the coil and not when i try my i2c commands while the coil is on

crt2
Associate II
Posted on July 25, 2013 at 13:32

That is why I've said tin foil around plastic box and if you'd ask me also the wires from box to 24V relays. That way you will protect your cuirit against EMP's, but you might also get trouble with 230V supply.

I think you've seen the magnetic dispersion coils cause, and you also know that longer and stronger the coil is, bigger the EMP around is. The flux lines have to sink into them somehow, and the radius’s can be huge.

The turn-on and off often cause a problem even with relays as the switch is not instant on, but there is a lot of other things happening (same idea is why button triggers many interrupts). Maybe that is also an aspect to consider. Anyways if you'll shield your stuff you can search for problem elsewhere, otherwise there are quite many possibilities with what you're playing...

kenny__84
Associate II
Posted on July 25, 2013 at 14:44

Thank you, this gives me some confidence that it is possible to use these busses and such!

I will test this prototype just with the GPIO's because the rewriting will be as fast as debugging the hardware (it's just the low level stuff i made lib's for everything sort of arduino style)

I have a working prototype with the same MCU and coils on GPIO and this works perfectly.

I will however design a new standard with the I2C possibilities to control future projects and than i will design everything shielded.

I almost burned one actuator that i controlled the speed with over I2C so i will have to go with safe now.

Thank you for your time!

michaelp2
Associate
Posted on July 25, 2013 at 17:04

If it seems the interference comes from the 230V relays, you could also try to use a Solid-State-Relay. They are not that much more expensive anymore and you might also be able to skip the 24V relays altogether. (Example: http://www.mouser.com/ProductDetail/Omron-Industrial/G3NA-210B-DC5-24/?qs=sGAEpiMZZMtyXJl6MftlF1QEhI3ERFBXO3WwRTi6s8Y%3d)

Many SSRs can be driven by DC 3-30V.

Also another option would be to try to lower the I2C frequency, not sure what the frequency is you are using, but lower it to 100kHz (or lower if possible) to make the transmission more robust against picking up stray signals.

kenny__84
Associate II
Posted on July 25, 2013 at 18:31

No the relays are 24v= and they switch 230v solenoids

I rather not skip the 24v= because i like to separate the 3,3/5v from the 230v

that's why i have a 24v= ''stage''

So the stm32 switches on the 5v relays and the 5v switch on the 24v relays that powers the solenoids. 

ikrame
Associate
Posted on June 29, 2015 at 10:43

Hey ,

Could you help me with stm32F4 & PCF8574.

thx