Tuesday, November 22, 2016

Double sided PCB tutorial

How to make double sided printed circuit board (PCB) at home


Homebrew PCB - not as hard as you might think. Ordering the PCB from a manufacturer might be easier but the disadvantage is the long waiting time, and in case you made a mistake in board design you need to repeat the process again.
For prototyping or for a one board spin, it is more practical and economical to make the boards at home. Following this tutorial you will be able to make a nice board in just a few minutes. The tutorial looks long because of the explanations, but once you get experience it's an easy task.

STEP 1: Printing circuit diagram

You will need a laser printer for this. The toner in the laser printer has plastic particles that will melt and stick to the copper clad. The sole purpose of the toner is to protect the copper below it from the ferric chloride. I use Brother HL-1210WE laser printer.

Printed electrical circuit diagram



The circuit diagram is created using DipTrace. I find it much easier to use than Eagle. You can print directly from DipTrace but i prefer exporting top, bottom and silk layers to .png files with 600 dpi density, and then arrange them on a A4 project to be printed on a single A4 paper. For this you need an image editor like Gimp, Inkscape, etc. I use Inkscape and it's free. The project in the image editor must have the same DPI as the exported images from the PCB design software. Also the printer must be set to print with the same DPI and everything will have the correct scale.
For aligning the layers i print the board dimensions (see image above) and use the lines at the corners to align the two layers on the light projector.
Only the top layers must be mirrored. I do this in DipTrace when exporting the image but it can be done in the image editor too.

Wednesday, August 24, 2016

Library code for interfacing LCD modules with AVR microcontrollers - ATmega328P

A library for LCD modules with the following features:
- Supports 16x1, 16x2, 16x4, 20x4, 20x2, 32x2, 40x2 LCD display modules
- Option for automatically wrapping the text to a new line
- Display of floating numbers
- Numbers can be padded with zeros to maintain user interface layout
- Scrolling a string of characters
- Includes two types of big digits numerical fonts for making a clock
- Has support for user defined fonts and other special fonts included on the HD44780 characters memory
- It does not use external libraries to convert integers to strings thus reducing code size
- Support for 8 and 4 bit mode interface
- LCD backlight dimming or on/off control using PWM
 
You can disable features that you doesn't use to reduce code size.
 

Hardware interfacing ATmega328 AVR microcontroller with a 16x2 LCD module with PWM brightness control

This LCD modules can be connected in 4 bit mode or 8 bit mode. Using 4 bit mode is recommended because it uses less pins but the code is a bit more complex. In the following example I use 4 bit mode.

Hardware interfacing AVR ATmega328 with an 16x2 LCD module with PWM brightness control