Different behavior on 5v and digital pin (Electric gache)

Hello everyone,

Someone installed an electric gache on a door. Apparently it's working using 12v and there is a 230v -> 12v transformer powering the gache.

I wanted to plug an Arduino (UNO) on it to remote control the lock, but I'm experiencing a really strange behavior: When I connect the 5v pin to the lock (there is no polarity) and the other side to GND, it "clicks" and unlock. When I connect the 3.3v pin, it works too.

BUT... When I connect the digital pin 12 or 13 (OUTPUT + HIGH) it doesn't react... I've tried to measure what I could, I have 5v on 5v pin and on pin 12/13, I have the same intensity too, so I don't get what could be the problem.

Any idea?

An Arduino I/O pin can only provide about 20mA of current (absolute max is 40mA). If your lock is drawing more than that you risk damaging the Arduino.

You need to make a pencil drawing showing all the connections and post a photo of the drawing.

If you need the Arduino to control a larger current it is common to use the Arduino to control a transistor which acts as a switch for the larger current - probably from the 12v system intended for the lock.

...R

Robin2:
An Arduino I/O pin can only provide about 20mA of current (absolute max is 40mA). If your lock is drawing more than that you risk damaging the Arduino.

I'm doing it carefully and I'm only "powering" the lock for less than 1 sec. I'm just touching and at the first "clic" it's enough to unlock the door until someone open it. But thank you for the info. If I want to measure the current drawn, do I have to make my measures while the lock is continuously powered (or in other words, I let the switch closed) right?

Something else, even if I pay attention to this, do the pins 12, 13 and 5v delivers different currents?

Robin2:
You need to make a pencil drawing showing all the connections and post a photo of the drawing.

Concerning the connections... I'm directly connecting the pins to the lock and only "touch" the lock's connectors. But if it's still necessary, I will draw it.

Robin2:
If you need the Arduino to control a larger current it is common to use the Arduino to control a transistor which acts as a switch for the larger current - probably from the 12v system intended for the lock.

