Adding Capabilities to Passive Keyless Entry/Remote Start for my vehicle

I am starting a new project and I need a few pointers and or advice. I would like to pick all of your brains about this all I ask is don't be rude and if it is not constructive or is condescending, just leave it in your head and just lurk like I have for many years. With that said, I am very well versed in low voltage and PLC circuits, but this would be my first "real" Arduino project. I have built such circuits with off the shelf PLC in industrial settings but I realize I can't move forward like that so consider me a newbie with very little python code knowledge but extensive component level experience.

The project: I have a 2002 Dodge Ram 1500 ST (work truck model) and I have been slowly bringing it up to todays tech standards. I installed a Passive Keyless Entry/Remote start system (Chineseium) in and well it lacks a lot of features that frankly a more prominent system and vastly more expensive system would solve (almost) I settled on building my own or adding features to my current setup(which works amazingly well it just lacks customization. I have included the PKE (Passive Keyless Entry) Wiring diagram as well as pictures of the board. As well as a 8ch 12V Time Delay Board I purchased model KR-122-8-V1.0 both are Chinese units and I'm sure are clones of something but Honestly Chinese stuff is actually quality now and it just works. This is something I hate to admit but it holds true.

Nitty Gritty; I need to integrate or piggyback on the PKE so when certain things are triggered other things also happen(sensed and controlled by Arduino uno clone) piggybacking is probably the best option as I already have the remotes and the module knows when I get close to its antennae and when I leave it's proximity. I am also sure it's fairly easy to tell the Arduino when those events happen. This system also utilizes a push to start button. It does a lot of things on its own, I just want to add a few things to make it (smart and customizable, marketable even?) Below is a list of features off the top of my head. Once I get the basic code and wiring down, adding features should be fairly easy.

New features:
-When lock triggers flashlights and Chip once
-When unlock triggers flashlights and chirp twice turn on dome lights for 30 seconds if door isn't opened after 30 seconds then auto relock
-Twilight auto light turn on info from light dependent resistor Auto dim headlights with oncoming traffic
-Use truck trigger(I don't have a trunk) for remote accessory turn on in case I want to remotely use or update Android head unit temperature dependent remote start

I know this is a lot but any helpful info would be appreciated. I have the PKE and Relay board on my bench for testing while my truck is being painted and body work done so I have maybe a few weeks to a month to accomplish this. I have done a lot more in a lot less time so let's get this discussion going. Thanks in advance.



Since you have some time here is some reading that will help you make a reliable unit.

Here are some Valuable Resources for Automotive Electronics:

  1. STMicroelectronics Application Note AN2689:
    This application note provides guidelines on protecting automotive electronics from electrical hazards, focusing on design and component selection. Reading this will greatly enhance your understanding of automotive circuit protection.
    Read AN2689
  2. Analog Devices: Automotive Electronics Design:
    This article distills key insights into designing automotive electronics, offering practical advice for engineers.
    Read the article
  3. Diodes Incorporated: Transient Voltage Suppression in Automotive:
    Learn about techniques to protect automotive circuits from transient voltage, which is critical for ensuring reliable operation in harsh conditions.
    Read the article
  4. AEC-100 Standards Webinar:
    This webinar from Monolithic Power Systems provides a detailed overview of AEC standards, essential for understanding automotive electronics requirements.
    Watch the webinar
  5. Understanding Automotive Electronics, An Engineering Perspective by William B. Ribbens:
    This comprehensive book offers an in-depth look into automotive electronics from an engineering perspective, making it an invaluable resource.
    Access the book
  6. Application Note https://www.ti.com/lit/an/slvafc1/slvafc1.pdf?ts=1652591872294
  7. https://www.ti.com/lit/an/snva681a/snva681a.pdf
  8. https://www.infineon.com/dgdl/Infineon-Managing_Transients_in_Control_IC_Driven_Power_Stages-AN-v01_00-EN.pdf?fileId=5546d46259d9a4bf015a4615e1280121

These resources should provide a strong foundation for anyone involved in automotive electronics design.

Welcome to the forum. Nice project idea.

Heed the advice of @gilshultz - the automobile is a harsh environment.

But in the lab

piggybacking is probably the best option as I already have the remotes and the module knows when I get close to its antennae and when I leave it's proximity.

Your first step will be to write a small sketch that proves your piggy-back idea. All you'll need to know programming-wise is how to wire up a button, read it and then copy the reading to (for ease) the build-in LED on your board. Or go the next small step and hook up your own LED and series current-limiting resistor to a pin you configre as an output in the setup() phase.

It is sometimes referred to as hijacking, but the idea is that you use existing signals from <whatever> to develop digital inputs for the Arduino board.

If you have relay contacts, you can treat them like a switch or pushbutton. If you are looking at voltages they might need to be brought into range for the digital input (0..5 volts), or in some cases where information is carried by various voltage levels (I see it on steering column stalks) you might need to read an analog voltage and detect that.

Then it's all code... the hard part is getting the piggy on your back, or you on its, and eventually dealing with the reality of deploying this.

You may like to use the wokwi simulator for convenience - I find I can get most of the logic for a project pretty much settled before I touch (or even buy) any real hardware.

a7

1 Like

Your idea of piggybacking is sound, in fact, the only possible way since you have no idea what code is on the MCUs. I think if you draw a schematic showing what pins on your Arduino or some other MCU are connected to what signals on the existing hardware, it is a good start. Once that is done, you can start the sketch with the pin assignments. HINT use meaningful names such as delight. Now, it's just a case of writing small pieces of code to detect an input pin change, which causes an output pin change. Go slow and test every new function, and it will go well. You will likely need more time than you mentioned.

LOL! Story of my life.

a7

Thanks for the replies, definitely some helpful information and a starting point. I am very aware of how harsh automotive electrical environment is but I will definitely have a look at the articles you posted @gilshultz. I am no stranger to the use of diodes to protect trigger circuits as I was thinking about using some sort of voltage regulation/filtering /smoothing in the Arduino circuit. So hopefully that shouldn't become an issue.

I agree that I will indeed need more time to accomplish this tasks and I am aware that is almost always the case. That is why I am. Sticking with an initial feature list , writing a sketch and laying out the circuit. My truck is already wired for these features, as I added the wiring when I was repairing the wiring harness(had an electrical fire) My goal is to take no longer than a few weeks to have it tested at the very least but I work fast. I will be working on a sketch this evening or at least draw up pin usage to help facilitate that.

I figured that piggybacking would be my only option, or I would have to build a super complicated circuit. I should have all of the components needed for this as I repair electronics for a living. If I don't have it in my case then I can get it within a day.

I will post a simple schematic this evening and we can go from there.

I had the thought of adding a lithium pack to run this whole circuit not only as backup in case my main battery died but to also smooth voltage spikes and or emi. What do you think?

I do not think it a good idea, if the circuit it is not properly designed it can burst into flame. Consider using some other chemistry such as Nickel or Lead. I use SLA without a problem.

If done properly it should work fine.

1 Like

I realize I forgot to include my relay board as almost all of the connections will have to run through it to maintain isolation. The board I have is optoisolated. My drawing is crude but kinda were I think it should be any pointers please point out my flaws and I will update with a new drawing that includes the relay board. I'm working on it now. It is a lot of wiring so it's difficult to draw in one go especially with a pen. I have searched high and low for a pencil lol to no avail.

Agreed about catching fire, that is always a rish when dealing with lithium. I have extensive work knowledge with working with them and building packs. If I were to use one it will be a very small pack and probably be contained in a fireproof container of some sort stored somewhere well ventilated. It's just an idea though. I can always do that at a later date. But for now extensive use of diodes and caps should yield good results. I only say lithium because of its longevity but you may be right sla might be the way to go like a small atv battery. I have a solor charger hooked into my circuit right now so that shouldn't be an issue but if down the road it is I will deal then

Some of my triggers are negative and some positive as well as inputs. I believe my lock and unlock triggers from the PKE are -5v last time I tested them. But things like started output is 12v and push start button is 12v I believe. I will confirm those later this evening

Quick question before I get this circuit laid out. I've pretty much got the Arduino and relay module wired up like I want it. But I have since tested my PKE board again and turns out all the triggering except from the push to start button is 12v. What is a good and safe way to push that 12v to 5v so the Arduino can read it? Should I use transistor and should the diodes be before or after the transit or. Any suggestions would be helpful. Voltage divider? Like I said I'm pretty well averse to electronics repair but I'm kinda wet behind the ears in when it comes to building new circuits. If I can get that part down it's all pretty much up to writing the code. Thanks

I also know I could just use the 12v trigger to trigger another relay that switches ground instead but that would add yet another set of relays and ain't nobidy got time for that. I'm ok with having a separate PCB with the step down converting circuit on it. Just not a whole nother set of relays

12V to 5V, I usually use a Buck converter to take it to 7.5V, then an LDO VR to get it to 5. Why two steps? The buck for efficiency at the cost of some noise, then the LDO VR for precision and noise elimination but not as much heat at 7.5 vs 12?

I hate when that happens.

If it was just nice 12 volts, a voltage divider. In the case of automotive deployment, use an optoisolator.

a7

Ok so I spent a lot of time working on the sketch and I think Ive got most everything included give or take a feature or two but it's complicated enough as is. So without further adue here it is. Roast me.

Also I decided to use a separate 5v power supply and switch that power with the PKE instead of using the 12v supplied to it. (I desoldered the relays and extended the leads and the common on each one will use a regulated 5v supply that should be safe to speak to Arduino safely. Coils will still be triggered with 12v but load will be 5v. If that makes sense. My relay module will be handling the 12v to each circuit.

#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ST7735.h>

// LCD Display (ST7735) Pins
#define TFT_CS 10
#define TFT_RST 9
#define TFT_DC 8

// Initialize LCD
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);

// Analog Inputs
#define LOCKED_PIN A0
#define UNLOCKED_PIN A1
#define PUSH_TO_START_PIN A2
#define ENGINE_RUNNING_PIN A3
#define TEMP_SENSOR_PIN A4
#define LDR_PIN A5
#define BATTERY_VOLTAGE_PIN A6

// Digital Outputs
#define FOOT_BRAKE_PIN 2
#define PUSH_TO_START_PIN_OUT 3
#define LOCK_SIGNAL_PIN 4
#define DOME_LIGHTS_PIN 5
#define PARKING_LIGHTS_PIN 6
#define ACCESSORY_PIN 7

// Constants
#define TEMP_THRESHOLD 512   // Analog value for ~32°F
#define LDR_THRESHOLD 512    // Light sensor threshold
#define BATTERY_LOW_THRESHOLD 620 // Analog equivalent of 12.2V
#define DOME_LIGHT_DURATION 30000 // 30 seconds

// Variables
unsigned long domeLightStartTime = 0;
bool domeLightActive = false;
bool engineStartedDueToBattery = false;

void setup() {
  Serial.begin(9600);

  // Initialize LCD
  tft.initR(INITR_BLACKTAB);
  tft.fillScreen(ST77XX_BLACK);
  tft.setTextColor(ST77XX_WHITE);
  tft.setTextSize(1);

  // Set pin modes
  pinMode(FOOT_BRAKE_PIN, OUTPUT);
  pinMode(PUSH_TO_START_PIN_OUT, OUTPUT);
  pinMode(LOCK_SIGNAL_PIN, OUTPUT);
  pinMode(DOME_LIGHTS_PIN, OUTPUT);
  pinMode(PARKING_LIGHTS_PIN, OUTPUT);
  pinMode(ACCESSORY_PIN, OUTPUT);
}

void loop() {
  int lockedStatus = analogRead(LOCKED_PIN);
  int unlockedStatus = analogRead(UNLOCKED_PIN);
  int pushToStartStatus = analogRead(PUSH_TO_START_PIN);
  int engineRunningStatus = analogRead(ENGINE_RUNNING_PIN);
  int temperature = analogRead(TEMP_SENSOR_PIN);
  int ldrValue = analogRead(LDR_PIN);
  int batteryVoltage = analogRead(BATTERY_VOLTAGE_PIN);

  // Display values on LCD
  tft.fillScreen(ST77XX_BLACK);
  tft.setCursor(0, 0);
  tft.print("Locked: "); tft.println(lockedStatus);
  tft.print("Unlocked: "); tft.println(unlockedStatus);
  tft.print("Push Start: "); tft.println(pushToStartStatus);
  tft.print("Engine Running: "); tft.println(engineRunningStatus);
  tft.print("Temp: "); tft.println(temperature);
  tft.print("LDR: "); tft.println(ldrValue);
  tft.print("Battery: "); tft.println(batteryVoltage);
  
  // Car Alarm: If locked, trigger alarm (for now, just print)
  if (lockedStatus > 500) {
    Serial.println("ALARM: Car is locked!");
  }

  // Remote Start: If push-to-start is pressed and engine isn't running, start the engine
  if (pushToStartStatus > 500 && engineRunningStatus < 500) {
    digitalWrite(FOOT_BRAKE_PIN, HIGH);
    digitalWrite(PUSH_TO_START_PIN_OUT, HIGH);
    Serial.println("REMOTE START: Engine cranking...");
    delay(3000);  // Simulate crank duration
    digitalWrite(PUSH_TO_START_PIN_OUT, LOW);
    digitalWrite(FOOT_BRAKE_PIN, LOW);
  }

  // Auto Start: If temperature is below threshold, start engine
  if (temperature < TEMP_THRESHOLD) {
    Serial.println("AUTO START: Cold weather detected, starting engine...");
    remoteStartSequence();
  }

  // Battery Monitor: Start engine if voltage is below 12.2V
  if (batteryVoltage < BATTERY_LOW_THRESHOLD && !engineRunningStatus) {
    Serial.println("BATTERY LOW: Starting engine to charge...");
    remoteStartSequence();
    engineStartedDueToBattery = true;
  }

  // Auto Lights: Turn on at dusk, off at dawn
  if (ldrValue < LDR_THRESHOLD) {
    digitalWrite(PARKING_LIGHTS_PIN, HIGH);
    Serial.println("LIGHTS: ON (Dusk detected)");
  } else {
    digitalWrite(PARKING_LIGHTS_PIN, LOW);
    Serial.println("LIGHTS: OFF (Daylight detected)");
  }

  // Dome Light Logic
  if (unlockedStatus > 500) {
    digitalWrite(DOME_LIGHTS_PIN, HIGH);
    domeLightStartTime = millis();
    domeLightActive = true;
    Serial.println("DOME LIGHTS: ON");
  }
  
  if (domeLightActive && millis() - domeLightStartTime > DOME_LIGHT_DURATION) {
    digitalWrite(DOME_LIGHTS_PIN, LOW);
    Serial.println("DOME LIGHTS: OFF (Timeout)");
    domeLightActive = false;
  }

  // Lock Signal: Send lock signal when needed
  if (lockedStatus > 500) {
    digitalWrite(LOCK_SIGNAL_PIN, HIGH);
    Serial.println("LOCK: Car locked.");
    delay(100);
    digitalWrite(LOCK_SIGNAL_PIN, LOW);
  }

  // Parking Lights Flash: Once for lock, twice for unlock
  if (lockedStatus > 500) {
    flashParkingLights(1);
  } else if (unlockedStatus > 500) {
    flashParkingLights(2);
  }

  delay(1000);
}

// Function to simulate remote start
void remoteStartSequence() {
  digitalWrite(FOOT_BRAKE_PIN, HIGH);
  digitalWrite(PUSH_TO_START_PIN_OUT, HIGH);
  delay(3000); // Simulate crank duration
  digitalWrite(PUSH_TO_START_PIN_OUT, LOW);
  digitalWrite(FOOT_BRAKE_PIN, LOW);
  delay(300000); // Keep engine running for 5 minutes
}

// Function to flash parking lights
void flashParkingLights(int flashes) {
  for (int i = 0; i < flashes; i++) {
    digitalWrite(PARKING_LIGHTS_PIN, HIGH);
    delay(500);
    digitalWrite(PARKING_LIGHTS_PIN, LOW);
    delay(500);
  }
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.