Dodge Cummins Diesel Forum banner
1 - 15 of 15 Posts

·
Registered
Joined
·
2,115 Posts
Discussion Starter · #1 ·

So instead of just replacing the wires, I decided it was better to make a new ignition system. This uses 9 relays and 2 microcontrollers and is more fun to use and make. Plus I wanted a remote start, so I got the best of both worlds. Total cost was around $50.

And for some pics...

Photobucket Slideshow

Photobucket
 

·
Registered
Joined
·
2,115 Posts
Discussion Starter · #2 ·
I started this project with the intent to learn how to program micro controllers. All the tutorials I found online were only how to flash LED's and whatnot, I felt I could do better. One day this idea popped into my head, why not put a keypad in my truck as a way to start it! Well from there it turned into a push-button start, instead of having to hold the ignition switch. After I developed that, I was thinking of a way to start/stop my truck using the key FOB lock/unlock keys. Then I just got bored and added a way to start the truck with the seat belt switch as well, but this is just pointless honestly.


The first step was to build the project on my computer. I used Proteus and MPlab. Proteus is a program that is used to build and simulate electrical circuits. It is not free and extremely expensive. MPlab is an awesome program as well. MPlab is a program provided by Microchip for free which allows you to write and simulate assembly code. Assembly code is the language that PIC's use. There is also a Proteus plugin for MPlab, which is probably the best thing ever. Using this setup, you can design the circuit, write the assembly code and simulate everything on the computer. This is how I debugged all of my code and made it work flawless (for me anyways.) So...


Step 1.

Design the circuit and make sure there are no stupid errors. I had my fair share of stupid mistakes and had to remake the board multiple times. But this was all a learning experience for me anyways and I learned a lot! You can download all of my files here. This zip file includes all the Proteus files, MPlab project files including all of the code and some PDF files of my truck's (2003) wiring. Proteus also allows you to make the PCB (printed circuit board) layout and draws a 3D rendering of what the finished board would look like. Here is the PCB layout that I used (PDF file), it does contain a few updates from the one that I current. The updates I had to manually solder onto my board so for future reference this reflects the final version. There are two micro controllers that are used. The first one is thought of as the engine controller, it turns the engine circuits on/off. The second is the keypad controller, it does what you think it does. The two PIC's do communicate with each other over a few pins but they are mostly separate. Make sure to test the circuit on a breadboard first. Computers can simulate anything, but whether it simulates it correctly is a completely different story. Things you will discover is that relays need protection diodes even if there is no way for the reverse voltage to damage anything, and buzzers do crazy things!





Step 2.
Build the PCB and solder all of the components on it. This part was fun for me. I bought a Weller soldering station for this with a pencil tip, amazing for circuit board work. Cost was around $40 off eBay, well worth the money. Google and YouTube is where I learned how to make PCB's, simple searches can teach you a lot! I personally used Press-n-Peel Blue toner transfer paper. In short, you use a laser printer to print out the PCB layout and then you iron it on a piece of copper clad. After you iron it on, you peel off the blue film which leaves the traces on the copper clad. Drop the board in a bowl of acid to dissolve all the copper that is not covered by the toner and viola, you have the board done. Fingernail polish remover can be used to rub away the left over toner and then use a very small drill to drill out the holes. Once I built the PCB I made sure to test everything. Double check it for solder bridges and broken traces.











Step 3.
Install the keypad assembly. I put the keypad in the ash tray, but with creativity, you can put it almost anywhere. I used a keypad from a phone, it was an old phone and the buttons were transparent blue, I like it. So I removed the keypad, but all of the wires and Frankensteined it into the ash tray. I removed the metal liner and used a piece of plastic to make the bracket. I installed the keypad, red and yellow LED's, and the ignition push button switch. There is also a proximity switch in there so that when the ash tray is opened, blue LED's light up the keypad. The keypad assembly is wired to the main PCB with a computer parallel cable. Old computer cables are great for projects like this, they have 22-24 gauge wires (they are colorful too.) So I chopped up a parallel cable and ran the wires under the carpet by the 4x4 shifter from the ash tray to the storage compartment. I made a small slit in the carpet in the storage compartment in order to pull the wires through. On "The Box" you will notice a black switch, this is the power toggle switch, I would recommend it.







Step 4.
Install the tachometer wire. The engine controller needs to know engine RPM's for much of its tasks. The crank position sensor is the perfect solution to this! Crank position sensors on a 4 stroke motor pulse a signal twice per revolution. This signal on our trucks is a 5 volt signal, which is exactly what is needed. Microcontrollers run on 5 volts, so the standard 12 volts is a no no, it will destroy the PIC immediately! So the crank sensor pulses 5 volts twice a second and I set the RPM cutoff at ~350 RPM's. So the engine controller thinks the engine is running if there is less than 85 milliseconds between these pulses. Anything over that means that the engine is turning too slowly. The engine controller does not wait longer than 100 milliseconds either, so thats the timeout. The code is simple, there is a maximum of 100 ms to run the following test. First, it waits for the CPS to to pulse the 5v, then it waits for it to go low (the sensor is grounded) and then it waits for the sensor to go hi again. The time between the two hi pulses determines if the engine is running or not, simple. Now the microcontroller sucks off no more than 20 milliamps of current, so you can connect it directly to the sensor, it won't cause any engine codes because the current drain is so small.

For the wire install, I found that the PCM has a very easy spot to tap into it. I ran the wire from the PCM, over the engine bay (inside the wire loom) and over to the clutch pedal opening. I have an auto, and from what I have read, this spot is used for the manual's clutch pedal. So if you have a manual, just find another spot to pass it through the firewall. The wire I tapped into was the grey/black wire on the PCM plug C1. I verified the tach signal after I tapped into the wire with my multimeter. If you notice the volts that are displayed are ~2.5, this is because the crank sensor is a 50% duty cycle. So the hertz are displayed at the top (~28) and the volts are half the time 5 volts and the other half 0 volts, so the average is 2.5 volts--this is normal for my multimeter. Now to test the signal, you need to have a proper ground. In reality, any ground will do.
























Step 5.
Finish up the wiring. I did have to replace the burnt blower motor wires when doing this. Instead of wiring back into the ignition plug I left them out. I also removed the power window wires from the plug and ran them through relays. This ignition system works by simply connecting circuits, just like the ignition switch itself does. I am not going to explain how to hotwire this truck, but I am using relays to connect circuits and the engine controller controls groups of relays. There is a group of relays that simulate the key in the run position and the other group simulates the start position. Simple I know. So when the truck is attempting to start, it engages the start relays until the engine RPM's are over 350, then it engages the run relays. The rest of the wiring that needs to be completed are the relays need to be wired into the ignition wiring loom, the power wires need to be run to the box (an aux outlet wires are run right next to the storage compartment), and the wires connecting the lock/unlock key FOB signals need to be run. The key FOB wires can be tapped from behind the instrument cluster. This however does create a unique side affect, you can start the truck by using the lock/unlock switch in either front seat. But starting the truck this way automatically engages the anti-theft system, so by pressing the brake, the system shuts off. Any 12 volt signal can be used to shut the system off, I chose the brake because you have to press it to shift out of park (my solenoid is still connected.) When I wired up the relays, I created a pigtail so that I can connect everything cleanly. I used 16 gauge wires which is plenty for the load that is run through those. The wires/plugs do not get hot at all, and I have thoroughly tested them all. The blower motor uses two relays though. The relay is rated for 40 amps but for some reason you cannot find a relay socket that is rated for that. So I just used two relays, simple. The power windows, which have 10 gauge wires for whatever reason are only utilizing one relay. The relays can easily be assembled in a much nicer form but I have yet to get around to that. I do not like them being under the steering column and would love to move them. I was thinking of tucking them up under the dash in a better place, but I need to find the relay socket connectors first so I can crimp wires into them.







Step 6.
Double check everything! I made the mistake of (somehow) accidentally reversing the +/- on the box, which blew up (yes it exploded) the voltage regulator. The LM7805 5v regulator can only regulate up to 500ma, and reversing the polarity is a no no as well. Voltage regulators have to dissipate the difference between the input and output voltage as heat. The LM7805 can accept up to 30 volts. So with he truck running, there is about 14 volts running over the "12 volt" system. 14v-5v=9v of heat dissipation. This means the voltage regulator needs a heat sink. I tested this circuit using a 9 volt batter, the regulator generated almost no heat, lesson learned.





Final Thoughts
I learned a lot by doing this, more than I thought I was going to. I found out how to order electrical components like the plugs, pins, microcontrollers and such. Pins need to be crimped correctly also, don't use pliers to crimp them or else the wires will just fall out. The correct wire crimpers are only like $10 and will make your life 100 times easier! The main relays must have protection diodes on them! I hid them under the relay themselves in the sockets, this is the wrong way to do it though! I am looking for the correct pins so that I can crimp the diodes with the wires. I originally just used a single diode for each group of relays but this somehow did not work. The side affect of this is that when the relay disengages, there is a jolt of reverse voltage that will affect the voltage regulator. It will stop any positive voltage from reaching the pics and the whole system will reset. When the system resets, defaults are restored. The system starts up obviously with no relays engaged and whatnot. So if you type in the correct code, press the ignition switch and the system resets itself, you have to retype the code in.
 

·
Hootie Hooo!!!
Joined
·
1,138 Posts
Freaking AWESOME! Thanks for the write-up....can't wait to check it out and possibly do it on mine :thumbsup:
 

·
Registered
Joined
·
2,115 Posts
Discussion Starter · #4 · (Edited)
Freaking AWESOME! Thanks for the write-up....can't wait to check it out and possibly do it on mine :thumbsup:
Thank you, i'll post up the pinouts on the board if you want. I had them written down somewhere, but I will probably just open it up in Proteus and get it from there, because its more correct anyways. There are an infinite number of crazy things you can do with microcontrollers. There are also bluetooth microcontrollers available as well, so you can interface your cell phone and send commands to your vehicle. Its amazing what you can do with such inexpensive stuff!
 

·
Hootie Hooo!!!
Joined
·
1,138 Posts
That would be awesome and thanks again! I thoroughly enjoy learning about all this new gizmo stuff we can do! Different than alot of other trucks out there!! :thumbsup:
 

·
Registered
Joined
·
2,115 Posts
Discussion Starter · #6 · (Edited)
**Large Pictures**

A few more pictures of the PCB and schematic. A word of advice, the 3D render shows the traces and the components on the same side, this is WRONG! The red lines represent the traces on one side and the blue on the other. So the red traces are on the opposite side of the board and the component leads are inserted from the non-copper side, through the PCB and then soldered on the other side, I hope this makes sense. The render does not shoe the use of chip sockets, but my post above does. Do not solder the PIC's directly to the board, solder a socket to the board and then insert the PIC into the socket. Also the three connectors are shown are not the same style I used because there was no model for the type I used. I bought the majority of my parts from newark.com. The "Controls" section was only for testing purposes on the computer, none of those parts are physically used. Hopefully looking at the schematic will help you understand what kind of keypad must be used and generally how everything works, its quite simple. The schematic picture is what everything *should* look like when the system is off. No relays are energized and no LED's are lit.







Layout File
 

·
Registered
Joined
·
1 Posts
I started this project with the intent to learn how to program micro controllers. All the tutorials I found online were only how to flash LED's and whatnot, I felt I could do better. One day this idea popped into my head, why not put a keypad in my truck as a way to start it! Well from there it turned into a push-button start, instead of having to hold the ignition switch. After I developed that, I was thinking of a way to start/stop my truck using the key FOB lock/unlock keys. Then I just got bored and added a way to start the truck with the seat belt switch as well, but this is just pointless honestly.


The first step was to build the project on my computer. I used Proteus and MPlab. Proteus is a program that is used to build and simulate electrical circuits. It is not free and extremely expensive. MPlab is an awesome program as well. MPlab is a program provided by Microchip for free which allows you to write and simulate assembly code. Assembly code is the language that PIC's use. There is also a Proteus plugin for MPlab, which is probably the best thing ever. Using this setup, you can design the circuit, write the assembly code and simulate everything on the computer. This is how I debugged all of my code and made it work flawless (for me anyways.) So...


Step 1.

Design the circuit and make sure there are no stupid errors. I had my fair share of stupid mistakes and had to remake the board multiple times. But this was all a learning experience for me anyways and I learned a lot! You can download all of my files here. This zip file includes all the Proteus files, MPlab project files including all of the code and some PDF files of my truck's (2003) wiring. Proteus also allows you to make the PCB (printed circuit board) layout and draws a 3D rendering of what the finished board would look like. Here is the PCB layout that I used (PDF file), it does contain a few updates from the one that I current. The updates I had to manually solder onto my board so for future reference this reflects the final version. There are two micro controllers that are used. The first one is thought of as the engine controller, it turns the engine circuits on/off. The second is the keypad controller, it does what you think it does. The two PIC's do communicate with each other over a few pins but they are mostly separate. Make sure to test the circuit on a breadboard first. Computers can simulate anything, but whether it simulates it correctly is a completely different story. Things you will discover is that relays need protection diodes even if there is no way for the reverse voltage to damage anything, and buzzers do crazy things!





