4. Electronics Producton

This week we learn how to make our own circuit boards.

Assignment

Group assignment

Link to this week's group assignment page.

Atmega328p Development Board

For the dev board, I'd like to have the ability to recycle the microcontroller, but we don't have the suitable female connectors for the board, so I deciced to make a dev borad for the atmega328p controller, since we have the sockets for them.

So I went off to search for a dev board that can be used for the atmega328p controller, and I found this one on Google. Looks nice to me, and it provides the Eagle design files for the borad, so I downloaded the files and imported in the JLC EDA Software. It's an online EDA software developed by the board manufactor JLC, and it supports loading the Eagle files.

Making the PNG files

I imported the .brd file and examined it in the JLCEDA editor, and checked it that it has no big problem (which turned out to be false later LOL), and I just exported the file as a PDF file. The export option is shown as follow, and we got a file with white traces on the black background.

jlc import jlc export1 jlc export2

Then I open the PDF file with GIMP to do some additional processing. Here are the steps:

Note: Later it turned out maybe I should add some addtional paddings before filling the board outline, now some of the traces is right on the edge of the board.

Cutting

Now we can use the png image to generate tool path for cutting the board, using the Mods Project website.

(TODO: document tool path generation)

cut board

Soldering and Testing

Now I've got my board cut, it's time to solder it!

I examined the board and I found some of the gaps in the design weren't wide enough and the end mill didn't go throungh. So I have to fix them by cutting them using the utility knife. The lesson I learnt here is that I should've set some design rules before exporting the images from the EDA software to let it check the errors for me first.

fixing traces

The Arduino Uno also has an Atmega328 at its core, so in theory my board can run the same program as an Arduino Uno can, the only difference is that the Uno has an extrenal 16Mhz crystal osillator to make it run at a higher frequency. The board I dev board I cut also designed the place to put the crystal and the capacitors it needs.

But unfortunately, I checked that we have the crystals in stock the day before I cut the board, the next day, they were gone :( . But I came up with another solution, that is to use the Atmega328's internal oscillator.

So I did't put the crystal and the capacitor that is under the socket, just started to solder the socket. The socket is a through hole component orignially, but it can be bent easily to make it SMD.

bend socket1 bend socket2 bend socket3

Then use the soldering iron to put a little bit of tin on the first pad for the socket, then solder the first pin of the socket to prevent it from moving. Then do it on the opposite side, then solder all the pins one by one.

solder socket1 solder socket2 solder socket3

Then I soldered the power led and its current limiting resistor, and some of the pin headers to test the traces. And connected the 5V and GND pins to test if everything is fine. The power led is working.

power led pin headers power test

Then solder the other pins to test the board.

soldered

The atmega328 without the crystal needs a different profile than the Arduino Uno to upload the program. I founded this tutorial by Arduino to upload code to a bare atmega328.

First download the board config for atmega328, create a folder called hardware in the Arudino project folder (defaults to My Document > Arduino on Windows), extract the downloaded board confige into the folder.

We need a programmer to program the atmega328p chip, and an Arduino Uno can be used to emulate a avr programmer. Open the Arduino IDE software and select the File > Examples > 11.ArduinoISP > ArduinoISP and upload the sketch to an Arduino Uno. Now the Uno can act as a programmer to program the other atmega chip.

Arduino ISP

Connect the Uno and 328p like the image below, the Uno can use the SPI interface to program the chip.

connection TODO: board connect

Just try to upload the basic Blink example of Arduino to the atmega, in the Arduino IDE, in Tools > Board menu, select the ATmega328 on a breadboard(8MHz internal clock) option, and in Tools > Programmer, select Arduino as ISP as the programmer.

upload program1

Then goto Sketch, click Upload Using Programmer to upload the program through the Uno as programmer.

After the blinking indecating data transmission, the LED blinks once every second, showing that the program has been uploaded successfully.

The board running with the power pins plugged in.

Finally I solded on the reset button and its pullup resistor.

final board