I remember writing as a kid in the mid ’70s to an electronics magazine well-known in Italy, Nuova Elettronica, asking them to publish the project of a device to display music on a TV like on an oscilloscope. They did not reply but eventually they published the project. I’m not sure I’m the one who actually sprung them into designing the circuit but I was nonetheless compelled to build the circuit which of course worked great as expected. In my idea the line would have been horizontal but vertical appeared to be the most natural after reading the article.
The circuit was a clever mixture of triangular wave generators, comparators, monostables and flip-flops plus an RF generator to feed the TV’s antenna input.
Now that circuit is lost and the magazine gone into recycled paper but it remains one of my preferred.
It is now possible to replicate the circuit using a few components. Also, it is now well clear that a regular microcontroller like a PIC or an AVR provide the necessary speed and peripherals to do the job.
The circuit is very simple as this was my main target. I decided I would use one of the smallest AVRs I had, an ATtiny84. Physically small but large in memory : 8k FLASH is way larger than needed as my circuit fits 1/32th of that much. Anyways, just one 20MHz crystal, 5 capacitors, 4 resistors and one VGA connector are sufficient to generate a vertical line on a VGA monitor which swings left to right depending on the voltage at a micro’s input pin. Applying music at the pin the line dances at the music. A little bit kitschy ’70s prop.
This is a picture of the output without any input : a well steady line is displayed, not bad for software timing.
I chose to go on a VGA instead of a regular TV because it is a single standard all over the world (no 60Hz vs 50Hz issue) and it is not interlaced (like TVs) which would have added another layer of difficulty.
This is the circuit. It is not mounted on a PCB : read further.
The code is entirely in assembler and interrupt driven.
Assembler source code and HEX files are here
Horizontal synchronism is generated by the internal PWM generator at Timer 1. Horizontal Synch is also used as the timebase for Vertical Synchronization. Also, the input voltage coming from the audio input is read by channel 0 of the internal ADC at the beginning of every line, then a new conversion is started over to give the ADC the time of a full Horizontal line to make a new conversion.
Resolution required is low and as few as 7 bits are sufficient to span the monitor horizontally. The overall effect is just fine anyways.
The only tricky part is the interrupt routine called at the start of every horizontal line :
In case it is the last (628th line at 800×600, 60Hz) line, a Vertical sync pulse is started with the aid of a counter. The pulse is stopped after a 4 lines’ duration has passed. This is the Vertical sync pulse wich causes the vertical retrace and during this period no out should be put on the RGB (colour) outputs (the reti instruction).
In case it is not the vertcal sync occurrence, the ADC input value is converted into a delay after that output at the RGB (Red only, actually) is set to VCC for one single instruction cycle. This time is the smallest possible yet a well visible red spot is displayed on the screen.
The schematic is herebelow. Download it in higher resolution clicking on the image to go to Flickr, then select ‘all sizes’.
The input at the ADC must be 0-5Vcc so it is offset at 2.5V with a resistive network. A capacitor cancels the DC component at the input so that audio is converted to an AC offset which adds/subtracts from the 2.5Vcc DC offset.
In case input level is not sufficient I added a simple op-amp preamp suitable for 5V operation. The requirements called for a rail-to-rail op amp that could be powered from as low as 5v and provide an output of 0/5V. Also it had to be powered from one single supply rail. National Semiconductors LMC6462 was my choice. Other components are fine as long as they meet the three requirements above.
The preamp is designed to be driven by an electret microphone of the kind used in cell phones. In case a regular external source like a magnetic microphone or CD player can be connected at the positive lead of C1 and ground. R2 should be removed also.
A filter can be added placing a .1uF to 1uF capacitor in parallel to R5.
I mounted the two circuits on regular perfboard but wanted to add some finesse, so I glued some black and red cardboard on the perfboard (component side, of course!) to hide the holes and just opened the ones I needed with a needle. Next time I’ll print these paper mask adding components references, some logo and legend at the connectors and variable resistor.
This is the circuit completed with the pre amp. Power supply comes from a 5Vcc wall adapter.
Finally a video of the thing in action.
As usual I take the videos with my Olympus camera, probably not the best mean.
The sources I used to understand are endless, probably too many and not always in agreement to each another: probably they all are right as there’s room for tolerance in timing.
I want to mention the most important: Alberto Ricci Bitti whose articles helped to shed some light on VGA with his award winning video projects (www.riccibitti.com), Daniel Ciocea for the same reason (check his VGA monitor tester at http://www.eosystems.ro/deogen/deogen_en.html) and the infinite list of PIC pongs .
Also the reference pages on VGA at http://www.epanorama.net/ was chosen as the standard since same resolutions happen to be given different different parameters on different internet sources.







very nice work. the paper mask over the perfboard is an exceptional idea – i’ll remember that. I wonder if they’d stand up to my soldering though!
[...] This small circuit is very simple to make,with only few components caps, resistors and the heart of this circuit is Attiny84 microcontroller running at 20MHz. Source: 5volt [...]
I wonder what software you use to draw the schematics ?
Caio Joaquim,
I typically use an old limited functions demo of Orcad for drawing the parts of the schematics, then the pieces are exported (within Orcad) in DXF vector format. DXFs are then imported in Illustrator, which I have occasionally access to, to be glued together and sort of beautified.
Ciao e grazie
Best regards
A.
This is a very nice work! but i’m fairly “noob-ish” so bear with me, i understand that vga is reasonably simple compared to composite, but how pratical would it be to make the ATtiny48 output in a composite compatible form? i’ve seen a few things around about a monochrome composite output from an atmel chip, and it seems pratical.
Regards
Composite is not much different but progressive video have an advantage over the interlaced composite video,
being it, well,…progressive! It is not composite that makes it a bit more complex.
Ali, for now I consider the project closed, but how about considering my project a starting point for the composite
version of your own ? In case, I’d be happy to link to your project.
Best regards and thank you very much for your appreciation
A.