What are you doing with your can bus messages?

283 views
Skip to first unread message

Cosmin Rosca

unread,
May 20, 2020, 3:31:42 AM5/20/20
to bmw-canbus
Hi!
I mostly decode s1000xr 2005 can-bus messages, using an arduino and a modified mpc2515 (I changed the 8Mhz quartz to a 16Mhz one)
For now I am toggling some auxiliary lights on/off using a combination of buttons, and it flashes when I press the horn button.
I am planning to put some adressable led strips on my topbox for additional brake lights and turn signal.

What else did you do to your bike? Can you share your code?

Thanks! Have a safe ride!

Bertrand

unread,
May 20, 2020, 3:41:51 AM5/20/20
to Cosmin Rosca, bmw-canbus

Hi

You meam 2015? If yes I have the same bike and would be lnterested to follow your progress as I want to do the same thing!

Can you share a bit more?

I also plan to add a OOK RF transmitter module and open my garage door by pressing the turn signals cancel button 3 times in a row (for example)

Bertrand

--
You received this message because you are subscribed to the Google Groups "bmw-canbus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bmw-canbus+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bmw-canbus/c8820b42-741b-4ad0-831e-43b9d3a0306e%40googlegroups.com.

Yigit Bacakoglu

unread,
May 20, 2020, 3:45:55 AM5/20/20
to bmw-canbus
I am planning to make similar functionalities of hexezcan.com for my 2014 GS
 

20 Mayıs 2020 Çarşamba 10:31:42 UTC+3 tarihinde Cosmin Rosca yazdı:

Cosmin Rosca

unread,
May 20, 2020, 3:46:38 AM5/20/20
to bmw-canbus
Yes! It's 2015.
I will post my work when I get home.
It's messy!

I had trouble to find a way to use double or triple press a button to do an action, but my C programming skills are not my strong point 😅
Also I want to connect a Bluetooth module so I can change songs and volume from wonderwheel

Yigit Bacakoglu

unread,
May 20, 2020, 3:52:08 AM5/20/20
to bmw-canbus
Hi Cosmin,

You can use something like below;

currentClickCount = 0
lastClickedTime = 0

if((currentMillis - lastClickedTime) <= 100) {
currentClickCount += 1;
if(currentClickCount == 3){ // dosometing and reset flags }
} else {
currentClickCount = 0;
}
lastClickedTime = mills();


20 Mayıs 2020 Çarşamba 10:46:38 UTC+3 tarihinde Cosmin Rosca yazdı:

Cosmin Rosca

unread,
May 20, 2020, 3:54:22 AM5/20/20
to bmw-canbus
Yes, the problem is that for every button pressed I assigned a boolean variables.
I don't know how to use millis with variables
Message has been deleted

Yigit Bacakoglu

unread,
May 20, 2020, 6:29:10 AM5/20/20
to bmw-canbus
investigate the algorithm below to catch multiple clicks. 

float currentMillis = 0;
int currentClickCount = 0;
float lastClickedTime = 0;

void listenTripleClicks() {
  if (button_pressed) // Some logic that catches button press
  {

    // If this is the first button press, then we increment the counter by one
    if (currentClickCount == 0) {
      currentClickCount = 1;
    }

    // Button is pressed again within 100ms
    else if ((currentMillis - lastClickedTime) <= 100) {
      currentClickCount += 1; // Increment the counter
      if (currentClickCount == 3) // If this is third consequent click, handle the action
      {

        // dosometing and reset flags
        currentClickCount = 0;
      }
    }

    else
    {
      currentClickCount = 1; // If button was not pressed again within 100ms, reset the counter to one.
    }

    lastClickedTime = currentMillis; // Set current time as last click time
  }

}

}


void loop() {
  currentMillis = millis();
  listenTripleClicks();
}






20 Mayıs 2020 Çarşamba 10:54:22 UTC+3 tarihinde Cosmin Rosca yazdı:

Cosmin Rosca

unread,
May 22, 2020, 12:27:17 PM5/22/20
to bmw-canbus

This is my code for now.
it's buggy. 
s1000xr_id.h
s1000xr_state.h
test.ino
Message has been deleted

Cosmin Rosca

unread,
May 22, 2020, 12:31:46 PM5/22/20
to bmw-canbus
@Thorsten Rusert had send me his code, doing amazing stuff
new 1.ino

technicahmett

unread,
Nov 9, 2022, 4:36:33 AM11/9/22
to bmw-canbus
Hi friends.
I have a 2010 F650GS (K72).
I am trying to connect to my bike on the DWA module port for I want to make similar things that you made or planned things.
But I cannot read any message on the serial monitor. I fistly tried Can Read Demo skecth with Nano. But I cannot read any data.
I think that canspeed may incorrect?
Do you have any idea?


22 Mayıs 2020 Cuma tarihinde saat 19:31:46 UTC+3 itibarıyla cosm...@gmail.com şunları yazdı:

technicahmett

unread,
Nov 9, 2022, 9:44:49 AM11/9/22
to bmw-canbus
There is a 8Mhz xtal on the my MCP module. Do I need to change it with 16Mhz xtal?

9 Kasım 2022 Çarşamba tarihinde saat 12:36:33 UTC+3 itibarıyla technicahmett şunları yazdı:

Keith Conger

unread,
Nov 9, 2022, 9:59:20 AM11/9/22
to technicahmett, bmw-canbus
I believe so, this is what I have used in the past.

--
You received this message because you are subscribed to the Google Groups "bmw-canbus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bmw-canbus+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages