Add Video & Audio to Your Microcontroller Project

by Gadget Gangster in Circuits > Microcontrollers

20252 Views, 39 Favorites, 0 Comments

Add Video & Audio to Your Microcontroller Project

4286156658_596529acd6.jpg
4286157712_8fa71587ae.jpg
7 Segment LED displays are useful for displaying numbers and bitmap LCD's can do simple graphics, but sometimes a real, color video output is the easiest way to go:
  • Composite video (a.k.a., RCA Jack) is ubiquitous, and works with 3" - 60" displays
  • 640x480 color screen lets you display complex information, graphics, charts and animations
  • Composite is inexpensive, easy to program, can run with a small memory footprint, and uses cheap cables
This instructable is for the ProtoPlus, a circuit board I designed to add video and audio connections to the Propeller Platform. Because the Propeller already has video generation circuitry on the chip, generating video is very simple.  I used the rest of the space on the board to include a 240 hole 2-row / 3-row prototyping area and audio connection.

I use slightly longer pin headers than normal so it can be connected on top or below the Propeller Platform.  I also marked the traces in the prototyping area on the silkscreen to make it easy to see how the traces are connected.  The ProtoPlus is available as a kit on Gadget Gangster.

The Propeller can output PAL or NTSC, here are a few samples of what can be done:

Fancy Graphics



Really Fancy 3D Graphics (You have to watch this one!)


UI / Information Display


FAQ

4286157712_8fa71587ae.jpg
What is the ProtoPlus?
It's an expansion module for the Propeller Platform, it lets you connect video and audio to your Prop and has a prototyping area.

What does it work with?
It's set up to work the Parallax Propeller, it will fit on top (or below) the Propeller platform, or you can drop it on a breadboard.

Will it work with Arduino or PICaxe?
No.  Arduino and PICaxe simply aren't fast enough to generate video on their own, they need a 'helper' microcontroller dedicated to video.  The tellymate is one such tool I'm aware of, although it is B/W, text-only.

NTSC or PAL?
Up to you - the Propeller is perfectly content to generate either signal.

Parts and Tools

4285412861_9f20452a37.jpg
Here are the parts you'll need. If you've ordered a kit, double check to make sure your package has all the parts listed. If there's anything missing, just email us at info@gadgetgangster.com;
  • 0.01 uF Radial Ceramic Cap
  • 47 uF Radial Electrolytic Cap
  • 40 pin headers
  • 2x 1.1k Resistors (Brown - Brown - Red)
  • 560 ohm Resistor (Green - Blue - Brown)
  • 270 ohm Resistor (Red - Violet - Brown)
  • 2x RCA phono jacks
  • ProtoPlus PCB
To build it, you'll need a 20-30 watt soldering iron and a pair of dikes. See my Soldering tutorial if this is your first time soldering.


Make: Resistors

4286154430_18836570e0.jpg
4285413507_11d811971e.jpg
Let's start by adding the 3 resistors that make up the video DAC;

R1 is 1.1k ohms, it's Brown - Brown - Red

R2 is 560 ohms, it's Green - Blue - Brown

R3 is 270 ohms, it's Red - Violet - Brown

Add R4. That's also 1.1k ohms (Brown - Brown - Red)

Make: Capacitors

4286155140_1d1a6b9d59.jpg
4286155510_9fc028070c.jpg
There are 2 capacitors:

C2 is the ceramic .01uF capacitor, it's not polarized, so it doesn't matter which way it goes in.

C1 is the electrolytic 47uF capacitor. It IS polarized, the longer lead goes through the square hole closer to the '+'. The stripe on the body of the capacitor goes on the side closer to the edge of the board.

Make: Connectors

4286155838_9856fe7fbe.jpg
Add the 2 RCA connectors. The connector marked 'TV' will output TV, and the Audio connector outputs line level audio.

Make: Pin Headers

4286156658_596529acd6.jpg
4285414991_c12360abf6.jpg
The easiest way to add the pin headers is to insert them into a breadboard (or a Propeller Platform, as shown in the picture), put the board on top, and solder it down. Once the pin headers are soldered to the ProtoPlus, just lift it off your breadboard and you've got straight pin headers.

Using It and Downloads

4286158522_87578902bd.jpg
4285415807_a62a5fd40f.jpg

Using It: Video

Doing video with the Propeller is straightforward:
  1. Get the Propeller Tool. This is the development environment for the Prop. Links for Mac/Linux and windows are in the download section below.
  2. Include the 'tv_text' object. The Propeller tool comes with a decent library of objects, including a TV object. In the OBJ section of your code, just include:
    text: "tv_text"
  3. Start up the TV. Use:
    text.start(12)
  4. Put stuff on the screen with text.str, text.hex, text.out, etc. Here's an example:
    text.str(string(13,"Hello World",$C,1)) 
The entire program would be:
CON
_clkmode = xtal1 + pll16x 'sets the Prop to 16x the xtal
_xinfreq = 5_000_000 'tells the Prop the xtal is running at 5MHz
   
OBJ
text : "tv_text" 'include this object

PUB start
text.start(12) 'start up the TV with basepin 11
text.str(string(13,"Hello World",$C,1)) ' use the method 'str' to put up text

This is just a summary of putting up basic text. Graphics are a bit more complicated, but not bad, take a look at the Graphics_demo to see how to do animation, shapes, and graphics.

Using It: Audio

Audio is just as easy.  There are already objects to play .wav files, voice synthesis, and frequency synthesis.  If you just want quick and dirty example, Kwabena's speaker driver object looks easy.  Grab the object, change the PWM_Pin constant to 11, and here's an example usage:
CON
_clkmode = xtal1 + pll16x 'sets the Prop to 16x the xtal
_xinfreq = 5_000_000 'tells the Prop the xtal is running at 5MHz
   
OBJ
speaker : "PWMEngine" 'include this object

PUB start
speaker.PWMEngine 'start up the speaker
speaker.changespeakerfrequency(1000) 'change frequency to 1,000 hertz
speaker.changespeakervolume(50) 'volume to 50%
waitcnt(clkfreq + cnt) ' cnt = current system time, clkfreq = ticks in 1 second
speaker.changespeakerfrequency(6000) 'change frequency to 6,000 hertz

Downloads

Hi-res photos are up on flickr

The board is available under the MIT license (public domain). You can download the design in DipTrace Format, pdf, or png.

The Propeller tool (the programming environment for the Propeller) for Mac/Linux and Windows.  Also, don't forget to grab a PDF of the Propeller Manual.


Get
ProtoPlus or Propeller Platform on Gadget Gangster