Go Down

Topic: 230V Input check for Arduino? (Read 14428 times) previous topic - next topic


Hi Guys,

i like to "hack" an garage door and want to controll the door with a webbrowser.
For this i need to check the actual status of the Door. So i need to check the 230V relais from the Garagedoor controller.

One way is to use another 230v relais, that switch a channel from the arduino, but i think this isn´t the best way.
Any ideas to check with arduino if theres a 230v power present at a input channel?


If you ask, I should not tell you, because 230V is dangerous for Arduinos and Newbies.

Another thing is never pull the 230V N signal to Arduino GND, (assuming you wire L to a diode (e.g. 1N4004) and a 100k resistor to a capacitor (polarized 1µF) and a parallel zener diode <5V) but feed that to an optocoupler. This increases the components price considerably ( from 10 to 40 cent ) but its worth investing, to protect your Arduino.

It's much safer to feed the 230V to a small transformer (230V to 12 or 6V) and do the electronics fiddling as above on the secondary side ( with a smaller resistor, of course).


Can't (shouldn't?) you make a reflective sensor to accomplish this ( X = open/close) ?
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!


Thanks for your reply! Dont worry, i have more expirience with Highvoltage than microcontroller.
I would Never connect a 230v supply directly to a arduino. I have a Schooling in electrician, but mircocontrollers and low current is new for me :)
So i Need to learn more about optocoupler and so on.. Thats why i ask :)

Jack Christensen

i like to "hack" an garage door and want to controll the door with a webbrowser.
For this i need to check the actual status of the Door. So i need to check the 230V relais from the Garagedoor controller.

High voltage issues aside, I would humbly submit that the status of the door is not necessarily the same as the status of the relays that control the door. If it were me, I'd want to know the status of the door, and would sense it via limit switches or some similar arrangement. The control on my door is a simple pushbutton in a low-voltage circuit. There I would probably use a small relay, actuated by the Arduino, in parallel with the switch.


Maybe an ir setup on the ceiling above the door to "see" if its up? Or cheap i guess and somewhat more dangerous is just a diode,  voltage divider and a zenerdiode. And cap right to the input, mind you that should work nit that there arent a 100 better safer ways, although then you could also get the mains frwuency if you lose the cap


Using a web browser to open your garage door? Sounds secure to me... Cool idea though.

230V WILL blow your arduino, no doubting that fact. A device made to function between 3 and 5v will not stand up to an AC of 230V. Get a step down onto this , 230 to 5v.

You might be best using a relay instead of connecting your arduino directly to a live circuit like that. I dont think a garage door would use a full 230V supply to open the door , I bet there is a step down later on in the circuit , maybe even a DC converter depending on the mechanism. Make connecting the arduino up to a 230v a last resort as , even if its on a step down , I guess it is possible that an electrical surge could fry everything on that circuit.

Also , don't fry yourself either.


There are tons of ways to see if the door is up or down that do not require you to hook up to 230VAC. So, my recommendation would be to investigate one of the alternatives, such as a magnetic switch (alarm company style reed switch or hall effect sensor), optical approaches (reflecting IR modules like the Toshiba series, for example), Ultrasonic (i.e. is there a reflection or not) or other similar means. Keep the Arduino isolated...

Now if the issue is not whether the door is open or closed but rather whether the relay is live or not, I wonder if you can't tie into the low-voltage circuit that powers the relay coil instead. Most PCBs inside appliances use micro-controllers (MCUs) that utilize a separate ULN2003a darlington chip to turn relays on and off. You could tie into the signal that comes into the Darlington IC (i.e. between the MCU and the Darlington IC) or sense the output of the Darlington driver IC. The only issue with the latter approach is that you may need to add a protection diode for any kick-back from the relay when it is de-energized from frying the LED.

Now if the question is whether the motor is stalled, I kindly suggest using a current switch like the ones made by CR magnetics instead of sensing voltage. Again, it isolates the Arduino, poses no voltage problems and is usually painless to integrate.


If you need to sense if there is 230VAC, have a small light bulb on the mains, and a photoresistor close by connected to the Arduino. Sort of a DIY optocoupler.


How's the roller door work?

If you open up the circuit there has to be a relay to open the door with, well, you could reroute those (gnd/+) to the arduino and then check the voltage from that if the signal >5v use a voltage divider.


i like to "hack" an garage door and want to controll the door with a webbrowser.
For this i need to check the actual status of the Door.

Here's what I did:

Reed switch with a magnet attached to the door.

Story here:

Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics


They make industrial models of those contacts, ive installed them for alarm systems beforr, maybe worth searching for as that doesnt look like it will last long


Mar 19, 2012, 02:19 pm Last Edit: Mar 25, 2012, 07:07 pm by mmoscz Reason: 1
check this post http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1235146158/2
, using a PS2501 optoisolator, but  I changed C1 to 0,033uF and R1 to 12K ohms to 230V, I don´t use the bleender resistor.

It works fine to me...
4x Duemilanove (clone)
Uno torrado (clone)
Amiga 1200 40MB
Windows XP


Mar 25, 2012, 06:53 pm Last Edit: Mar 25, 2012, 07:09 pm by da2001 Reason: 1
i don´t like to check the position by magnetswitchs. I think this is a simple way, but not the best and exact way.
mmoscz version is more helpfull for me, so i can also see in wich direction the garagedoor is moving at the moment.
The Webserver can deliver the actual status of it and the iphone app will show the status :)

Btw. Its not the problem to switch the garage door. i only need a relay that can switch a 14v power, but its just a single button for move-up/stop/move-down.

@Constantin i thought it would be better to check the 230v outputs of the controller, instead of soldering in the original circuit. :)


If you're someplace where 230 volts is the "standard" mains voltage, you should be able to find a relay with a coil voltage of 230 volts.  DigiKey or your local electrical supply house should have them.  Sorry -- I'm the States where the mains voltage is 120 volts.  And I know where to find relays with 120 volt coils :)

It sounds like what you really need is the position switch sensors other have mentioned.  Though what you =really= need to do is fully describe what you're trying to accomplish -- for my money, you need two sensors for the AC power and two for position.  There are five possible states -- traveling up, traveling down (that's your two AC sensors), closed and open (that's your two contact switches), and "stopped in the middle" (no AC, no contact closures).

Go Up