![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
..........
Last edited by Kyle-s4h; 6th January 2008 at 01:55 PM. |
|
|
|
|
|
|
(permalink) |
|
Is this an effort to avoid multiplexing and consuming I/O lines? The ADC has more accuracy than you need. Any variance is caused by the resistors and temperature. Yes, I would make a range for each button.
As for 9v to 5v operating voltage, as long as the ADC module uses a fixed reference voltage and the keypad buttons are connected to this same fixed reference voltage, you will get consistance results. But if you use a variable voltage as the source to the keypad resistors, then its a waste of time. I suggest a 5v or less regulator to power the circuit and a 3v zener as an external reference voltage. So do all the keypads feed into a single ADC input? Will you be perform dual button decoding? 3v / 12buttons = 0.25v per step. Plenty of room for 10-bits or 8-bit ADC. Last edited by donniedj; 8th August 2007 at 01:06 AM. |
|
|
|
|
|
|
(permalink) | ||||
|
Quote:
Quote:
Quote:
Quote:
|
|||||
|
|
|
|
|
(permalink) |
|
I have just finished up a test routine that scans the ADC results and issues results corresponding to my keypresses, and am able to set a "code" to compare a 4 digit entry to and respond to correct and incorrect entries -- so, the ADC routines are working as expected.
What I have noticed though is that they seem to be slightly erratic. The good part of that is that they are consistently erratic. |
|
|
|
|
|
|
(permalink) |
|
Key pad is battery powered with 2 9V batteries. Any idea why 2? Did you try with only one?
Where is your PIC powered from? Same battery? I suggest you do the follwing tests first to know how your keypad is working: 1) With power supply (not battery) set @9V press all keys one by one and measure the output with a voltmeter. That way you will know the voltage of each specific key. If the maximum readout is 5V you can't use a 3V zener as a voltage reference for the PIC ADC like donniedj suggested 2) Repeat those measurements for some voltages below 9V (8, 6, 5, 3) and see what happen with the voltage/key. As long as they are equal to the first measurement you're ok. If you see variations from a 6V power you need to monitor that voltage in your PIC and: a) give a "Change battery signal" or b) make the compare values dependent of the keypad battery power voltage. 3) Put all this data in Excell for "battery voltage dependent values" calculations. This is my learn, simulate, evaluate, coding approach Coding starts only when you know how it works and you know what you want Last edited by mcs51mc; 8th August 2007 at 06:36 AM. |
|
|
|
|
|
|
(permalink) | ||||
|
Quote:
Yes, the PIC is powered from the same battery. Quote:
The maximum readout will only be what I put into it. The ADC line (RA0/AN0) has a pull up resistor attached to the 5VDC power rail, which provides the power -- the ADC line of the keypad then drops this power by a specified amount due to the resistor attached to the specific key pressed. So, if I drop a 3v zener diode on the ADC line to the pic, voltages read back will be between 0-3VDC. What I do not quite understand is if it is better to have a lower "range" -- ie. 0-3VDC over 0-5VDC, as I have it setup now. Quote:
The "Change battery signal" will be implemented at a later date -- after I get everything else working. That shouldn't be too difficult. Quote:
It's really just a matter of testing, and more testing, and more testing.... it'll reveal it's secrets in time. I have it working now -- it only gets better from here! I'll update y'all when I have it working reliably. |
|||||
|
|
|
|
|
(permalink) | ||
|
Quote:
Quote:
Best of luck to you. Overall an interesting keypad and an interesting project.
__________________
L.Chung |
|||
|
|
|
|
|
(permalink) | |||
|
Quote:
Quote:
Where can you put something in ? Beside the control line for LED/peizo, these are all OUTPUT lines How many V do you have on the power out line? If that's 5V you maybe can use it to power your PIC. With nothing attached to the analog output line is there a voltage according to a key pressed on it? If yes you don't need to power that line, it's self powered from the battery. The problems you described earlier (Today 01:37 AM) maybe comes from the fact that you force some voltage on that line because of Quote:
After reading the user manual I'm pretty sure there's a PIC(-like) chip inside the keypad |
||||
|
|
|
|
|
(permalink) |
|
It was my error in the way I worded it -- sorry. There are two inputs and two outputs.
The ground and power (black and yellow) provide 9VDC to the lock body. (outputs) The green wire, what I call the ADC line of the keypad, is a resistor network and provides resistance only when NOT hooked to the lock body (even with batteries in the keypad). When the lock is hooked up to it, it has 3.44VDC applied to it (LaGard lock). Mine is using a 22K resistor attached to the 5VDC power rail. Either way, voltage is connected to ground through the keypad, so the ADC line would be a keypad input, requiring the voltage from the 22K resistor (from the lock) to pass through a resistor in the keypad to ground. The red wire is an input and controls the LED/piezo. The keypad does not have a PIC(-like) chip in it, the lock itself contains the µC. If you read the manual a little closer, you will notice that you require a lock body (part number 4100, for example) to make that keypad do anything -- it is simply an analog keypad. I am a distributor for the product, as well as a factory certified tech for the entire product line. I service these locks on a daily basis, which generally entails unit replacement, so I have never really gotten into the schematics of it before -- now it interests me. The batteries are going to be used to power the pic, which will be inside of a safe -- hence the reason to try and keep the wires to a minimum, and not have a Wall-Wart wired to it. There will be times when a Wall-Wart is warranted, but not in this case -- for development, OK -- batteries ain't cheap! So, eric1388, can you point me in the direction of a good regulator for use with 9VDC batteries (I did a quick search this morning and didn't find what I was looking for -- I look again after dinner, but it doesn't hurt to ask!). Oh, thanks, BTW, for the information -- I didn't know the 7805 would drain the battery -- but then I have to confess... I haven't read the datasheet on it too well. I have simply copied what I have seen in various schematics for the power supply portion of my tinkering. I was at Sayal Electronics today -- man, these guys don't know their A$$ from a hole in the ground without a part number. I looked at their regulator wall for 20 minutes and couldn't find anything on my own (back to the net for some research). I even looked for a 7803 (if that exists, I'll look at that later too) or something similar, hoping I could find get 3VDC regulated for a stepper motor I want to play with, which is 3VDC. I figured it would be a whole lot better than using a resistor to reduce the voltage, as it probably won't work well under load. Well, that's another post... sorry. Every part I was looking for "they could order" -- L298 or SN754410 H-Bridge, TIP107, TIP102, TIP112, 1N5817 (the list goes on, but these, I thought, were the common ones) -- I was frustrated today and put what else I had accumulated down and left. When I ask if they have any other H-Bridges, I get the blank stare and "what's the part number?". I think it might be easier to order things myself from DigiKey. |
|
|
|
|
|
|
(permalink) |
|
Thanks to clarify the wiring thing
Now the final question. Why the 22k resistor? If it's only a resistor network between green wire and ground you can connect power supply directly to it and also to the Vref of the PIC ADC. That way you will always have the same ADC data in your PIC whatever the power voltage (= ref voltage) to the resistor network will be. Don't care about diminishing power supply anymore Since you make your own system why not using 4 AA rechargable NiMh batteries? That gives you 4*1.2 = 4.8V / +2500mAh. Will last way longer than your 9V batteries I don't know PIC But check if it has idle state capability and use it |
|
|
|
|
|
|
(permalink) | |
|
Quote:
Some regulators have ground quiescent current in the uA range like 15uA or even 5uA. Trust that we should really retire the old faithful 7805 or 78L05 which consumes 3mA or more. Most PICs and AVRs operate well with this total current consumption or even less. @mcs51mc: The PIC is ok with 4.8V, but how about the lock mechanism? I don't think the original lock mechanism(motor, plunger or solenoid) operates with regulated supply. The difficulty is the OP can't "get" at the internal of the lock to separate the supply into two paths of 6V and 9V.
__________________
L.Chung Last edited by eblc1388; 9th August 2007 at 08:36 AM. |
||
|
|
|
|
|
(permalink) |
|
I've used the LM2936-5. It's a Low Drop Out - Ultra Low Quiescent Current regulator. Here's the datasheet: http://www.national.com/ds/LM/LM2936.pdf
It's expensive if compared with other regulators, but perfect when low quiescent current is required. |
|
|
|
|
|
|
(permalink) | ||||||
|
Quote:
Quote:
Here are some specs that I am seeing with these locks; Quote:
Using a large battery box by itself will produce; Quote:
As for "building my own", yeah, but I don't want to change the voltage on it for a couple of reasons. I am not designing "locks", perse -- I do not want to reinvent the wheel. What I am doing is trying to design a couple of different boards to meet specific needs within my industry. Accordingly, I will use what is available to me to avoid having to make what is already available. Meaning -- why design a keypad if I have one available to me already? Besides, when I get this pad working, I have a half a dozen others that can be utilized from the same company (even a couple with an iButton (1 Wire) port). LaGard also sells a lock body without electronics -- mechanical, with solenoid only. So, I don't have to design a lock either. I simply need to be the "go between man" between the keypad and the lock. The keypad is simply used for input -- the lock body is only used when I want to actually open the safe -- the board between is the important part! Quote:
( I appologize for bastardizing your screen name in my first post to you -- I thought I saw eric1388! Quote:
|
|||||||
|
|
|
|
|
(permalink) | |
|
Quote:
The resistor was put there in the first place because, although the resistor network would work fine under normal use, the pin on the PIC *could* go low during initialization and cause a direct short to ground if the power rail were connected directly, without a pullup resistor. |
||
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Analog Meter | windozeuser | General Electronics Chat | 19 | 3rd October 2007 02:44 PM |
| A/D, value for Vref on PICs for best accuracy. | Odin | Micro Controllers | 12 | 19th June 2007 03:04 AM |
| help on A/D conversion on pic18F2620 | lionman | Micro Controllers | 0 | 15th May 2007 03:28 PM |
| A/D problem | Merkur | Micro Controllers | 8 | 3rd February 2007 10:35 AM |
| Specifications Applied | Caltech | General Electronics Chat | 1 | 25th December 2003 05:00 PM |