F30POST
F30POST
2012-2015 BMW 3-Series and 4-Series Forum
BMW Garage BMW Meets Register Today's Posts
BMW 3-Series and 4-Series Forum (F30 / F32) | F30POST > Technical Forums > F30 DIYs and Coding Discussions > [DIY] Remote start using Arduino
Extreme Powerhouse
Post Reply
 
Thread Tools Search this Thread
      05-18-2020, 07:48 AM   #1
AlbertoSONIC
Private First Class
98
Rep
155
Posts

Drives: 318d F30 LCI
Join Date: Sep 2018
Location: Italy

iTrader: (0)

[DIY] Remote start using Arduino

Hi everyone! Today, I want to show you this little Remote start project, made with Arduino.
Cost: around 30 euros.
Source code: https://github.com/AlbertoMarziali/bmw_remote_start

If you like my work and you want to support me, you can Donate!


Video

Video of remote start in action:



Features

This project allows to do this things:
- If the engine is off, remote start the car with a triple click on the lock button of the OEM keyfob.
- After 15 minutes from remote start, if no one started driving, automatically shut off the car
- If the engine is on, remote stop the car with a triple click on the lock button of the OEM keyfob.
- You have to unlock the car before driving it (why wouldn't you) or it will perform an emergency anti-thief stop


How it works

The Arduino, thanks to the MCP2515 board, constantly listen to the BMW K-CAN2 bus, looking for a triple lock button click. If found, it starts a 18 seconds long operation, during which it does those steps:
1. Turns on the in-car keyfob
2. Unlocks the car
3. Locks the car
4. Virtually presses the start button, turning on the ignition
5. Waits some seconds, to let the engine be ready to start.
6. Virtually presses the brake and the start button, turning on the engine
7. Turns off the in-car key.


Security issues

What happens if a thief enter the car (by smashing the window) and tries to steal it?

If someone tries to engage a gear with the car remote started, without unlocking it with a keyfob first, the car automatically shuts off.


The spare key is always in the car. Wouldn't this be enough to allow a thief to turn on the engine?

Yes, but actually no. The Arduino turns on the keyfob only when it needs it to remote start. Normally the key isn't powered so the car doesn't see it and can't be turned on!


Why do the Arduino open and close the car before starting the engine?

The lock and unlock thing is needed to be able to turn on the ignition. This is because of the BMW security protocol, which disables the possibility of turning on the car if the car wasn't opened before. This is not a security issues though, because this process happens in 2 seconds and the car remains open for just 1 second.


Required things

Here's a list of things you need for this project:
- Arduino Nano
- LM2596S voltage regulator board, with the output regulated to 5V
- MCP2515 Canbus board (Niren)
- 6x Relay Board with 5V relays
- 2x 560Ω (to replicate the start button internal 560Ω resistor)
- 1x 1100Ω (to replicate the 12mA current outputted by the hall sensor inside the brake light switch)
- The spare keyfob

You can get those resistance values by putting more resistors in series and sum the resistance value.
For example:
- to get a 550Ω resistance, you can put 220Ω and 330Ω resistors in series!
- to get a 1100Ω resistance, you can put 1kΩ and 100Ω resistors in series!


Wiring

You have to do the wiring for:
- KCan2 bus
- 12V and GND
- Brake light switch
- Start button switches
- Keyfob battery
- Keyfob lock switch
- Keyfob unlock switch


Car Wiring

KCAN2

Attention: the OBD2 port doesn't have KCAN2. You can't use it. You have to take KCAN2 from the FEM
- KCAN2_H: FEM A173\*8B, pin 50
- KCAN2_L: FEM A173\*8B, pin 49


12V and GND

Attention: you can't use the 12V plug as power source, you need an always-powered 12V source. You can find it at the FEM.
- 12V: FEM A173\*3B, pin 33
- GND: FEM A173\*3B, pin 6


Brake Light Switch and Start-Stop Button

Here you can see how to wire break light switch and start/stop button:
- The start-stop button wiring is right behind the switch button, just pull it out.
- The break light switch wiring is above the brake pedal.



KeyFob Wiring

KeyFob Power

You have to interrupt the battery positive connection, split it in 2 wires and feed them inside the relay:




KeyFob Lock and Unlock buttons

You have to simulate the press of the switch using the relay. To do that, just hook to the key switches like that:




Arduino wiring

Schematic

You can follow this schematic to build everything.
Note: this schematic shows a 8x relay board, but you can use a 6x one



Final look

This is the final look, with the spare key wired. You have to hide it somewhere inside the car.
(it's ugly, I know. You can make it definitely better)




Credits
autowp for arduino-mcp2515 library

Last edited by AlbertoSONIC; 05-18-2020 at 07:54 AM..
Appreciate 19
Momir1338.50
fantanas112.00
chr12.00
VipinLJ1941.50
cozzzz35.00
ngl118.00
Siki78136.00
david51537.50
terahertz162.50
fe7565552.50
      05-19-2020, 04:29 PM   #2
Ibo24
New BMW owner
Ibo24's Avatar
Belgium
139
Rep
621
Posts

Drives: BMW 316d, BMW F40 116d
Join Date: Jan 2012
Location: Belgium

iTrader: (0)

Garage List
Nice write up!
Appreciate 1
      05-21-2020, 08:45 PM   #3
AleksanderSuave
Lieutenant
193
Rep
452
Posts

Drives: 2017 M240iX Coupe
Join Date: Sep 2015
Location: Detroit

iTrader: (1)

So how much to buy the assembled kit (minus the keyfob portion) from you?
Appreciate 0
      12-19-2021, 07:23 AM   #4
Adrian87
New Member
2
Rep
5
Posts

Drives: BMW F31 2014
Join Date: Dec 2021
Location: Romania

iTrader: (0)

I need help

Hey AlbertoSONIC.
Really cool what you have done there, I'v copied your project but I can't manage to make it to work.
I have connected to pin 49 and 50 in A173*8B, but it does not seem to receive info over CAN, I don't know if my arduino it's broken or my MCP2515 it's not working and I can't figure it out, can you help me with more info or a idea what to do next?
Appreciate 1
      12-19-2021, 03:12 PM   #5
crisfeup@gmail.com
Enlisted Member
17
Rep
43
Posts

Drives: Bmw f31
Join Date: Jan 2016
Location: Portugal

iTrader: (0)

Dear Albertosonic

This is a good good project. I'm going to buy the parts needed and try to get it work also on my f31.
Appreciate 1
      12-19-2021, 03:50 PM   #6
AlbertoSONIC
Private First Class
98
Rep
155
Posts

Drives: 318d F30 LCI
Join Date: Sep 2018
Location: Italy

iTrader: (0)

Quote:
Originally Posted by Adrian87 View Post
Hey AlbertoSONIC.
Really cool what you have done there, I'v copied your project but I can't manage to make it to work.
I have connected to pin 49 and 50 in A173*8B, but it does not seem to receive info over CAN, I don't know if my arduino it's broken or my MCP2515 it's not working and I can't figure it out, can you help me with more info or a idea what to do next?
Hi!
Thanks!

Make sure you connected the MCP to arduino the right way. The first time I tried it I inverted 2 wires by accident
Appreciate 0
      12-19-2021, 04:20 PM   #7
Adrian87
New Member
2
Rep
5
Posts

Drives: BMW F31 2014
Join Date: Dec 2021
Location: Romania

iTrader: (0)

Hey, thank you for fast answer.
I'v checked and double checked and it is as you draw it.
I'l try tomorrow again.
Attached Images
 
Appreciate 0
      12-19-2021, 09:14 PM   #8
fe7565
Lieutenant Colonel
fe7565's Avatar
United_States
553
Rep
1,574
Posts

Drives: 2012 BMW 328i N26
Join Date: Nov 2013
Location: United States

iTrader: (0)

Wonderful project! Kudos! I love Arduinos...
Appreciate 0
      12-22-2021, 12:10 PM   #9
Adrian87
New Member
2
Rep
5
Posts

Drives: BMW F31 2014
Join Date: Dec 2021
Location: Romania

iTrader: (0)

Hey AlbertoSONIC , I have maneged to install almost everything and I run into other issue.
If I'm in the car and 3xclick the lock button the engine starts, but does not wait for the preheating time, if I'm outside the car it says in the dashboard that "Rem. control missing. No engine start.", as if the key it's not powered on all the way until engine start.
Can you help me please?
I don't know how to modify relay key power to be longer and also a longer time for preheating.
Appreciate 0
      12-22-2021, 12:15 PM   #10
AlbertoSONIC
Private First Class
98
Rep
155
Posts

Drives: 318d F30 LCI
Join Date: Sep 2018
Location: Italy

iTrader: (0)

Quote:
Originally Posted by Adrian87 View Post
Hey AlbertoSONIC , I have maneged to install almost everything and I run into other issue.
If I'm in the car and 3xclick the lock button the engine starts, but does not wait for the preheating time, if I'm outside the car it says in the dashboard that "Rem. control missing. No engine start.", as if the key it's not powered on all the way until engine start.
Can you help me please?
I don't know how to modify relay key power to be longer and also a longer time for preheating.
During the startup procedure the embedded key has to lock the car again. Can you hear that? If that's not the case, you may have badly connected or powered the embedded key.
Appreciate 0
      12-22-2021, 12:18 PM   #11
Adrian87
New Member
2
Rep
5
Posts

Drives: BMW F31 2014
Join Date: Dec 2021
Location: Romania

iTrader: (0)

Yes, key on, unlock, lock, brake - all good. If good key is in the car engine starts. If it's only the key connected to arduino, it does not start the car and says that message.
Appreciate 0
      12-22-2021, 03:13 PM   #12
Adrian87
New Member
2
Rep
5
Posts

Drives: BMW F31 2014
Join Date: Dec 2021
Location: Romania

iTrader: (0)

Hey AlbertoSONIC , I think I found out the problem.

There are 12 steps in starting the engine, but your code is missing the steps 4 to 7, and also steps 2 and 3 are to lock and not unlock the car.

Why is your code like this?

/* ENGINE START:
* 1) Turn on the in-car key (2 sec)
* 2) Press unlock button (1 sec)
* 3) Release unlock button and wait (1 sec)
* 4) Press lock button (1 sec)
* 5) Release lock button and wait (1 sec)
* 6) Press start button (1 sec)
* 7) Release the start button and wait (1 sec)
* 8) Start holding the brake and wait (5 sec)
* 9) Press the start button (2 sec)
* 10) Release the start button and wait (1 sec)
* 11) Release the brake and wait (1 sec)
* 12) Turn off the in-car key (1 sec)
*/

void engine_do_start()
{
if(engine_do_start_time == 0)
{
engine_do_start_time = millis();
Serial.println("*** Engine starting ***");
}

//divided in phases:
//KEY_POWER_ON - 100 ms
if(millis() - engine_do_start_time < 100)
{
digitalWrite(RELAY_KEY_POWER, RELAY_HIGH);
Serial.println("1) Turn on the in-car key (100 ms)");
}
//KEY_LOCK - 300 ms
else if(millis() - engine_do_start_time < 400)
{
digitalWrite(RELAY_KEY_LOCK, RELAY_HIGH);
Serial.println("2) Press lock button (300 ms)");
}
//KEY_LOCK_RELEASE - 400 ms
else if(millis() - engine_do_start_time < 800)
{
digitalWrite(RELAY_KEY_LOCK, RELAY_LOW);
Serial.println("3) Release lock button and wait (400 ms)");
}
//BRAKE - 100 ms
else if(millis() - engine_do_start_time < 900)
{
digitalWrite(RELAY_BRAKE, RELAY_HIGH);
Serial.println("8) Start holding the brake and wait (100 ms)");
}
//START - 1500 ms
else if(millis() - engine_do_start_time < 2400)
{
digitalWrite(RELAY_START_1, RELAY_HIGH);
digitalWrite(RELAY_START_2, RELAY_HIGH);
Serial.println("9) Press the start button (1500 ms)");
}
//START_RELEASE - 100 ms
else if(millis() - engine_do_start_time < 2500)
{
digitalWrite(RELAY_START_1, RELAY_LOW);
digitalWrite(RELAY_START_2, RELAY_LOW);
Serial.println("10) Release the start button and wait (100 ms)");
}
//BRAKE_RELEASE - 200 ms
else if(millis() - engine_do_start_time < 2700)
{
digitalWrite(RELAY_BRAKE, RELAY_LOW);
Serial.println("11) Release the brake and wait (200 ms)");
}
//KEY_POWER_RELEASE - 100 ms
else if(millis() - engine_do_start_time < 2800)
{
digitalWrite(RELAY_KEY_POWER, RELAY_LOW);
Serial.println("12) Turn off the in-car key (100 ms)");
}
//ENGINE STARTED
else
{
remote_started = true;
remote_start_time = millis();
engine_do_start_time = 0;
engine_start = false;

Serial.println("*** Engine started ***");
}
}
Appreciate 0
      12-22-2021, 05:10 PM   #13
AlbertoSONIC
Private First Class
98
Rep
155
Posts

Drives: 318d F30 LCI
Join Date: Sep 2018
Location: Italy

iTrader: (0)

Quote:
Originally Posted by Adrian87 View Post
Hey AlbertoSONIC , I think I found out the problem.

There are 12 steps in starting the engine, but your code is missing the steps 4 to 7, and also steps 2 and 3 are to lock and not unlock the car.

Why is your code like this?

/* ENGINE START:
* 1) Turn on the in-car key (2 sec)
* 2) Press unlock button (1 sec)
* 3) Release unlock button and wait (1 sec)
* 4) Press lock button (1 sec)
* 5) Release lock button and wait (1 sec)
* 6) Press start button (1 sec)
* 7) Release the start button and wait (1 sec)
* 8) Start holding the brake and wait (5 sec)
* 9) Press the start button (2 sec)
* 10) Release the start button and wait (1 sec)
* 11) Release the brake and wait (1 sec)
* 12) Turn off the in-car key (1 sec)
*/

void engine_do_start()
{
if(engine_do_start_time == 0)
{
engine_do_start_time = millis();
Serial.println("*** Engine starting ***");
}

//divided in phases:
//KEY_POWER_ON - 100 ms
if(millis() - engine_do_start_time < 100)
{
digitalWrite(RELAY_KEY_POWER, RELAY_HIGH);
Serial.println("1) Turn on the in-car key (100 ms)");
}
//KEY_LOCK - 300 ms
else if(millis() - engine_do_start_time < 400)
{
digitalWrite(RELAY_KEY_LOCK, RELAY_HIGH);
Serial.println("2) Press lock button (300 ms)");
}
//KEY_LOCK_RELEASE - 400 ms
else if(millis() - engine_do_start_time < 800)
{
digitalWrite(RELAY_KEY_LOCK, RELAY_LOW);
Serial.println("3) Release lock button and wait (400 ms)");
}
//BRAKE - 100 ms
else if(millis() - engine_do_start_time < 900)
{
digitalWrite(RELAY_BRAKE, RELAY_HIGH);
Serial.println("8) Start holding the brake and wait (100 ms)");
}
//START - 1500 ms
else if(millis() - engine_do_start_time < 2400)
{
digitalWrite(RELAY_START_1, RELAY_HIGH);
digitalWrite(RELAY_START_2, RELAY_HIGH);
Serial.println("9) Press the start button (1500 ms)");
}
//START_RELEASE - 100 ms
else if(millis() - engine_do_start_time < 2500)
{
digitalWrite(RELAY_START_1, RELAY_LOW);
digitalWrite(RELAY_START_2, RELAY_LOW);
Serial.println("10) Release the start button and wait (100 ms)");
}
//BRAKE_RELEASE - 200 ms
else if(millis() - engine_do_start_time < 2700)
{
digitalWrite(RELAY_BRAKE, RELAY_LOW);
Serial.println("11) Release the brake and wait (200 ms)");
}
//KEY_POWER_RELEASE - 100 ms
else if(millis() - engine_do_start_time < 2800)
{
digitalWrite(RELAY_KEY_POWER, RELAY_LOW);
Serial.println("12) Turn off the in-car key (100 ms)");
}
//ENGINE STARTED
else
{
remote_started = true;
remote_start_time = millis();
engine_do_start_time = 0;
engine_start = false;

Serial.println("*** Engine started ***");
}
}
I removed the Unlock step as it wasn't really needed to start the car (I initially used it to wake up the car, but then I found out that Locking the car again woke it up as well).

Give me some minutes, I'll upload an update with longer timings!
Appreciate 0
      12-22-2021, 05:26 PM   #14
AlbertoSONIC
Private First Class
98
Rep
155
Posts

Drives: 318d F30 LCI
Join Date: Sep 2018
Location: Italy

iTrader: (0)

Quote:
Originally Posted by AlbertoSONIC View Post
Quote:
Originally Posted by Adrian87 View Post
Hey AlbertoSONIC , I think I found out the problem.

There are 12 steps in starting the engine, but your code is missing the steps 4 to 7, and also steps 2 and 3 are to lock and not unlock the car.

Why is your code like this?

/* ENGINE START:
* 1) Turn on the in-car key (2 sec)
* 2) Press unlock button (1 sec)
* 3) Release unlock button and wait (1 sec)
* 4) Press lock button (1 sec)
* 5) Release lock button and wait (1 sec)
* 6) Press start button (1 sec)
* 7) Release the start button and wait (1 sec)
* 8) Start holding the brake and wait (5 sec)
* 9) Press the start button (2 sec)
* 10) Release the start button and wait (1 sec)
* 11) Release the brake and wait (1 sec)
* 12) Turn off the in-car key (1 sec)
*/

void engine_do_start()
{
if(engine_do_start_time == 0)
{
engine_do_start_time = millis();
Serial.println("*** Engine starting ***");
}

//divided in phases:
//KEY_POWER_ON - 100 ms
if(millis() - engine_do_start_time < 100)
{
digitalWrite(RELAY_KEY_POWER, RELAY_HIGH);
Serial.println("1) Turn on the in-car key (100 ms)");
}
//KEY_LOCK - 300 ms
else if(millis() - engine_do_start_time < 400)
{
digitalWrite(RELAY_KEY_LOCK, RELAY_HIGH);
Serial.println("2) Press lock button (300 ms)");
}
//KEY_LOCK_RELEASE - 400 ms
else if(millis() - engine_do_start_time < 800)
{
digitalWrite(RELAY_KEY_LOCK, RELAY_LOW);
Serial.println("3) Release lock button and wait (400 ms)");
}
//BRAKE - 100 ms
else if(millis() - engine_do_start_time < 900)
{
digitalWrite(RELAY_BRAKE, RELAY_HIGH);
Serial.println("8) Start holding the brake and wait (100 ms)");
}
//START - 1500 ms
else if(millis() - engine_do_start_time < 2400)
{
digitalWrite(RELAY_START_1, RELAY_HIGH);
digitalWrite(RELAY_START_2, RELAY_HIGH);
Serial.println("9) Press the start button (1500 ms)");
}
//START_RELEASE - 100 ms
else if(millis() - engine_do_start_time < 2500)
{
digitalWrite(RELAY_START_1, RELAY_LOW);
digitalWrite(RELAY_START_2, RELAY_LOW);
Serial.println("10) Release the start button and wait (100 ms)");
}
//BRAKE_RELEASE - 200 ms
else if(millis() - engine_do_start_time < 2700)
{
digitalWrite(RELAY_BRAKE, RELAY_LOW);
Serial.println("11) Release the brake and wait (200 ms)");
}
//KEY_POWER_RELEASE - 100 ms
else if(millis() - engine_do_start_time < 2800)
{
digitalWrite(RELAY_KEY_POWER, RELAY_LOW);
Serial.println("12) Turn off the in-car key (100 ms)");
}
//ENGINE STARTED
else
{
remote_started = true;
remote_start_time = millis();
engine_do_start_time = 0;
engine_start = false;

Serial.println("*** Engine started ***");
}
}
I removed the Unlock step as it wasn't really needed to start the car (I initially used it to wake up the car, but then I found out that Locking the car again woke it up as well).

Give me some minutes, I'll upload an update with longer timings!
I updated the timings (check out latest commit)

Now it waits more time before starting the car. This should give the car enough time to find the embedded key. Let me know if it works!
Appreciate 0
      12-23-2021, 04:48 PM   #15
crisfeup@gmail.com
Enlisted Member
17
Rep
43
Posts

Drives: Bmw f31
Join Date: Jan 2016
Location: Portugal

iTrader: (0)

Quote:
Originally Posted by AlbertoSONIC View Post
I updated the timings (check out latest commit)

Now it waits more time before starting the car. This should give the car enough time to find the embedded key. Let me know if it works!
Dear AlbertoSONIC,

After press 3 times the lock button to start the car and after the car starts, is possible to shut down the car with the remote if we decided to cancel the operation?
Appreciate 0
      12-23-2021, 05:54 PM   #16
webdeemo
New Member
0
Rep
11
Posts

Drives: f31 330d
Join Date: Sep 2021
Location: deutschland

iTrader: (0)

Yes, that's a good idea. Well done.
Appreciate 0
      12-23-2021, 08:01 PM   #17
AlbertoSONIC
Private First Class
98
Rep
155
Posts

Drives: 318d F30 LCI
Join Date: Sep 2018
Location: Italy

iTrader: (0)

Quote:
Originally Posted by crisfeup@gmail.com View Post
Quote:
Originally Posted by AlbertoSONIC View Post
I updated the timings (check out latest commit)

Now it waits more time before starting the car. This should give the car enough time to find the embedded key. Let me know if it works!
Dear AlbertoSONIC,

After press 3 times the lock button to start the car and after the car starts, is possible to shut down the car with the remote if we decided to cancel the operation?
Hi! Just triple press lock again to shut off the car!
Appreciate 0
      12-24-2021, 08:45 AM   #18
david51
Captain
david51's Avatar
France
538
Rep
817
Posts

Drives: bmw M3 F80
Join Date: Dec 2013
Location: france

iTrader: (0)

Garage List

Possible to do this on an M3 F80?
Appreciate 0
      12-24-2021, 10:44 AM   #19
AlbertoSONIC
Private First Class
98
Rep
155
Posts

Drives: 318d F30 LCI
Join Date: Sep 2018
Location: Italy

iTrader: (0)

Quote:
Originally Posted by david51 View Post

Possible to do this on an M3 F80?
I guess it should work right out of the box
Appreciate 0
      12-24-2021, 10:57 AM   #20
david51
Captain
david51's Avatar
France
538
Rep
817
Posts

Drives: bmw M3 F80
Join Date: Dec 2013
Location: france

iTrader: (0)

Garage List
Quote:
Originally Posted by AlbertoSONIC View Post
I guess it should work right out of the box
cool thank you
your program is the same?
Appreciate 0
      12-24-2021, 11:56 AM   #21
AlbertoSONIC
Private First Class
98
Rep
155
Posts

Drives: 318d F30 LCI
Join Date: Sep 2018
Location: Italy

iTrader: (0)

Quote:
Originally Posted by david51 View Post
Quote:
Originally Posted by AlbertoSONIC View Post
I guess it should work right out of the box
cool thank you
your program is the same?
Yeah, it should work as-is. The only way to know it for sure is to try it!
Appreciate 0
      12-24-2021, 04:52 PM   #22
david51
Captain
david51's Avatar
France
538
Rep
817
Posts

Drives: bmw M3 F80
Join Date: Dec 2013
Location: france

iTrader: (0)

Garage List
Quote:
Originally Posted by AlbertoSONIC View Post
Yeah, it should work as-is. The only way to know it for sure is to try it!
OK, thanks lot
Appreciate 0
Post Reply

Bookmarks

Tags
f30, remote, remote start


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -5. The time now is 06:10 PM.




f30post
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
1Addicts.com, BIMMERPOST.com, E90Post.com, F30Post.com, M3Post.com, ZPost.com, 5Post.com, 6Post.com, 7Post.com, XBimmers.com logo and trademark are properties of BIMMERPOST