PAL Video Signals from ATmega168

Go To Last Post
35 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, i have seen projects that uses some kind of microcontroller to send signals to a tv via SCART or RGB(?). How does those signals "look", how do they work?



  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

RES

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


Thank you RES. =) Anyone know where i can find something like this for sound/audio?



  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I saw this analogy on a test I took once... "Colorbars are to video as xxx is to audio". Here's my guess... an octave band analyzer using a sweepable bandpass filter?

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bobgardner wrote:
I saw this analogy on a test I took once... "Colorbars are to video as xxx is to audio". Here's my guess... an octave band analyzer using a sweepable bandpass filter?

Can you please explain that? I'm not to experienced with all this =P



  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There are several ways to make sounds with an avr. Easiest is just a square wave from an output pin to a small speaker. You know tones are audible from 20-20,000 cycles. Just turn the output on, delay 1 ms, turn it off, delay 1ms, jump back. You are generating a 1 KHz tone! Next step is to write a general purpose subroutine that will generate any frequency (in some reasonable range... 300-3000) for any duration (3-3000ms), You could play simple melodies with this. Is it also possible to generate speech and instrument waveforms using PCM samples 'played' out one of the PWM outputs on the AVR.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bobgardner wrote:
There are several ways to make sounds with an avr. Easiest is just a square wave from an output pin to a small speaker. You know tones are audible from 20-20,000 cycles. Just turn the output on, delay 1 ms, turn it off, delay 1ms, jump back. You are generating a 1 KHz tone! Next step is to write a general purpose subroutine that will generate any frequency (in some reasonable range... 300-3000) for any duration (3-3000ms), You could play simple melodies with this. Is it also possible to generate speech and instrument waveforms using PCM samples 'played' out one of the PWM outputs on the AVR.

Thanks a lot! This signal could be sent to a tv?



  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The audio signal could be sent to the audio input. The windows Media Player has some cool 'visualizations' that let you 'see' music. I suppose there are some programs that let you 'hear' pictures. What would you call that? A Symphony Orchestra playing Mussorgsky's 'Pictures At An Exibition'?

Imagecraft compiler user

Last Edited: Sun. Nov 25, 2007 - 05:26 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bobgardner wrote:
The audio signal could be sent to the audio input. The windows Media Player has some cool 'visualiztions' that let you 'see' music. I suppose there are some programs that let you 'hear' pictures. What would you call that? A Symphony Orchestra playing Mussorgsky's 'Pictures At An Exibition'?

How big are the risk to damage my TV? =P The power-source for my microcontroller will be 5.3V 500mA (An old Nokia cellphone-charger)



  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just do anything you want to it. TVs are cheap. In fact, I'd like to know what a real loud 60 Hz waveform sounds like. Seems like if you could find a source of 60Hz voltage at a real loud level, like maybe 120 volts or so, you could put that onto the speaker jacks and get this awesome OMMMMMMMMM tone that would rock the neighbors right off their easy chairs. Try that and come back and tell us how it worked out. You have fresh batteries in your smoke alarm? Might I inquire what that is a picture of? It looks like the belly view of a dead duck lying on its side. I'm sure thats not what it is.

Imagecraft compiler user

Last Edited: Sun. Nov 25, 2007 - 05:23 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Bob:
1mS on 1mS off would be a cycle time of 2mS=500Hz?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Right you are. So glad someone is checking my math. I wish I had a prize to send out for keeping me honest. Think this new guy is pulling my chain?

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bobgardner wrote:
Just do anything you want to it. TVs are cheap. In fact, I'd like to know what a real loud 60 Hz waveform sounds like. Seems like if you could find a source of 60Hz voltage at a real loud level, like maybe 120 volts or so, you could put that onto the speaker jacks and get this awesome OMMMMMMMMM tone that would rock the neighbors right off their easy chairs. Try that and come back and tell us how it worked out. You have fresh batteries in your smoke alarm? Might I inquire what that is a picture of? It looks like the belly view of a dead duck lying on its side. I'm sure thats not what it is.

Ok.. :P So there are a risk to damage my TV?



  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You haven't told us what you are trying to build yet. Your first question was about video, and we have seen video projects using AVRs that run on NTSC, PAL systems. Your next question asked about audio. There are audio projects using AVRs. Aint electronics wonderful? Anything is possible if you are smart enough, rich enough, and have enough time.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bobgardner wrote:
You haven't told us what you are trying to build yet.

I'm going to try to build something like this: http://www.velleman.be/ot/en/pro...
But from scratch, and fully programmed by myself.



  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, cool. You could make a gameboy version with a 128x64 graphics lcd you could stick in your pocket and take it to the bar with you. No need to lug a TV around to show off your cool gizmo. Bet the birds really dig guys that can fix their electronics.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bobgardner wrote:
