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
      06-28-2022, 06:52 AM   #89
cu4
Registered
0
Rep
2
Posts

Drives: BMW F30 335i xDrive
Join Date: Jun 2022
Location: Germany

iTrader: (0)

Hi AlbertoSONIC,

first of all thank you from across the globe for this amazing project. I'm planning to do it this weekend as well (hope the parts arrive till then). I just have a few questions regarding the lastest information on here.

As i also see in the code there is no unlock performed anymore. So in theory i don't have to connect the unlock button on key. Is there anything against it?

Secondly you are using the constantly powered clamp 30 from the FEM. Since some problems with battery consumption were mentioned in here i'm planning to use the 30_B clamp. This will shut it self off soon after a defined time (3min when doors locked with engine off) but will be powered on when vehicle wakes up like with one push of the lock button. So maybe this will require me to first push the lock button to activate the 30_B to activate the Arduino's power source and then performing the tripple click. Do you think this will work? Is there a startup time for Arduino to be ready to listen to Can-Bus?

And to make my first post even longer, is it possible to add an second push of the start button in engine stop sequence in code to turn the vehicle completely of?
Appreciate 0
      06-28-2022, 07:00 AM   #90
AlbertoSONIC
Private First Class
98
Rep
155
Posts

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

iTrader: (0)

Quote:
Originally Posted by cu4 View Post
Hi AlbertoSONIC,

first of all thank you from across the globe for this amazing project. I'm planning to do it this weekend as well (hope the parts arrive till then). I just have a few questions regarding the lastest information on here.

As i also see in the code there is no unlock performed anymore. So in theory i don't have to connect the unlock button on key. Is there anything against it?

Secondly you are using the constantly powered clamp 30 from the FEM. Since some problems with battery consumption were mentioned in here i'm planning to use the 30_B clamp. This will shut it self off soon after a defined time (3min when doors locked with engine off) but will be powered on when vehicle wakes up like with one push of the lock button. So maybe this will require me to first push the lock button to activate the 30_B to activate the Arduino's power source and then performing the tripple click. Do you think this will work? Is there a startup time for Arduino to be ready to listen to Can-Bus?

And to make my first post even longer, is it possible to add an second push of the start button in engine stop sequence in code to turn the vehicle completely of?
Thanks!

I'll try to answer your questions:
1) Yeah you can completely avoid soldering the Unlock button
2) Yes that would be a good idea, but U actually haven't tried it yet. The guy of the post above yours stated that it works perfectly with that configuration, and doesn't even require (as I would have thought) to first wake up the car and then triple press the lock button. Looks like you can just triple press the lock button: this will make the car wake up and the buffer of the CAN module will be fast enough to read the key presses and start the car!
3) Yeah that's totally doable, just edit the code of the shutdown function
Appreciate 0
      06-28-2022, 07:01 AM   #91
AlbertoSONIC
Private First Class
98
Rep
155
Posts

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

iTrader: (0)

Quote:
Originally Posted by rkrishnan View Post
Hey AlbertoSONIC , how did you fetch the IDs for the kcan messages? I'm trying to find a more comprehensive list but there's very little documentation.

EDIT: Nevermind, I found em here: http://www.loopybunny.co.uk/CarPC/fi...ter=flag_KCAN2
Yeah I found them there, but only the IDs. The message content is different, I found it by looking at how the message changed when I pressed things and stuff like that
Appreciate 0
      07-01-2022, 04:33 AM   #92
cu4
Registered
0
Rep
2
Posts

Drives: BMW F30 335i xDrive
Join Date: Jun 2022
Location: Germany

iTrader: (0)

Quote:
Originally Posted by AlbertoSONIC View Post
Thanks!

I'll try to answer your questions:
1) Yeah you can completely avoid soldering the Unlock button
2) Yes that would be a good idea, but U actually haven't tried it yet. The guy of the post above yours stated that it works perfectly with that configuration, and doesn't even require (as I would have thought) to first wake up the car and then triple press the lock button. Looks like you can just triple press the lock button: this will make the car wake up and the buffer of the CAN module will be fast enough to read the key presses and start the car!
3) Yeah that's totally doable, just edit the code of the shutdown function
Thanks for your reply. Other thing that came into my mind is the power supply of the key. Here u using the key battery as power source. This would make this thing stop working when the battery is empty. I think it should be possible to use the 3,3V power source from the Arduino from pin 3V3 and ground form from powersuppy trough the relay. Then the key battery would not be required at all. Do you think this is a good idea?
Appreciate 0
      07-01-2022, 05:46 AM   #93
