Display on TV/VGA monitor

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.

Vertical line without any audio input

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 circuit

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.

Display music on a VGA monitor like on an oscilloscope

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.

Remote controlled light bulbs RGB mood lamp

This RGB light I designed and built a while ago. A large spectrum of coloured light can be made mixing light from bulbs coloured in red, green and blue.
So, this one is not based on LEDs but it’s based on 3×60W 220/110Vac light bulbs.
Also, it has a remote controller to change intensity of the three bulbs, store and recall
preferred hues, turn the thing on and off.

Danger !Before attempting to work on this project yourself you must be absolutely aware that this thing is powered from the mains and as such it could kill you, cause damage or injuries.

If you are not very well skilled with mains powered electronics and related safety building practice and you are not well aware of the risks related, you are absolutely required just to enjoy the pictures and the video or get assistance by a very skilled friend.

No part of the circuit can be considered safe to touch when the circuit is powered on.

This project is intended only for very experienced adults.

The author of this document is not responsible for any death, injury, or property damage resulting from or relating to the procedures shown or devices described in this document.

The bulbs: I looked for both 40W and 60W bulbs and found them from Philips and Osram.
They are reasonably priced (4/5 Euro) and provide pretty good a spot of light so that the three beams can be superimposed and the three colours mixed. Other light bulbs could do well. They must be filament types, no ballasts or fluorescent tube, just good old filament types.

Dimming the lights cannot be done via PWM as LEDs are. The lamps must be phase controlled, that is they must be turned on with a delay with respect to the zero crossing of the mains phase. The delay ranges from 0 (no delay, lamp immediately turned on -> maximum light) to 1/2 of the mains period (20ms for 50Hz, 17 ms circa for 60Hz -> minimum light, dark). In the pictures below, the light intensity is strictly related to the area enclosed by the X axis and the curve. Top trace shows the mains, the lower one is the output to the green lamp (green light visible on wall in the background)

Oscilloscope view

The delay with respect to zero crossing is quite large and the lamp is dim.

The TRIACs

Driving the bulbs is done via TRIACs. They are cheap and well proven. Some RC network is necessary to reduce interferences produced by triggering of the TRIACs. The filter should be compliant so as not to disturb any electronic device around. The filters provided reduce interference pretty much but I have no idea if FCC or other regulations are really met.
Notice the heat sinks: they should not really be necessary as long as TRIACs are loaded with 60W each. But heat sinks look cool. Remember consider any part of the circuit dangerous when powered on: do not touch any part of it (to check for heat, as an example…) under any circumstances.
No part of the circuit is safe to touch to anyone. And I mean you !Optocoupler

Safety first: Optocouplers provide isolation between low voltage (safe) side and high voltage(the mains) side.

The low voltage side is connected internally to an LED facing an opto sensitive device (OPTODIAC) which is connected to the high voltage side.

Lighting the LED makes the OPTODIAC conduct and trigger the TRIAC wich in turn turns on the lamp.

The low voltage and high voltage sides must be well separated electrically so has to guarantee isolation. The minimum requirement is to Dremel out the copper between the two sides. A much better practice is to dig a hole between the two side. For no reason interconnection should pass between the two sides.

The circuit must be powered via a low power transformer. This provides the added feature of isolation from the mains. As I said, isolation is a safety feature no one should underestimate. Even though the circuit does not have any pushbutton which might break and let electrical contacts become touchable by a hand and the circuit can be safely enclosed in an all-plastic case (special care must be taken for metallic screws), the transformer and the OPTODIACS provide added safety.

Remote control receiver

The IR receiver was taken from a dead TV set together with its remote control. The case is metallic and it is connected to the low power ground. Even if there is isolation, take precautions so as no metallic part (IR case also) can be touched. A transparent plastic for the circuit case would help.The controller is a PIC16F627A which receives the remote control signals. The software attached is commented and should be easily understandable by those who have some understanding of PIC assembler.
I tested the thing with 220Vac 50Hz. Could not test it against 110Vac 60Hz. The only difference relates to the transformer and the delay generating routine inside the micro (and the light bulbs ratings).
Selection between 50Hz vs 60Hz timing is done connecting shown pin to ground for 60Hz.
I would appreciate some feedback by anyone whom may realise and test this thing in the USA.

Source code is here.

Hex file ready to burn is here.

Schematic is here. Please note: for ’some reason’ [ it's usually called 'a mistake' I know :) ] 50/60Hz selection bit is depicted on PORTB, bit 1 : it must be on PORTB bit 0 to reflect source code and hex file. I’ll correct ASAP.

The remote I used is an RC5-standard no-brand one. I incidentally noticed that a Philips TV remote works fine.
I think that any universal remote control should work as well as long as Philips TVs are supported.

Some feedback here appreciated.