Elektroda.com
Elektroda.com
X
Elektroda.com

Opel Astra H - smartphone door control via bluetooth

Mimitron 5061 28
This content has been translated flag-pl » flag-en View the original version here.
  • 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.

    Opel Astra H - smartphone door control via bluetooth

    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.
    Opel Astra H - smartphone door control via bluetooth

    Opel Astra H - smartphone door control via bluetooth

    Opel Astra H - smartphone door control via bluetooth

    Opel Astra H - smartphone door control via bluetooth



    Opel Astra H - smartphone door control via bluetooth

    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.

    Opel Astra H - smartphone door control via bluetooth

    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.

    Opel Astra H - smartphone door control via bluetooth

    The whole thing works like this:




    Cool? Ranking DIY
    Can you write similar article? Send message to me and you will get SD card 64GB.
    About Author
    Mimitron
    Level 20  
    Offline 
    Mimitron wrote 726 posts with rating 144, helped 8 times. Been with us since 2003 year.
  • #2
    hetm4n
    Level 20  
    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 a mini computer based on OLED with engine temperature, because this model is missing on the clocks :(
  • #3
    Mimitron
    Level 20  
    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 the car is standing, without the keys, I could not leave the purchases in the car and had to drag them back and forth ;) Or how many times, being outside, I could use something from the car, but I didn't have the keys with me. The fact that this is a gadget used occasionally, but it will come in handy. :) As for the computer, I used to make a Golf 4 computer, days before arduino and aliexpres. If I had access to this knowledge then, it would be a miracle, and just to calculate fuel consumption, I had to count the injection opening time, you can see it in DIY, I described my computer here.
  • #4
    error105
    Level 13  
    What is the current consumption of the device?
  • #5
    Mimitron
    Level 20  
    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 battery.
  • #6
    v-cu
    Level 11  
    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?
  • #7
    Mimitron
    Level 20  
    https://www.elektroda.pl/rtvforum/topic3911885.html

    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.
    I display the boards on the display. After that, it was enough to look for a PID, which changes after pressing the remote control buttons. That's how I found frames for closing, opening doors and windows with the remote control. I also found data on opening and closing doors and locking the locks, which would be useful for an alarm.

    [youtube]https://youtube.com/shorts/rXcnpilkAy4?feature=share[/youtube]
  • #8
    sq3evp
    Level 31  
    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 - potential damage to the CAN bus.
  • #9
    Mimitron
    Level 20  
    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 Volvo does not tolerate such fun, you can only listen. In theory, everything can be scanned, the question of setting the transmission speed.
  • #10
    austin007
    Level 17  
    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 the ECU sent in time intervals spontaneously without a specific query in the CAN system, or do they require polling every time?
  • #11
    Mimitron
    Level 20  
    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 still have trouble finding the right PID and then decrypting the frame. For example, in Astra PID 1280 and frame 00 98.
    I would not come up with the fact that this PID is the battery voltage, and the second byte is the voltage indication, which still needs to be divided by 8.
  • #12
    austin007
    Level 17  
    Thanks. How did you listen / poll the bus? It's about soft and hardware.
  • #14
    eurotips
    Level 38  
    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 for a working device.
  • #15
    urkotrebor
    Level 18  
    @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), MCP2515 is then unnecessary, because the ESP32 does the same and there is bluetooth and WIFI for free.
    Can you also reveal which CAN you are operating on, medium or low?
  • #16
    Mimitron
    Level 20  
    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.
  • #17
    William Bonawentura
    Level 33  
    Mimitron wrote:
    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.

    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. Does your application have a "STOP" function, and if the BT connection is disconnected or the application loses focus, traffic is stopped?
  • #18
    Mimitron
    Level 20  
    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 until the window is closed or opened. I ship once and then the glass opens or closes automatically.
  • #19
    carrot
    Moderator of Cars
    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.
  • #20
    Mimitron
    Level 20  
    Well, stopping the glass has to be resolved somehow. The command is sent via CAN once, the rest is done by the door electronics.
  • #21
    William Bonawentura
    Level 33  
    carrot wrote:
    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.

    Amperometry will not protect, for example, a child's larynx. The actuator must have enough torque to break the ice off the guides. The security is provided by a man who is on the spot and can react immediately. For this he must have the keys in the ignition.
  • #22
    byrrt
    Level 21  
    Interesting topic mainly due to the connection to the car via CAN. I am thinking of something similar (systemically) but for automatically disabling the start-stop system. So, after starting the engine, one frame that turns off the system. In my car, you have to do it every time you start it, in addition only through the menu on the display. I conclude that this could be done by sending a command.
  • #23
    sq3evp
    Level 31  
    The manufacturer of the car made sure that you do not think about such evil - ecology is the key.
    Some cars have it on the button in the cabin - so not everyone makes it difficult.
    The very idea of the device is good, it would only be necessary to analyze a lot, what could be controlled by such systems and how safe it is for the car. In some models, it is enough to reprogram the module via ODB2 - the only question is how much the settings have to be interfered with. Such a light hacking of the car's system.

    Or otherwise - adding "features" that the car manufacturer "forgot" about.
  • #24
    eurotips
    Level 38  
    sq3evp wrote:
    Some cars have it on a button in the cabin - so not everyone makes it difficult.

    Well, I don't agree with that. The age of the car is the key again.
    When this system was just entering, it was enough to flip the button and shorten / open the cables.
    Then, from the diagnostics level, it was possible to turn it off permanently, until it was time for bistable relays simulating a click after each start. Now once that you don't disable it permanently, and two, sometimes it's hidden in the menu perfidiously, as @byrrt wrote.
    I do not want to remind you about Security Diagnostic here, because it has only been functioning for two years, and there you can plug "something" into the OBD connector.
  • #25
    byrrt
    Level 21  
    @ sq3evp, there are two difficulties in the car I drive - no button and a guarantee. And such an impersonation of some driver, sending the package to the bus with the command turn off the start-stop system seems simple and rather safe. In addition, this system cannot be turned on in specific conditions, e.g. severe heat or at temperatures below 0 C, so you would probably have to first read whether the system is not turned off, and if it is, turn it off and silence, cut off the line and that's it.

    Does my friend @Mimitron know if there are no other ways to sniff CAN, maybe via some ready interface or analyzer? Because I tried to find some information on this subject on the Internet, but to no avail. It is of course something reasonably priced.
  • #26
    carrot
    Moderator of Cars
    As for deactivating the start-stop, I know two options: in the VW group, it is enough to re-code in the climatronic module, you need to activate the comfort function, it is enough to have the ventilation turned on so that the engine does not go out.
    The second one, not all cars, but it is worth checking, is the momentary activation of the engine hood opening limit switch.
  • #27
    eurotips
    Level 38  
    carrot wrote:
    in the VW group, it is enough to recode in the climatronic module, you need to activate the comfort function, it is enough to have the ventilation turned on so that the engine does not go out.

    In what age groups does it work? because in 5-year ones it is only a change of the permissible voltage drop at start-up from 9 to 12V works. As I mentioned, what will you connect to OBD in new cars after 2019 with safe diagnostics?
  • #28
    byrrt
    Level 21  
    Gentlemen, we're littering the subject a bit. In my case, it is Toyota Proace City, which is actually a clone of the PSA group of the Berlingo / Partner / Combo type, and it is a car from 2020. I understand that in these years it is not so easy to eavesdrop on OBD?
  • #29
    sq3evp
    Level 31  
    A question of safety for sure.
    The Start-Stop buttons are still used by new cars - I don't remember, but it probably works so that after turning on the engine, you can turn it off.
    I do not know if they all have the same or cannot be turned off in the settings, but many cars have a button on the board.

    The question is whether this can be turned off in the comfort modules or something similar.

    A small update - apparently VAG (for VW Audi group) and DDT4All (for Renault and Dacia) you can disable the Start-Stop system. I don't know how it works - whether permanently or otherwise, but it is a change of value in the configuration of the corresponding module.