Radio Transmitter

For your comments, suggestions, or your looking for a circuit or design, or a electronics designer, please send you Inquiries to pcb1001@gmail.com. We are happy to help and attend to your concerns.
Showing posts with label Video Application. Show all posts
Showing posts with label Video Application. Show all posts

Thursday, May 7, 2009

Graphic MP3 Player

The MP3 players consist of only semiconductor parts and no complex mechanics. This is a great feature for electronics handicrafts because it can be built easy with the same performance as commercial products except for the appearance. After a long blank in MP3 project, I built a new one again as the second MP3 project.


The first MP3 project was Pocket sized MP3 Player built with an MP3 chipset that obtained by chance. I have completed some projects of MP3 application for my business but not for hobby because I have no practice of listening music at the outdoors. Why did I built it in pocket size? Because that was only an impulse and nothing else. BTW, the MP3 player is being used in my car as a car MP3 player :-)

Now, there are many easy-to-use MP3 decoders that integrates DSP, DAC and amplifier on a chip. As the result, the MP3 player becomes to a popular project for electronics handiworks and everybody is enjoying to build it as their original project. One day I got to want to build an MP3 player by a reason (described below) and decided to start a new project. This is a regular project on the MP3 player after 8 years. I designed it as a desktop player because portable player is not useful for me.


Hardware

Below image shows the block diagram and the circuit diagram of built MP3 player. It has a feature that it has a large color LCD and a touch screen. Followings describe on each block.

Controller

A V850ES/JG2 (NEC Electronics) is used for system control. This is a 32-bit RISC microcontroller with 256KB flash and 24KB RAM. It was not that well known for electronics handiworks but somebody will be interesting in it because the V850 board was bundled as supplement of magazine in this year. For ordinary MP3 players, most 8-bit microcontroller is sufficient to build it. However this project requires a microcontroller with external memory interface because the controller must handle large amount of image data. Of course any popular microcontrollers, such as Renesas SH2 and H8, will able to be used as well. The reason why I chose the V850 is from its very low power consumption and the serial interface is easy-to-use better than Renesas's one. The V850ES/JG2 can run at 20 MHz but it is used at 14.7 MHz (4xPLL from 3.68 MHz xtal) to deliver a clock signal to MP3 decoder and LCDC.

Storage Media

SD Memory Card is the de facto standard of flash memory card. It can be attached to the microcontroller via a few signal lines. FAT format is used to store data files in it so that the project using the memory card must implement the FAT file system. Fortunately, there are various FAT libraries on the web as freeware so that everybody can use the memory card in their project with ease.

LCD Module

A 4″ color STN-LCD module in resolution of 320x240 is used for the display. Recently the price of color TFT-LCD are going falling and color STN-LCD will soon be shut out of the market. This project was started to to use this LCD module before it decays in the junk box.

A touch screen is attached on the LCD module, so that command buttons can be omitted. A CCFL is used for the back light and a CCFL inverter is required to drive the back light.

LCD Controller

The LCD module in this degree of resolution with built-in display buffer is not available and it must be refreshed by external circuit like CRT display system. Therefor it requires an additional LCD controller on the board to drive the graphic LCD module. The display buffer (RAM) is integrated in the LCDC or attached externally. In this project, an S1D13705 (EPSON) is used for LCD control. The S1D13705 has 80KB integrated display buffer and it can display in resolution of 320 by 240 with 8-bit color depth (256/4096 indexed color). It can be attached to the host controller via a 16-bit SRAM like interface.

The LCD module requires a 3.3V logic supply and an LCD bias supply (21-25V/3mA). Generally, the contrast of the STN-LCD in high drive duty ratio is affected by ambient temperature, so that a contrast dial is required to adjust the contrast. The contrast dial varies the LCD bias voltage. In this project, the contrast is adjusted automatically in software with a thermister put on the LCD module and a D-A converter.

MP3 Decoder

Recently VS10xx family (VLSI Solutions) is used for most home-built MP3 projects because it is easy to obtain and use. The VS10xx is designed for portable audio equipments and can drive a headphone directly. However it has only analog outputs and no digital (I2S) output, so that the VS10xx is not good when require an I2S output to attach an external DAC besides the analog performance is not good for Hi-Fi audio.

