Front Sensor Mount and OpenCV

Now that we pretty much have the chassis sorted, well, the draft version of it anyway, it's time to start getting everything wired up and working. 

Pi Cam and OpenCV

The camera has been mounted for a while but not connected, so that's been sorted, as has a fresh installation of OpenCV, which I have to say was much less painful than the last time we set it up. There seemed to be an issue with the setup of the Raspberry Pi cam on our last setup and we always planned to start with a formatted SD card and fresh install of everything, so this was a good opportunity to sort that out too. I'm not sure what was wrong last time, but the Pi cam works perfectly on the new set up.

Sensor Mounting

Mounting of the front time of flight distance sensor was pretty simple, just a 3D printed bracket that mounts via the same mounting holes as the front bumper, just with a little added protection to prevent damage to the sensor in the event of a little bump. It's the sensors on the sides that needs a bit more thought, mainly as we want them low enough to get a good reading but without interfering with the steering mechanism. 

Pi Upgrade, Chassis Update and Flashy Lights

So, it's been a while since our last blog post, but that doesn't mean we've not been working away on our robot, far from it. 

We've done a lot of work on the body, including paint, decals and mounts for lighting. There's still quite a bit of work left to do in this area, but it's more than good enough for us to move on to other areas of the robot.

Pi Upgrade

Foolishly I managed to blow up the Pi we were going to use (A Pi 3 A+), absolutely 100% my fault and I ensured I was suitable chastised for the crime. But I don't have a direct replacement in my collection of Pi, so I have opted for a Pi 3B+. As it happens, I think the extra ram could make a bit of a difference, so it's turned out better in the end. As the mount for the Pi is an integral part of the chassis, I had to take the robot apart for the 43rd time and reassemble, we all know this wont be the last time. In fact, all of the acrylic sheet is going to be replaced at some point, so the entire robot is coming apart again at least once or twice. 

Chassis Update

One area that we identified as a possible issue was the front wheels, they are quite vulnerable, especially as we've gone with larger wheels for 2020. So We're experimenting with a front bumper with a small wrap-around to give a little protection for the front wheels. We are using the Pololu micrometal gear motors and we're already in the habit of destroying the little gearboxes, so thought it best to not increase the risk even further. 

Please excuse the wiring, it wont look like this in the future.

Flashy Lights

It wouldn't be a Pi Wars robot without flashy lights, right?

The only thing we can think of that's better than flashy lights at being flashy lights, is coloured flashy lights. So We ordered some 10mm RGB LEDs and set about building a light bar to sit atop our robot. We considered a few ways that we could control the four LEDs, with using the GPIO pins on the Pi not even considered as an option as this would hog far too many of the GPIO pins. One option was to use an off the shelf LED driver board, but I really felt it was better for us if I was to make something myself.

So the option we decided to go with was a 16-Channel I/O Expander, the MCP23017 in fact. This works via I2C, so no tying up GPIO pins and it has more than enough pins to drive the four RGB LEDs. 

I wanted the light bar itself to be as compact as possible, and the size we went with in the end meant that it was quite a squeeze in there (see below). There's a little hot melt glue in there, just to keep everything in place and prevent the connections from moving and shorting with each other, it's not pretty but with some silicone potting it will look a bit better.

So, whilst I'd like for it to have been a bit tidier, I am pleased to report that it works really well and besides you wont see the underneath when it's mounted anyway. 

Each colour of each LED can be controlled independently, so any LED can be any colour at any time and whilst this is hardly ground breaking, it still looks pretty.


On to the next task now.

We're Competing in Pi Wars 2020, It's official

So, it's that time of the year again, when we've been waiting on a decision from the Pi Wars organisers to find out if we get a place from the start or get added to the reserve list. 

Well, after being on the reserve list for the past two years, we now have a place from the start and we're delighted. 

Right, that's it for this post, we need to get on, we've got a robot to build.

Body Design and Body Mounts

The three of us have spent many hours this week planing and discussing the theme for our robot, in fact we spent most of yesterday evening discussing it.

We've taken into account the disaster movie theme for PiWars 2020 and we've tried very hard to not take what we feel are the obvious choices.

If you're reading this expecting us to reveal exactly what we've decided, then I'm sorry but you're going to be disappointed, we're not revealing too many details on that yet, at least not until we know we have a confirmed place in the competition. 

What we will say is, it should be very much in keeping with the disaster movie theme and it's already been printed from a heavily modified 3D model found on

Today, in addition to printing parts for the body itself, we've been playing around with where the body mounts and how all the other elements fit around it. 

Below is a photo of the mock up body mounts, which work for now, but still need quite a bit more adjustment before we make the final versions (note the scrap piece of acrylic being used as part of the body top mount). 

In this photo it looks a lot more top heavy than it really is, most of the weight is low down, so being a little taller than our previous robots has no negative effect on the handling, in fact I believe the COG is even lower than our 2019 robot.

The plan for tomorrow is code, code and even more code. We are pretty much starting from scratch with our code for 2020, in my opinion sometimes it's better to start with a totally clean slate than to re-hash and refresh old code.

"Any code of your own that you haven't looked at for six or more months might as well have been written by someone else." — Eagleson's law

It's alive, again.

Today we've been cutting, splicing and soldering parts of the old wiring loom, all with the intention of powering up the robot and to get it moving again.

We're going to build a brand new wiring loom once we've got everything in place and once we've fully decided on what power distribution boards we're going to use. I'm toying with the idea of designing our own PCB and getting a small batch made up by JLC PCB, but that's not very high on the list of priorities at the moment and I doubt this is something I'll pursue much further until we know whether or not we have a place in the competition (fingers crossed we get a place from the start this time). 