I have thought about using a transistor but locally (I'm in Congo) I couldn't find a reseller for 5v to 12v. I've tried to find a regulator, couldn't find 12v, only 24v output. Then I tried to find a 12v relay which can be controlled by 5v... None.

I have ordered these (transistor, relay AND regulator) for other projects, waiting few days to receive them, but I'm still trying to understand what could be different between the 2 pins.

Thank you for the info.

max13:
I'm doing it carefully and I'm only "powering" the lock for less than 1 sec.

One second is a very long time for an Arduino that does 16 million instructions in that time.

If I want to measure the current drawn, do I have to make my measures while the lock is continuously powered (or in other words, I let the switch closed) right?

I am not going to offer comments without seeing the wiring diagram that I requested. There is a too great risk of damage due to misunderstandings.

...R

max13:
Something else, even if I pay attention to this, do the pins 12, 13 and 5v delivers different currents?

No Arduino pin (or any other microcontroller) can drive a solenoid directly, ever. You do not do this,
its like using a piece of string to pull a car out the ditch - the string will be damaged.

You have likely damaged the Arduino pins you used on the solenoid.

Solenoids take high current (0.5 to 5A sort of range), and are highly inductive - this means unless
you use a suitable free-wheel diode or snubber you will get very high voltage generated which
damages your circuit.

Did you see this on the Arduino Playground: Arduino Playground - HomePage

That's the basic scheme, but you need to find out the current taken by the solenoid from its 12V
supply using a multimeter (or checking the specifications if you have them). You may need
a MOSFET if the solenoid is very high current, you likely need to use 150 ohm base resistor
anyway (that circuit isn't perfect alas).

Robin2:
One second is a very long time for an Arduino that does 16 million instructions in that time.

Well... I wrote 1 sec as an figure of speech (actually it's just a quick tap), but I understand it's already too long...

Robin2:
I am not going to offer comments without seeing the wiring diagram that I requested. There is a too great risk of damage due to misunderstandings.

Sorry for the mess. I'm not a pro, I have an arduino for years (Uno + Mega + Basic kits + GSM + GPS) in order to learn and have fun. But during that time, I didn't have a real life use, so I didn't face problem like these.

Anyway, I didn't know how to make clear draws, I have downloaded "Fritzing" to make correct schematics, and forgive me in advance, I don't find how to represent my lock. So I've replaced it with a LED...

So, basically, here are the draws:

  1. the working draw, showing direct connection between 5v, Lock and GND.

  2. The non working draw. What I can't understand, is that the 5v pin is activating the lock, but not the pin 12, which is "OUTPUT" and "HIGH", and correctly showing 5v on the voltmeter.

MarkT:
No Arduino pin (or any other microcontroller) can drive a solenoid directly, ever. You do not do this,
its like using a piece of string to pull a car out the ditch - the string will be damaged.

You have likely damaged the Arduino pins you used on the solenoid.

I didn't know that relationship between these components...

But lucky me, it seems everything is still working correctly (I think...).

MarkT:
Solenoids take high current (0.5 to 5A sort of range), and are highly inductive - this means unless
you use a suitable free-wheel diode or snubber you will get very high voltage generated which
damages your circuit.

Did you see this on the Arduino Playground: Arduino Playground - HomePage

I don't understand very well (yet) the relationship between the needed current and the output. Because for me (figure of speech) if there is not enough "electricity", the device isn't working... Is it specific to the solenoid, or do any component will draw what it needs?

I didn't see the playground, this type of schema is still hard to understand at first sight because I don't know yet the basic components.

MarkT:
That's the basic scheme, but you need to find out the current taken by the solenoid from its 12V
supply using a multimeter (or checking the specifications if you have them). You may need
a MOSFET if the solenoid is very high current, you likely need to use 150 ohm base resistor
anyway (that circuit isn't perfect alas).

I will check the current tomorrow in the morning. I understand the use of the MOSFET, but what about the resistor? Is it to avoid the solenoid to draw too much?

Your diagrams appear to have LEDs in them. They are not mentioned earlier in the Thread. You should not be using an LED without a current limiting resistor.

Make a drawing showing all of the connections for the lock with everything properly labeled.

...R

Robin2:
Your diagrams appear to have LEDs in them.

max13:
I don't find how to represent my lock. So I've replaced it with a LED...

Here is a pencil draw.

Thank your for your help.

As I said in Reply #1 I think you need to use a transistor to switch the higher current required by the lock. Have a look at this link. I think it should work with your lock in place of the buzzer.

There are lots of other circuits on that website.

...R

First thing is to find out the current draw of the solenoid. Then you can choose a transistor / MOSFET / relay
or whatever to drive it.

MarkT:
First thing is to find out the current draw of the solenoid.

Unfortunately, I noticed (with our electricians) that our ampere meter isn't working (but working with other functions) and shows 0...

So, I remembered Ohm's law, and I tried to measure the resistance at the solenoid's poles and it's showing 11.0 Ohm. So, I guess, the current drawn should be 1.09 A, right ?

If it's right... Well... Poor arduino...

In that case you will need a MOSFET to drive it, a logic level n-MOSFET to be exact. You will
need a freewheel diode to go across the solenoid, and a resistor of 150 to 1k or so between arduino
pin and the MOSFET gate. 10k or higher resistor between gate and source to keep it off during
resets / powering up.

Checkout this example circuit:
http://www.g7smy.co.uk/?p=595

Thank you for the tip. Can you tell me about the resistors and the diode, why are they useful?

I'm buying everything today, but I still can't understand why the lock is opened using the 5v or 3.3v pins and not the others, does anyone know why?

Without the diode the inductive load will easily destroy the MOSFET - inductive loads kick back hard.

The resistor on the gate prevents over-current on the Arduino pin. The datasheet isn't very clear about
the max pulsed currents on an Arduino pin, but if you go by the abs max current on a pin of 40mA
this suggests a 150 ohm gate resistor.

Your solenoid needs about 1A to operate - 40mA will never do it. Power is power, signal is signal.
Signals convey information, power delivers power. Signals always carry some power, but it is measured
in milliwatts or microwatts, not watts.

MarkT:
Power is power, signal is signal.
Signals convey information, power delivers power.

I have never thought this way... Well, thank you a lot for all this help. I have bought few things and I will try this when I'm back.

So when you suggest me to use a MOSFET, you're basically transforming the little power carried by the signal, right ?

If I wanted to send just a burst of power to the solenoid (when clicked, it's unlocked until you push the door), will it work if I use a capacitor just like camera's flash work?

The mosfet is used as a switch.

5volt on the gate turns the mosfet switch "ON".
0volt on the gate turns the mosfet switch "OFF".

How long you want the switch to be "ON" can be done in software.

About the current of your DMM not working.
Usually a blown fuse inside the meter, the small (500mA) one.

If you can't get a logic mosfet, use a darlington power transistor, e.g. TIP120-122
Leo..

max13:
I'm buying everything today, but I still can't understand why the lock is opened using the 5v or 3.3v pins and not the others, does anyone know why?

When you use the 5v output you are drawing current from the 5 volt regulator directly.

When you hook up to a digital pin it is being drawn from the chip (max 40ma)