Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Rookie needs help with keypad circuit design

ac-dc

New Member
I need help with circuit design for a door lock keypad.
Currently there is a door lock that uses MiFare proximity cards only and the mfgr discontinued the version that had both prox and keypad.
So my hack is to add 3 mom contact buttons and a circuit to interrupt the connection between the existing prox pcb and actuator lock/unlock motor. (DPDT reed relay I am thinking)

I am an electronics rookie, conversant in discreet components and handy at circuit construction, but have a hard time spelling IC..

Here are some of the design requirements:
I have physical space inside the door lock of about 4 AA batteries rafted together to put all this in.
Needs to be able to run on 3 AA batteries, with very low standby current draw.
Does not have to be high security, a 4 digit code is fine (could even be 3 worst case) and does not have to be changeable.
Lock actuator is a DC motor that spins 1 direction once unlocked, then reverse polarity 4 seconds later after you have rotated door lever to lock again. So my circuit has to do this also.
Motor runs on 4.5v from batteries.
I am sure I have forgotten something, but just ask.

Thanks in advance, James
 
Reed relays have very fragile contact, the are not good for things that may take current surges.
I'd suggest two conventional miniature DPDT relays; they can be smaller than reed relays.

The idea sounds workable, just cascade through the two pairs of normally closed contacts in the relays, with the motor at the relay common side. Connect the NO contacts to power & ground, one each polarity.

A control circuit could be built with such as a PIC MCU to read the keypad. Those can be configured to "sleep" with the power consumption down to a be microamps.


The battery voltage is the one thing that concerns me, if that's what the card reader is operating on??
Whether you use primary cells or rechargeable, the cell voltage when they are getting near the end of their life is down to near 1V per cell.

eg. A properly designed device that uses four AA cells would be able to operate down to 4V.
It would work on three new cells (4.5V) but have a very short working life with those as the voltage will fall below 4V when only a small part of the cell life has been used.

If the batteries are just for the add-on function, will the lock motor work down to 3V??
 
Thanks JRW.
Got it on the Reed relays.
I will look into PIC-MCU,
The card reader and motor run on 3 AA batteries, the physical space I have for the new circuit is about 4. (so worse than you thought) And the 3 AA are not rechargeable and will need to run the card reader board, motor and new circuit. The card reader board and motor are part of existing design so I assume they have taken the low batterie voltage issue into account and I cant change that. I just have to make sure the new circuit works down to 3v.

So to recap, functionally this thing needs to:
Have 2 DPDT relays (im thinking is series) where the motor is the common poles, NC poles are connected to card reader board and NO poles are connected to the batteries, each relay a different polarity. (such that the new circuit could never back feed into the card reader board)
Once keypad circuit is engaged, 1 of the above relays coils gets energized for 1 second to move motor 1 direction, (unlock and you open door) then 4 seconds later other relay is energized to move if back (locked).

See below
20231107_130231[1].jpg
and let me know what you think.
 
let me know what you think.
That looks OK, it's the same relay contact configuration as I was trying to describe.

A lot of PICs have an interrupt-on-change feature, where you can configure inputs to cause an interrupt if the pin state changes - ie. with a button press.

That means the CPU can be in its lowest power mode and "wake up" when a key is pressed, rather than having to scan the keys all the time.

I'd suggest a PIC16f18323 or 16F18446. Those are 14 pin and 20 pin respectively.

You need five pins to connect eg. a PICKIT programmer / debugging tool to the circuit; power, ground, reset and two specific data pins. That leaves you nine or fifteen i/o pins.

If you got it working with a 18323 and you need no more than six I/Os, you could reconfigure the pins if the program and use a 18313 for the final device - those are eight pin! Not enough for in circuit debugging if more than three I/Os are used, but if it's working fine it does not matter.

You would need transistors to drive the relay coils, either small MOSFETs or bipolar ones, with turn off resistors and for bipolar, base resistors. Plus flywheel diodes across the relay coils.
Other than that, just decoupling capacitors and not much else.
 
Great thanks,
I like the interrupt-on-change idea.
I just started looking at the MPLAB IDE and its a bit intimidating for me, I cant tell if I will need to know C to get it to work (which I dont want to do) I really need a tool that is IF-THEN driven and it writes the code. Also I dont understand why I would develop with 1 PIC and use another for final? Would you suggest youtube or microchip's site for for learning MPLAB ap?

Would it be too much to ask you to draw the schematic between the PIC and a relay and suggest components? plus where do the decoupling caps go?
 
Both, I believe - the configurator works out the internal MCU configuration code, the IDE allows you to edit programs.
You also need XC8 which is the actual C compiler that's used by the IDE.

Install the IDE first.
 
Directly across VDD and VSS (V+ and 0V) on the PIC.

Typically a 0.1uF ceramic to handle high frequencies, and an electrolytic cap, eg. 100uF or 470uF at 10V 16V.
(I'm suggesting a bit larger than normal due to the supply current varying with the relay coil switching).

I often put the ceramic under the IC, in a gap in the IC socket - that both saves board space and minimises the connection lengths to the IC pins.

ps. The idea of changing the type of MCU was just if the available space was really tight, you could save a bit by using the smaller IC once you were pally with the program - but the smaller one does not have enough pins to do what you need and use the in circuit debugging features of the PIC devices, so it's easier to use a larger one initially.

If there is enough room to use the 14 pin one in the final design, just stick with that.

ps. I use the MPLab IDE and debugging tools, but with a different C compiler that works rather differently for the configuration side etc., so I'm not really familiar with MCC..
 
Ultimately went with Arduino Pro, as IDE was much easier for me to learn being a beginner.
Was able to get the standby current down to 0.1uA, which I think is lower than the natural decay of batteries on shelf.
Had to use small SSR's instead of transistors for relay drive as motor noise fed back and drove the MCU crazy.
Learned a lot on this project and I appreciate everyone's help!
 
Ultimately went with Arduino Pro, as IDE was much easier for me to learn being a beginner.
Was able to get the standby current down to 0.1uA, which I think is lower than the natural decay of batteries on shelf.

I design and build long life battery powered systems, and in our marketplace the target is to get below 100uA - we also use special long life Lithium Thionyl Chloride batteries to give in excess of five years battery life.

Had to use small SSR's instead of transistors for relay drive as motor noise fed back and drove the MCU crazy.
Learned a lot on this project and I appreciate everyone's help!

That seems highly strange, more likely you'd done something wrong somewhere, perhaps poor layout?. Transistors and relays are pretty universal for switching motors etc. and work without problems. Still, job sorted, that's all that matters.
 
Thanks Nigel,

Yeah I was very happy with 0.1uA, what is interesting is that the clone Arduino I first got, would only go to 3mA in sleep mode, which is a no-go.. chinese junk..

On the noise problem, when I changed from transistor to SSR, I also added 300uh chokes on each motor leg, so not sure which was the culprit. I was thinking opto isolation would be good..
 

Latest threads

New Articles From Microcontroller Tips

Back
Top