A few months ago I designed and assembled my first PCB featuring multiple SMD components. It is essentially a scaled down pinball machine controller board featuring eight high power outputs, eight LED outputs, and a four by four input matrix. And all of that crammed onto a 10 by 10 centimeter PCB.
I designed this PCB as part of a project (code)named Test-Case. The design of this board is based on the Arduino Uno and Adafruit 16 cannel PWM LED driver module. This meant that the board would at least feature an ATmega328P microcontroller and a PCA9685 PWM LED controller.
To drive the high power outputs, I used IRL540N MOSFETs. The board can have up to eight of these MOSFETs. The MOSFETs are driven by the PCA9685 PWM LED controller. The remaining eight channels on the PCA9685 are used for driving the LED outputs directly.
The controller board has the following features:
- A +5V power LED
- A heartbeat LED
- An ATmega328P microcontroller
- A PCA9685 PWM LED controller
- Up to eight IRL540N MOSFETs
- Eight dedicated LED outputs
- A four by four input matrix
I designed this PCB using KiCad. Drawing the schematics did not take a long time as I could base parts of them on the schematics of the Arduino Uno and PCA9685 module. I only had to add the input matrix, the MOSFETs, some resistors, and a whole lot of connectors. KiCad already had all the footprints for the parts I used in my design, which also saved some time.
Drawing the actual board itself took much longer. It looked like all the parts would fit on a 10 by 10 centimeter PCB. It took some weeks moving and rotating parts to get it all to fit, but in the end it worked out pretty well.
Production & assembly
This is the first board I designed which needed a stencil and solder paste during assembly. Working with a stencil, solder paste, and small SMD parts always felt daunting, but it worked out really well. I would even go as far as to call it easy.
This is the brain of the controller. It has a ATmega328P microcontroller, just like the Arduino Uno. I accidentally ordered the ATmega328 instead of the ATmega328P. Luckily, these parts are pin-compatible. However, this specific device is not supported by the Arduino IDE out of the box. I solved this problem by installing MiniCore, which adds support for the ATmega328 microcontroller to the Arduino IDE.
In addition to the microcontroller there is a 16MHz ceramic resonator, a reset button, and a few capacitors. All pins of the ATmega328P are broken out via standard pin headers which have the Arduino pin names next to them. The UART and I²C pins are also exposed via their own dedicated connectors which also carry +5V power.
And then there is the most important connector: The ISP connector. It is used to program the microcontroller. The standard Arduino bootloader can not be used on this board as it lacks the reset circuitry which can reset the microcontroller via the UART connection. This means that this board always requires an external programmer.
The controller has two built-in LEDs. One is a +5V power LED which will turn on once power is applied. The other one is a heartbeat LED, controlled by the microcontroller. This LED can be used to indicate that the processor of the microcontroller is still running.
The controller has a four by four input matrix. The matrix is completely optional. Both rows and columns can be left off the board, in which case they free up pins on the microcontroller.
The controller features a PCA9685 PWM LED controller for driving LEDs and MOSFETs. The PCA9685 is connected to the microcontroller via the I²C bus. The controller has six solder bridges which can be used to change the PCA9685’s I²C address.
The controller can have up to eight IRL540N MOSFETs. The MOSFETs are driven by the PCA9685. All MOSFETs are optional and will free up an additional LED channel on the PCA9685 controller.
Each MOSFET has its own connector and flyback diode. The first and second MOSFETs can be used to drive a flipper coil, which usually has two separate windings. The same can be done with the third and fourth MOSFET.
When the controller has to drive a flipper coil, a single three-pin connector can be installed, instead of two separate two-pin connectors.
During assembly I found some small things that I can improve on in a future design. For example the clearance around the screw holes could be a bit larger. Also, the ground plane has one major bottleneck in the middle of the board. This won’t probably a problem as all high current stuff is close to the power connectors.
On the other hand, there were also things I really liked. For example, labeling all pins of the ISP, UART, I²C, and power connectors. This really helps creating the cables to connect all stuff. Just look up the pin order on the board.
The design files for this PCB are open source and available through Github.
And what will this exactly be used for? Well, I’ll write another blog post on the full project. Stay tuned.