Arduino Forum

Forum 2005-2010 (read only) => General => Exhibition => Topic started by: neonpolaris on Mar 11, 2009, 02:44 am

Title: Car Keypad
Post by: neonpolaris on Mar 11, 2009, 02:44 am
Hey everyone.  After having it sit around unfinished for a few months, I finally finished my car door keypad code.  The keypad is a five button keypad from a ford explorer, interfaced with my arduino and ready to be embedded into my Dodge.  The software is 100% finished and now I'm letting the hardware run on 12v for a while in my house before I take the plunge and cut the hole in my door.

Basically, you type in the combo and it unlocks your doors. (closes an optical relay)  If you press the last two together, it locks your doors.  The backlight lights when you press a button, and goes out 4 seconds later.  The entered code is sliding, so if the code was 12345, you could press 5512345 and get in.  I thought about not having it this way, but I'd rather not have to wait if I mispress.  I mean, no one is really going to try and brute force it, so I'm not worried.  The entered code is cleared after the same timeout as the backlight.

This is my first real project, so it may be kind of hard to read.

Code: [Select]
// Car Keypad
// Version 0.20 beta
//
// Michael Casson Rogers (michael.casson@yahoo.com)
// March 10th, 2009
//
// Takes input from keys, compares last 5 pressed keys to the pre-programmed code.
// If last 5 pressed keys are the same as the code, unlock door.
// If last two buttons are pressed simultaneously, lock door.
//
// Input keys are assigned values starting with 0 for the first, 1 for the second, etc.
//
// Time out (reset input keys) after programmable time (default 4 seconds).
//
// For this program I borrowed heavily from Simple Simon 2.0 by Gian Pablo Villamil
// http://itp.nyu.edu/~gpv206/2006/09/simple_simon_v2.html
//


// Define the pins the lock and unlock relays are connected to.
#define UnlockPin 18
#define LockPin 19

#define BackLight 17 // Define backlight pin.

#define DebounceTime 20 // debounce time in milliseconds
#define TimeOutTime 4000 // timeout in milliseconds

// Define the pin assignments for the input switches
#define ButtonStartPin 2
#define ButtonEndPin 6

// Set how many buttons
int ButtonValues = ButtonEndPin - ButtonStartPin ;

int codeLength = 5; // Set code length
int CodeArray[5] = {1, 2, 4, 1, 0}; // Enter desired combination code here, must match codeLength
int InputArray[5] = {9, 9, 9, 9, 9}; // Starts InputArray with all 9's

// Remember when last press was for timeout function.
// Also, set lastPress as having just timed out so that the backlight doesn't light for the first few
// seconds on initialization because lastPress and millis are both zero.
unsigned long lastPress = millis() - (TimeOutTime + 1);

// Define inputScore (used to compare InputArray to CodeArray)
int inputScore = 0 ;
// Define rightAnswer (set to true when code is validated)
int rightAnswer = false ;

// counter for debouncing routine
unsigned long SwitchDownTime ;

void setup () {
//Serial.begin(9600);           // set up Serial library at 9600 bps, used for debugging.
pinMode(LockPin, OUTPUT);
pinMode(UnlockPin, OUTPUT);
pinMode(BackLight, OUTPUT);

for (int i = ButtonStartPin; i <= ButtonEndPin; i++) {
pinMode(i, INPUT);
}

}

// Main loop - should be easy to follow
void loop () {
getAnswer () ;
timeOut () ;
checkAnswer () ;
if (rightAnswer) {
Success();
}
}

// Get the user's button presses and store it in InputArray
void getAnswer () {

for (int i = 0; i < codeLength; i++) {
 for (int j = 0; j <= ButtonValues; j++) { // poll the switches
   if (digitalRead(ButtonStartPin+j)) {  // If current polled button is down
     SwitchDownTime = millis() ; // Record time it went down (for debounce)
     digitalWrite(BackLight, HIGH); // Light backlight while pressed
     lastPress = millis() ; // Needed here to light as soon as button is pressed
     while (digitalRead(ButtonStartPin+j)) { // While a button is pressed
       if (digitalRead(ButtonEndPin - 1) && digitalRead(ButtonEndPin)) { // If the last two are pressed together
         digitalWrite(LockPin, HIGH); //
       } else {
         digitalWrite(LockPin, LOW);
       }
     }

     if (millis() - SwitchDownTime > DebounceTime) { // If button was down longer than debounce
       InputArray[0] = InputArray[1];
       InputArray[1] = InputArray[2];
       InputArray[2] = InputArray[3];
       InputArray[3] = InputArray[4];
       InputArray[4] = j;
       lastPress = millis() ; //Needed here also, in case button is held down for more than timeout value
     } // end if
   } // end if
 } // end for
} // end for
} // end GetAnswer

// Compare CodeArray with InputArray
void checkAnswer () {

// Print current InputArray
//for (int i = 0; i < codeLength; i++) {
//  Serial.print(InputArray[i]);
//}
//  Serial.println(" ");
// End print current InputArray
   
inputScore = 0;
for (int i = 0; i < codeLength; i++) {
if (CodeArray[i] == InputArray[i]) {
inputScore = inputScore + 1;
}
}
if (inputScore == codeLength) {rightAnswer = true;}

}

void Success () {
digitalWrite(UnlockPin, HIGH);
delay(100);
digitalWrite(UnlockPin, LOW);
clearArray () ;
rightAnswer = false;
}

void timeOut () {
if (millis() - lastPress > TimeOutTime) {
 clearArray() ;
 digitalWrite(BackLight, LOW);
 lastPress = millis() - (TimeOutTime + 1); //lastPress follows millis() just outside of timeout, to prevent problems with millis rollover lighting backlight after 50 days
}  else {
 digitalWrite(BackLight, HIGH);
}
}

void clearArray () {
 InputArray[4] = 9;
 InputArray[3] = 9;
 InputArray[2] = 9;
 InputArray[1] = 9;
 InputArray[0] = 9;
}
Title: Re: Car Keypad
Post by: neonpolaris on Mar 11, 2009, 03:48 am
Photos:

(http://farm4.static.flickr.com/3013/2942354831_57e9d62f86.jpg)
Quick Keypad for writing software

(http://farm4.static.flickr.com/3112/3345974022_67c279cd31.jpg)
Running in the house.

(http://farm4.static.flickr.com/3323/3345974072_6904996472.jpg)
I really should have etched a board for this.

(http://farm4.static.flickr.com/3411/3345138827_4e31326e2d.jpg)
Schematic, quick and dirty.

(http://farm4.static.flickr.com/3551/3345138859_439de24253.jpg)
The actual keypad it's wired to.

I had some shots of the board before I soldered the nano on it, so you could see the rest of the circuit, but I can't seem to find them.

The screw posts were mainly for testing, I wanted to solder my connections in permanently (connected to car with waterproof plugs) but I'm not sure if I'll bother to remove them when I install.  Anyone think they'll loosen and let go with time?

--

Also, as to not drain my car battery, I wanted to make it as low powered as possible.  I removed the power LED, but not sure how else to lower power.  It has to be available all the time, so the powered down modes of the chip wouldn't seem applicable.  It's pretty low power now, so I suppose I shouldn't worry about it.
Title: Re: Car Keypad
Post by: florinc on Mar 11, 2009, 04:38 am
Good stuff!
A suggestion, if I may, for the version 2: make it remote controlled, with an IR receiver inside the car. No car thief uses a TV remote control.


Title: Re: Car Keypad
Post by: italoraony on Mar 11, 2009, 05:12 am
Will you leave the option to open using the key?
Title: Re: Car Keypad
Post by: koyaanisqatsi on Mar 11, 2009, 06:15 am
Pretty slick!  Here's another suggestion: make it honk the horn if the entered code is incorrect three times within a certain period.  That should help deter tampering.
Title: Re: Car Keypad
Post by: follower on Mar 11, 2009, 09:39 am
Quote
It has to be available all the time, so the powered down modes of the chip wouldn't seem applicable.

You want to look at using one of the external or pin change interrupts to wake the processor in sleep mode. That would work in your situation AFAICT.

--Phil.
Title: Re: Car Keypad
Post by: neonpolaris on Mar 11, 2009, 01:24 pm
Quote
A suggestion, if I may, for the version 2: make it remote controlled, with an IR receiver inside the car. No car thief uses a TV remote control.

I've considered that, or RFID, but really my problem is always running out to my car and forgetting my key.  This way I don't need anything (remote, tag, key, fob) on me to get in.

Quote
Will you leave the option to open using the key?

Of course!  I didn't remove any functionality from my car.  To lock and unlock my car, all i had to do was close two wires already in the door together with either a 1k ohm resisitor (lock) or a 330 ohm resistor (unlock).  I wired those with tiny solid state relays on the board.  They are actually under the nano.

Quote
Here's another suggestion: make it honk the horn if the entered code is incorrect three times within a certain period.  That should help deter tampering.

I'm not really worried about anyone brute forcing the password.  I could make the code longer if I was worried.  I'd rather not have the car make noise.  Just my personal preference.

Quote
You want to look at using one of the external or pin change interrupts to wake the processor in sleep mode.

I've glanced over them before, but I didn't get a real solid grip on it.  Maybe I'll revisit it in the next few days.
Title: Re: Car Keypad
Post by: neonpolaris on Mar 11, 2009, 06:43 pm
As far as the sleep mode, it looks like I'd have to change the status of one of two pins to wake it.  Even if I made that pin one of my key's pins, it would only wake on that one key press.  I'd have to use it as my first number, and it would be obvious since the backlight wouldn't work until that one was pressed.

I can't think of how I would tie all five keys to change the state of the one pin without wreaking havok on my code entry.
Title: Re: Car Keypad
Post by: ckiick on Mar 11, 2009, 07:25 pm
Hi,
 about pin change interrupts. You would have to read the datasheet for the Atmel to get an idea of how to use the PCints.  But they do exactly what you want: when ANY of a set of pins changes, an interrupt can be generated.  It's easier when they are all on the same port, but it can be done.

As for power saving.  I don't know a lot about sleep mode, but there are several bits that turn off pieces of the chip that aren't used.  like analog input, secondary timer, UART, TWI etc.  Again it's in the datasheet. It saves some power when running, but sleep mode is probably going to save more.

HTH,
Title: Re: Car Keypad
Post by: italoraony on Mar 11, 2009, 07:26 pm
Connect a second wire from all keys to a interrupt pin. Probably, to avoid trying to awake the uC every time you press a key, you'll need a "state variable" telling you if the uC is awake or sleeping. I think it works...
Title: Re: Car Keypad
Post by: neonpolaris on Mar 11, 2009, 07:58 pm
Thanks chiick, I'll have to do some reading.

Lima, wouldn't that tie all of my buttons together?  Then pressing one presses all?

I wonder how much my car actually pulls when it's off.  I'll have to go measure sometime soon.  If it dwarfs what the nano is using now, I won't worry about it.  I'm really ready to be done testing and eager to install.
Title: Re: Car Keypad
Post by: koyaanisqatsi on Mar 12, 2009, 05:09 am
Quote
wouldn't that tie all of my buttons together?  Then pressing one presses all?

Actually that will work if you isolate the buttons with diodes on the lines going to the interrupt pin.
Title: Re: Car Keypad
Post by: neonpolaris on Mar 12, 2009, 02:27 pm
It looks like the only real considerable power savings comes from power-down.  To come out of power-down I would need to bring either pin 2 or 3 LOW.

The problem is, those pins are already held LOW all the time in my circuit.  (HIGH when button pressed) Perhaps for version 2.

If a typical car battery is about 45 amp hours, and I'm pulling 20mA or so, does that mean it would have to run for 1125 hours (almost 47 days) to half-discharge the battery?
Title: Re: Car Keypad
Post by: koyaanisqatsi on Mar 13, 2009, 02:19 am
Quote
If a typical car battery is about 45 amp hours, and I'm pulling 20mA or so, does that mean it would have to run for 1125 hours (almost 47 days) to half-discharge the battery?

Yup.  Unless something shorts out, you won't drain the car battery with the Arduino.
Title: Re: Car Keypad
Post by: neonpolaris on Apr 20, 2009, 05:53 am
Just as an update, I've decided to go with a different keypad. You see, the one pictured above has a solid membrane across the front. The first few buttons had a nice tactile response to being pressed, that is, you could 'feel it' when you pressed the button. But the last two, although they did work, didn't feel like you were doing anything. Since I'm ridiculously picky (and worried about longevity) I found another keypad. I found this one on a 2008 Escape: (Although it's on heaps of other models/years)

(http://farm4.static.flickr.com/3401/3421420250_ffe51f9d41.jpg)
http://www.flickr.com/photos/43268066@N00/3421420250/

It has a nice feel, is good enough for Ford to use on their vehicles now, and still has the backlight. Unfortunately, it is not wired the same internally, so my old board is useless. I rewrote my program to handle the new keypad properly, but I still needed a new board. Instead of making another monstrocity like that first board, I learned enough Eagle to design a PCB and I've already sent it off to be profesionally fabbed. So now I'm waiting on this to come in the mail (a couple more weeks to go):

(http://farm4.static.flickr.com/3299/3421437586_ac8b9f4177_o.png)
http://www.flickr.com/photos/43268066@N00/3421437586/

Note: That 1K resistor on the right side, above the 330, is incorrectly labelled. It should be 100. This board should fit just perfect into a radioshack 1x2x3in project box, and already have holes drilled to line up with the internal mounts in it.

I have the weather-proof external connectors, all my headers, resistors, internal connectors, and optical relays also. This board is more modular than the other one with quick disconnects for all external connections, and I'll be able to easily remove the Arduino Nano for reprogramming. I think I'll stick it in the door with some servo tape, and see how it holds up.

I'll post more when I get the pieces in!
Title: Re: Car Keypad
Post by: neonpolaris on Apr 30, 2009, 03:45 pm
My board came in today and it looks good!  I can't wait to get home and try it out.  I ordered two, just in case I royally mess the first one up on assembly. :)  I really would hate to have to wait a whole extra month.  I'll post more pics when I get it all put together.

(http://farm4.static.flickr.com/3580/3488071985_7b9372cc24.jpg)
http://www.flickr.com/photos/43268066@N00/3488071985/

(http://farm4.static.flickr.com/3302/3488887204_7663c7f4d6.jpg)
http://www.flickr.com/photos/43268066@N00/3488887204/

Title: Re: Car Keypad
Post by: neonpolaris on May 06, 2009, 10:59 pm
So here I am, closer to the inevitable car door cutting.

Populating the board:
(http://farm4.static.flickr.com/3340/3508647444_bf4443b713.jpg)
http://www.flickr.com/photos/43268066@N00/3508647444/
I got a little better as I worked from right to left. I didn't realize how little solder that SMD parts required.

All assembled:
(http://farm4.static.flickr.com/3379/3507836857_ab5ca46ba3.jpg)
http://www.flickr.com/photos/43268066@N00/3507836857/

Testing the board:
(http://farm4.static.flickr.com/3339/3507836899_d71eb60877.jpg)
http://www.flickr.com/photos/43268066@N00/3507836899/
Everything works perfectly!

Fitting into the box:
(http://farm4.static.flickr.com/3650/3508647580_ec41a69237.jpg)
http://www.flickr.com/photos/43268066@N00/3508647580/
The screw holes line up perfectly. The connectors on each end were a bit taller than I had expected, though. The lid still closes, but it pinches the wires a bit. I'll trim a little useless plastic off the top of the connectors and it should be fine.
Title: Re: Car Keypad
Post by: george_graves on May 11, 2009, 07:40 pm
VERY COOL - I love to see an arduino put to use in the "real world"

I didn't see much power protection going on there.  What are you doing to keep away nasty voltage spikes and reverse voltage?

(a car's power is notoriously bad)
Title: Re: Car Keypad
Post by: neonpolaris on May 12, 2009, 05:30 pm
Thanks George!

I'm not exactly an EE, so I'm real green on most of this.  I knew that car voltages can be nasty, but as per other discussions around these forums, people have been running Arduinos from cars seemingly fine.  The datasheet for the Nano says it should be ok up to 20v.  I hadn't even considered reverse voltages at all, does this tend to happen on a car?  For reverse voltage, one would throw in a diode on the power line?  As for the spikes, a capacitor on the power line?

Honestly the only thing I considered was a drop in voltage on cranking the car.  I doubt much that anyone is going to be using the keypad while cranking, so I didn't think a restart would hurt anything.  I suppose that the dip could lock up the chip instead of just restarting it.  I'll be actually running it in my door soon, so I'll have to see.

If you have any good suggestions for cleaning up the power, or maybe a good place to look, let me know.
Title: Re: Car Keypad
Post by: designer2k2 on May 12, 2009, 05:59 pm
great project  :)

you should consider some safety for the arduino, there is quite some noise there!

i made this:
(http://lh3.ggpht.com/_06lZfFsoZas/SejGUBsSSFI/AAAAAAAADGE/vHnOhqNCaHk/s800/PowerSupply.JPG) (http://picasaweb.google.at/lh/photo/XfQQ4t57ZujKV4wVzmg48A?feat=embedwebsite)

just take the input part, that should block the biggest problems
Title: Re: Car Keypad
Post by: neonpolaris on May 12, 2009, 09:14 pm
Thanks!

So the 1N diode keeps the current from flowing backwards, the zener diode would cut out voltages above 15v, and the choke would clean up the power a bit.  What exactly do the two different caps do?  Decoupling to clean up the power?  Something else?

I assume that everything to the right of C3 I should ignore, as I don't want to reduce the voltage to 5v?
Title: Re: Car Keypad
Post by: designer2k2 on May 12, 2009, 10:30 pm
Yes, you dont need C3,IC1,C2 when it should only protect  ;)



L1 blocks HF noise (should be 2A cappable).

the 1N makes in case somebody messed up the polarity a safety, and in case the input drops it prevents the C1 from getting discharged.

D2, can also be a 20V type, this limits the voltage.

C1 (Ultra Low ESR) smoothens out small ripple.

C3 could be removed, but im used to always put C3 and C2 with a 7805  :)
Title: Re: Car Keypad
Post by: neonpolaris on May 12, 2009, 10:57 pm
Maybe I'll work this into my board when I get home.  This would mean waiting another MONTH before I could install, though.  Ugh.
Title: Re: Car Keypad
Post by: KG2 on May 13, 2009, 08:05 am
Nice and clean prototype work,  First class job.
Keep on building,
make stuff.

KG2
Title: Re: Car Keypad
Post by: kev on May 13, 2009, 06:27 pm
hmm, nice =P
Title: Re: Car Keypad
Post by: kev on May 13, 2009, 06:32 pm
where did you make your own pc board =D


id like to make my own ;D
Title: Re: Car Keypad
Post by: neonpolaris on May 13, 2009, 08:30 pm
I used http://BatchPCB.com, which is a service of SparkFun.  It's relatively cheap, but it takes a month or so to get your board.

You'll need to learn Eagle (or similar).  There's a tutorial on PCB layout using Eagle on SparkFun's site here:
http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=109
Title: Re: Car Keypad
Post by: kev on May 13, 2009, 09:14 pm
wow >_>

well, i can wait a mont to get started on arduino sheild making lol
Title: Re: Car Keypad
Post by: neonpolaris on May 14, 2009, 04:54 am
Would this work for L1?
http://www.mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMsg%252by3WlYCkUzVCd1mk%252bcol1TAFnl1vgYE%3d

And for C1, can I use a ceramic here, or only electrolytic?  I'm thinking of longevity and temperature sensitivity, but I'm not terribly sure of when I can use one.  If ceramics are non-polar, can they always replace the others, but not the other way around (like when dealing with AC)?


----
Edit:

Ok, here's the cart I'm looking at, ignore the amounts:
http://www.mouser.com/ProjectManager/ProjectDetail.aspx?AccessID=e91ded73b4

I may not have room for that choke on the board!
Title: Re: Car Keypad
Post by: designer2k2 on May 14, 2009, 08:22 am
yes, that L1 looks good!

for C1 it should be a ultra low ESR electrolytic. Thats becouse they are like the "fastest" and you can get them with big F values.
elextrolytic is fine, as long as you dont take the super cheap ones.
my C1: http://shop.conrad.at/ce/de/product/445903/KONDENSATORULTRA-LOW-ESR220F35V
its rated with 6000h at 105°C, that should be enough...

in your chart you have a 220pF, what should be a 220µF  ;)
and with a 20V zener diode your still safe but it will not be so close to trigger unwanted (14,4V is quite common in a car)

thats how this looks in my prototype:
(http://lh5.ggpht.com/_06lZfFsoZas/SejBZ4NFW1I/AAAAAAAADF8/yVGxuKfqumI/s400/170420091284_small.jpg) (http://picasaweb.google.at/lh/photo/-sgQspIxHRdZxLiLnuHtRA?feat=embedwebsite)

(my 1N is a little oversized, had no smaller around ::))
Title: Re: Car Keypad
Post by: neonpolaris on May 14, 2009, 02:22 pm
Thanks for taking the time to help me like this, I really appreciate it.

I may have to turn my nano sideways to fit the inductor on there.  I have room on the bottom of the board for the smd components, but I dont think I have enough room on the bottom for that.

Thanks for catching my capacitor boo boo, I would have been displeased when (if?) I figured that out.

---

Edit:
Ok, here's my cart, take 2.
http://www.mouser.com/ProjectManager/ProjectDetail.aspx?AccessID=52fca78cf3

I'll have to wait until I get home to see how/if I can make all that fit on my board/box.
Title: Sugestion
Post by: kev on May 14, 2009, 02:39 pm
i make this sugestion to every1 doing a car project. Get another car battery for your project. that way, you dont have to replace your car's so often ;D
Title: Re: Car Keypad
Post by: designer2k2 on May 14, 2009, 02:53 pm
thats why this forum exists, or?  ;)

could be that it never has shown with the smaller cap, but you never know...

now the cart is good  :)
Title: New Board
Post by: neonpolaris on May 15, 2009, 04:47 pm
(http://farm3.static.flickr.com/2231/3532991295_c3528ff353_o.png)
http://www.flickr.com/photos/43268066@N00/3532991295/

I removed a pin from the Nano to route the power to the backlight better.  I'll just rip the pin out of the headers that I mount the Nano on.  Since I removed the hole in that spot, I won't be able to forget to do this and feed 12v into a digital pin.
Title: Re: Car Keypad
Post by: chelmi on May 15, 2009, 05:32 pm
Quote
i make this sugestion to every1 doing a car project. Get another car battery for your project. that way, you dont have to replace your car's so often


[smiley=huh.gif] That doesn't make any sense.
Title: Re: Car Keypad
Post by: neonpolaris on May 15, 2009, 08:50 pm
Okay, new board ordered, new parts ordered.  Now I wait for a month...

If I get time to cut the hole before my new board gets here, my old one is going in in the mean time.  I'll just plug the new board in when it gets here.  I'm already glad I made it modular. :)
Title: Re: Car Keypad
Post by: kev on May 18, 2009, 05:57 pm
Quote
Quote

i make this sugestion to every1 doing a car project. Get another car battery for your project. that way, you dont have to replace your car's so often


That doesn't make any sense.


what do u mean?
Title: Re: Car Keypad
Post by: neonpolaris on May 19, 2009, 08:11 pm
What he means is that it doesn't make sense to add another car battery just for a project.

When you say wouldn't have to replace it as often, I assume you mean one of two things:

A: The car's battery would be drained by the electronics.
B: The battery will be worn out more quickly by the extra load.

The battery in a car gets recharged constantly as the car is being ran.  So it wouldn't be drained by the project.  Car batteries aren't replaced because they run low like some AA's in a gameboy.  They are replaced because, like any rechargeable, they stop holding a charge after a length of time, or charge cycles.  Really, the only time a battery is being discharged in when your car is off, or being cranked.  After that, the alternator supplies enough power for everything.  You can crank a car, then remove the battery entirely, and it will continue to run! (assuming your alternator is healthy)

As for B, the amount of current that these projects pull is relatively low.  Simply turning on your radio easily pulls more than my whole project.  Turning on your headlights, even more so.

So adding another battery to power these projects wouldn't make sense.  The car's battery keeps itself charged, is already there, and isn't adversely affected by it.  (would barely even notice)

Also, from your post here:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1239996764/13#13
You shouldn't really control voltage with just a resistor.  The reason is that your voltage with fluctuate depending on how much current your load draws at the moment.  Take a look at Ohm's Law, it will explain it fairly well.  This is why voltage regulators (such as the 7805) are used.  They hold output voltage steady independent of load.
Title: Re: Car Keypad
Post by: neonpolaris on Jun 12, 2009, 03:28 pm
My redesigned board should be in next week, but since it's a direct swap for the other board, I see no reason to wait for it.

So I finally cut that scary, scary hole.

I was somewhat torn between putting the keypad underneath the door handle, and next to it. Most people I asked seemed to like it underneath, while I kind of preferred next to. Well, inside the door there is this "stuff". It kind of looks like metal painted on the inside of the door skin. For strength? Sound dampening? Something else? I don't know, but it made the door skin much thicker there (underneath the handle), so my decision was pretty much made for me.

(http://farm4.static.flickr.com/3564/3611704532_494943128e_o.jpg)

Close up of metal "stuff".
(http://farm4.static.flickr.com/3555/3610891775_c12d837766_o.jpg)

Here are my practice holes. This allowed me to not only get used to cutting with my Dremel, but also work out the exact shape and size I needed to cut. I used the thin metal cutting disc for the Dremel. It worked well.
(http://farm4.static.flickr.com/3341/3611704200_35d0c0c88e_o.jpg)

Here's the door with my template on it and taped up a bit.
(http://farm4.static.flickr.com/3605/3611704172_4a16f8db83_o.jpg)

Hole cut.
(http://farm4.static.flickr.com/3363/3610891555_47f5bd32e4_o.jpg)

Looks a bit rough. (those marks below the hole are just dust)
(http://farm4.static.flickr.com/3399/3611704254_efeb649361_o.jpg)

The hole retaped, rough edges filed, and paint cracks sanded away.
(http://farm4.static.flickr.com/3639/3610891611_36eef4c110_o.jpg)

Retaped and primer paint applied (to inhibit rust)
(http://farm3.static.flickr.com/2245/3610891691_9012a59a10_o.jpg)

Dried and untaped.
(http://farm4.static.flickr.com/3615/3610891717_30a3f31740_o.jpg)

Last shot of keypad and clip.
(http://farm4.static.flickr.com/3312/3611704400_9c72ac59e8_o.jpg)
Title: Re: Car Keypad
Post by: neonpolaris on Jun 12, 2009, 03:30 pm
Back of keypad up inside the door.
(http://farm3.static.flickr.com/2422/3611704488_2304e5067e_o.jpg)

Keypad on door. (not as crooked as this picture makes it look)
(http://farm3.static.flickr.com/2433/3611793876_f10db78720_o.jpg)

And a nice wide shot of the door.
(http://farm4.static.flickr.com/3312/3611793848_0ec47f1578_o.jpg)


Hopefully my next update will be when I have the wiring finished!
Title: Re: Car Keypad
Post by: designer2k2 on Jun 12, 2009, 04:45 pm
WOW, thats nice  :)

reminds me of that song "the first cut is the deepest"  ;)
Title: Re: Car Keypad
Post by: neonpolaris on Jun 14, 2009, 07:13 pm
[size=14]CODE FINISHED![/size]

Ok, after many hours yesterday, the keypad is wired in.  It works fully, and I finished ALL the software for it.

But it wasn't easy.

You see, I realized that on my board that I have for the car, I can't connect the arduino to the keypad AND the arduino to the PC.  The plug connections interfere with each other.  This would not be the case with my latest board (that HAS shipped now, but isn't here yet)  I really wanted to see what was going on, to make writing and testing new features better, so I made ANOTHER test keypad.  This was made strickly with what I could get from Radioshack (expensive) THAT DAY (I had those headers already).

(http://farm3.static.flickr.com/2481/3625033355_135cf8c04f_o.jpg)
http://www.flickr.com/photos/43268066@N00/3625033355/

I really didn't want to pull the real keypad back out of the door anyway.

With the help of my new keypad, I have finalized my code.  I've tried my best to emulate the Ford Keypads as much as possible.

Instructions:
To unlock the car, type in the 5-digit 'factory' code.
To lock the car, press the last two buttons together.

After too many unsuccessful attempts to type in a code, the keypad will flash and ignore input for one minute.

Program up to three additional 'user' codes (stored in EEPROM):
Type the 'factory' code, then 1, then a new 5-digit code, and finish by pressing one of the first three buttons.
Your new user code is now saved to that position.  The car will confirm by locking and unlocking the doors.
You can overwrite the code by saving another to the same position.

Erase all user codes:
Type the 'factory' code, then 1, then press 1 again and hold for two seconds.  The car will confirm by locking and unlocking the doors.

Time out (reset input keys) after programmable time (default 5 seconds).  All key presses must be pressed within
this time from each other to be considered together.  The backlight will turn off after timeout.

The finalized code is in the door, fully working.  When I get my new board in and fix a problem with my wire mounts in the door I'll post pics of the wiring side.
Title: Re: Car Keypad
Post by: neonpolaris on Jun 14, 2009, 07:18 pm
My code is too long to post on this forum.  You can find it here:
http://www.caliberforumz.com/showpost.php?p=130538&postcount=42
Title: Re: Car Keypad
Post by: zooto68 on Jun 14, 2009, 08:42 pm
If you forget your key how will you start the car?
Title: Re: Car Keypad
Post by: neonpolaris on Jun 14, 2009, 11:19 pm
The keypad doesn't let you start the car.  It just lets you in the car.  It's great if you just need to get something out of the car and you don't have your keys on you.  It would also be handy if you happen to lock your keys in the car.
Title: Re: Car Keypad
Post by: bill2009 on Jun 15, 2009, 12:44 am
Quote
Quote

If a typical car battery is about 45 amp hours, and I'm pulling 20mA or so, does that mean it would have to run for 1125 hours (almost 47 days) to half-discharge the battery?  

Yup.  Unless something shorts out, you won't drain the car battery with the Arduino.


I guess the math is correct but I'm surprised.  20ma seems like no load at all but 47 days is not an outlandish period for a car to sit idle and having half my battery drained by my door lock key pad seems a bit alarming.  Maybe it's a Canadian winter thing but I'd be worried!

Title: Re: Car Keypad
Post by: neonpolaris on Jun 15, 2009, 12:56 am
I wish that I had ever gotten around to actually testing what the rest of the car pulls when it's off.  Has anyone else done this?  My car has never sat idle for more than three days it's whole life, so a month and a half wouldn't be a problem for me.  The winters are rather mild here in Florida. :)
Title: Re: Car Keypad
Post by: cverink on Jun 15, 2009, 08:01 pm
Nice work on the finished product.

How did you interface the keypad with your existing electronic locks. I read you used a relay, but where did you splice into the system?

The reason I ask is because I want to add keyless entry into my car, and i found the existing switch in the car door to just be two simple contact switches, one for lock, and one for unlock. Did you just add the relay in parallel with something like that?
Title: Re: Car Keypad
Post by: neonpolaris on Jun 15, 2009, 08:57 pm
My door lock buttons are also just simple contact switches.  They way that they signal the car to lock or unlock all the doors is by connecting two wires in the door together with either a 100 or 330 ohm resistor.  One is for lock, the other for unlock.  One of the wires was pulled high to 5v and the other was a ground, so any ground should work.

Instead of trying to send wires from my box to my door control's box and soldering on that board, I just used my own 100 and 330 ohm resistors and used the solid state relay to close the same two wires together with them.

Since this forum is more about the electronics and less about the car, I didn't bother with which wires in the door I used, etc.  It would be different with each car.
This is the relevant post from my thread over at CaliberForumz:
http://www.caliberforumz.com/showpost.php?p=99273&postcount=26

For the switching I used this solid state relay:
AQW212A
http://www.mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMtLEhJ5P%2fNsZx%2fVqDTYcQwamYMh1RNGSig%3d
It was handy because I can drive it directly from my arduino's pins (I put a resistor on it to be safe).

---

I just realized that I haven't posted a parts list yet.  Still waiting on that last board, I suppose.  When I get it installed I'll release the board info (at BatchPCB) and the parts list along with it.
Title: Re: Car Keypad
Post by: bill2009 on Jun 16, 2009, 02:13 am
Quote
CODE FINISHED!

Ok, after many hours yesterday, the keypad is wired in.  It works fully, and I finished ALL the software for it.

But it wasn't easy.


Congrats - can't wait to see the video!
Title: Re: Car Keypad
Post by: neonpolaris on Jun 24, 2009, 03:49 pm
I needed to find something that would hold my wire loom to the door skin, not flopping around and out of the way so the window doesn't rub it when it goes down.  I went to Lowes and this was the only thing I found that didn't involve screws:
(http://farm3.static.flickr.com/2457/3656368633_407ecefe97_o.jpg)


Unfortunately, they detached from the door when it got hot (summer in Florida).  So I replaced the crappy foam tape with some decal tape that I've used alot and has never failed me.
(http://farm4.static.flickr.com/3661/3657162348_c8fb559db3_o.jpg)


It may be hard to see, but here's my wireloom coming from the keypad, down to the bottom of the door and up the other side.  That's the connector on the bottom right.
(http://farm4.static.flickr.com/3653/3656368723_9f63d97ee4_o.jpg)


Here's my box with the hole cut and some tape covering some pins to protect my wires.  I used my first board since my new one didn't work out, but I was too impatient to try and troubleshoot it.  I'll worry about it if I have any problems with this one (I haven't yet).
(http://farm4.static.flickr.com/3341/3657162370_ed1acc7e0f_o.jpg)


The back of the box, ready for mounting:
(http://farm4.static.flickr.com/3388/3657162398_47c84a04de_o.jpg)


Here is an example of my splices into the door.  Soldered together and double walled heat shrink with adhesive.  This is the door lock sense wire, I believe.
(http://farm4.static.flickr.com/3605/3657162432_8ff676af65_o.jpg)


Here's the box mounted.  I can assure you that it's quite secure.  I used just a tiny piece of the decal tape to hold it up temporarily while I was waiting for the other board, and it was harder than I expected to come off.  Fully taped will definately hold it.
(http://farm4.static.flickr.com/3360/3656368759_eb43611ee2_o.jpg)


So it's been in my car for a while now, and I've had no problems from it at all.  I'm very pleased with it.  I don't used it all the time, most of the time my keys are more convenient, but there has been more than once that I was already outside and wanted something from my car and didn't have my keys on me.  So it has already fulfilled its purpose.  I'll sure be happy I did it if I ever lock my keys in my car.
Title: Re: Car Keypad
Post by: kg4wsv on Jun 24, 2009, 04:09 pm
Quote
I needed to find something that would hold my wire loom to the door skin

What you found is pretty nice.

Another option is known as a "cable tie mount".  It's a plastic tab with slots to accept a cable tie on one side and adhesive on the other, so you tie the cables to the mount.

-j

Title: Re: Car Keypad
Post by: neonpolaris on Jun 24, 2009, 04:16 pm
I was looking for a cable tie mount, even checked NAPA, but had no luck.  Where does one find these?  I know I'll want them again in the future.

Also, I've published the board at BatchPCB, so anyone can have one made whenever they want.
http://www.batchpcb.com/product_info.php?products_id=20456&check=c14c074daa0b1640579156fd6d36dd84

Title: Re: Car Keypad
Post by: kg4wsv on Jun 24, 2009, 06:39 pm
Quote
I was looking for a cable tie mount, even checked NAPA, but had no luck.  Where does one find these?


I got them through an electrical distributor for work.

For personal use, I'm pretty sure I have picked them up at the local borg (home depot, lowe's, etc) in the electrical department.

http://www.allelectronics.com/make-a-store/item/TM-5/T-B-CABLE-TIE-MOUNT/1.html

-j

Title: Re: Car Keypad
Post by: neonpolaris on Jun 30, 2009, 04:42 am
I posted a simple video by request of bill2009.  It shows locking, unlocking, and the anti-scan.  Don't worry, that combo was just a user-code that I added and have since erased. :)

http://www.youtube.com/watch?v=2kG6GXieaKM