I chose STA013 (ST Microelectronics) for MP3 decoding. The STA013 have been released at the dawn of the MP3 format and widely used as a well known MP3 decoder chip. It has only digital (I2S) output, so that a proper audio DAC is required. This is an advantage on electronic handiworks because it can use various DAC chips and output audio data in SPDIF format with DAI encoder.

The STA013 has an integrated PLL oscillator to generate an audio timing clock (384fs) depends on DSP clock. If there is a jitter on the sampling clock, SNR of the analog output will be worse especially on Sigma-Delta DAC. Therefore the PLL power should be tightly filtered and pay attention to parts layout around the loop filter.

Analog Block
A PCM1748KE (BurrBrown) is used. The analog performance on the data sheet is not so bad but it is a little difficult to achieve expected performance because it is a Sigma-Delta DAC.

A post-filter is required at DAC output but only a slow roll-off one will do due to integrated 8x over sampling digital filter. In this circuit, the DAC output is filtered with a LPF+buffer and then output it as a line output and there is no speaker out. Therefore the MP3 player is used with any audio power amplifier.

The line output is tied to ADC input of the microcontroller. This is to get amplitude of the line output and display it as a level meter on the LCD. Generally an envelope detector is used for the audio level meter. In this project, to eliminate the envelope detector, the microcontroller samples waveform in sampling rate of 1kHz and detects peak-to-peak value from 20 samples. There will be dip points on the frequency response but there is no problem because this is for only a visual effect.

Building the MP3 Player

The circuit board must be embedded into a space in height of 10mm, so that the allowable height of the components on the circuit board is less than 6mm. Most of components used in this project ware surface mounted device. They are mounted on the proto-board directly and wired with UEW. This method requires soldering skill and practices but there is an advantage that it can achieve the density of double layered PCB or more. The FPC connector (0.5mm) easily creates solder bridge due to its terminal forms, so that solder the wire to the terminal via a stripe PCB instead of solder the wire directly.

The built circuit board is embedded with the LCD module into the case. The case is a clear acrylic case SK-16 (110x78x32mm) sold from Akizuki. Its depth was too long for this project, so that I cut down it to 25mm, paint black from inside and put an aluminum sheet for electromagnetic shield.

Free FirmWare

YUV(YCbCr) to RGB converter

Recently, most digital video equipments, such as video recorder, DVD player and TV game, have component video output. The component video signal is like RGB video signal, but it cannot connect to RGB monitor directly. Thus I designed and built YUV(YCrCb) to RGB converter to use old TV monitor or video equipment which does not have component video input.


For old RGB monitor....no, my principal aim is to generate RGB signal from component signal from PlayStation 2 for scan converter because recent shipped PlayStation 2 fixes configuration of video output format to component video when used as DVD player :-( Converting the component signal into RGB signal can enjoy the game and DVD with high quality picture. However, the PlayStation 2 can be fixed to RGB output configuration with only a jumper wire. If you wish to get only RGB signal from the PlayStation 2, I recommend this way instead :-)

The theory of RGB to YUV conversion

The component video signals are generated by separating a luminance component and two chrominance components from RGB signals with following formulae:

Y = 0.299R + 0.587G + 0.114B Luminance component

R-Y = R - (0.299R + 0.587G + 0.114B)
= 0.701R - 0.587G - 0.114B Chrominance component (Red)

B-Y = B - (0.299R + 0.587G + 0.114B)
= -0.299R - 0.587G + 0.886B Chrominance component (Blue)

Note: These parameters are for SDTV(525/625), not for HDTV(750/1120).

G-Y crominaice component can also be generated. However, to restore the RGB signal, Y and two chrominance components will do. The G-Y component contains least chrominance in the three chrominance components so that this term is omitted to minimize conversion error.

When restore RGB signals from component signals, following formulae are applied.

R = Y + (R-Y)
G = Y - 0.51(R-Y) - 0.186(B-Y)
B = Y + (B-Y)

