Converting Bang & Olufsen Raw code to Hex

Everything related to protocols and IR codes
Schmeling
Posts: 14
Joined: Tue Nov 27, 2018 6:13 pm

Re: Converting Bang & Olufsen Raw code to Hex

Post by Schmeling »

Actually I prefer yours :) Perhaps because I have got it working :D

Anyway. I got some different usb to serial converters, among them some almost certainly fake FTDI modules. Oddly enough they perform ok, with no junkmessages in the serial data. But the whole unit is working great i seems, and I can communicate with the Arduino through the FTDI. My plan now is to finish the code, so I can control the dimmer serially from Eventghost.

Would it be ok, to post the result on this forum? (and should it be in this section or in the Showcase section?
User avatar
AnalysIR
Site Admin
Posts: 776
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: Converting Bang & Olufsen Raw code to Hex

Post by AnalysIR »

Thats great news that you finally got it working.

What resolved the issue?

You can post your results wherever you feel is best. But as you say, in the Showcase would be good if you also posted a link to the topic here.
Schmeling
Posts: 14
Joined: Tue Nov 27, 2018 6:13 pm

Re: Converting Bang & Olufsen Raw code to Hex

Post by Schmeling »

It was a question of sending the right code.

When I started this attempt, I had the idea, that I should send the following command from a Beo4 remote: press "Light" and press "Green" (or any of the other colors) in order to control an LK FUGA TOUCH UNI350 dimmer. http://www.lk.dk/produkt/5703302141772 (probably the most common dimmer in Denmark)

You supplied me with the following two Raw codes:

Code: Select all

Light = +200, +2925, +200, +2925, +200, +15425, +200, +2925, +200, +6050, +200, +6050, +200, +6050, +200, +9175, +200, +6050, +200, +2925, +200, +9175, +200, +6050, +200, +6050, +200, +2925, +200, +6050, +200, +9175, +200, +6050, +200, +2925, +200, +9175, +200, +6050, +200, +12300, +200, 

Green = +200, +2925, +200, +2925, +200, +15425, +200, +2925, +200, +6050, +200, +6050, +200, +6050, +200, +6050, +200, +6050, +200, +6050, +200, +6050, +200, +6050, +200, +9175, +200, +6050, +200, +2925, +200, +9175, +200, +2925, +200, +9175, +200, +2925, +200, +9175, +200, +12300, +200, 
These two codes are correct readings, but they do not work for controlling the dimmer. If I convert only the datapart of the two codes above to burst pairs, I get:

Code: Select all

Light = RRR1R01R - R0R1R01R
Green = RRRRRRRR - 1R010101
If I then use this document: https://www.mikrocontroller.net/attachm ... talink.pdf (page 5) to convert the B&O burst codes to binary, I get:

Code: Select all

Light = 00011011 - 10011011
Green = 00000000 - 11010101
Converting to Hex I get:

Code: Select all

Light = 0x1B - 0x9B
Green = 0x00 - 0xD5
Refering to this link: https://github.com/christianlykke9/Beom ... Commands.h the Hex codes for Light and green are:

Code: Select all

Light = 0x9B
Green = 0xD5
So the Raw codes convert correctly, but the dimmer doesn't react to them. I also tried to use Georges BnO code to send the Hex codes: 0x9B + 0xD5, which didn't work either. After looking at the code, i could see, that what I was sending in Hex was actually:

Code: Select all

Light = 0x01- 0x9B
Green = 0x01 - 0xD5 
Note the difference in the first byte. This is because Georges code "pads" an extra byte 0x01 onto the data:

Code: Select all

sigCode = sigCode | 0x1b00;
from this:
https://forum.beoworld.org/forums/p/11816/191651.aspx and this
https://github.com/christianlykke9/Beom ... eomote.cpp

It seemed, that the first byte in the B&O data part of the IR code was an address byte, and the second byte was a command byte. All the values for the command byte seems wery well described in both Georges code, and in the beomote link above. I havn't been able to find any description of what values for the address byte should be used, but this document:
http://mlgw.bang-olufsen.dk/source/docu ... to0240.pdf

Describes in part 4.2 four values, where 0x01, as George uses seems to correspond to controling an Audio source, where 0x00 from the Raw Green code above suggests a video source being controlled. This link: https://forum.beoworld.org/forums/p/11816/191651.aspx suggested, that an address byte value of 0x1b should correspond to Light sources being controlled, which interestingly corresponds to the address byte of the Raw Light code being sent above.

So I tried sending:

Code: Select all

0x1B + 0xD5 (destination byte = Light, command byte = Green)
, which works perfectly. :idea: :idea:

I have tried looking for a list of address byte values, but without luck, except from what I've listed, but it seems they can be derived from the Raw codes, by looking af the first databyte in the Raw code, when pressing the nine source buttons (TV, Light, Radio, DTV, DVD...etc.) .
User avatar
AnalysIR
Site Admin
Posts: 776
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: Converting Bang & Olufsen Raw code to Hex

Post by AnalysIR »

Wow that sounds challenging, but thanks for posting your results.

I am sure it will be of value to others using the B&O IR Protocol.
Schmeling
Posts: 14
Joined: Tue Nov 27, 2018 6:13 pm

Re: Converting Bang & Olufsen Raw code to Hex

Post by Schmeling »

Thankyou very much. But I'm more inclined to feel, that it was Yours and Georges code, that was challenging. without them, I would never have been able to get to this point :)

And I'm not quite finished yet, because I have an issue with the SendIR module locking up or rather it is the arduino uno, that locks up on the IR pin, but I have to test a bit more before I post about that.
Post Reply