i need a little help with a proper circuit for a connection between a microcontroller and the HDMI CEC bus.

Here is the whole plan:

CEC Basically I want to use an ATMega microcontroller to decode the CEC bus signal and communicate via the CEC bus with other coneccted devices (TV/BD-Player/AV).

The current state:

I connected the CEC line to the input capture pin of my microcontroller. And the CEC ground to the ground of the microcontroller. The CEC bus works at 3.3V (max 3.63V) and my microcontroller at 5V. This isn't much of a problem and works fine (due to the switching threshold). A C-program is doing the job of decoding the signal and currently sending it out via UART. This works great and I can read every signal of my CEC capable devices.

Now the problem:

In the current state I can only read signals, but I obviously also want to write something. How do I need to connect my microcontroller to change the state between high/low on the bus?

Maybe the Solution?!:

Because of the different logic levels (3,3V <-> 5V) I first need some level shifting. I would use a simple voltage divider (10k and 6,8k) and connect it on to the CEC line from some output pin (other than the pin I am using to read the signal). Would it work like this? If the line is HIGH and I am applying also a HIGH state with my microcontroller, does this cause any problems? How would I minimize the current going out?

I don't want to damage anything here and my electrical knowlage is just the basic stuff :D


3 Answers 3


Since the HDMI CEC bus is an open-collector configuration with shared pullups like i2c, you should write to it by toggling the port's state (the data direction register or DDR) between input (does not affect the bus, a 1) to output 0 (pull the bus down) and back again. Instead of writing 1 and 0 to the PORT[ABCD] register since the microcontroller doesn't need to pull the line back up.

On other microcontrollers you might configure the port in open-drain mode or use a built-in CEC peripheral.

You should disable the microcontroller's built-in pull-up/down resistors. The bus already has pullups and yours will not match the voltage/current specification required by the bus. A commercial device might provide its own discrete pull-up resistors or rely on the other end depending on the specification.

It would also be a good idea to run your ATMega at 3.3V. It will work at 3.3V; many AVRs are designed to work all the way down to 1.8V.

  • \$\begingroup\$ thanks for your answer. I also thought about just pulling the line down (since someone is pulling it up). So I would just use a pin and connect it directly to the CEC line. To apply a LOW state I would set DDRD = 0x01 (output) with ouptut of PORTD = 0x00 (LOW). For a HIGH state I would simply set the pin to input again (DDRD = 0x00). On the input state the pull up resistor needs to be disabled? (Does it matter?) And if I would apply a HIGH state (PORTD = 0x01) on the output pint this would obviously cause some problems? \$\endgroup\$
    – MrNobody
    Commented Oct 2, 2013 at 15:30
  • 1
    \$\begingroup\$ You should disable your pull ups. The bus already has them at the correct voltage. \$\endgroup\$
    – joeforker
    Commented Oct 2, 2013 at 16:47

There's a lot of information in this thread at Arduino forum, there's a schematic for both receive and transmit, see below. Reply #81, on page 6, have complete Cadsoft Eagle schematic and layout files.

It could be useful to connect also I2C to the HDMI-port to get EDID-information from the TV, no circuits are needed if the AVR is running at 3.3V, just connect data and clock pins straight from AVR to HDMI (see the eagle schematic).

They also wrote some kind of library, I'm not sure how useful it is since it's written for Arduino, but the code can be found on Google Code.

Please share your C library for AVR, I would love to have something to start with myself. :)

CEC receive and transmit,


all you need is the circuit below.

enter image description here

Please, could you share your project?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.