The contents of component video signal are these three signals, Y, R-Y and B-Y. You will able to understand that these are loss-less conversion. However, in order to reduce overall video signal band-width to be recorded or transmitted, the band-width of chrominance components are reduced and some compression processes are applied. Human eyes are sensitive to luminance but not sensitive to chrominance. The quality of chrominance components, such as band-width, SNR and digitizing resolution, can be reduced compared with luminance component.

The chrominance signal levels at the transfer line are normalized to luminance amplitude because it is easy to A-D, D-A conversion and transmittion processes. Following are attenuation ratio for the chrominance signals:

Cr = 0.713(R-Y)
Cb = 0.564(B-Y)

And sync pulse is added to luminance signal as -0.3V pulses. These are the component video signals that is appering at input/output point. Typical signal levels at the interface connector are from -0.3V to +0.7V for luminance signal, ±0.35V for chrominance signals.

Hardware

To convert component video signals into RGB video signals, the alithmetic circuit composed with some OPAMPs is used. However, only it is not sufficient to build complete set, some glue logics are also required.

Most video signal outputs except some high end equipments are AC coupled, DC restore circuit is needed to video input part. To remove sync pulses added to Y signal, blanking circuit is also required. These function should apply for completed process. The timing generator for the functions is realized with only a CPLD because to realize it with discrete components will be complex. Following images show the generated wave form of blanking pulse and clamping pulse. Top one is Y input, below two are /BLANK and /CLAMP. Left image is near horizontal blanking area, right image is near vertical blanking area.

Relationship of picture quality between component video and its source

Difference between component video signal and YC video signal is the transfer method of chrominance components.

At YC video signal, a color sub-carrier is modulated by two chrominance signals with quadrature balanced modulation, and transferred as a chrominance signal. Therefore, the band-width of chrominance signals are reduced to half of the sub-carrier frequency. At NTSC video format, I,Q signal which is shifted 33 degree from R-Y,B-Y axis is used instead of R-Y,B-Y signal, the band-width for I signal is 1.5 MHz, for Q signal is 0.5 MHz. However, most video decoders seem decode in R-Y,B-Y axis and both signals are limited to 0.5 MHz.

At component video siglal, two chrominance signals are transferred with two separated lines directly. This is full band-width transmittion. When video signal is from TV game whose source is RGB video buffer, difference between component signal and YC signal appers conspiculusly as some effects shown in following images. In this case, component signal is better than YC signal.

NTSC Test Signal Generator

A video test pattern generator will be needed when calibrate or test video equipments. To characterize system performance and understand it quantitative, wave form monitor, vector monitor and related video measurement equipments will be required. Some generic patterns, shch as color bars, cross hatch, dots and full field, are also used for home video creation to calibrate video monitors without any measurement equipment.


This kind of test signal generators for personal use are often found as construction kits, however, most of the kits are designed on cheap analog method and the wave form is not accurate, therefore it cannot be used as a standard signal in fact. I designed and built a digital video test signal generator in order to generate accurate reference signals which can be used for calibration and measurment of video montors and home built video equipments.



Basic Design

Supported test patterns

The test signals used for electronics handiworks are required at least, plus some additional test signals are also implemented. However most test signals are used with wave form monitor, vector monitor, spectrum analyzer and others. An oscilloscope will able to be used instead of the wave form monitor in most case.

Color video signal format

This signal generator uses a three channel DAC to generate Composite video signal (CVBS) and S video signal (Y/C separated) at the same time, left one channel is not used in NTSC format. It is assigned for one of the color components of Y/CB/CR video format. This feature was not planned some years ago, but it has been added when started to draw the schematic this year, because NTSC television system might be obsoleted in the near future. The two different video format, component video and NTSC video, work in exclusive.

Specifications

