Outputting a Video Signal From a Microcontroller's GPIO Pins — Through Square-Wave Harmonics

Taking advantage of higher-order harmonics, Manzel Seet's PAL Streamer can output valid video signals from slower microcontrollers.

Gareth Halfacree
4 years agoDisplays / HW101 / Retro Tech

Student engineer Manzel Seet has demonstrated how to create a video output from a microcontroller's general-purpose input/output (GPIO) pins with no external components — by using pulse-width modulation (PWM) to generate analog TV signals.

"I wanted to make a simple & cheap analog TV transmitter from parts I had lying around," Seet explains of the project's origins. "I searched online and I came across @CNLohr avr_vhf project. He used an AVR ATtiny85 to generate PWM waveforms which were picked up by his TV."

"I found it clever and genius because I didn't know that a square wave PWM could serve as AM modulation. In his case, he both overclocked the MCU to 30MHz and used PLLx8 to the timer. Thus, his timer is clocked at 240MHz and with a period of 4, its output is 60MHz (approximately the frequency of CH3). I looked around for an alternative because I did not have a fast enough microcontroller. (ie. to transmit at CH3 of 61.25MHz, I need the timer to be clocked at minimum 2x the speed — at least 122MHz for PWM.) I am not a fan of overclocking the internal oscillator because the frequency drifts easily."

The breakthrough came in using harmonics: "I realized that PWM is a square wave and thus it has odd harmonics. I thought it would be creative if I could simply output a lower frequency of which its harmonics matches the TV channel frequency," Seet explains. "In my case, through trial and error, I managed to get a clear image on the TV with a 6.86MHz PWM output. The 9th harmonic is 61.71MHz which is about CH3 frequency. In theory, you can replicate this behavior on any slow microcontroller (like an Arduino Uno which does not have PLL)."

With some wiring, a Python script, and a TV with analog tuner still present and functional — an increasingly rare site these days — Seet was able to successfully play back still images and animated GIFs from a PC via a USB connection to an STMicro STM32 Nucleo development board. While the system works without external components, Seet admits it could be improved by the addition of a bandpass filter to avoid interference across other channels.

The full project write-up is available on Seet's Hackaday.io page.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles