Close
0%
0%

CEC2Usb

HDMI CEC to USB Keyboard adapter

Similar projects worth following
Starting from
$3.00
RedoX has 9 orders / 0 reviews
Ships from France
Small adapter board to use a TV remote as a keyboard for a HTPC. Also provides Hyperion/Ambilight capabilities.

It is cheap, simple, hackable, ...
Some of the nice features:

  • Instead of requiring a host software (like cec-client) it acts as a standard keyboard.
  • Provides Hyperion-compatible interface for Ambilight setups

It's not a dedicated development board, but it provides some nice development/debug features:

  • a LED
  • a DFU bootloader (can be enabled/disabled with a solder jumper)
  • ICSP header is broken out in case you break with the DFU feature or want to flash the AVR often...
  • Test pads for all interesting signals
    • CEC
    • CEC input
    • CEC output
    • HPD
    • I2C SCL/SDA
    • 5v
    • 3.3v
    • GND
  • ICSP header is broken out in case you break with the DFU feature or
    want to - SPI Port is broken out ( mostly for the WS2811 LED strip )
  • SPI Port is broken out ( mostly for the WS2811 LED strip )
  • Input 5v can be selected from USB (default) or HDMI. In case you want to develop an autonomous device.
  • TWI/I2C is wired to the HDMI bus. The goal is to be able to read the Physical address of the HTPC (currently hard-coded in firmware)
  • Hotplug Detection (HPD) is wired to the HDMI bus

Firmware status is a bit less advanced:

  • Working
    • CEC spy-mode
    • CEC read/write
    • RawHID USB debug
    • Keyboard emulation
    • Ambilight
  • ToDo
    • Currently hardcoded
      • Physical address
      • Device name
      • Keys mapping between CEC and Keyboard (ie: Currently only for my TV and Kodi)
    • Missing features
      • TV control (turn off, turn on, switch source)

CEC2Usb.pdf

Schematic

Adobe Portable Document Format - 51.54 kB - 12/01/2019 at 15:07

Preview
Download

  • 1 × Atmega32u2-AU Microprocessors, Microcontrollers, DSPs / ARM, RISC-Based Microcontrollers

  • 1
    Assembly notes
    • All passive are 0603
    • Most values can be approximated ( I tried not to change them too much on he CEC part though, not really knowing what whas going on there)
    • R5 must not be placed (well, at least, it didn't work when I tried)
    • I2C pullups (R11/R12) should not be placed (I didn't ttry this yet...)
  • 2
    Programming notes
    • DFU upgrade
      • Solder the jumper on the board
      • Plug the USB port in your computer
      • Reset the board by shorting the 2nd (GND) and 3rd (/RST) pads on the ICSP header
      • I use "dfu-programmer" from the Debian repository
        • Sometimes, an "erase" command is required before the "flash" command
    • ICSP upgrade:
      • Pinout for the ICSP header is the following:
        1. Vcc
          • If the USB port is not connected, you can put 3.3v or 5v here, the Atmega32u2 supports both.
          • If the USB port is connected, it is better to leave this unconnected
        2. Gnd
        3. /RST
        4. SCLK
        5. MOSI
        6. MISO
      • I use a DIY UsbtinyISP clone and never had any issue with it.
      • Be aware that you might end up erasing the DFU bootloader on the chip. Good luck finding a replacement ^^

View all instructions

Enjoy this project?

Share

Discussions

Michael R Colton wrote 01/06/2020 at 22:13 point

I would like my TV to behave like a monitor, that is, to turn on when the computer is on and awake, and off when it is off or asleep. I can handle the PC side of that (sending a command when the screen saver activates, for example) would this board work to send the relevant power on and power off commands to the TV? Thanks!

  Are you sure? yes | no

RedoX wrote 01/12/2020 at 09:47 point

Hello,

If your TV supports CEC commands, you should be able to send turn on/off commands with this board. Some firmware development is required though, since the firmware currently only support TV => PC communication (using a keyboard emulation).

To make sure your TV supports the CEC features your need, you can try with a RaspberryPi if you happen to already have one, and the cec-utils package.

  Are you sure? yes | no

Vladimir wrote 12/13/2019 at 22:30 point

Hello. I am interested in your project. I spent a lot of time finding it. On the Internet there are projects with arduino but they are all outdated and no one is discussing them. There are schemes for connecting to the CEC line but without I2C. I’m interested in whether it is possible to make a CEC to UART converter on the basis of your device. Why do I have this, I have an HDMI ARC board that is controlled by an IR remote and a bluetooth TV. I would like to grab the volume control signal on the CEC bus and pass it to the amplifier controller.

  Are you sure? yes | no

RedoX wrote 12/14/2019 at 11:18 point

Hello,

UART is not straightforward with this design... I use the hardware UART pins to read/drive the CEC line. You could probably use a software UART library if you don't have too high requirements.

I haven't tried the I2C part yet, so I can't say for sure that it works. Since the Atmega32u2 doesn't have any hardware I2C, I will have to use a software implementation but I have already done it on an other project and it went fine, so I believe it should work.

You can probably use the same schematic as a base for a more elaborate board. The hardest part on this project was the firmware/CEC library. As you mentioned, there a very few similar projects available, and most of them look unmaintained/dead, so I had to rewrite one from scratch, in C.

I don't have much time to work on the firmware right now, but the upcoming holidays should help and I will finally be able to release the firmware...

  Are you sure? yes | no

Tim Ansell wrote 12/05/2019 at 10:30 point

What part is that upside down HDMI connector? I've never seen one like it before but seems super useful for passthrough devices like this!

  Are you sure? yes | no

RedoX wrote 12/07/2019 at 09:52 point

Hello !

The upside down HDMI connector is the hardest part to find actually. Molex used to make them, TE Connectivity is phasing them out, ... Sales were too low I guess.

I may have to change the design in the future if I don't manage to get a reliable source for theses parts though...

You can find them as "reverse HDMI connectors" on eBay or Aliexpress. Another good source/option seems to be to look for "PS4 HDMI connector", then you can find them on eBay, Amazon, ... but the footprint is a bit different.

Making a pass-through double sided board would be way more difficult without them.

Side note, this is not required for the CEC stuff to work. CEC is a multipoint bus shared by all the HDMI ports of the TVs. Assuming you have a free HDMI port, you can make a board with just the common HDMI connector, plug it in the unused port, and it should work the same way CEC2Usb does.

  Are you sure? yes | no

Paul Fernquist wrote 12/25/2019 at 03:40 point

I've seen feed through with two vertical connectors.

  Are you sure? yes | no

Mike Szczys wrote 12/02/2019 at 21:24 point

Very clever approach. I've often wondered about hacking in CEC for some of my devices... I have a TV that claims to have CEC but it doesn't seem to work wiht a Fire TV Stick. This would be a fun way to play around -- sniffing what the TV is sending and finding a way to make it actually work.

  Are you sure? yes | no

RedoX wrote 12/04/2019 at 11:10 point

Hello and thanks for you kind comment. The hardware part is quite simple, I just adapted it from the datasheet of the TDA9950. I think it should be possible to simplify it a little bit to use one I/O instead of two (but I have plenty, so I don't really care). The tricky part is the software. Fortunately, CEC is quite slow (in the milliseconds range) and supported in open logic analyzer softwares, like sigrok, which makes debugging easier.

I am currently refactoring the software to be able to reconfigure it at runtime and/or use the special modes, like the CEC-spy; but I haven't figured the best way yet. I plan post an update and to release the sources as soon as I have improved this.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates