Opel Astra H - smartphone door control via bluetooth
Hello
I present my door control devices in my Opel Astra H. The device is based on the Atmega 168 and the MCP2515 module schematic for communication with the can bus. I used the HC-06 bluetooth module to communicate with the phone. The phone application was written in Mit App Inventor.
Functions:
- closing the door with the windows closed
- opening the door
- closing windows
- opening windows
- closing the windows after closing the door with the remote control
Before I started building the target device, I had to find the right pid and frames to control the door with. For this, I had to build a sniffer.

We managed to find the relevant data that can be used to control the door:
PID 352
- closing the door 1 64 73 62
- opening the door 1 16 73 62
- closing windows 1 192 73 62
- opening windows 1 48 73 62
Knowing these data, it was possible to start building the target device.





The biggest challenge was the Android application. This is where the Mit App Invetor platform came to the rescue. The program sends the appropriate command to uC via bluetooth. It has the ability to change the PIN of the bluetooth module. After starting the application, you must log in with a four-digit PIN. This PIN is stored in the device, and the compliance of the entered PIN with the saved PIN is also checked there. If everything is correct, the application will log into the device. This PIN can be changed. After the first connection, it remembers the data of the bluetooth module and connects to it automatically after re-entering the range.

In addition to bluetooth control, I added the function of closing the windows after closing the door with the remote control. Unfortunately, in Astra H the factory window closing is a misunderstanding. After closing the door, you need to press and hold the close button again to make the windows close.
My device, after receiving information from the CAN bus that the door has been closed from the remote control, sends information to close the windows.
During the tests, it turned out that the CAN bus goes to sleep after closing the door. Unfortunately, I couldn't find a way to wake it up using CAN commands. It remained to check what wakes CAN. Among other things, this is the door opening / closing button on the center console. When CAN is in sleep mode, pressing this button wakes the CAN, but does not open the door, which was convenient for me. After dismantling this switch, it turned out that there are ordinary rubber bands like in the remote control, and the contacts are shorted to ground. As you can see in the diagram, it was enough to connect the emitter of the transistor to the ground of the button, the collector to the second pin of the button, the base is connected to ground through a resistor, and to the uC port through another resistor.

The whole thing works like this:
I present my door control devices in my Opel Astra H. The device is based on the Atmega 168 and the MCP2515 module schematic for communication with the can bus. I used the HC-06 bluetooth module to communicate with the phone. The phone application was written in Mit App Inventor.
Functions:
- closing the door with the windows closed
- opening the door
- closing windows
- opening windows
- closing the windows after closing the door with the remote control
Before I started building the target device, I had to find the right pid and frames to control the door with. For this, I had to build a sniffer.

We managed to find the relevant data that can be used to control the door:
PID 352
- closing the door 1 64 73 62
- opening the door 1 16 73 62
- closing windows 1 192 73 62
- opening windows 1 48 73 62
Knowing these data, it was possible to start building the target device.





The biggest challenge was the Android application. This is where the Mit App Invetor platform came to the rescue. The program sends the appropriate command to uC via bluetooth. It has the ability to change the PIN of the bluetooth module. After starting the application, you must log in with a four-digit PIN. This PIN is stored in the device, and the compliance of the entered PIN with the saved PIN is also checked there. If everything is correct, the application will log into the device. This PIN can be changed. After the first connection, it remembers the data of the bluetooth module and connects to it automatically after re-entering the range.

In addition to bluetooth control, I added the function of closing the windows after closing the door with the remote control. Unfortunately, in Astra H the factory window closing is a misunderstanding. After closing the door, you need to press and hold the close button again to make the windows close.
My device, after receiving information from the CAN bus that the door has been closed from the remote control, sends information to close the windows.
During the tests, it turned out that the CAN bus goes to sleep after closing the door. Unfortunately, I couldn't find a way to wake it up using CAN commands. It remained to check what wakes CAN. Among other things, this is the door opening / closing button on the center console. When CAN is in sleep mode, pressing this button wakes the CAN, but does not open the door, which was convenient for me. After dismantling this switch, it turned out that there are ordinary rubber bands like in the remote control, and the contacts are shorted to ground. As you can see in the diagram, it was enough to connect the emitter of the transistor to the ground of the button, the collector to the second pin of the button, the base is connected to ground through a resistor, and to the uC port through another resistor.

The whole thing works like this:
Comments
Congratulations on your willingness :) impractical for me, the only thing cool is closing the windows. Closing by phone? I would go crazy, I can do it faster with the remote or the key. I would prefer... [Read more]
Necessity is the mother of invention. In fact, initially it was just about closing the windows. But I have already had situations several times when going from Biedronka to Lidl, I pass the place where... [Read more]
What is the current consumption of the device? [Read more]
Unfortunately, I don't know, a few days ago I blown the fuse in the ammeter, but I want to check it out of curiosity. On the other hand, the car is used every day, so I'm not afraid of the bat... [Read more]
CAN sends full frames, how did you decode which one is needed to close / open the door? You sent each one in turn and watched what happened? Can you write something more about your sniffer? [Read more]
https://www.elektroda.pl/rtvforum/viewtopic.php?t=3911885&highlight= It writes everything that goes from CAN to the table, if there is a pid that has already been written, it only updates its data. ... [Read more]
Beautiful work - I assume that other brands can also be scanned and added something or modified the behavior of the comfort modules. You joined via OBD2 - can you join without the OBD socket? Is it risky... [Read more]
I connected to the OBD. The risk of damage is always there, fortunately nothing happened in the Astra, but it may crash some errors in other cars when you start sending your frames. Somewhere I read that... [Read more]
Interesting project due to the bus. Can you tell? I wanted to build a reading of engine parameters for a two-wheeler, including specific fuel consumption / injection length. CAN bus. Are the frames from... [Read more]
I do not know. I listened for the reaction after triggering the event, but the battery voltage is being supplied all the time. Even if it is the same with the parameters you are interested in, you will... [Read more]
Thanks. How did you listen / poll the bus? It's about soft and hardware. [Read more]
I was only picking up what is going on CAN. https://www.elektroda.pl/rtvforum/viewtopic.php?t=3911885&highlight= [Read more]
Is it possible to make some extra check engine and pillow error? I know people who seal them once a year. I know that CAN alarms can turn on the reserve light, so maybe you can turn off something. Plusik... [Read more]
@mimitron, did you also test your patent in the car without REC, or maybe you found other interesting frames? I use ESP32, which simplifies the design, because it is enough to add TJA1050 (or similar),... [Read more]
Slow CAN. I did not have the opportunity to test it in a different Astra or other Opel, so I do not know if it would work without rec or without factory-activated window closing. [Read more]
Functionality and security are sometimes contradictory, and that's where it is. Radio control is unreliable and according to the machinery directive, the transmitter must actively send a move command.... [Read more]
I have no stops and breaking the connection will not stop the movement of the glass. The command is sent once, then the car does the rest. It does not work that the door closing frame is sent all the time... [Read more]
A safety system is integrated in the driver of the window motor itself, when the current increases (an obstacle) it will stop closing or even start to lower the window. [Read more]
Well, stopping the glass has to be resolved somehow. The command is sent via CAN once, the rest is done by the door electronics. [Read more]