Anyway, here's the proof that we managed to successfully power up the robot via our makeshift loom, it's not pretty but it's more than good enough for the time being. 

What you probably can't see in this photo is the redesigned the battery box, this was done to enable the battery to be held securely in the centre of the robot where it's much less likely to get damaged (making sure we don't break *Rule zero) and to make it quick and easy to swap out the battery should it need replacing with a fully charged one in a hurry. 

Also the housing for the Raspberry Pi has been redesigned to make it stronger and we've moved a few things around to enable the Pi to sit centrally on the top plate.


*don't be on fire :)



Final locations of the boards, Maybe

I think we're nearly there with the mounting locations for each of the boards that we plan to use, all apart from the power distribution board, which we're looking at designing ourselves and getting a company like JLCPCB to make a small batch of them, watch this space. 

But back to the boards that we have already, it's been like one of those plastic picture puzzles where you slide each tile into the empty space in order to get each tile in the correct location to reveal your pretty picture. You put this one here, no, that wont work because of this one here and so on and so on.

However, I think we've pretty much got it now and we should soon be able to make a new top plate, which will tidy things up a lot.

Oh, and we finished designing and printing the mount/case for the Raspberry Pi 3 A+. It is now well protected, as are the GPIO pins, so the risk of accidentally shorting anything out is very low.


Build, Unbuild, Rebuild, Repeat

It's been too long since our last post, work and general life stuff has been demanding the lion's share of our time. 

But we have been doing robotics in-between, just not had the time to post here, anyway, enough of the waffle. 

If you've ever built a robot for Pi Wars then I am sure you'll be familiar with this scenario. You plan, measure at least once :), build, then change plans or location of a few components and before you know it you're back to a bench full of your robot in 100's of pieces. Well, that's where we've been for the past week or so. 

But all of this Build, Unbuild, Rebuild, Repeat has still been quite productive, even though you'd be forgiven for not thinking so if you saw the current state of the robot (below).

What isn't clearly visible here is the lower plate that supports the top section of the steering gears has been redesigned to tighten up the steering even further and to enable the entire battery tray to be removed and replaced very quickly. Although this of course means a redesign of the battery tray, but it's all in hand. 

The top plate is still a prototype one, hence the lovely collection of seemingly random holes and the fact that it's not straight, but again, it's all in hand. 

We've also changed the angle of the steering arm as this seems to give a more positive and more natural movement to it all, in reality it doesn't make much of a difference but it all helps to make for a better steering operation. 


Tightening Up The Steering Mechanism

Whilst we have been working on a number of areas of our robot, we've not got a huge amount to report at the moment. 

However, one area that I've been very keen to get on top of is the steering. In our 2019 Pi Wars robot we had about 2mm of slack in the steering components and whilst this didn't cause too much of an issue, it was one of the things that I really wanted to sort out but simply ran out of time before the competition started. 

So with time on my side at the moment (I know I'm going to regret saying that), I decided to tackle this niggling issue once and for all. 

The gears that I designed and printed have almost no play in them, so the only other area it could be was in the steering arm and servo horn. 

So the solution was to add nylock nuts to the steering arm connecting rod and to replace the plastic servo horn with an aluminium one. 

The servo mount is already a great deal more rigid than the one we made previously, so that along with the upgraded steering arm has resulted in a very precise and positive steering mechanism. 

Steering Mechanism Before

Steering Mechanism After

Planning The Layout Of The Boards

Today is mostly about trying to plan the layout of all the small boards that we'll be using, so lots of hot melt glue will be in use and lots of placing components only to find that they wont fit and then having to relocated them.

Attempt one of who knows how many can be seen below.

The target for today is to get everything fixed down, albeit temporarily fixed down with hot melt glue. Then knock up a quick battery box so we can hopefully get this moving under it's own power again.

Redesigning The Steering Mechanism

One of the trickiest parts to setup on our 2019 Pi Wars robot was the articulated steering, there are a lot of aspects to consider and very often if you adjust one aspect, it has a knock-on effect to rest of the steering components. It took a lot longer that I would have liked to get the steering dialed in, but we did manage to get it to a level that I was relatively happy with. So for 2020 we're not changing a lot in this area (if it aint broke etc), but there's always room for a little improvement.

We're sticking with the same size gears as we tried a number of different options before and these seemed to work out best for us, but we are moving the steering servo from the back to the front and now mounting it on same section as the wheels (the bogies?).

Relocating the steering servo has presented a few extra challenges though, it has altered the steering geometry and there seems to be a little extra play in it all, but we're hoping that the change in geometry will be sorted in the software tuning and the extra play will be solved with a redesigned servo mount.

When designing components, I always try to consider how these will effect neighbouring components and also consider if it's beneficial to integrate them in any way. By moving the servo mount to the front of the robot it makes sense to also use it as the front accessory mount too, that way accessories such as the Pi Noon adaptor or TOF sensors can be mounted and removed with ease.


Unfortunately the first servo mount I made for the 2020 robot was located in a way that seemed to allow the acrylic sheet to flex a little and it looks like this is where most of the extra play was, so the mount has been extended and reinforced in the hope that this tightens it all up.

Above is a picture of the 3D model and below is it being printed, in fact it's being printed as I write this.

We'll find out in a future post if this worked out or not.

 Update: It printed just fine and looks like it will work quite well.

 And here is it fitted into the prototype chassis.

It's solid now and has given a really firm base to fix all the front mounted accessories to.