Printed Circuit Board Lab

The first step in making an electronics project is prototyping. An initial design is made and then tested; usually using something called a solder-less breadboard. A solder-less breadboard consists of a two-dimensional grid of pinholes with a gap running down the middle columns. The columns of pinholes on each side of the gap are connected together along a single row inside the breadboard. Circuit components are inserted into the breadboard and wired together.

Source: electronicsclub.info

Sometimes complicated designs containing a large number of wires and components become difficult to deal with. In those instances it is useful to have a printed circuit board or PCB made. A PCB is similar to a breadboard in that it is a board, usually made of fiberglass. Instead the place of wires it has permanent copper “traces” on its surface which are the conductive interconnections between components. Components are then soldered to the copper trace “pads” of the PCB and the circuit complete.

Source: wikimedia.org

PCBs can be ordered on the Internet, but are expensive and take time to be manufactured and shipped. If you’re in the middle of prototyping a circuit and need to build and revise, all the ordering and waiting can be expensive and time consuming. I got tired of all the waiting. That’s why I have taken matters into my own hands and have made a PCB lab at home.

There are kits you can buy for making PCBs at home, but they are pricy and require making negatives, mixing photoresist and other darkroom techniques. The method I chose to make PCBs is more “do it yourself” than a kit. It’s also a lot cheaper.

Source: usm.edu

The first step in making a PCB at home is generating the artwork, a layout of the copper traces. The artwork is applied to a fiberglass board with a thin layer of copper covering its surface. There are several techniques for applying the artwork to the copper board, with photolithography being the most common. I use a technique known as the toner transfer method in which a mirrored version of the artwork is printed onto glossy photo paper, which is then heated and pressed onto the copper board. The toner bonds to the copper and the paper can be soaked in water and then dissolved away, leaving behind the copper board with an non-mirrored version of the artwork attached to it.

Source: slug.blog.aeminium.org

The toner covers and protects the traces underneath while the exposed copper can be etched away in acid. Typically the acid used in etching is ferric chloride, however to keep the cost as low as possible I use a special formula of hydrochloric acid. After etching the toner is easily removed with acetone revealing the shiny copper traces underneath.

Source: pcbfx.com

All that is left after etching is to drill the holes for the components and solder them in place. Being able to do this process at home makes prototyping go much faster and it’s a pretty cool experience.


Astro-Text

Astro-Text is a game that I made on using an Atmegea328p microcontroller, a 16×2 character liquid crystal display and a speaker. Before getting into a detailed explanation of how the game was constructed, It would be helpful to have an understanding of what the game looks like. So, here is a short demo video of Astro-Text (38 seconds):

The Arduino UNO R3 was used as the development board used for this project. The Atmege328p onboard the UNO was programmed in C using Atmel’s AVR library. There project has many complex components, however, I will be focusing on how the projects audio was implemented.

The audio portion of Astro-Text was the most difficult and time-consuming portion of the game. It is also responsible for at least half of the user experience. Without sound the game would seem very dull. Try watching the demo video again without sound and you will see.

To make the game play sound, the voltage level of a single output pin on the microcontroller is varied 20,000 times a second. Since the output pins are digital, they can only be set high or low. To get around this, the game uses pulse width modulation or PWM for short. PWM is the act of varying the duty cycle or pulse width of a square wave to achieve an average value that is somewhere between the high and low output levels. By then passing the output pin through a low-pass filter, the square-wave signal is smoothed out leaving behind the underlying audio signal.

Getting the system to play audio simultaneously while displaying graphics was by far the most challenging aspect of the project. To make things even more difficult, the sound being played was sampled audio, which ran at 20 kHz. The difficulty was that if too much time elapsed between audio samples there would be a noticeable pause in the sound. It would sound like a record that was skipping. To avoid this, a timer interrupt system was used to set the audio output. 20,000 times a second, the microprocessor stops what its doing, changes the audio output, and then goes back to what it was doing. Each time it changes the audio, only an infinitesimal amount of time passes, so it is imperceptible to the user.


Preamble

Hello and welcome to my engineering and homebrew site. My name is Timothy Grijalva and I am an electrical engineering student at California Polytechnic State University. Each week on this blog, I will be posting an article about an engineering project I am working on. As I am an electrical engineer with experience writing software, most of the posts will be hardware or software related. However, there may be a few surprises from time to time.