I am using Steve Hoefers code for a secret knock detecting door lock
I uploaded to an uno (clone) with a servo motor, see pics, works great.
I would like to modify the code and circuit to run an electronic lock. I have made a couple of attempts at this already and I have already locked up two other uno's.
Please see the photos for the current code's circuit and for specs on the electronic lock.
Any help or pointers in the right direction would be great. Thanks.
If the latch requires power to hold it locked, it requires your logic to supply power to,the latch whenever it is required to be locked. This could be bad as if the power turns off, you lose your security.
My first reply was to tell you how to connect the supply to the relay. You cannot drive the latch directly from the Arduino output.
When connected to an external power supply "vin" supplies 12v no, why the need for a relay?
Concerning the security issue of power going out and door opening, for my project this necessary for safety, the lock is stopping people from getting out, if the power goes out, the door opens.
OK, so, I need a MOSFET and will follow tutorials such as this one..
This should power the lock without frying my arduino's. Yes, ouch, I assume those boards are dead now if I connected the lock directly to the arduino's?
If you applied 12v to an I/o pin then there is a good chance their toast.
A relay or mosfet will work, but that tutorial is misleading
Most mosfets need higher gate voltage.
mosfets designed to work well with 5v gate voltage are called logic level mosfets.
There is much to consider in picking the right mosfet.
And unfortunately I am not skilled enough to pick one of the top of my head for you.
But there are plenty others here who can.
Perhaps it would be easier to do as weedpharma suggested and use a relay instead? Simpler?
All the tutorials I find make this all seem rather easy but when you are a newbie (as I am) a lot can go wrong, which can end up costing money and time.
Seems rather difficult and a lot to understand just to power something over 5v.
Where I am now: the code is mostly done, just change out the servo code for digitalWrite, either add a relay or a MOFSET to power the lock, either one I will have to learn how to do, it seems tutorials are a hit or miss.
Yes while arduino made this stuff a lot easier than it used to be,
programming & electronics can both be daunting subjects especially if you trying to learn both at the same time.
But hey that is what this forum is for, so we can help each other figure this shtuff out.
if you search ebay for "arduino relay" you will find lots of relay boards set up to be used with arduino.
That tutorial refers to a 5 volt relay board which will work fine, but if you get a 12volt board you can use the 12v power supply that powers your lock . saving you from needing a separate 5v supply
The wiring is the same you just hook up 12v to JDVCC
and 5v from arduino to VCC.
That is with the jumper removed of course.
7m535:
Concerning the security issue of power going out and door opening, for my project this necessary for safety, the lock is stopping people from getting out, if the power goes out, the door opens.
Interesting - you want people to be trapped in there unless you knock correctly or the power is cut to the lock. You've piqued my curiosity.
Some strange sort of prison? And the inmates can escape during blackouts?
Or is it to keep your workers from wandering? Nose to the grindstone, so to speak.
And there's a major fault in the logic of a secret knock lock. Anyone within earshot can hear your 'secret code' and duplicate it when they want, including your 'prisoners'.
Hutkikz:
if you get a 12volt board you can use the 12v power supply that powers your lock . saving you from needing a separate 5v supply
The wiring is the same you just hook up 12v to JDVCC
and 5v from arduino to VCC.
That is with the jumper removed of course.
I just received the 12v relay board. I am confused as to how the wiring would be the same. I don't understand how to connect the lock. The diagram below I think won't work.
This thread explains it well 8 Channel Relay and has a better diagram.
The important things to remember are to remove the jumper connecting VCC to JDVCC and don't connect ground from the relay to the Arduino.
5v from arduino goes to VCC. I/O pins go to relay inputs.
12v goes to JDVCC. 12v ground goes to relay ground.