Hi Folks,
My Key died, and rather than spend countless amounts of money and time, I decided to take matters into my own hands and use third-party means to resolve the issue by installing this fairly decent (and cheap) keyless entry system:

http://ift.tt/1e1miGT
I found this system to be well constructed and reliable, although it's range could be better.
Second, I used an Arduino Leonardo, and paired it with this relay module:

http://ift.tt/1e1miGT
All in all, I get excellent and consistent results each time. I've done extensive testing with my car and successfully open and close the top each third key press. Below is the modified code taken from open source community. Feel free to use it and do with it what you may. I won't be responsible for any adverse effects and or damages to car or bodily injury. So you will take matters into your own hands:
My Key died, and rather than spend countless amounts of money and time, I decided to take matters into my own hands and use third-party means to resolve the issue by installing this fairly decent (and cheap) keyless entry system:
http://ift.tt/1e1miGT
I found this system to be well constructed and reliable, although it's range could be better.
Second, I used an Arduino Leonardo, and paired it with this relay module:
http://ift.tt/1e1miGT
All in all, I get excellent and consistent results each time. I've done extensive testing with my car and successfully open and close the top each third key press. Below is the modified code taken from open source community. Feel free to use it and do with it what you may. I won't be responsible for any adverse effects and or damages to car or bodily injury. So you will take matters into your own hands:
Quote:
/* Base code by: Tom Igoe Modified by: Eric Geer Version: 1.2 Date: 6/12/2014 Function: Read state of door lock mechanism and hold state open after third press Purpose: Automatic open and close of BMW E46 Convertible top mechanism. Code is designed to work with input detected from third party keyless entry system: http://ift.tt/1e1miGT Arduino reads the lock/unlock mechanism and passes state through to vehicle on pins 11 and 12 via relay board: http://ift.tt/1e1miGT After third press of the lock or unlock buttons within 5 seconds time, a hold timer engages with sufficient time to fully close or open the convertible top. Code can easily be modified for purposes of controlling coupe or 4-door to close all windows and sunroof. This Based off "State change detection (edge detection)" by Tom Igoe http://arduino*****en/Tutorial/ButtonStateChange */ // this constant won't change: const int lockbuttonPin = 2; const int unlockbuttonPin = 3; const int lockledPin = 12; const int unlockledPin = 11; const int TimeoutPeriod = 50; // Variables will change: int lockCounter = 0; int lockButtonState = 0; int lastLockButtonState = 0; int unlockCounter = 0; int unlockButtonState = 0; int lastunLockButtonState = 0; int timeout = 0; void setup() { pinMode(lockbuttonPin, INPUT); pinMode(lockledPin, OUTPUT); pinMode(unlockbuttonPin, INPUT); pinMode(unlockledPin, OUTPUT); Serial.begin(9600); } void loop() { lockButtonState = digitalRead(lockbuttonPin); unlockButtonState = digitalRead(unlockbuttonPin); delay(100); timeout++; if (timeout > TimeoutPeriod) { timeout=0; if (lockButtonState == lastLockButtonState) { lockCounter=0; Serial.print("Timeout reset lock counter: "); Serial.println(lockCounter); } if (unlockButtonState == lastunLockButtonState) { unlockCounter=0; Serial.print("Timeout reset unlock counter: "); Serial.println(unlockCounter); } } if (lockButtonState != lastLockButtonState) { timeout=0; if (lockButtonState == HIGH) { digitalWrite(lockledPin, HIGH); delay(100); digitalWrite(lockledPin, LOW); lockCounter++; Serial.println("Lock Relay ON"); Serial.print("Lock pushes: "); Serial.println(lockCounter); timeout=0; } else { Serial.println("Lock Relay OFF"); } } if (unlockButtonState != lastunLockButtonState) { if (unlockButtonState == HIGH) { digitalWrite(unlockledPin, HIGH); delay(100); digitalWrite(unlockledPin, LOW); unlockCounter++; Serial.println("Unlock Relay ON"); Serial.print("Unlock pushes: "); Serial.println(unlockCounter); timeout=0; } else { Serial.println("Unlock Relay OFF"); } } lastLockButtonState = lockButtonState; lastunLockButtonState = unlockButtonState; if (lockCounter % 4 == 3) { lockCounter=0; digitalWrite(lockledPin, HIGH); delay(34000); } digitalWrite(lockledPin, LOW); if (unlockCounter % 4 == 3) { unlockCounter=0; digitalWrite(unlockledPin, HIGH); delay(25000); } digitalWrite(unlockledPin, LOW); } |
Aucun commentaire:
Enregistrer un commentaire