7. Electronics design

This week I made a PCB all the way from designing to fabricating it. The idea was to make a board that I can already use for my final project, a DPV. The requirements are, additionally to the requirements of this assignment, to support at least a + and a - connection to the battery to power the board and to measure the voltage of it, a connection to some LEDs from the outside of the hull as a output device to indicate the battery level, connections to two buttons to run the dpv in two different speeds and a connection to a motor controller, to use a motor as an output device to propell the DPV.

image sketch

Design

As the software of choice for designing the PCB, I used AUTODESK EAGLE Version 9.5.2.

I used the Add Part function to start with the microcontroller, a ATMEGA328P, and placed it on the scheme. I then placed the other needed components and wired or respectively labelled them with the Label function. I added a four pin header to have two pins for + and two pins for - to connect to the battery. I am planning to power the motor of the DPV with three 12 V 18 Ah lead acid batteries, connected in series, to end up with a nominal voltage of 36 V. Therefore, i want to connect the battery pins to just one battery with a nominal voltage of 12 V. Still, the microcontroller can only take a maximum voltage of 5.5 V according to the data sheet. For that reason I integrated a voltage regulator and two capacitors according to the voltage regulator’s data sheet. Additionally I added three capacitors in parallel in the power circuit for noise cancelling. Also the power indicating LED and its 499 Ohm resistor are connected in parallel to that. This part of the board delivers ground (GND) and +5 V (VCC) to the board.
For programming the board I added a three pin header and connected the pins to MOSI, MISO and SCK on the microcontroller via labels. Between the SCK wire and a ground label I added a 499 Ohm resistor and a LED to indicate communication via that pin.
As a resonator I added a 16 MHz crystal between the microcontroller pins PB6 and PB7, also connected to ground in parallel with two 22 pF capacitors to reduce the noise.

One of the two main functions of the board is to measure the voltage of the batteries and to indicate the battery level. Therefore, I connected a two pin header to the ground and to the PC” pin with a voltage divider in between. That means that I can connect those two pins to all three batteries in series to measure a a fraction of the total voltage of the batteries to calculate the battery level without overpowering the board. A three pin header is connected to the controller’s PD5, PD6 and PD7 pins with respectively a 499 Ohm resistor in between. Another three pin header is connected to ground. Three LEDs can then be connected to the headers to show the battery level in three steps from 100 % to 2/3, from 2/3 to 1/3 and from 1/3 to 0 %. Two two pin headers are lanned to be used for two buttons outside the hull to operate the motor in two different speeds to propell the DPV. one header is connected to the ground, the other one to the pins PB0 and PB1.
Another two pin header is reserved for the motor controller and is connnected to PB2 and to ground.

image scheme

I then created the board view and moved the micro controller to the center of the board. All the other components were then placed around the controller so that the capacitors for the crystal were close to the crystal and the crystal close to the controller. I used the Autorouter function to make all necessary connections between the components with airwires. I had to move some components around and have some wires run through between the two pads of some components. For that, the clearences in the DRC menue were all set to 12 mil.
I drew the board outline as a polygon and added three holes to mount the board to the DPV’s hull later.

image layout

After finishing the design I exported the file as a .pgn image.

image image

Milling

To further process my board, I opened the image in GIMP. A first unsuccessful attempt had shown, that I had to scale the image down by a factor of two. A potential reason for that might have been the 4k resolution of my computer.
Out of the image of the layout of the board I made three images. One as it was, for the milling of the traces, one with just the throughholes for the pins of the headers and one for milling the outlines.
image traces

image drill

image outlines

I then uploaded those three images to fabmodules.org and created the G-code for milling the traces, drilling the pin holes and cutting the outline of the board like for the electronics production assignment. The input format was .png, the output format was .rml for a Roland MDX-40. For the traces I chose the process “PCB traces (1/64)” and for the pin holes and the outline I chose “PCB outline (1/32)”. The speed was set to 2 mm/s for all three operations and the offset was set to (0/0/0) to save some space on the stock maaterial and mill the board closer to the edges. For the traces I set the tool diameter to 0.1 mm, for the pin holes to 0.8 mm and for the outlines to 1 mm. The offset overlap was always set to 55 %.
With the three .rml files I moved over to the Roland MDX-40 and milled all three files with 8500 rpm and the respective tools and adapted z axis offsets, due to different tool lengths.

image milled

Soldering

Since Eagle offers the possibility to export a partlist, I used that to pick all the necessary components to stuff my board. I placed them on the board, starting with the microcontroller in the middle and soldered the components in place.

image soldered

Programming

For programming my board I used an Arduino Uno and the Arduino IDE. In the software I set the board to ATmega328PB Chrystal Clock, the speed to 16 MHz and the programmer to Arduino as ISP. I then burned the bootloader and successfully tested the board with the Arduino example file Blink.

image setup

Downloads

traces
holes
outline