Converting Bang & Olufsen Raw code to Hex

Everything related to protocols and IR codes
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 »

first try using sendRAW with IRremote with hkz=455. (in case there is an issue with the uPWM)
Schmeling
Posts: 14
Joined: Tue Nov 27, 2018 6:13 pm

Re: Converting Bang & Olufsen Raw code to Hex

Post by Schmeling »

Sorry, you just lost me there. What is sendRaw?? and IRremote??
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 »

IRremote is an open source library for sending & receiving IR

You will find it on Github and may be able to install it from within the Arduino IDE
Schmeling
Posts: 14
Joined: Tue Nov 27, 2018 6:13 pm

Re: Converting Bang & Olufsen Raw code to Hex

Post by Schmeling »

Ahh. Got it.

I'll test it and repport back :-)
Schmeling
Posts: 14
Joined: Tue Nov 27, 2018 6:13 pm

Re: Converting Bang & Olufsen Raw code to Hex

Post by Schmeling »

Holy S__t :shock: :shock: I got it working!

Pardon my language. I probably didn't expect to figure it out ;)

Anyway the B&O protocol is specified as: 4 Start bits, 16 Data bits, 1 Trailer bit and 1 Stop bit. When sending a code, we only parse 8 bits to void sendHexBnO. Void sendHexBnO stores the hex code to be sent in this variable

Code: Select all

sigCode = sigCode | 0x0100;
The 8 least significant bits gets "padded" into sigCode, which is translated into sigArray[43], that contains the full bit array for transmission. This means that when sending the code 0xD5 (8 bits), it gets turned into 0x01D5 (16 bits), which is transmitted as the 16 databits.

Because George reported his code as working, I kept with this and tried looking for the right code. The problem is that the B&O protocol is not completely described, and most decodings only contain codes for the TV, not for tape, aux, light, etc. Therefore none of the codesets I could find worked for Light. After a complete double enumeration (I was trying to send Light + Green) of all codes yielded no results, I figured it had to do with the bits in the code. After stumbling on this link:

https://forum.beoworld.org/forums/p/11816/103267.aspx

It seemed, that the difference between TV commands, and other commands lies in changing the 2 most significant bytes

changing the above to

Code: Select all

sigCode = sigCode | 0x1B00;
and then sending

Code: Select all

arduino.sendHexBnO(0xD5, 16, 0, 455);
Worked perfectly. Apparantly there is no need to to send the light command 0x9B. Only 0xD5 (green) is nescesarry. :idea:
Schmeling
Posts: 14
Joined: Tue Nov 27, 2018 6:13 pm

Re: Converting Bang & Olufsen Raw code to Hex

Post by Schmeling »

Having found the correct B&O code for the dimmer, I'm left with another problem. The uPWM_Arduino Hack described here,

https://www.analysir.com/blog/2015/10/1 ... sing-uart/

renders the hardware USB/Serial port non-functional, which is a major bummer, since I would like to control the code via the serial port. The only solution I can come up with is to buy two Arduino Nano's and use one for receiving serial signals, the other for sending the IR code, and let the first control the second through one of the pins.

This does seem a bit (a lot) redundant. Does anybody have any ideas for a more elegant solution?
Schmeling
Posts: 14
Joined: Tue Nov 27, 2018 6:13 pm

Re: Converting Bang & Olufsen Raw code to Hex

Post by Schmeling »

I was wondering whether this:

https://www.amazon.com/Qunqi-FT232RL-Se ... B014Y1IMNM

would make it possible to establish an other serial port for serial communication with the arduino.

I'm mostly interested in whether it will interfere with the uPWM_Arduino Hack https://www.analysir.com/blog/2015/10/1 ... sing-uart/
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 »

Sorry, I don't have any additional ideas for you.

We dont offer any 455kHz receiver as a standard option, because they are so rarely used.

However, I could do up a custom module for you with a genuine Vishay 455kHz receiver as I have a small quantity available. (They are not made any more).

I could customise the DetectIR module or any of the A.IR Shields(without the IR Learner sensor, as it makse no sense for 455kHz)

AnalysIR, will work with a 455kHz receiver, but so far we haven't implemented decoding for B&O because it is used so little. However, you could send directly from AnalysIr @ 455kHz using any A.IR shield.

So a custom module with IRremote should be fine for you.

PS: There is a poor-mans Ir receiver circuit on our blog, using an IR LED as a receiver. That could work as a receiver for 455kHz, but you wouldnt be able to measure carrier frequency, which is not required.
Schmeling
Posts: 14
Joined: Tue Nov 27, 2018 6:13 pm

Re: Converting Bang & Olufsen Raw code to Hex

Post by Schmeling »

Right now my goal is to be to be able to communicate through a serial usb connection with the arduino. Since running the uPWM_Arduino Hack uses the serial signal for the IR signal, I was wondering if using the softwareserial library with this

https://www.amazon.com/Qunqi-FT232RL-Se ... B014Y1IMNM

would make it possible to establish an other serial port for serial communication with the arduino, or if it would interfer with the clock for the IR signal?
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 »

The uPWM hack is only meant to be used in limited circumstances & not yours. (For example if you can't run IRremote or similar)

For you the best method is to use the IRremote sendRAW function to send the signal.

Any usb to serial module is fine, but be careful with FTDI modules, as there can be driver issues, particularly if not 100% genuine. I stopped using FTDI since they messed up a few years ago 'aggressively' responding to clones. However, IRremote is the preferred way.
Post Reply