DEV Community

Frank Delporte
Frank Delporte

Posted on • Originally published at webtechie.be

From breadboard chaos to a real PCB: designing the Pi4J smoke test board

Testing a Java I/O library properly means testing it on real hardware. No mocks, no stubs, just actual pins doing actual things. For Pi4J, that means running the smoke test: a setup with two BMP/BME280 sensors, some GPIO-to-GPIO jumper connections, and a bunch of patience while you untangle the wires for the third time this week.

That last part is what finally pushed us to design a proper PCB. This is the story of board number 0001.

What is the Pi4J smoke test

The Pi4J smoke test is a test project that verifies the Pi4J library works correctly on real Raspberry Pi hardware. It covers the most important communication protocols:

  • I2C: using a BMP280 or BME280 sensor for air pressure and temperature
  • SPI: a second BMP/BME280 sensor over SPI
  • GPIO: several pin-to-pin connections to test PWM output, digital output, digital input, and debounce behaviour

The wiring involves quite a few connections. Two sensors, a T-cobbler breakout board plugged into a breadboard, and a collection of colour-coded jumper wires connecting GPIO pins to each other. It works fine, but "works fine" and "reliable test setup" are not always the same thing.

The problem with the breadboard

Every time someone of the Pi4J sets up the smoke test on a breadboard, something is slightly different. A wire in the wrong column. A jumper that looks seated but is not. A sensor that falls over when you move the board.

This is fine for a quick experiment. It is not great when you want to hand the setup to a contributor, or use it consistently across different hardware revisions of the Raspberry Pi. The goal of a smoke test is to give you a fast, repeatable answer to the question "does this still work". A breadboard that changes shape every session works against that goal.

Smoketest setup on a breadboard

So we wanted to have a "fixed solution" already for a long time...

Designing the board with EasyEDA

I used EasyEDA Pro for the design. It is a browser-based PCB design tool with a built-in schematic editor, a large component library, and direct integration with JLCPCB for ordering. The learning curve is manageable, especially for a board this straightforward.

I did not do this alone. Jan, a coach from my CoderDojo club in Ieper, helped me convert the breadboard setup into a proper schematic. That turned out to be the right call. There are details in PCB design, like how to connect the sensors, adding the LEDs, component placement, and clearance rules, where experience matters more than enthusiasm. Jan has a lot of hardware-design experience and was happy to share it.

The starting point was the wiring tables from the smoke test documentation. Every connection in those tables needed to end up as a trace or a connector on the board. That gave us a clear scope and made the design process straightforward.

In the schematic you don't have to draw every wire as a line. Instead you use net labels: a pin gets a label like SDA or SCL, and every other pin with the same label is connected to it. The same approach works for both the I2C and the SPI side, and for the ground and 3.3V connections that run across the board. It keeps the schematic readable while still describing every single connection from the wiring table.

From the schematic, EasyEDA can propose a board layout for you. That proposal is only a starting point. I did a lot of fine-tuning on top of it and went back and forth with the Pi4J team before the layout was right. A nice feature here is that you can hover over a net and watch all its connections light up, which makes it easy to validate that, for example, the ground plane and the SPI wires really go where they should. EasyEDA also has a 3D visualization, so you can turn the board around, check it from all angles, and confirm that everything is labeled correctly before ordering anything.

What is on the board

The finished board has a few distinct sections.

The 40-pin GPIO header runs across the middle, with pin numbers printed on both rows. This connects directly to the Raspberry Pi GPIO header. Above the header, a row of SMD resistors and LEDs helps to see if the GPIO-to-GPIO tests are running. They are grouped by the pin ranges they cover: 12-16, 13-15, 16-22, 32-36, 36-37, and 38. Each group maps to one of the test cases in the smoke test wiring table.

On the left side of the board there is an I2C connector for the first BMP/BME280 sensor. On the right side there is an SPI connector for the second sensor.

The board also has mounting holes in all four corners, which means you can actually fix it to something instead of letting it slide around on a desk. And there are two additional 20-pin headers so it's easy to connect a measuring instrument if something seems to be not working as expected.

Board number 0001 is the first one off the production run. The QR code in the top corner is the PCB manufacturer's tracking code.

PCB 001

Ordering the board

The board is manufactured by JLCPCB, which integrates directly with EasyEDA. This is where I ran into some user experience problems. These companies are great at hardware, but the ordering software is confusing the first time you use it. From the schematic view, the only thing you get is an "order the parts" button that drops you on the JLCPCB website without actually starting an order. The real ordering options live in the PCB view, behind a different set of buttons that are not clearly labeled. I ended up chatting with the support team just to figure out which button I needed to press.

Once I found the right place, ordering was easy. The minimum quantity is five boards, which was fine, because I also wanted them assembled and will share with members of the Pi4J team. The only component not in stock was the 40-pin GPIO header, but that is cheap and easy to solder yourself, so it was not a problem.

The package arrived well protected, with each board resting on a piece of foam to protect the headers. The boards came on a larger panel because my design was too small to run through the production machines on its own, so the manufacturer adds extra board material around it. After that it was just a matter of soldering the 40-pin header, which goes straight through and is the easy part.

First results

To make sure nothing had changed in the code, I first ran the existing smoke test on my old breadboard setup with a Raspberry Pi 5, straight from IntelliJ. The run executes about ten tests across the different protocols, including PWM, digital I/O, I2C, and SPI, and the summary reported all ten passing.

Then I connected the new PCB using a flat cable, carefully matching pin 1 on the Raspberry Pi to pin 1 on the board. Using two flat cables means I don't have to keep unplugging connectors directly on the Raspberry Pi, which limits the stress on the Pi's own header. Running the same smoke test, the LEDs started blinking and jumping from one pin group to the next as each test ran, a nice visual confirmation that something is actually happening. And the result was the same: all tests passed.

The connections are solid, the connectors are in the right place, and nothing falls over when you pick it up. That is exactly what you want from a test board.

What Is Next

The plan is to open source the EasyEDA design files and add the board to the Pi4J hardware testing documentation. If there is interest from contributors, it could become an official Pi4J testing accessory, something you can order yourself or build from the files.

If you have feedback on the design, or ideas for what else should go on a future revision, open a discussion on the Pi4J GitHub or find us on Slack.

And yes, CoderDojo coaches know more about PCB design than you might expect.

Top comments (0)