Post Two - Main Control Board Pt. 2

PCBs were provided at no charge to LRJ by PCBWay in exchange for an honest review. All sponsored content is clearly marked.

Nearly two months later, and we finally have the second post ready. I swear I’ll try and get better at sticking to deadlines…

I’ll warn you though, this’ll be one long read. If you can’t tell by the lack of progress updates since late November, the control board has been nothing short of an absolute nightmare to get working, a saga involving exploding parts, endless frustration, and so, so many broken components.

Let’s get right back to where I left off last time. We had a completed schematic, so it was time to lay out a PCB and order some parts. We decided on a bog-standard rectangular form factor, with screw holes on all four corners, as this would fit well in our custom case (more on that in a future post), while leaving room for cable routing on the top and bottom sides. Routing the traces was simple enough (if you’re not aware, traces are the etched lines of copper on the board that form the connections between parts), if complicated somewhat by the large number of thicc power lines needed to drive the motors (traces can have different thicknesses, depending on the current levels they are expected to carry).

PCB Design

The final PCB design, the Raspberry Pi mounts on the underneath into the GPIO header, this causes some problems later on.

At this point, we turned to PCBWay, who generously provided us with multiple free PCBs, making a custom control board wouldn’t have otherwise been possible on our very limited budget.

Begin sponsored review

The PCBs were all of excellent quality, with no obvious visual or electrical defects. l have used circuit boards from PCBWay before in personal projects outside of the jam and they have always performed well, with no manufacturing defects. The layers are all well-aligned and the silkscreen is sharp and bright.


The two sides of the raw PCB, before any soldering or assembly.

Another point I can make is that the adhesion of the traces to the fiberglass backing was excellent, as demonstrated by the lack of ripped pads after many hours of rework, and I’m not exaggerating there, I must have pulled and resoldered one of the chips at least 25 times during troubleshooting, with only minor defects in the solder-mask present when we finally got it working.

In conclusion, I would recommend PCBWay for all of your prototyping needs, their rates are well in line with the competition and delivery is usually quick and cheap, despite our boards for this particular project being heavily delayed due to the general state of the world in 2020.

End sponsored review

Now that’s over - have you ever tried writing a review of a circuit board, there’s not much to talk about, it’s really hard! - let’s get onto the parts. We ordered all the components needed to populate the boards from LCSC, and a week later I had a lifetime’s supply of anti-static bags, and the parts too of course.

LCSC Parts

I wasn’t joking about the lifetime supply thing, look at how many bags of parts there are! Side note - I apologize in advance for the quality of all photos, I’m no photographer by any stretch.

Bags in hand, I soldered up the board, in what was quite possibly the dodgiest “workshop” setup ever, no joke - it consisted of a sheet of MDF balanced between a bathtub and a stack of boxes. In retrospect I wish I’d have taken a photo. Anyway, I powered it up and…

Assembled PCB

The assembled PCB, spoiler - most of these parts will be desoldered fairly soon.

Nothing. And so began the endless troubleshooting, the problematic section of the board was the ARM chip, luckily all the other functions turned out fine. I went through the obvious troubleshooting steps, checking the voltage regulator, which was fine, checking the oscillators and jumpers. also good, I checked the programmer on another chip, and it worked fine. At this point, I was completely confused, and I eventually came to the conclusion that the problem must be my soldering. Off the chip came and I inspected the pins, no hidden bridges or bending. I tested the traces on the board itself, all fine. Somehow even more confused, I resoldered it back in place and flicked the power switch once again…

It worked, at least partially. Half the pins weren’t connected properly, this gave me yet more evidence that the problem was my crummy soldering skills rather than the parts I was working with. So I tried to reflow the non-functional pins, and I broke it somehow. Once again, there weren’t any solder bridges, at least none I could see, and all the supporting circuitry was functioning just fine. The only difference was that now the 3V power rail was shorted to GND. To test whether this was a problem with the regulator or the micro itself, I pulled the chip once more. The short went away.

All of this was fine though, we planned for this and had ordered a spare of every chip. After checking everything again, the regulator, the pads, the traces, the supporting circuitry, everything that could have an impact, I soldered the second chip in place, using hot air reflow this time rather than drag soldering.

It didn’t work. I feel like I’m repeating myself a ton here, but the power lines had shorted yet again, exactly the same failure mode as the previous chip. After a lot of deliberation on our Slack channel over what could be causing everything to keep breaking, we still had no clue. Our only option was to get another set of chips and try something different.

A few weeks later and I had the replacement chips (corona-mania shipping times sure did have a huge impact on how painful this whole process was). We weren’t taking any chances this time, I removed the regulator, powering the circuit from a known-good external supply and disabled all the external components the chip connected to, in case they were breaking it somehow. I swapped out all the capacitors and scrubbed the board to death in an effort to remove all left-over flux that could be causing problems. I held my breath, soldered it in place and flicked the switch, and…

New Chips

The replacement chips we had to order in.

It broke, AGAIN!!!!!!! Not only that, but it also fried the Pi, one of the motor drivers and blew up a capacitor (I still have no clue how this happened, we’re talking about 3.3V here, the capacitors were rated for far more). I was absolutely fuming, we were at around £60 in broken parts at this point, a huge chunk of our total budget. I was on the verge of tears, you have no idea how angry I was. I had no choice but to put everything in a drawer and forget about it, we were out of money and I had no confidence in this design ever working. Things were so bad, that I had actually started drafting an email pulling us out of the competition6.