AlbertoSONIC
Private First Class
98
Rep
155
Posts

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

iTrader: (0)

Quote:
Originally Posted by cu4 View Post
Quote:
Originally Posted by AlbertoSONIC View Post
Thanks!

I'll try to answer your questions:
1) Yeah you can completely avoid soldering the Unlock button
2) Yes that would be a good idea, but U actually haven't tried it yet. The guy of the post above yours stated that it works perfectly with that configuration, and doesn't even require (as I would have thought) to first wake up the car and then triple press the lock button. Looks like you can just triple press the lock button: this will make the car wake up and the buffer of the CAN module will be fast enough to read the key presses and start the car!
3) Yeah that's totally doable, just edit the code of the shutdown function
Thanks for your reply. Other thing that came into my mind is the power supply of the key. Here u using the key battery as power source. This would make this thing stop working when the battery is empty. I think it should be possible to use the 3,3V power source from the Arduino from pin 3V3 and ground form from powersuppy trough the relay. Then the key battery would not be required at all. Do you think this is a good idea?
Arduino 3v3 output isn't powerful enough to run the key. What you can do is buy a 5v->3v3 step down on aliexpress, it's very tiny and works perfectly. In my current setup I have that instead of the battery
Appreciate 0
      10-08-2022, 01:54 PM   #94
fe7565
Lieutenant Colonel
fe7565's Avatar
United_States
553
Rep
1,582
Posts

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

iTrader: (0)

The range of my factory key FOBs is about 10 meters, if I am lucky. Would be nice to be able to start it from a much longer range. It should be possible to add a DIY CAN module with a remote receiver that is connected to the car's CAN bus. This module injects (send) the key FOB's door lock signal code in to the CAN bus. This is picked up by your gadget and from there it works as you described. Or the CAN bus door lock signal is encrypted to the car and changes every time?


Can use any decent range aftermarket car remote control that has security built-in and can do on/off, or a long range BLE module.
Appreciate 0
      12-07-2022, 05:39 PM   #95
Suspence888
Registered
Canada
0
Rep
1
Posts

Drives: BMW 328i X-Drive F30
Join Date: Nov 2022
Location: Canada

iTrader: (0)

I am going to be attempting this, but i am a noob at Arduino. Can someone help with providing the code needed to complete the timing code as provided by the OP?

code needed:

can.h
mcp2515.h
SPI.h
Appreciate 0
      12-08-2022, 05:20 PM   #96
fe7565
Lieutenant Colonel
fe7565's Avatar
United_States
553
Rep
1,582
Posts

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

iTrader: (0)

Quote:
Originally Posted by Suspence888 View Post
I am going to be attempting this, but i am a noob at Arduino. Can someone help with providing the code needed to complete the timing code as provided by the OP?

code needed:

can.h
mcp2515.h
SPI.h
I haven't done it yet, but have some experience with the Arduino IDE.

The Arduino Nano board and all basic libraries for it should be installed by default.

Those libraries that you listed above the program needs to run. The SPI library should be already installed by default when you open the Arduino IDE. If this comes up as an error later, let me know. I suspect that the can.h file is in the same library as the mcp2515.h (if not let me know)

You need to download and setup the Arduino IDE.0. When you open it, make sure the following library is installed:

https://github.com/autowp/arduino-mcp2515

There are two ways to install this. From the page I linked where this library is click on the green "Code" and select "download as zip". Put that ZIP file into the Arduino IDE libraries folder. If you do not have such folder, then create on. It should be placed here:

C:\Users\YOUR_COMPUTER\Documents\Arduino\libraries

Put this zip file inside it. You have two options to let Arduino IDE know to find the library. Try the easier option: open the Arduino IDE and go to the menu item above that says "Sketch" => "Include Library" => "Add Zip Library" ..now navigate to the C:\Users\YOUR_COMPUTER\Documents\Arduino\libraries folder and click on the zip file arduino-mcp2515-master.zip and let the Arduino IDE do its thing. Hopefully this take scare of the can.h too.


Now the main program. All your programs (i.e. sketches) should be in this folder:

C:\Users\YOUR_COMPUTER\Documents\Arduino

Add the program file ( bmw_remote_start.ino ) there. Then click on it to open it. The Arduino IDE will complain that this file has to be enclosed inside a folder. Just click on OK, and let it do it for you. Eventually the codes page will open.

Once you have the program code open, you should be able to select the Arduino Nano board from the Arduino IDE menu on top from "Tools" => "Boards" => "Board Manager"=> "Arduino AVR Boards" => "Arduino Nano"

Make sure your Nano board is plugged in the PC and select its COM port.

Now click on the blue check mark arrow on the top left to run a "compile". If all your libraries are there it should compile without any errors. The you can upload it with the right facing blue arrow next to it.

Let me know if you run into any errors.

Last edited by fe7565; 12-09-2022 at 05:02 PM..
Appreciate 2
      12-29-2022, 02:17 PM   #97
fe7565
Lieutenant Colonel
fe7565's Avatar
United_States
553
Rep
1,582
Posts

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

iTrader: (0)

Quote:
Originally Posted by Suspence888 View Post
I am going to be attempting this, but i am a noob at Arduino. Can someone help with providing the code needed to complete the timing code as provided by the OP?

code needed:

can.h
mcp2515.h
SPI.h

Did you manage to do this? If yes, any tips?
Appreciate 0
      01-15-2023, 05:00 AM   #98
fe7565
Lieutenant Colonel
fe7565's Avatar
United_States
553
Rep
1,582
Posts

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

iTrader: (0)

Ridiculous
https://cars.usnews.com/cars-trucks/...20BMW%20models.
__________________
Help each other: if you manage to fix your issue (especially with help from this forum), don't be a d*ck and disappear. Follow-up by posting the solution so you can help others.

Last edited by fe7565; 01-16-2023 at 09:58 PM..
Appreciate 0
      07-20-2023, 01:18 PM   #99
_Brian
Registered
0
Rep
4
Posts

Drives: Bmw f31 320i
Join Date: Jul 2023
Location: Belgium

iTrader: (0)

Have you tried controlling start/stop button with can bus instead of using relays?
Appreciate 0
      10-13-2023, 02:28 PM   #100
fe7565
Lieutenant Colonel
fe7565's Avatar
United_States
553
Rep
1,582
Posts

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

iTrader: (0)

Quote:
Originally Posted by Tazman78 View Post
My first post on the forum. Needed to give thanx to the creator of this brilliant setup!!

I decided to give this a try on my 530d F11 2012.

But I wanted the ability to remote start and stop via MQTT and my Home Assistant.
So I went fot the Arduino Nano 33 IoT. And yes, the power req are larger. But I can live with that.

The fact that I am completley new to coding in this it took some time to figure it out. But I think I've sorted it out. (pending IRL test)

Let med know if you are interesed in the code. The code from this thread are completley intact.
I only added support for wifi, MQTT and added some functions for activating the start and stop sequences.
Thinking about adding OTA support aswell for easier access to update the code remotley.

I would be interested. I am fairly familiar with BLE coding, but not with MQTT. What distances are you getting with the Nano 33? Using BLE between the car and the Nano 33? Or using the home wifi to reach the car with the Nano 33 inside?
__________________
Help each other: if you manage to fix your issue (especially with help from this forum), don't be a d*ck and disappear. Follow-up by posting the solution so you can help others.
Appreciate 0
      10-13-2023, 07:06 PM   #101
fe7565
Lieutenant Colonel
fe7565's Avatar
United_States
553
Rep
1,582
Posts

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

iTrader: (0)

Quote:
Originally Posted by Tazman78 View Post
Using wifi. Have an AP about 20ft from the car. Haven't checked the signal strength but no issues atm.

But my OTA seems to be giving me a hard time..
Cant get the Arduino IDE to find the network ports anymore.
Working on a solution for that.

Don't know where to put the code for everyone to find it.
It's about 500 lines so attaching it here seems to be not so good of an idea...
I have not used this yet, but it's free and does not require registration:

https://send.internxt.com/


Are you planning to do the OTA over wifi or BLE?
__________________
Help each other: if you manage to fix your issue (especially with help from this forum), don't be a d*ck and disappear. Follow-up by posting the solution so you can help others.
Appreciate 0
      11-11-2023, 01:01 PM   #102
sizanx
Private First Class
Denmark
97
Rep
130
Posts