Used LSIs DAC: MB40988 (Fujitsu)
MCU: ATmega161 (ATMEL)
PLD: XC95108 (Xilinx)
Output terminals CVBS: RCA pin jack
Y/C: 4pin Mini-DIN (S1)
Y/CB/CR: 14pin D type half pitch connector (D2)
Output impedance Video out: 75 ohm
ID out: 10 kohm
NTSC output
D1 output (480i) Timing: SMPTE 170M (RS-170A), Setup=0IRE (NTSC-Japan)
CVBS output: Y=714mV, Sync=-286mV, Burst=286mVp-p
Y/C output: Y=714mV, Sync=-286mV, Burst=286mVp-p
Y/CB/CR output: Y=700mV, Sync=-300mV, CB/CR=±350mV
D2 output (480p) Timing: SMPTE 293M
Y/CB/CR output: Y=700mV, Sync=-300mV, CB/CR=±350mV
Sampling 8bit x 3, 28.63636MHz
Power Supply AC100V 50/60Hz, <5w style="font-weight: bold;">

Hardware

Genarating a video signal

To generate any video signal, generic frame memory architecture will be used at most case. All samples of the video frame are stored into the frame memory and they are read in sequence and fed to video DAC. The difference between video signal generator and PC's video system is: which is stored into the frame memory, whole wave form including blanking/sync pattern or only pixel values in visible area.

The samplig frequency is 4 fsc (approx. 14.3MHz) at least. This is the typical value on the NTSC video system. However when use 4fsc for video measurements, an excellent video filter which has very sharp cut off, flat group delay and aperture effect compensation, is requied. This is very expensive and difficult to obtain. I chose 8 fsc (approx. 28.6MHz) for this project in order to decrease requirement to the post filter, like over sampling technic.

Wave form memory

The frame memory size is number of samples per line * number of lines per frame. In this case, memory size of 1820 * 525 = 1M samples is required for the frame memory, and the samples must be read out in transfer rate of 8fsc (cycle time of 35 nsec) continualy. An SDRAM is the best for shch use. However I have some small junk SRAMs (32 Kbyte) used for cashe memory, and I wanted to use these chips for the frame memory under recycle spirit :-)

To store the test pattern into the small memory, any data compression process is required. I had an eye to a point that the video test signal tend to repeats same line patterns. When store only the line patterns used in the frame and select the required line pattern for each line, the memory size and downloading time will able to be reduced drastically. Ten several line banks will do for the most test patterns except for patterns change vertically, such as picture, monoscope and vertical sweep. Luminance component and chrominance component are separated into two channels. The luma signal has many kind of patterns at vertical blanking area, the chroma signal is fliped every line. The effeciency of compression ratio can be improved when separated the NTSC signal into luma and chroma components. Y/C signal can be generated at the same time.

This compression technic can be applied to only NTSC format because the chroma subcarrier at the PAL system, fh*283.75+25 Hz, slips its SC-H phase in rate of 360 degrees per frame, each chroma line patterns in a frame are not the same. SECAM is out of the question. For these video formats, complete frame memory is needed. Don't ask me :-p

Controller

An Atmel ATmega161 is used as controller. It manages user interface, downloading the wave form data to the line memory and selecting wave form for each line under line sequense list. The line patterns are shrinked to 1/2-1/50 based on its monotony of luma and periodicity of chroma, The shrinked data is stored to a serial EEPROM and expanded at downloading, 59 frames (100 Mbytes) are packed into 40 kbytes. Therefore two compression process are applied and attained the total compression ratio of approx. 1/2500.

Analog Outputs

A three channel DAC is used. One channel is assigned for a luma channel, left two channels are for chroma channels. The reason of two DAC channels are assined to chroma is to support Y/CB/CR component output. Of course NTSC mode and component mode cannot be used at the same time. The DAC outputs are filtered, bufferred and then output. CR components placed at inverting input is to compensate frequency response due to aperture effect.

Contorl Panel

Two digits numeric LEDs indicate the frame pattern currently output and one of two video format incicater at the corresponding connector is lit. The frame pattern is selected with a dial and set by clicking the dial. Numeric LEDs blink during the pattern selection.

Video Line Selector

When measure video signal with oscilloscope, video line selector is very useful to find a scan line. The line selecter generates trigger pulse at selected line, oscilloscope will display only selected line. This is a very simple video line selector.


Now, I have a Tektronix TDS3032B digital oscilloscope for home use. It can also be implemented video line selecter feature with a video module, any external accessory might not be needed. But this project has started before purchasing the new one, so that I achieved the project to open to the public.

Specifications:
Trigger mode All-line, Both-field, Odd-field, Even-field, An Odd-field in superframe, An Even-field in superframe
Control panel Display: 16cols x 1row LCD module
Conrol: UP button, DOWN button, MODE button
Interface Video input: CVBS/Y Input/Through (75ohms or Hi-Z)
Trigger out: TTL level (rise edge)
Power supply DC 5..12V, 20mA

HARDWARE

There are many video line selecter projects from of old, most line selecters are composed with a sync-separator and some counter ICs. In this project, all of counter/trigger function are processed by a microcontroller without external counter. Therefore, the circuit diagram could be very simple and it has many function.
Compsite sync pulses separated from input video signal are tied to external interrupt of an AVR and a flip-flop. Processing trigger output only software cannot avoid propagation delay and jitter, so that made the trigger edge pass through to the trigger output directly. Sync separator is composed by discrete parts, however, LM1881 is recommended if it is in stock. Test pins are for monitoring the clamped wave form.

SOFTWARE

Firmware for NTSC and PAL

Foreground task processes only user interface. Counting incoming syncs and trigger control are procecced by interrupt driven background tasks. AVR has very high performance, it will able to be implemented some additional functions. Any customized trigger mode or superimposing line marker will easy to implement with modifying the firmware or expanding some external components.

Line counting

First, 16 bit timer/counter is initialized as free running counter with 1.25MHz source clock and compare register is set to 65. The value will reach 79 while a horizontal period. The line counting process is driven by external interrupt (INT1). In this interrupt, when timer/counter has exceeded 60 (3/4H), the timer/counter is cleared and line counter is increased. If timer/counter is less than 60, the interrupt is half-H pulse, the line counter is not updated.

Trigger

After line counter is updated, if the value (next line) matches trigger line, trigger request flag is set. Compare match interrupt (timer/counter maches 65) is occured every 10µs before next line start. In this interrupt, if the trigger request flag is set, reset to external flip-flop is released and next sync edge will pass through the flip-flop. The flip-flop is reset agan by the external interrupt process. The trigger pulse width is approx. 2µs.

Detecting vertical sync pulse

8µs after external interrupt occured, sync level is sampled and stored it into shift register (left shifted). If the interrupt is at half-H, exit with no process. If it is start of line, compare the value of shift register and 0b11111110 (sync pattern at start of vertical sync). Only line 4 in odd field will match this condition. When the vertical sync is detected, set line conter to 4. This process is before updating line counter.

Detecting no signal

If no sync is detected for 20ms, timer/counter overflow interrupt will occure. In this interrupt, no signal flag is set and the condition is informed main task. The no signal flag is cleared by external interrupt (INT1).

Tuesday, April 7, 2009

Simple AV (audio / video) Wireless Transmitter

This circuit provides you with wireless audio and visual transmission to a TV. The TV acts as a receiver, eliminating the need to buy a separate monitor. You can also hook it up to a VCR or CCD Camera, and even set up a remote CCTV security system!





Circuit Analysis:

  • Q3, VC1, C13, C16 and L3 all make up a colpitts oscillator circuit that fluctuates form 220~250MHz. You can regulate the frequency to any value within this threshold by tuning VC1 or L3. C13 modulates the signal rate. When the capacitance increases, so does the modulation. R9 and C16 bias the local oscillation. If you lower R9's frequency to 680W the oscillator's output level will increase.
  • Q2 and L2 act as a frequency doubler. C7, along with FCZ7S3R5 (IF transformer), the Q4 transistor, C14, C19 and R12 all make up the mixer. This mixer takes both audio and visual signals together and "mix" them into one and passes through RF Amplifier Q1 to transmit the signal to the antenna.

Testing:

  • Turning the blue component's trimmer on VC1 varies the frequency. When we turn the trimmer, the television's channel has to be changed accordingly. It is easier to tune the A/V Sender if you have a spectrum analyzer to help you find the correct frequencies. If the frequency is tuned to 474 MHz then this would be the equivalent of your TV's channel 14 UHF band.
  • The IF transformer is used to synchronize the audio and video frequency's level radio. If the TV's image is too blurry then you can adjust the IFT to fine-tune the image.
  • SVR1 controls the video signal input ratio, while SVR2 controls the audio portion. You can tune these components according to your needs.