A couple of weeks later, I was about to get the go-ahead to send said email, when I had an idea. Couldn’t we just scrap the onboard circuitry entirely and get a dev-board from STmicro, which we would then wire up to the points on the control board manually. Sure it’d be ugly and a ratsnest of wiring but it was a cheap way to get one last chance of success. I cut all the traces going from the chip to other parts of the board to avoid interference and wired up the development board.

I soldered in the spare motor driver from the first batch of parts and mutilated a new Pi Model 3B given to us by the jam to fit in the place of a Model A (those ports are a nightmare to remove, so much thermal mass…), powered it up and it worked. Entirely. I’m writing this two weeks after we had everything working for the first time, and no new problems have come up. I still have no clue why we had so many problems. I’ve used the exact same circuit on other projects before and it’s worked fine. Not that it matters now though, all I care about is that it worked.

Mutilated Pi

The replacement Pi, somewhat modified to properly connect to the control board.

Development is progressing very smoothly now, and I’m pretty sure we’ll be able to stick to weekly posts from now on. Next time - how we designed and manufactured the casing. I promise it won’t be as long as this one!

Take a quick peek at the case design below!

Thanks for reading to the end, if you’re from another team reading this in the future, the best advice I can give you after going through this ordeal is get all the support you possibly can, think of other ways to solve problems, don’t just try the same thing over and over again, and although it’s cheesy to say it, don’t give up!

We're not dead!

Apologies for the lack of posts (if anyone is even reading this - I haven’t checked) but we’ve had some issues getting the control board fully functional.

Post 2 should be ready by the end of next week.

Post One - Main Control Board

Hi there, and thanks for visiting our blog. We’ll be documenting every step of the development of our robotic entry to Pi Wars 2021.

Pi Wars is a non-destructive Raspberry Pi based robotics competition with both autonomous and remote-controlled challenges. It takes place over one weekend and features teams of school students, family members and hobbyists as well as solo roboteers.

We’ve decided to go with a non-chronological format, that is we’ll be writing about each element of the robot separately, rather than documenting changes as we make them. We feel this is much more useful for future teams looking back on previous years as it better categorises information about a specific part in one place. Of course, there will still be some news spliced in with the posts - it just won’t be the main focus.

Let’s start with the schematic - Cryptoid is primarily controlled by a Raspberry Pi Model 3A+, as required by the Pi Wars rules, which both directly interfaces with hardware through the GPIO pins and connects to a second ARM coprocessor for additional functions that cannot be performed reliably by the Pi, such as large amounts of PWM pins for motor control and precise timing for LED strips.

Diagram of the SMPS circuit

The circuit features three switched-mode power supplies, which take the approximately 15 volt supply from the batteries and regulate it down to the levels required by the hardware, these being VCC1 running at 12V for half of the motors, VCC2 - also running at 12V - for the other half and 5V for the Raspberry Pi. The ARM coprocessor is supplied power through a traditional 3.3V linear regulator, from the 5V rail.

Diagram of the motor control circuit

The motors themselves are controlled by two power transistor drivers. We chose these instead of a more efficient H-Bridge MOSFET design as it massively reduces the board space required, we would have needed 16 TO-220 packages just for motor control and we wanted to keep the final robot as small as possible. The motor pins are broken out into a spring terminal, as with all other connections on this board that need to interface with external hardware. The drivers require flyback diodes on the output for preventing voltage spikes from destroying the ICs. We have also included LEDs for easy troubleshooting later on. In this same section is the transistor driver for the piezo buzzer used for error notifications and decoupling capacitors for each of the power rails.

Diagram of the breakout connectors

This section contains output terminals for a string of WS2812B LEDs, ultrasonic sensors (with the data pins going through a resistor divider to bring the signal levels down to safe voltages for the Pi - that’s 3.3V from 5V), breakout pins for the additional hardware from the ARM chip - we’ll probably end up using these for servo motors later. power lines and a hookup for an LCD screen if we decide to add one later.

Diagram of the ARM coprocessor circuitry

Here you can see the ARM coprocessor and its support hardware. There are two crystal oscillators feeding the clock generators for the chip and headers for firmware programming and mode selection along with a reset button and the linear regulator I mentioned earlier.

Diagram of the Raspberry Pi Connection Circuit

Finally, we get to the Raspberry Pi controlling everything. There’s not much interesting going on here, it’s just signals being routed away from the GPIO connector to the rest of the board. The NOWHERE lines are a bodge to stop a glitch with EAGLE’s board editor - as the name implies, they don’t actually go anywhere.

Next week, I’ll go through how we put all this circuitry onto a PCB and how that circuit board fits in with the rest of the hardware. We did order the boards months ago but they’re still stuck in international shipping limbo so I can’t show off the finished product yet. You can sign up for email alerts through the form at the bottom of any page (if you don’t see it, try disabling your ad-blocker - I’ve found it can interfere) to get our latest posts as soon as they are available or if you have an RSS reader installed, you can subscribe to our feed by adding the link here.

[Design drawings by Matthew Charlston © 2020 Leeds Raspberry Jam]

[Pi Wars quote taken from © Michael Horne & Tim Richardson]

Reticulating Splines...

Content writing in progress - we will update this eventually.