Drives: BMW F36 420d Gran Coupé
Join Date: Oct 2021
Location: Denmark

iTrader: (0)

Really nice post and guide! I have ordered the parts

Last edited by sizanx; 12-23-2023 at 01:21 PM..
Appreciate 0
      11-13-2023, 10:41 AM   #103
mazen222
Private First Class
Canada
28
Rep
161
Posts

Drives: BMW 435i
Join Date: Apr 2020
Location: Huntington Beach, California

iTrader: (0)

Pretty cool - who ever got this done is smart
Appreciate 0
      11-21-2023, 11:07 PM   #104
Chepelin
New Member
Romania
0
Rep
10
Posts

Drives: 320d E46
Join Date: Mar 2018
Location: Brasov

iTrader: (0)

Hello and big thank you AlberoSONIC for your amazing work, I will try to give a try for my F11 manual gearbox. I will say I'm good with wiring an cars electronics but never worked with Arduino.

Did you try or think to use Gate Controller, like G202 which have a nano SIM inside. And you can call that SIM number and with that 3A signal to use it and start the car via phone.

Could this device power up Arduino, or do you know how we can use this device to start car via phone call?

Thank you!
Appreciate 0
      12-19-2023, 05:23 PM   #105
sizanx
Private First Class
Denmark
97
Rep
130
Posts

Drives: BMW F36 420d Gran Coupé
Join Date: Oct 2021
Location: Denmark

iTrader: (0)

Doing some more digging, the commercial solutions like bimmertech and easyguard use FEM A173*2B, pin 30 for driver door lock and FEM A173*4B, pin 16 for central locking to imitate keyfob lock press.

Last edited by sizanx; 12-26-2023 at 04:40 PM..
Appreciate 0
      12-27-2023, 06:34 AM   #106
Infam0uspt
Registered
0
Rep
2
Posts

Drives: BMW 425d
Join Date: Dec 2023
Location: Portugal

iTrader: (0)

Amazing project thanks for sharing
Appreciate 0
      12-29-2023, 02:23 PM   #107
sizanx
Private First Class
Denmark
97
Rep
130
Posts

Drives: BMW F36 420d Gran Coupé
Join Date: Oct 2021
Location: Denmark

iTrader: (0)

By adding a 1000 ohm resistor to "driver door signal" on FEM A173*2B, pin 30 and to the relay, you can start the car without tapping into the keyfob lock button However, this will trigger the alarm if its armed.

So next step is figuring out how to see if FEM A173*4B, pin 16 can circumvent this or some kind of CAN bus fiddling - I am trying to figure out what the default resistance is for engaging the fuel filler flap actuator is.
Appreciate 0
      01-01-2024, 02:12 PM   #108
sizanx
Private First Class
Denmark
97
Rep
130
Posts

Drives: BMW F36 420d Gran Coupé
Join Date: Oct 2021
Location: Denmark

iTrader: (0)

After some time playing around trying to figure out how do remote start without tapping in the key, here is my very work-in-progress solution
What's changed:
  • Instead of tap into key lock button, connect 1000 ohm resistor to FEM A173*2B pin 30 - imitates driver door lock signal
  • Added a 5V to 3V step down converter for KEY_POWER (MP1584EN)
  • -- Just connect the +wire to the side on the key and -wire to the bottom, you can use hotglue or make a battery dummy
  • Changed 1100 ohm resistor for brake switch to 800 ohm, as brake switch current for pressed range is 12-17 mA
  • -- My car would try and fail to start if voltage was < 13V using 1100 ohm, now it always starts
  • Uses 12V from terminal 30B by tapping into A173*3B pin 3 - so not to drain power
  • All common wires, besides for KEY_POWER, can to connected to ground (-INPUT on 12V to 5V converter) and then to the carframe/body
Pros:
  • No need to destroy/tap into second keyfob for lock
  • Uses terminal 30B for 12V which wakes up when keyfob is pressed, the CAN buffer should in theory have picked up the first lock press
  • Only 8 wires needed
  • 800 ohm resistor for brake makes the starting more consistent when car battery is not > 13V
Cons:
  • Alarm engages for a brief second, a single beep is heard
  • The car unlocks when door lock signal is imitated (need to lock after start if you want the car locked, the unlock button on keyfob still needs to be pressed to be able to drive)

