Help figuring out circuit

Hello everybody.

I have a little project where I have my Arduino Uno in a 5 volt circuit opening a relay to a 12 volt circuit activating an electromagnet. My question is, is there any way to signal the arduino if the 12volt circuit is broken - for instance the power is switched off?

You could connect that power to a relay that is normally open, so it closes when it loses power. Then you take that output from the relay to an GPIO pin on your arduino.

Then from there you can program however you need it.

I do not have a lot of skills in electronics…
I know you can use a relay to switch a higher current circuit with a lower current.
But how does it work the other way?

Option number two would be to use a Hall Sensor AT the magnet… then have the program look for an input from that sensor after the electro magnet output is activated.

So for lack of better info currently…

if (magnet activated && Hall Sensor = 0)

Output/print - magnet broken to lcd, or other item/input or notification.

(Optional) (and where x = normal magnetic field and y= weak field

if (magnet activated && Hall Sensor > x)

Output/print - magnet activated to lcd, or other item/input or notification.

if (magnet activated && Hall Sensor > 0 && < x)

Output/print - magnet activated but weak to lcd, or other item/input or notification.

To better explain my relay setup... you would need two relays. The first one is driven by a 5v output on your arduino to trigger the 12v power. The second, you would power that relay from the 12v circuit as close as possible to the magnet and take it's output to an input on the arduino.

Thank you very much for the ideas:). Can you in fact take the output from the 12v without frying the arduino?

Ahh I think I get it...

I can for example have pin3 connected to a relay triggering a 12v circuit. That circuit then automatically triggers another 5volt circuit going to pin 2. I can the have the arduino make sure that pin 3 and 2 are active. In case the 12v circuit is broken, pin 3 will be active but pin 2 will not, thus having the solution right there:).

Thank you very much for your help:)

Common Ground ?

If your Arduino and your 12V circuit can share a common ground the solution is VERY easy.

Take 2 resistors (eg. 4K7 and 2K2) to build a voltage divider. Just make sure the 4K7 resistor is connected to 12V and the 2K2 is connected to ground.

This will give you an output voltage of 3.x Volts.

Use one of your analogue inputs to watch this signal.

[u]And do not forget two other things:[/u]

  • a diode in parallel with your electro-magnet (watch polarity) - this makes the contacts of your relais live longer

  • the Arduino has a max. output of 40mA (absolute maximum) - may be you need a transistor to drive your relais.

arduinoaleman: Common Ground ?

If your Arduino and your 12V circuit can share a common ground the solution is VERY easy.

Take 2 resistors (eg. 4K7 and 2K2) to build a voltage divider. Just make sure the 4K7 resistor is connected to 12V and the 2K2 is connected to ground.

This will give you an output voltage of 3.x Volts.

Use one of your analogue inputs to watch this signal.

[u]And do not forget two other things:[/u]

  • a diode in parallel with your electro-magnet (watch polarity) - this makes the contacts of your relais live longer

  • the Arduino has a max. output of 40mA (absolute maximum) - may be you need a transistor to drive your relais.

So where would the electromagnet be placed? Like Gnd -> 2k2 -> pinOnArduino->4k7 -> electromagnet -> 12v?

Please see the circuit diagram in the attachment.

The transistor has to be a NPN type (almost anyone will work - no problem here)

Connect the Emitter to ground, the Base to the 2K2 resistor and the Collector to your electro magnet.

If you write your code, the input at analogue input is usually not exactly 0 when there is no input. If the input value is less than 100 you will not have power on your 12V segment.

Scan.pdf (170 KB)

Thank you so much! This has been very helpful.
Had no way of coming up with this on my own.

Hi,
Arduinoaleman circuit.
pic5.jpg

Tom… :slight_smile: