ATMega328PB Dev Board

Circuit Board

This board is a microcontroller PCB intended for project prototyping. I designed the board in Altium with this in mind. The MCU, the ATMega328PB, runs at 3.3V, and is programmed via SPI at 5V. A level shifter protects 3.3V SPI lines allowing for a 5V programmer to be used. This board is on the beefier side of the Atmel MCU catalogue, and as a result is a board designed for larger projects or ones with more complex code and libraries.

This project is sponsored by PCBWay, a wonderful and easy to use PCB manufacturer.

Skills Used

Advanced Circuitry

Altium

C++

Demonstration Videos

Below are videos demonstrating different features of the ATMega328PB Dev Board.

Programming via SPI & Builtin LED Flash - Demonstration

The video below shows me programming the chip on the board and blinking the builtin LED at different speeds.

MCU UART to USB Serial via FTDI - Demonstration

The video below shows the board outputting MCU UART data through an FTDI board to USB Serial on my laptop.

Final Schematic Design & PCB Layout

Below are photos showcasing the final schematic sections and printed circuit board design for the project.

Entire Schematic

PCB 2D View

PCB 3D View - Front

PCB 3D View - Back

Bill of Materials (BOM)

Below is a table containing all of the parts as well as a link to the Digikey parts list.

Part Name Count Cost Per Part
ATMega328PB 1 $1.63
1µF 1206 Capacitor 4 $0.12
Green 1206 LED 3 $0.69
Female USB-C Connector 1 $0.78
3.3V LDO 1 $0.22
5.1kΩ 1206 Resistor 2 $0.10
620Ω 1206 Resistor 2 $0.10
1kΩ 1206 Resistor 1 $0.10
0.1µF 1206 Capacitor 3 $0.43
SS14 Schottky Diode 2 $0.29
Female Barrel Jack Connector 1 $0.52
10µH 1206 Inductor 1 $0.50
1x4 2.54mm Male Pin Header 1 $0.17
1x14 2.54mm Male Pin Header 2 $0.71
1x6 2.54mm Male Pin Header 1 $0.31
10kΩ 1206 Resistor 4 $0.10
SMD SPST Push Button 1 $0.96
5V LDO 1 $0.49
SMD SPST Slide Switch 1 $0.80
5V to 3.3V Level Shifter 1 $0.71

Using the Device

Using the Device such as Pinouts or Setup is detailed below.

Device Pinouts

Below is information and necessary tables of pinouts for the device.

Pin Technical Name Pin Name Pin Info
USB-C USB-C USB-C Power (5V)
P1 - 1 3V3 MCU 3.3V
P1 - 2 RXD MCU Rx
P1 - 3 TXD MCU Tx
P1 - 4 GND MCU Ground
P2 - 1 VIN Vin (>5V Input)
P2 - 2 5V0 5V power pin
P2 - 3 GND MCU Ground
P2 - 4 PB1 MCU PB1
P2 - 5 MOSI MCU MOSI (SPI)
P2 - 6 SCK MCU SCK (SPI)
P2 - 7 PE2 MCU PE2
P2 - 8 PE3 MCU PE3
P2 - 9 PC0 MCU PC0
P2 - 10 PC1 MCU PC1
P2 - 11 PC2 MCU PC2
P2 - 12 PC3 MCU PC3
P2 - 13 SDA MCU SDA (I2C)
P2 - 14 SCL MCU SCL (I2C)
P3 - 1 3V3 MCU 3.3V power pin
P3 - 2 GND MCU Ground
P3 - 3 GND MCU Ground
P3 - 4 MISO MCU MISO (SPI)
P3 - 5 MOSI MCU MOSI (SPI)
P3 - 6 SCK MCU SCK (SPI)
P3 - 7 PE2 MCU PE2
P3 - 8 PE3 MCU PE3
P3 - 9 PC0 MCU PC0
P3 - 10 PC1 MCU PC1
P3 - 11 PC2 MCU PC2
P3 - 12 PC3 MCU PC3
P3 - 13 SDA MCU SDA (I2C)
P3 - 14 SCL MCU SCL (I2C)
P4 - 1 5V0 Programmer 5V
P4 - 2 SCK Programmer SCK (SPI)
P4 - 3 RESET Programmer RESET (SPI)
P4 - 4 MOSI Programmer MOSI (SPI)
P4 - 5 MISO Programmer MISO (SPI)
P4 - 6 GND Programmer GND

Setting Up & Using the Device

The device can simply be plugged in via any of its power inputs to power it on. This includes the barrel jack input, for VIN, which can take >9V, the USB-C port, or the external 5V in line of the programmer header. As for programming, the device needs to be connected to an SPI programmer. For my case, I used an Arduino Uno. I flashed the Arduino Uno with the "Arduino ISP" example code file that comes with the arduino IDE. From here, I connected the Arduino Uno to my ATMega328PB Dev Board according to the table below:

328PB Pin Name Arduino Uno Pin Name
PC6 (P4-3, RESET) D10
PB3 (P4-4, MOSI) D11
PB4 (P4-5, MISO) D12
PB5 (P4-2, SCK) D13
GND (P4-6, GND) GND
5V (P4-1, 5V0) 5V

Once hooking it up as such, make sure the onboard switch of the 328PB board to enable programming mode is in the ON position, i.e. it matches the silk screen indicator. From here, if using the Arduino IDE like me, install the "MiniCore" board library. To do so, add "https://mcudude.github.io/MiniCore/package_MCUdude_MiniCore_index.json" to the preferences list in your IDE, then search for the library in "Boards Manager" and install the package. Configure your board settings to match as follows:

Board Settings in the Arduino IDE

With this done, select "Burn Bootloader" at the bottom. Then, open the code you want to push to the 328PB board. Then, go Tools>Upload Using Programmer. That's it! See the video at the top of a this page too for a demonstration if you are having issues, or feel free to contact me.

Development Documentation

Challenges, What I Learned, and More.

Challenges

This board had its fair share of challenges. Most notably, this was the first MCU I've worked with directly that required SPI based programming, SPI being a protocol I hadn't used much at all already as it is, much less for programming. In the same realm was the challenge of level shifting the SPI programming signals from a 5V programmer to the 328PB running at 3.3V. Due to the high speed directional nature of SPI finding the right level shifter was a challenge and the first set of boards I ordered actually didn't work due to a level shifter that wasn't capable of handling SPI. Additionally the programming process was entirely new so learning the ropes of programming an MCU via SPI was also a challenge.

What I Learned

I learned quite a bit from this project. I think most notably and as mentioned lots I learned plenty about both level shifters and SPI as these were both brand new for the most part to me. It also helped me develop my board layout skills as this board came out quite compact but with many many components and traces.

Inspiration

This board was most certainly inspired by the Arduino Uno which also uses a 328P Atmel chip as its MCU (though not a PB, to my knowledge). This is a board I've used plenty of times, mainly early in my EE explorations, but that was the back bone of most of my early learning and so was a great inspiration. I was also inspired to simply have a larger chip with more GPIOs available and more storage in case a larger project called for it.