The commercial solutions (Bimmertech, EasyGuard others) unlock to disarm alarm and lock to arm the alarm again. I cannot figure out how, I think via KCAN_2 but what CAN ID's and such I don't know - tried some sniffing without any luck....
Some solutions (older Bimmertech) use A173*4B, pin 16 central locking for fuel cap actuator, but I haven't figured out in what sequence it needs to triggered in order to unlock and lock the car, or even if this is needed.
The newer Bimmertech for f30 uses the same pins as described in this post without central locking. (Researched via youtube and aliexpress)

Good to know:
If you have another arduino, a good thing is to use one arduino as ISP programmer to program the other. This removes the bootloader and the startup time decreases to about 500 ms instead of 2 seconds. This would help in catching the first keypress when using terminal 30b/or other non constant 12v source.

Changes to code:
The relay for DOOR LOCK should only be open for 100 ms as if it's longer the alarm beeps for longer (the alarm does disengage). The code change is very small:
Code:
  if (millis() - engine_do_start_time < 300) {
    //KEY_POWER_ON - 300 ms
    digitalWrite(RELAY_KEY_POWER, RELAY_HIGH);
    Serial.println("1) Turn on the in-car key (300 ms)");
  } else if (millis() - engine_do_start_time < 400) {
    //DOOR_LOCK - 100 ms
    digitalWrite(RELAY_DOOR_LOCK, RELAY_HIGH);
    Serial.println("2) Imitate door lock (100 ms)");
  } else if (millis() - engine_do_start_time < 800) {
    //WAIT - 400 ms
    digitalWrite(RELAY_DOOR_LOCK, RELAY_LOW);
    Serial.println("3) Release door lock and wait (400 ms)");
  } else if (millis() - engine_do_start_time < 2800) { ....
If you want you can in engine stop use another press of the start button and RELAY_DOOR_LOCK to shutdown headunit and imitate door opening to shut of lights.

Conclusion:
So it is still a WIP, but it is still usable as is. If anyone has any idea how to disarm/unlock the car and arm/lock the car again in software, feel free to contact pm or respond in post.

I mean you could use A173*7B pin 27 to "press" the central locking in the car twice to unlock and lock, however, the alarm would stay disarmed and the fuel cap remains open.

I'll post a youtube video when I have added it to the car again
Attached Images
 
Appreciate 2
david51537.50
fe7565552.50
      01-01-2024, 04:18 PM   #109
fe7565
Lieutenant Colonel
fe7565's Avatar
United_States
553
Rep
1,582
Posts

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

iTrader: (0)

Quote:
Originally Posted by sizanx View Post
The commercial solutions (Bimmertech, EasyGuard others) unlock to disarm alarm and lock to arm the alarm again. I cannot figure out how, I think via KCAN_2 but what CAN ID's and such I don't know - tried some sniffing without any luck....

(Could replace the relays with MOSFET/transistor switching for faster/more durable operation: https://www.pololu.com/category/121/...power-switches)


Here is a cheap and easy CANBUS sniffing setup (Part 1-4):

__________________
Help each other: if you manage to fix your issue (especially with help from this forum), don't be a d*ck and disappear. Follow-up by posting the solution so you can help others.

Last edited by fe7565; 01-01-2024 at 04:29 PM..
Appreciate 0
      01-01-2024, 04:58 PM   #110
sizanx
Private First Class
Denmark
97
Rep
130
Posts

Drives: BMW F36 420d Gran Coupé
Join Date: Oct 2021
Location: Denmark

iTrader: (0)

Quote:
Originally Posted by fe7565 View Post
Here is a cheap and easy CANBUS sniffing setup (Part 1-4):

I've tried his code with both Arduino and Esp32, the connection is quite unstable but I can sniff data. How to interpret is the problem.

I've looked at the available E65 library to see if some of the same IDs come up, and they do: https://rusefi.com/forum/viewtopic.p...25bc2f6#p43671

And BMW has thought of can bus tampering, so a simple central locking control (which is 2A0 for E65) will not disarm the alarm, as the CAS authenticate itself with the DWA every unlock/lock event. I have been doing my research I am just stumped and need some input to see if any others have had any luck.

I know the basic electronics stuff but not when to use MOSFETs etc, someone else with that knowledge should optimize that I can code, solder and Arduino/Esp32 stuff on s intermediate level..

Last edited by sizanx; 01-01-2024 at 05:05 PM..
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 12:19 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