PAL Composite video timing

India moved to DVB T2 in 2015. I always wanted to make a system which can project images on to the biggest screen i can get my hands on. So here are details.

PAL = Phase Alternate Line

total of 625 lines

Field one + Field two  = 625 lines

each field line consist of

[ vertical sync ] [ horizontal sync + active video ]x n

each scan line if of 64 micro second. (strict constraints don’t play with margins)

each 64 micrsecond line starts with

[Horizontal Sync = 4.7 us] [ color burst = 8us] [active data] [4 us of black level] = 64 us

This scan is done from the composite line of sony playstation 2. So i am taking this as a reference.

help is taken from here

Additional notes here

Atmega32 Development Board

This development is very basic. It provides the GPIO in the form of header. As i will be using this board for rapid development and learning different coding practices.

I designed this board in KiCad – a open source l tool. From schematics and PCB layout is designed in this software suite.

Here are the schematics and PCB layout.

As i don’t have a laser printer i used the free hand sketching of traces. It is a very long and tedious process. After tracing with permanent marker and letting it dry it for few minutes. I etched this PCB in ferric chloride solution. I use very diluted solution, few grams of ferric chloride in around 200 ml water.

atmega32 dev board schematic
atmega32 dev board schematic
atmega32 dev board pcb layout
atmega32 dev board pcb layout
Drill Holes Marking
Drill Holes Marking
Copper Mask
Copper Mask

Total Etching time is around 40 minutes, After the board has been etched it needs to be cleaned thoroughly. I used utensil cleaning powder for that. And rinsed the board under water. And then let it air dry for few minutes.

Component Placement on PCB
Component Placement on PCB
Component Soldering
Component Soldering
Marking the Components on top layer
Marking the Components on top layer

The development is created. But there are few issues that came while testing the board. When i tested the board the chip does not responds. While checking for shorts or no connection on the PCB. I found that capacitor is not blocking the alternating signal. rather it is showing a short. So i had to change the 22pf capacitor with a new one and the board now works perfectly fine.


LDR Based Camera

Schematic of LDR based Camera
3d Rendering of the pcb’s

Scan the LDR reading with the help of atmega32 adc pins. Send the captured data to a computer using ftdi, bluetooth ,wifi or zigbee. Run any free math processing tool and make a image. Increasing the Number of ldr increases the resolution of the image.

2 axis stepper motor control

This two axis stepper motor control system uses attiny2313 microcontroller. And it utilities the l298 dual h bridge power ic in multiwatt 15 package. The code is easy to write. Dual power supply for the microcontroller and l298 allows for increased isolation. The circuit must use a transformer for the proper galvanic isolation. This is a crude circuit as it needs some filter capacitors to reduce the voltage and current spikes.  

Shadiuno A Open-source electronic prototyping platform

Why limit yourself to the realm of arduino’s here is a new open-source electronic prototyping platform for the tinkers out there. It uses every thing open source. It is so open source you make your own. excpet for the chips.

Designed exclusively for the atmega16 and atmega32.

It can even be used with ardiuno.

You can use usbasp or usbtiny programmer.

One Axis Stepper Motor Control

I was thinking of building a CNC machine. But because of lack of fund i can only design. This crude design does the job. 

There is a high heat dissipation from both the voltage regulators. So a big heat sink must be used. Otherwise there is a high probability of thermal runaway.

Test Code

#define F_CPU 1000000
* GccApplication1.c
* Created: 8/27/2018 4:18:20 PM
* Author : abhay
#include <avr/io.h>
#include <util/delay.h>
int main(void)
DDRB = 0xff;
/* Replace with your application code */
while (1)
PORTB = 0x09;
PORTB = 0x0c;
PORTB = 0x06;
PORTB = 0x03;

Rewriting lfuse and hfuse of Atmel Atmega series

Atmel Atmega micro controller if set correctly will work fine. But when you tinker with its setting. Things get out of control. One such problem is when you set the wrong fuse setting of the device to use the external crystal oscillator.

  1. Connect the microcontroller with the USBASP programmer
  2. Open the command prompt 
  3. write the command
    avrdude -c usbasp -p m32 -t
  4. This will open a terminal where you will write
    read lfuse
  5. Note down the settings
  6. Then write 
    read hfuse
  7. Calculate the correct fuse setting and then write
    avrdude -c usbasp -p m32 -U lfuse:w:0xe1:m -U hfuse:w:0x99:m


These setting specified in the above post is incorrect. 
Calculate the fuse setting in advance
Also remember the JTAG pin will also be set correctly
Never Change SPI setting without reading document. Changing this setting will result in non-functioning of SPI and the programming can only be done with manufacturer programmer. 

The above said procedure is verfied on the follwing micrcontrollers:

  • ATMEGA16
  • ATMEGA32