Will I, as a new user be able to make this happen? (Bmw Ibus)

Hi! :slight_smile:

I have an idea of making a simple interface that makes me control (skip songs) on my steering wheel controls in my Bmw E39 03 model, over bluetooth.

The thought was to use an arduino UNO (witch I have bought and played a bit with), make a Ibus "device" to make the arduino listen on the ibus, use a simple bluetooth module witch has the capability to skip songs over bluetooth, and make the arduino cotrol the buttons on this with simply ground (i think) the connections for the buttons witch then will make it skip.

I have found a scetch of a ibus device used with a arduiono at a site called curious ninja, a lot of interesting information. So i have bought the parts needed, included a TH3122.4 chip.
Will try to make this thing when the parts arrive. That will probably be no problem as it wasnt that hard.

Edit:
I forgot to mention that i have a Reslers Ibus interface, and i have used navcoder to obtain the telegrams from the buttons. :slight_smile:

But, my biggest problem is that i have no knowlage of using and programming the arduino.
My brother had a arduino kit with leds and stuff that i have used and made most of the tasks in the book, with sucsess. But the code is aleready made so that part isnt difficult.

But from knowing zero nada about this, i am now able to write a scetch that makes the led blink, and i have made it send an SOS signal.. :stuck_out_tongue: But thats about it with my knowlage of this.
My brother might be able to help littlebit, but its a few years since he used this thing.
My father works with a guy that know this, so he might be able to help but i won't rely my project on him. :slight_smile:

So my big question is, is this something i can be able to make my selfe with my limited knowlage?
And would the scetch be long and complicated to make it listen on the ibus via the ibus device?

After i started fiddeling with the arduino it really is a cool thing, and probably has SO many cool things i could make.. So it irritates me that i know so little.. :stuck_out_tongue:

Hope you would share your experience and tell me if this would even be possible for me to make? :slight_smile:

Thanks!

Regards
Fredrik

Nobody can know whether you'll succeed, unless you try it.

For now find out and understand which library functions will be required in your project. See the examples, coming with every library.

For other code, try to understand it, and locate the parts that will be useful.

Then glue all that together, so that it finally will do what you want.

Hi,
Thanks for your answer.

Trying is what im doing, but as i dont know this, i have to search for everything, and very often the answer i find isnt explained a way that i would understand, or im left with even more questions.
So im struggeling with understanding everything. But i try to learn as i go.
Not optimal, but i dont have any other way of doing it. And i hope that i somehow can manage to
get enough information to make the scetch needed to read the ibus through the adapter.

How do i know what librarys i need when i have made the part my self?
Is it the chip that decides that`?

Fredrik

Beginners should start with ready-made modules, accompanied by Arduino libraries and examples. If you buy a bare chip, you have to make it work and interface it to the Arduino yourself. Eventually you find related code by searching e.g. for "TH3122 Arduino".

Can you provide a more complete list of your project items, what works and what does not yet work?

Take a look at this post. A lot of info on the BMW I-bus. Struggling with my BMW IBUS projects. Serial.read related issues. - Project Guidance - Arduino Forum

Sorry for the delayed answer.

DrDiettrich:
I probably should start to learn from the bottom, i agree.
Searched for "th3122 arduino" and found some interesting reading that i have to dig into.

Regarding the items im using, i use the schematics from this page, and i have bought the parts to put this together.

Im still waiting for some parts before i can put it together though, so at the moment nothing is up and running. Exept the bluetooth module, witch i have tested, and connected to the arduino for testing.

I wrote a simple scetch witch sends a puls every 6 seconds, on one pin that i connect to the "skip" pin on the bluetooth module. This made it skip tracks in google play, so this part works. The pin on the bluetooth module supplies 3.3 volts, and when this is connected to the skip pin, it skip tracks.
I meassured the output voltage from the pin of the arduino, and it supplied only around 2 volts. Still worked though. But ideally i need to find a way to supply 3.3 volts, controlled by the arduino.
This is currently what im looking into, while waiting on the rest of the parts.

When the "ibus device" is made and connected, all that remains is the code to make the arduino talk to the car, and set pins to HIGH when it sees the button on the steerinwheel getting pressed.
And this would again trigger the skip input on the bluetooth module.

So thats where im currently at.

detown:

Thanks for the link, I have already read alot in this thread, interesting readings there. :slight_smile:

What pin do you mean with 2V? The on-board 3.3V voltage regulator is not suited to drive BT modules, you need a stronger 3.3V power supply (step down regulator).

Sorry, bad explanation.

The BT module needs 3.3 volt on the pins for skipping tracks.
(The module it selfe is rated to run on 7-30 volts DC)

The sketch sets pin 13 HIGH for 200 ms (on and then off every 6 second) to act as a button was pressed.
The pin 13 was then connected to the pin on the bluetooth module witch skip track.

When i meassured the output voltage from the 13 pin when high, i only got around 2 volts.
So the pin did not supply 3.3 volts as the bluetooth module does. But it still worked.

This was just a test, to see if signal from the arduino would make it skip.
I will have to make a better circuite for this, where it will get 3.3 volts.

Maybe use some transistors (?) witch will activate when the pins on Arduino goes high, and send the 3.3 volt signal from the bluetooth module to it selfe.. (if you understand what i mean).

But i dont see that as a problem, my biggest problem is getting the sketch and arduino to talk with the car. :slight_smile:

Hi Fredrick,

You should be able to use the library and example code from the Curious Ninja site to do this.

I originally wrote the library code, but the Curious Ninja site is run and maintained by someone else.

It shouldn't make any difference when connected to the car (it's already pulled up), but for bench testing, you'll need to pull the iBus line up to 12v (car battery voltage) with a 1K resistor. You won't get any communication without this.

If you haven't already, it's worth registering Navcoder (20 Euros), to be able to send messages on the iBus. This (and the Resler interface) will allow you to properly bench test, without having to take everything out to the car for testing. It even has a multi function steering wheel emulator built in.

It's also worth powering the Arduino from the 5v regulator built into the TH3122 (Max 100mA). This allows my library code to shutdown the entire device when it detects the iBus has been quiet for a certain period of time. It will then wake up as soon as it detects more iBus traffic, like you unlocking the car.

Ian.

Hi Ian,

I have ordered all the parts that stated on the curious ninja schematic, that includes the 1k resistor, doesnt it?

I already have a registered version of Navcoder, and a reslers interface. :slight_smile: This way i got the messages from the steeringwheel to.

I read that the TH3122 could power the Arduino, so i was planning to try to use that feature. :slight_smile:

But, when browsing in the goodle drive of curious ninja, witch sketch should i use?
There is many sketches, i have opened some of them, but not sure witch one that is supposed to be used for the communication with the ibus through the "homemade" adapter.

Regards
Fredrik

Alpejohn:
I have ordered all the parts that stated on the curious ninja schematic, that includes the 1k resistor, doesnt it?

I don't see a 1K pull up resistor in the schematic you linked to before. There's a 10ohm resistor in series, but no pull up.

I already have a registered version of Navcoder, and a reslers interface. :slight_smile: This way i got the messages from the steeringwheel to.

Excellent.

But, when browsing in the goodle drive of curious ninja, witch sketch should i use?
There is many sketches, i have opened some of them, but not sure witch one that is supposed to be used for the communication with the ibus through the "homemade" adapter.

I've attached the latest library code below. This needs to be un-zipped into the arduino 'libraries' folder. Then try the example sketch.

Ian.

Ibus.zip (17 KB)

Thanks for the zip! Will have a closer look at it later.

But about the 1k pull up resistor, i might be confusing it with a different schematic, cause i remember seeing this somewhere about a 1k pull up resistor. Cant find it at the moment though.

But where should this resistor be added/placed?

Fredrik

It's not that critical where you put it. Simply connecting the resistor between TH3122 pins 1 & 6 will work fine.

Ian.

I see! That should be a easy fix. :slight_smile:

Now, im not an electrician, but when i searched for the 1k ohm resistor on ebay, i find several types like 1/4w, 1/8w, 1/2w and so on.

Witch is the right one? :slight_smile:

I really appreciate your help!

Fredrik

Again, not really critical in this application. I would go for the 1/8W, just because it's physically the smallest.

As a pull up resistor, it's going to dissipate virtually no power, so there's no need for anything bigger. I use tiny surface mount resistors in my circuits, and these have even lower power ratings.

Just use what's easiest/cheapest to get.

Ian.

Hi,
Still waiting for some parts!
But I am ready to start put the ibus adapter together as soon as the rest arrives.
I have a breadboard and wires an everything, so i cant wait to test it out! :smiley:

I have had a closer look at the ibus files i got with you Ian, but im left with some questions :-[ ;D

Is this where the ibus messages that it should look for should be?

void loop()
{
  ibus.run(); // This keeps the IbusSerial library running.
}

// This is where we compare the received message with all the message bytes
// in IbusGlobals.h, and respond accordingly.
void packetHandler(byte *packet) // callback function - Library calls this when good message received.
{

  // Message from MFL_RT
  if (memcmp_P(packet, MFL_RT_PRESS, 6) == 0 ) {
    // This is how to send a known i-Bus message, from list in IbusGlobals.h.
    // It's sending the CD_STOP message whenever you press the
    // R/T button on the steering wheel. This is just an example, and probably
    // not something you would ever want to do.
    ibus.write(CD_STOP, sizeof(CD_STOP));
  }
  // Message from MFL_VOL_UP
  if (memcmp_P(packet, MFL_VOL_UP, 6) == 0 ) {
    // This is how to send text message to the Business CD/Radio display
    ibus.radioWrite("You pressed the Vol up key"); // Text longer than 12 characters will automatically be scrolled.
  }
  // Message from MFL_VOL_DOWN
  if (memcmp_P(packet, MFL_VOL_DOWN, 6) == 0 ) {
    ibus.radioWrite("Vol DOWN");
  }
}

I opened the ibusglobals.h file, and had a look at all the messages.
But i dont quite understand how they are going to be written in the sketch so that it knows what to look for, and how to determine what it should do if the spesific message appears?

I think that if it activates two pins (one for skip FF and one for skip BW) that would be enough to control the BT module. :slight_smile:

I was thinking the other day, if it would be possible to display ID3 tags over bluetooth, so that it will show what song thats playing on the display.. You wouldnt happen to know if that is possible? :grinning:

Thanks again Ian, you have already helped me alot!

Regards Fredrik

Right, the callback function should handle all (important) messages.

What the messages mean, and what you can do upon receipt, is a question for ibus gurus.

I only can guess that you have to look at the length of the messages, so that you can write the right length into memcmp_P().

Hi Fredrick,

When the library has received, decoded and confirmed it has a good message, it will call the packetHandler() function, and pass it a pointer (*packet) to the newly received message.

In the packerHandler function, you compare packet with any of the known iBus messages stored in IbusGlobals.h. This is done using memcmp_P. memcmp_P compares two sections of memory, and if they both contain exactly the same data, it will return 0

If we look at this line of code:

memcmp_P(packet, MFL_RT_PRESS, 6)

This basically says 'Compare the first 6 bytes of the memory location pointed to by packet, with the first 6 bytes of the memory location pointed to by MFL_RT_PRESS'. If they both match, memcmp_P will return 0.

If we now look at the complete statement:

if (memcmp_P(packet, MFL_RT_PRESS, 6) == 0 )
{
    Your Code here.

}

This basically says 'IF the return value from memcmp_P == 0' - run the code between the curly braces.

It's up to you what code is written between the curly braces, but driving a digital pin High or Low to activate something on the BT module should do the job.

Writing ID3 tags to the display is possible. My library already has the capability to write to the single line display on an E46 3 Series radio. I think it's shown on the MID display on an E39, but I've never tested it on an E39. It basically simulates messages coming from the Telephone module.

Which BT module are you using ?

Ian.

Thanks DrDietrich!

Ian

Ok then i understand a little bit more. And all the button functions are listed in the library right?
In the ibusglobals.h? Would it be enough to change the code from MFL_RT_PRESS to MFL_SEARCH_UP?
Or is it more then that that needs to be changed to make it look for the messages that i need it to?

The BT module i use is this one, its a "standalone" and not to be connected and interfered with the code of the arduino.

If you look at the pic from the back side of the board, there is a connection point that says "Key com", this pin supply constant 3.3 volts, and when this pin is connected to "up" or "dn" for a short second it will make the phone skip track. So the only thing i need is to control this 3.3 volt signal every time the code sees the skip up/down message.

I was thinking of using two transistors connected to one pin each on the arduino so that it will activate them and send the 3.3 volt signal to the BT board skip pins.
Atleast that was how i thought it would work..

But im not sure if thats the best way to do it.

When i meassured the voltage from the pins on the arduino when they where HIGH, i only got around 2 volts. This was enough to activate the skip prossedure though.. So it might not be needed with extra transistors and stuff.. I just have to get it all mounted toghether and do some testing. :slight_smile:

My english isnt perfect, so i somtimes struggle to explain stuff.. :drooling_face: :grinning:

Hi Fredrick,

Alpejohn:
And all the button functions are listed in the library right?
In the ibusglobals.h? Would it be enough to change the code from MFL_RT_PRESS to MFL_SEARCH_UP?
Or is it more then that that needs to be changed to make it look for the messages that i need it to?

I can't say that ALL button functions are listed in IbusGlobals.h, but I think all the ones you need should be there. This is assuming the E39 uses the same iBus codes as the E46, but I think they should be the same.

It really is as simple as changing MFL_RT_PRESS to MFL_SEARCH_UP. All of the MFL iBus messages are 6 bytes long, so you don't need to change the 6, but if you use any messages that are longer or shorter, you need to change the number of bytes to match.

The BT module i use is this one, its a "standalone" and not to be connected and interfered with the code of the arduino.

I'm not sure you'll be able to get ID3 tags from that module. If you can, then it is possible to display them.

If you look at the pic from the back side of the board, there is a connection point that says "Key com", this pin supply constant 3.3 volts, and when this pin is connected to "up" or "dn" for a short second it will make the phone skip track. So the only thing i need is to control this 3.3 volt signal every time the code sees the skip up/down message.

I was thinking of using two transistors connected to one pin each on the arduino so that it will activate them and send the 3.3 volt signal to the BT board skip pins.
Atleast that was how i thought it would work..

But im not sure if thats the best way to do it.

Two transistors may be the safest option. I'm assuming the BT module is a 3.3v device, so the 5v from an Arduino output could damage things.

When i meassured the voltage from the pins on the arduino when they where HIGH, i only got around 2 volts. This was enough to activate the skip prossedure though.. So it might not be needed with extra transistors and stuff.. I just have to get it all mounted toghether and do some testing. :slight_smile:

When you measured the 2 volts, was that when the pin was in the high state, or just when it was being pulsed high for a short duration ? Most digital volt meters take a certain amount of time to update the display, and a short pulse may only show as 2v, even though the pin is reaching 5v.

My english isnt perfect, so i somtimes struggle to explain stuff.. :drooling_face: :grinning:

Your English is just fine :slight_smile:

Ian.