jenswilly.dk


IR Remote working!

Yessiree!

It works! Pretty darn well in fact!

Although I did have a couple of minor problems when I had assembled the board.
First, I could not connect to the BLE112 module with the CC Debugger in order to load firmware onto the Bluetooth module. Not so good... I spent quite some time tracing the connections of the programming header and the BLE112 module and comparing with the prototype but everything seemed to match so I feared I had a malfunctioning BLE112 module. Which would bad since those are by far the most expensive part and not easy to unsolder – in fact, it would probably require ordering more parts and building a completely new board. However – a bit more connection tracing, this time at the pins of the 2.54 to 1.27 mm adapter board attached to the CC Debugger, revealed that there was a faulty ground connection. It looks like it's the pin on the programming header itself that has a poor connection. Fortunately I can fix this by making a temporary green-wire fix (by temporary I mean hand-held) while programming the module. Whew!
Then came the next problem. I had actually discovered this when I was assembling the board: I had forgotten the 4k7 Ω pull-up resistors for the I2C interface of the EEPROM! Doh! And it turned out that the ATmega couldn't communicate with the EEPROM. This was easily fixed, however, by simply activating the ATmega's pull-ups for PC4 and PC5.

With the problems fixed, everything worked like a charm. With all IR LEDs in place the range is excellent (tough I have yet to see if I can control the neighbors' TV sets :). And it looks just awesome in its laser-cut acrylic case with countersunk screws and threaded insets (so no screw heads or nuts protrude from the case).

There is still a bit of iOS app programming remaining, like converting the app to a universal app so it'll run on iPad as well as iPhone.

Enjoy the pictures – click for full-size version:

    


11 comments on "IR Remote working!"
Paul B. says:

Do you use Bluegiga's C library (BGLib) to communicate with the BLE112 module or are you flashing BGScript straight to the BLE112? I am having troubles getting the BLE112 to respond to commands through UART using the C library and am wondering if you had any documentation or could help me.

There is promise, in that I can receive and parse the ble_evt_system_boot event, but the module won't respond to my commands.

Jens Willy Johannsen says:

I flash BGScript directly to the BLE112. The BGScript responds to events (system_boot, attributes_value, connection_status and connection_disconnected) and sends data on system_endpoint_uart0 to the MCU.

I haven't looked more into getting the BLE112 to receive data on the UART endpoint which I never got working.

Jens Willy Johannsen says:

You can find my BLE112 firmware project here: https://github.com/jenswilly/BLE-multiremote

Paul B. says:

Rats! I've gotten bidirectional communication over UART using BGScript (which is what you seem to be doing) but am flummoxed on getting BGLib functionality! If you're ever bored, it might be an interesting project to write up- you'd be the first one to post about doing it.

Nathan Martin says:

Hi Jens Willy,

I really appreciate the detail you've put into this tutorial! I've put together the PCB, iPhone app, and AVR setup for this project, and have almost been able to get everything working. I've gotten the BLE remote app to connect and "learn" IR codes, but have had trouble sending them.
I'm ignoring EEPROM for now, and have seen that the timing while sending an IR code seems to be off. Is the code from https://github.com/jenswilly/AVR-multiremote the latest working version? If so, I'll need to figure out what I'm doing wrong...
Thank you so much for this fantastic tutorial!

P.S. I noticed the ICSP connector pin seems to be connected backwards, and I was wondering why you decided to abandon the sendSequence function, was it not enough accuracy?

Jens Willy Johannsen says:

Hi Nathan,

Yes, the code at Github is up-to-date. And I abandoned sendSequence() because I had problems getting the timing working.
I, too, had some problems getting the timing just right. I hooked up an oscilloscope to the IR LED pins in order to measure the length of the pulses so I could tweak the timing.
I suggest you try the same and see if the pulses are sent as too long or too short. If you consistenly send either too long or too short pulses you can try adding (or subtracting) a bit of padding when configuring the timer for sending (OCR1A = TICK_OCR; in sendSequence2()).

I hope you get it working :)

David says:

I must say, wonderful project. Currently I am attempting to get the hardware for this design to work utilizing an arduino uno and BLE112 shield. I've run across a few questions, and if you had the time I would be much appreciative if you could help me with them via email if possible. Very good tutorial overall.

Jens Willy Johannsen says:

Hi David. I'd much rather answer some questions here in the comments – that way other people can benefit as well :)

David says:

Understood. Lets start from the top and work down. The shield I am using with the BLE112 module on it is wired such that UART1 is used so P0_4/Tx, and P05/RX are used. Im only just familiar with the BG scripting for the firmware, but from what I could take, the hardware.xml file needs to be changed from <usart channel="0" ... to <usart channel="1"... and in the script the "call system_endpoint_tx( system_endpoint_uart0," needs to be changed to uart1 throughout.
Am I correct in my diagnosis?

The shield by the way is the one designed by m.kroll(available via seeedstudios).

Jens Willy Johannsen says:

@David: Yes, changing to channel="1" in the hardware.xml and to system_endpoint_uart1 in the BGScript should do it.

David says:

Thank you for the input!
I got the device to work as I sought. Another question concerning licensing of the code. all the code is copyrighted under greener-pastures with all rights reserved. Am I alright in modifying the code to satisfy my needs for non-commercial personal use? I know the question may seem silly but I want to ensure that all is legal, and I have not seen a posting anywhere concerning this.

Leave a Reply