Monday, April 6, 2009

Video Stabilizer/MacroVision Removal

Have you ever attempted to copy a commercially produced video only to end up with a distorted and jumpy image? If so, then you have run afoul of MacroVision. MacroVision is the most popular copy protection scheme used on the majority of content distributed on VHS cassettes. Like all copy protection, it does nothing to discourage the real pirates and only annoys the user who may wish to create a legal copy for backup and archival purposes. This circuit can eliminate MacroVision encoding in both NTSC and PAL recordings.



Parts

  • R1, R2, R3, R4, R5, R7 -------- 6 68K 1/4W Resistor
  • R6 ---------------------------- 2 75 Ohm 1/4W Resistor
  • R8, R9 ------------------------ 2 100 Ohm 1/4W Resistor
  • R10 --------------------------- 1 2.2K 1/4W Resistor
  • R11 ---------------------------- 1 1.5K 1/4W Resistor
  • R12, R17 ---------------------- 2 470K 1/4W Resistor
  • R13, R16 ---------------------- 2 33K 1/4W Resistor
  • R14 --------------------------- 1 6.8K 1/4W Resistor
  • R15 --------------------------- 1 22K 1/4W Resistor
  • R18 --------------------------- 1 47K 1/4W Resistor
  • C1 --------------------------- 1 15uF Electrolytic Capacitor
  • C2 --------------------------- 1 220uF Electrolytic Capacitor
  • C3 --------------------------- 1 220pF Ceramic Disc Capacitor
  • C4 --------------------------- 1 0.0022uF Ceramic Disc Capacitor
  • C5, C7, C8, C9, C10, C11, C12, C13 7 0.1uF Ceramic Disc Capacitor
  • C6 -------------------------- 1 0.47uF Ceramic Disc Capacitor
  • D1-D9, D10-D18, D19-D27, D28, D29, D30, D31, D32, D33, D34, D35 35 1N4148 Diode
  • Q1 --------------------------- 1 BC548 NPN Transistor
  • Q2 --------------------------- 1 BC558 PNP Transistor
  • U1 --------------------------- 1 4040 12-Bit Ripple Counter
  • U2, U3 ------------------------ 2 4027 Dual J-K Flip Flop
  • U4 ---------------------------- 1 4011 Quad Two Input NAND Gate
  • U5 --------------------------- 1 TL802 Dual Op Amp
  • U6 --------------------------- 1 4053 Triple Two Channel Multiplexer
  • U7 --------------------------- 1 4069 Hex Inverter
  • J1-J9, J10-J18, J19-J27 ------- 27 Jumper
  • J28, J29 --------------------- 2 RCA Jack
  • MISC ---------------------- 1 PC Board, Wire, Sockes For ICs

Notes

  • The circuit was submitted via email by Jari Ekstrom. Jari noted that the author is Antti Paarlahti and that the circuit originally came from the author's website. This website is no longer accessible. However, some searching revealed that the author of the circuit also wrote The MacroVision FAQ. The email address listed for the author in the FAQ is invalid and the FAQ was last updated in late 1996. This circuit reproduced here without permission.
  • Before use, the circuits's jumper need to be set. Take a look at the table below:

MacroVision Type
Upper Start Line
Upper End Line

Lower Start Line
PAL 0x05 0x0F 0x126
NTSC 0x06 0x0E 0xFB

  • To set the jumpers, first convert the line numbers to binary. You will end up with three binary digits, one for each set of line numbers. Bit 0 is least significant, bit 8 is most significant. Now simply open the jumpers at the 0 bits and close the jumpers at the 1 bits.
  • Connect your video source to "Composite Video In". As the label suggests, this circuit accempts composite video signals only. The corrected video signal is sent to the "Composite Video Out" jack.
  • With the two "Video" terminals disconnected the circuit passes video through without modifying it. Jumping the "Video" terminals enables the MacroVision removal.
  • As with all circuits involving CMOS (4000 series) ICs, you must tie the unused inputs of those ICs to ground. This is not shown on the schematic for clarity.
  • Supply voltage is 12V.