OK, cool. You could make a gameboy version with a 128x64 graphics lcd you could stick in your pocket and take it to the bar with you. No need to lug a TV around to show off your cool gizmo. Bet the birds really dig guys that can fix their electronics.

Great idea! =P Actually i'm recieving a sample of this one:

Datasheet

Hopefylly I can fit a LCD and everything else in it. It has a holder for two R6 (AA) batteries. And, a pocket clip =P

But anyway, thanks for the idea bobgardner =)

Hmm.. Just noticed that one was 46mm wide.. That will be a small one. =P But whatever.



Last Edited: Sun. Nov 25, 2007 - 08:37 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Search for 'alberto ricci bitti' to get some *good* hints.

Briefly - video consists of sequential lines of 63.5(NTSC)/64(PAL) microseconds; each is marked by a sync pulse of about 5us. Every 262.5(NTSC)/312.5(PAL) lines, there's a more complex frame sync pulse. The signal is interlaced; starting at top left and scrolling down on one field, with the second field filling in the gaps. The bottom of the syncs are at 0v, black level at 0.3v, and peak white at 1.0v when terminated into a 75 ohm load.

You can get away with 262/312 lines and no interlace, and a 0v pulse for three line periods for the field sync. Leave at least fifteen or twenty lines black for the flyback period after the field sync.

Bob - your colour bar question; I'm not going into detail, but the colour is encoded using a constant frequency subcarrier phase referenced to a once-per-line colour burst signal to indicate colour hue and saturation. It's possible to generate this in TTL but it's not easy. Better to get an encoder chip, or working in RGB rather than coded.

The colour bar signal is used by broadcast engineers to check HF gain (if all the bar chroma amplitudes are low); signal path gain (if the colour burst is not at the correct ratio to the colour bar chroma); signal path phase (incorrect bar and burst phase relationship); differential phase and gain... there are others I haven't touched on. Which doesn't seem to quite tally with any equivalent audio test signal...

Neil

(of course, it's all academic now with the transfer to 270Mbps SDI digital signals.)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Thanks a lot! This signal could be sent to a tv?

This depends on what you mean. As Bob said, you can send it to a standard audio input. However, it would be difficult or impossible to do as a part of the video signal. The audio band of baseband video is at something like 4.5MHz (though this is the figure for NTSC, but I'm sure PAL is similar) and is frequency modulated. Since the highest frequency that you can run an AVR at is 20MHz, that wouldn't give you enough resolution to play with. Even if you can find a way to get it to work, you couldn't do it with the same AVR as the video since all you time is spent outputting the video.

I can think of one possibility that may work. Using a separate AVR for the audio, you might be able to use the internal RC oscillator at 8MHz and use OSCCAL to modulate the frequency. Unfortunately, I don't think that 8MHz would work. If it were 9MHz, you'd have a better shot. Though you could use an external RC oscillator.

Regards,
Steve A.

The Board helps those that help themselves.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No point to try and encode audio as part of the video signal; the whole lot needs to be modulated on the 400-600MHz signal anyway if you want the TV demodulator to do something with it. (PAL-UK modulates the audio at 6.5MHz offset from the video carrier).

Neil

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Koshchi wrote:
Quote:
Thanks a lot! This signal could be sent to a tv?

As Bob said, you can send it to a standard audio input. However, it would be difficult or impossible to do as a part of the video signal.

I'm not planning to do it as a part of the video signal.

Koshchi wrote:

Using a separate AVR for the audio...

I can use a separate ATmega168 for the audio if that would be neccesary.



  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just put a speaker in the pong game.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If i want to show the 'image' on my TV's screen and play sound from it's speakers.. Two AVR's would be needed?



  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just need another rca cable for audio in addition to the one for composite video. Your TV has video and audio jacks, I assume? (I cant figure out the picture yet)

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bobgardner wrote:
Just need another rca cable for audio in addition to the one for composite video. Your TV has video and audio jacks, I assume? (I cant figure out the picture yet)

Yes, my TV has jacks for this kind of cable:



  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Make sure you use the yellow one for the video. There is a special magical coating of pure unobtanium on the center conductor of that cable that reduces the noise floor of video signals by 4dB. Say... you dont know anyone that wants to buy some Florida real estate do you?

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bobgardner wrote:
Make sure you use the yellow one for the video. There is a special magical coating of pure unobtanium on the center conductor of that cable that reduces the noise floor of video signals by 4dB. Say... you dont know anyone that wants to buy some Florida real estate do you?

So yellow for video, and white for mono-audio, right?



  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You really are keeping that picture a secret. Is it the bottom view of a duck listing to starboard?

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
If i want to show the 'image' on my TV's screen and play sound from it's speakers.. Two AVR's would be needed?

It really depends on what you want out of the sound. If it is simple beeps or simple tone generation, then you could do it with one. You would use a timer in PWM mode and set the frequency and duty cycle during video blanking. If you want complex waveforms, then you would need a second AVR.

Are you planning on color video? The link that RES provided shows color bars, but that method is not very practical for a video game. But you can get fairly high resolution in black and white.

Regards,
Steve A.

The Board helps those that help themselves.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Koshchi wrote:
Quote:
If i want to show the 'image' on my TV's screen and play sound from it's speakers.. Two AVR's would be needed?

It really depends on what you want out of the sound. If it is simple beeps or simple tone generation, then you could do it with one. You would use a timer in PWM mode and set the frequency and duty cycle during video blanking. If you want complex waveforms, then you would need a second AVR.

Are you planning on color video? The link that RES provided shows color bars, but that method is not very practical for a video game. But you can get fairly high resolution in black and white.

I'm thinking something like simple tones. So it will be enough with one ATmega. Ok.



  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

claesson92 wrote:
RES wrote:
http://www.serasidis.gr/circuits...

Thank you RES. =) Anyone know where i can find something like this for sound/audio?

..........

I'm going to try to build something like this: http://www.velleman.be/ot/en/pro...
But from scratch, and fully programmed by myself.


Although those are cute little projects, one can squeeze a LOT more out of an AVR.

I myself have been using a Mega32 for a video game system (but it could work just as well with a Mega88 with a lower screen resolution).
So far i've got 32x24 characters color video and 3 channel audio... using just over 4kB of flash for code, and another 1kB for the character set, so i have still over 26kB of the flash to fill up with all kinds of neat stuff...

Permalink: Electronics Pit

Technical data:

  • video: 32x24 characters 4 bit color; 768 bytes character data + 768 bytes color data (16 text & 16 background colors for each character)
  • 'medium' graphics capability: 96x48 pixels (character based). Physical resolution: 288x192 pixels on PAL signal
  • dotclock: 8MHz with the AVR running on a 16MHz crystal
  • RGB+HSYNC output. For PAL FBAS or CVBS an additional RGB to PAL IC is required (for example: MC1377 or AD724). Without this, it is possible to create monochrome composite video, using a resister DAC
  • audio: 3 independant voices, capable of producing either triangle, sawtooth, pulse wave or white noise.
  • three ADSR envelope generators and master volume are also included (simular to 6581 SID)
  • mixing speed: 7.8kHz (half the PAL horizontal frequency).
  • BASIC: 32 user variables (16bit, signed)
  • on-chip EEPROM (1kB) completely usable for BASIC program/data
  • BASIC command "vocabulary" still to be created. Simple commands: PRINT, POKE/PEEK, IF, GOTO and simple equations are already coded
  • data can be entered using a PS/2 keyboard on a full-screen editor (Commodore64-like)
  • Tests show that the Console32 uses roughly 3/4 of its time for interrupt service routines, leaving a little over 4MHz for user implementation (BASIC)
  • 3 external ICs required: two 74HCTxx for color generation and i've used a Tiny13 as a PS/2 keyboard controller
  • peripherals: 2 Joystickports (9 pin D-Sub Commodore/Atari joysticks), I2C, RS232, optional 8bit parallel I/O (uses same pins as RS232 and Audio output: PORTD on the Mega32)
  • currently, the test runs on a Conrad 5V, 1.2A switching power supply, but can just as well be powered by 3 AA cells
The Commodore 64 served as an example and "template" for designing this Console32 project.
For this, a lot of the Console32 features mimmic the C64 (i would not call it emulate, since they just look the same)

(The website shows a "log" of the progress on the project, including a few schematics. There is no sourcecode on the site)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bobgardner wrote:
I saw this analogy on a test I took once... "Colorbars are to video as xxx is to audio".

My guess is white noise... ;)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Bob,
Is that developed or undeveloped land you have for sale in Fld???

Anyways, here is an example of using an AVR to generate video for a VGA display. Here .

There are similar designs for TV outputs, such as this one: Here .

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bobgardner wrote:
Just do anything you want to it. TVs are cheap. In fact, I'd like to know what a real loud 60 Hz waveform sounds like.

I didn't have to read the rest of your post before i started laughing. Evil, evil man.. :D

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think you should push AVR8s so hard and perform so efficient coding if you want to output colorful video and musical tones respectively. AVR8s throughput is not that good for this kind of application. I've made this kind of thing (not a gaming device actually) and it successfully made me using 3 AVR8s (or 2 actually). 1 for generating video signal and character-pattern generator, the other for main coding (the game itself-for you) and the sound. Good luck!

KISS - Keep It Simple Stupid!