Projects

Part 1: HDMI Gaming Cut-Off Timer

Rob Bell

Issue 16, October 2018

This article includes additional downloadable resources.
Please log in to access.

Log in

Whenever you’re gaming, the hours can fly by without you realising it! This HDMI cut-off timer will solve that problem for you!

Developed by some of the world’s leading manufacturers of AV equipment, HDMI took the world by storm.

HDMI stands for High-Definition Multimedia Interface. Introduced in 2002, it rapidly became the standard for Audio / Video connections, rapidly supersceding DVI, VGA, SCART, and Component video connections. While these interfaces are often still supported, HDMI has become the dominant force. HDMI truly managed to standardise so much of what used to require multiple different cables to achieve.

Within a decade we have seen “rare” HDMI usage become the true standard. Now, virtually any device which drives or receives an AV signal provides HDMI.

HDMI has grown from standard high definition spec (1920 x 1080) back in 2002, to Version 2.1 providing specification for 8K and even 10K resolutions! Though most consumers really only deal with full HD or 4K, it’s only a matter of time before 8K and higher resolution devices become standard in our homes.

HDMI is a powerful representation of what happens when manufacturers work together, rather than against each other (think Blu-ray vs HD DVD, or VHS vs BetaMax).

THE BROAD OVERVIEW

The HDMI standard is a complex thing, especially when we’re getting up to 4K resolutions and such which involve incredible amounts of data and mind-boggling frequencies.

HDMI is, after all, a 19-pin interface which can basically do anything! OK, perhaps not “anything”, but 4K video, surround sound audio, Ethernet, and more, all via one cable? That’s still impressive by anyone’s standards. However all that data means tolerances are tricky, and the HDMI specifications leave little room to mess about.

Fortunately for us, we really just want to disrupt the signal (ie - shut it off when the time runs out). This, is somewhat easier to achieve.

HDMI runs anywhere from as low as 25MHz, to as much as 680MHz!!! That’s insane! However all that data means there’s one achilles heel; the clock signal. By interrupting the clock signal, all that data is totally useless. The result? Disconnected signal!

HDMI is exceptionally resilient, and the ability for some devices to auto-correct signal problems can be amazing to watch. There are actually two clock signals in a HDMI cable. TMDS and DDC clocks.

TMDS stands for Transition-minimised differential signalling, This is the technology used for transmitting massive amounts of data flawlessly, so naturally the TMDS clock is fairly important.

DDC stands for Display Data Channel, and is responsible for content protection and identification standards such as EDID, CEC, and HDCP.

We did actually have, during testing, moments where HDMI would try and auto-correct for dropped clock signals. This was indeed impressive and speaks to the robustness of the standard. When we disconnected both clocks however, we had a reliable disconnect every time. Presumably resulted in the display device determining there was simply nothing connected, regardless of the data on the serial lines.

HOW IT WORKS

While the HDMI specification is exceptionally complex and adding to the stream wouldn’t be possible using an Arduino-style microcontroller, we don’t really need to. All we have to do is disrupt the clocks.

The PCB is made to resemble an UNO-style footprint, in order to provide compatability with the touchscreen shield chosen for interfacing. It also keeps the HDMI throughput in a neat area of the PCB. The biggest challenge with HDMI is not disrupting the signal, but trying to ensure it runs smoothly normally. For this reason, we disrupt the signal path as little as possible, to help ensure everything runs normally when we want it to.

The software to run the system is far more complex than the hardware interfacing itself, however we’ll cover that next month in Part 2 when we get everything running.

WHY NOT A SHIELD?

We know what you’re thinking... why didn’t we just make this a shield? There are a few reasons actually:

BREAKOUT

We enhanced the footprint giving ourselves another set of GPIO headers alongside, so even with the screen shield connected, we can access anything we want.

BETTER CLEARANCE

Having the HDMI sockets away from everything else help reduce noise and interference. The HDMI sockets are also mounted with one on top, one on the bottom, to help keep the pin-routing as simple as possible.

LOWER COST

Ultimately the combined cost of the PCB and hardware will rival that of an UNO anyway, so it helps keep the cost of the project lower overall.

The PCB Build:

Parts Required:Jaycar
1 × ATMega328P MCUZZ8727
1 × 16MHz Crystal(included with MCU)
1 × 5V RegulatorZV1645
1 × 3.3V RegulatorZV1650
1 × BC337 TransistorZT2115
2 × IN4004 DiodeZR1004
1 × LCD Touch Sensitive PanelXC4630
2 × 10uF/35V Electrolytic CapacitorRE6075
1 × 2.2uF Electrolytic CapacitorRE6042
3 × 100nf Ceramic CapacitorRC5360
2 × 22pF Ceramic CapacitorRC5316
2 × 100Ω ¼W Resistor*RR0548
1 × 1kΩ ¼W Resistor*RR0572
1 × 10kΩ ¼W Resistor*RR0596
2 × 5V Relay DPDT PCB Mount-
1 × DC Input JackPS0519
2 × HDMI PCB SocketPS0942
1 × 28 Pin IC SocketPI6466
2 × 40 Pin Female Header StripHM3230
3 × 6 Pin Female Header Strip-
4 × 8 Pin Female Header Strip-
2 × 10 Pin Female Header Strip-
1 × 9V DC Power AdaptorMP3146

* Quality shown , may be sold in packs.

While sometimes the PCB is something of a luxury and not always essential, this one should probably be considered mandatory. While it is possible to cut-up a HDMI cable (and indeed this is what we did for the proof of concept), it’s not very reliable and can result in erratic behaviour.

We also decided to use a production PCB, rather than prototype one on our Bantam Tools Desktop PCB Milling Machine. While it was physically possible to do so, the complex double-sided routing and ultra-small pads on the HDMI sockets meant we were pushing past the limits of what that machine is designed to do. So we tested as much as we could on the PCB layout ahead of time, but ultimately ordered professional PCBs to prototype with.

pcb

The PCB itself is a double-sided design. It is built to a standard UNO footprint where it matters (so it’s shield compatible), with the extra rows of GPIO headers. Naturally it also has the relays and HDMI sockets together to minimise the data paths required.

Check your PCB for broken tracks, corrosion, or other manufacturing defects. Give it a good clean with some isopropyl aocohol or circuit board cleaner, to help remove any grease or residue that may exist. This will help reduce the incidence of dry joints and other problems (and is especially critical for the HDMI sockets).

Use the lowest temperature possible for the solder you’re using, to help avoid overheating the PCB and components, which can be easily damaged with excessive heat.

As with all PCB builds, we follow a hardware, passives, semiconductors type construction pattern. This means you should start with the IC sockets and terminal strips, including the FTDI header. Install the DC input socket too. If you don’t plan to use the additional GPIO headers, you can leave the headers unpopulated if you prefer.

Now is a good time to insert the HDMI sockets. Note that one is mounted to the top of the PCB, and the other is mounted to the bottom. Refer to the overlay for correct orientations. The easiest approach is usually to insert firmly (taking care that all pins are aligned to their respective holes and are not bent when inserted). Once it fits flush on the PCB and you can see all pins poking through the other side, solder in the larger retaining pins. While these are a major pain to desolder if it becomes required, it helps ensure your socket is firmly placed to begin soldering the data pins, and also protects the data pins from insertion / removal forces which would easily damage the tiny pins.

Now you can solder each data pin on the HDMI sockets. Use the finest soldering tip you can, using as little solder as possible for a solid connection.

schematic

With minimal spacing, it’s very easy to accidentally bridge them, as well as overheat them. Take care and take your time (but not so much time that you overheat the PCB!).

Next move on to the resistors and capacitors, taking care with the electrolytic capacitors to ensure correct orientation.

Next insert the voltage regulators and transistor, taking care to orient the electrolytic capacitors and transistor correctly, referring to the overlay diagram.

bottom layer

You can then insert your Crystal and the two diodes providing input protection.

TESTING

With no ATmega328p inserted just yet, and certainly no HDMI connections plugged in, we’re going to make a few electrical tests to ensure we have power where we expect it.

Connect your 9V DC source into the DC socket and turn the power on. Take your multimeter and check for power in two places.

checking for power

Place your positive and negative probes onto pin 7 and 8 respectively. You should see very close to 5V.

Then move to pins 20 and 22 as shown, which should also show 5V.

5v

Finally test the 3.3V regulation circuit, probing the GPIO as shown (labelled as 3v3 and GND).

Note: GPIO can be tough to get some probes into for testing. If you insert some spare resistor legs or similar into the sockets, it should give you something you can get your probes onto more easily. Just be careful you don't accidentally short anything else while you're using this method!

gpio

There is no power provided between the microcontroller circuit and the HDMI part of the PCB. The only interfaces to the HDMI signal itself are to the relays which switch the clock pins on the HDMI, so there shouldn’t be any power found on this area of the PCB at all. Any power that is present during operation is from the HDMI connections, not our power source.

If everything tests OK, your build should be complete and ready for the next steps!

Part 2: finishing off the build

The code for this is reasonably complex. We have an adjustable timer and touch screen GUI to wrangle. However since this project is designed to remove kids from their ability to play games, we need to work around them resetting the unit and other potential issues for getting around the timer cut-off. We’ll address these aspects, as well as put it all into a tidy case!