Step 2.
Build the PCB and solder all of the components on it. This part was fun for me. I bought a Weller soldering station for this with a pencil tip, amazing for circuit board work. Cost was around $40 off eBay, well worth the money. Google and YouTube is where I learned how to make PCB's, simple searches can teach you a lot! I personally used Press-n-Peel Blue toner transfer paper. In short, you use a laser printer to print out the PCB layout and then you iron it on a piece of copper clad. After you iron it on, you peel off the blue film which leaves the traces on the copper clad. Drop the board in a bowl of acid to dissolve all the copper that is not covered by the toner and viola, you have the board done. Fingernail polish remover can be used to rub away the left over toner and then use a very small drill to drill out the holes. Once I built the PCB I made sure to test everything. Double check it for solder bridges and broken traces.











Step 3.
Install the keypad assembly. I put the keypad in the ash tray, but with creativity, you can put it almost anywhere. I used a keypad from a phone, it was an old phone and the buttons were transparent blue, I like it. So I removed the keypad, but all of the wires and Frankensteined it into the ash tray. I removed the metal liner and used a piece of plastic to make the bracket. I installed the keypad, red and yellow LED's, and the ignition push button switch. There is also a proximity switch in there so that when the ash tray is opened, blue LED's light up the keypad. The keypad assembly is wired to the main PCB with a computer parallel cable. Old computer cables are great for projects like this, they have 22-24 gauge wires (they are colorful too.) So I chopped up a parallel cable and ran the wires under the carpet by the 4x4 shifter from the ash tray to the storage compartment. I made a small slit in the carpet in the storage compartment in order to pull the wires through. On "The Box" you will notice a black switch, this is the power toggle switch, I would recommend it.







Step 4.
Install the tachometer wire. The engine controller needs to know engine RPM's for much of its tasks. The crank position sensor is the perfect solution to this! Crank position sensors on a 4 stroke motor pulse a signal twice per revolution. This signal on our trucks is a 5 volt signal, which is exactly what is needed. Microcontrollers run on 5 volts, so the standard 12 volts is a no no, it will destroy the PIC immediately! So the crank sensor pulses 5 volts twice a second and I set the RPM cutoff at ~350 RPM's. So the engine controller thinks the engine is running if there is less than 85 milliseconds between these pulses. Anything over that means that the engine is turning too slowly. The engine controller does not wait longer than 100 milliseconds either, so thats the timeout. The code is simple, there is a maximum of 100 ms to run the following test. First, it waits for the CPS to to pulse the 5v, then it waits for it to go low (the sensor is grounded) and then it waits for the sensor to go hi again. The time between the two hi pulses determines if the engine is running or not, simple. Now the microcontroller sucks off no more than 20 milliamps of current, so you can connect it directly to the sensor, it won't cause any engine codes because the current drain is so small.

For the wire install, I found that the PCM has a very easy spot to tap into it. I ran the wire from the PCM, over the engine bay (inside the wire loom) and over to the clutch pedal opening. I have an auto, and from what I have read, this spot is used for the manual's clutch pedal. So if you have a manual, just find another spot to pass it through the firewall. The wire I tapped into was the grey/black wire on the PCM plug C1. I verified the tach signal after I tapped into the wire with my multimeter. If you notice the volts that are displayed are ~2.5, this is because the crank sensor is a 50% duty cycle. So the hertz are displayed at the top (~28) and the volts are half the time 5 volts and the other half 0 volts, so the average is 2.5 volts--this is normal for my multimeter. Now to test the signal, you need to have a proper ground. In reality, any ground will do.
























Step 5.
Finish up the wiring. I did have to replace the burnt blower motor wires when doing this. Instead of wiring back into the ignition plug I left them out. I also removed the power window wires from the plug and ran them through relays. This ignition system works by simply connecting circuits, just like the ignition switch itself does. I am not going to explain how to hotwire this truck, but I am using relays to connect circuits and the engine controller controls groups of relays. There is a group of relays that simulate the key in the run position and the other group simulates the start position. Simple I know. So when the truck is attempting to start, it engages the start relays until the engine RPM's are over 350, then it engages the run relays. The rest of the wiring that needs to be completed are the relays need to be wired into the ignition wiring loom, the power wires need to be run to the box (an aux outlet wires are run right next to the storage compartment), and the wires connecting the lock/unlock key FOB signals need to be run. The key FOB wires can be tapped from behind the instrument cluster. This however does create a unique side affect, you can start the truck by using the lock/unlock switch in either front seat. But starting the truck this way automatically engages the anti-theft system, so by pressing the brake, the system shuts off. Any 12 volt signal can be used to shut the system off, I chose the brake because you have to press it to shift out of park (my solenoid is still connected.) When I wired up the relays, I created a pigtail so that I can connect everything cleanly. I used 16 gauge wires which is plenty for the load that is run through those. The wires/plugs do not get hot at all, and I have thoroughly tested them all. The blower motor uses two relays though. The relay is rated for 40 amps but for some reason you cannot find a relay socket that is rated for that. So I just used two relays, simple. The power windows, which have 10 gauge wires for whatever reason are only utilizing one relay. The relays can easily be assembled in a much nicer form but I have yet to get around to that. I do not like them being under the steering column and would love to move them. I was thinking of tucking them up under the dash in a better place, but I need to find the relay socket connectors first so I can crimp wires into them.







Step 6.
Double check everything! I made the mistake of (somehow) accidentally reversing the +/- on the box, which blew up (yes it exploded) the voltage regulator. The LM7805 5v regulator can only regulate up to 500ma, and reversing the polarity is a no no as well. Voltage regulators have to dissipate the difference between the input and output voltage as heat. The LM7805 can accept up to 30 volts. So with he truck running, there is about 14 volts running over the "12 volt" system. 14v-5v=9v of heat dissipation. This means the voltage regulator needs a heat sink. I tested this circuit using a 9 volt batter, the regulator generated almost no heat, lesson learned.





Final Thoughts
I learned a lot by doing this, more than I thought I was going to. I found out how to order electrical components like the plugs, pins, microcontrollers and such. Pins need to be crimped correctly also, don't use pliers to crimp them or else the wires will just fall out. The correct wire crimpers are only like $10 and will make your life 100 times easier! The main relays must have protection diodes on them! I hid them under the relay themselves in the sockets, this is the wrong way to do it though! I am looking for the correct pins so that I can crimp the diodes with the wires. I originally just used a single diode for each group of relays but this somehow did not work. The side affect of this is that when the relay disengages, there is a jolt of reverse voltage that will affect the voltage regulator. It will stop any positive voltage from reaching the pics and the whole system will reset. When the system resets, defaults are restored. The system starts up obviously with no relays engaged and whatnot. So if you type in the correct code, press the ignition switch and the system resets itself, you have to retype the code in.
can u up wiring diagram, please:thumbsup:
 

·
Registered
Joined
·
212 Posts
I read threads like this and chuckle because its so beyond my intellect with electical systems. i love the idea and concept but i cant possibly imagine myself being able to do this project :banghead:
 

·
Registered
Joined
·
2,115 Posts
Discussion Starter · #10 ·
I read threads like this and chuckle because its so beyond my intellect with electical systems. i love the idea and concept but i cant possibly imagine myself being able to do this project :banghead:
Heh, it was an adventure for me. I thought I was going to end up putting a new starter on after troubleshooting, but it actually acted like it was supposed to, very rare! I came up with the idea because I wanted to learn how to program microcontrollers. Apparently the beginner projects are "Learn how to turn an LED on and off" and such, waaaay to boring for me.
 

·
Registered
Joined
·
212 Posts
So do you have to put the key in the ignition after a few minutes or is the ignition completely done away with?


Sent from my iPhone using AutoGuide.com Free App
 

·
Registered
Joined
·
2,115 Posts
Discussion Starter · #12 ·
Its still there, you need the key to unlock the steering wheel only, I removed the key shift-lock. But in case the system fails, you can still operate the truck with the key, sort of like a backup. I have a new updated system I'm testing on my computer that will add the auto up/down for all windows and if you are out of the truck, you can press lock-lock (or whatever button combination I feel like) on the key FOB and it will roll the windows up for you. I just need some time and motivation to build it.
 

·
Registered
Joined
·
1,807 Posts
Pardon the newb question but what is the deal with burnt ignition wires??
 

·
Registered
Joined
·
2,115 Posts
Discussion Starter · #14 ·
Pardon the newb question but what is the deal with burnt ignition wires??
The 03's have an issue with the blower motor power wires on the ignition switch plug corroding and burning up. Can cause the blower to stop working. The circuit is a fused 40 amp circuit which when connected to the ignition switch, runs through a 25 amp connector. I think the 04.5+ years have a different ignition switch and system.
 
1 - 15 of 15 Posts
Top