PiWars Robot Competition

Click here for details of the next Southend Raspberry Jam on 20th May 10am-5pm.

Raspberry Pi projects, Scratch by local Code Club members, Microbits, Robots, talks, Artificial Intelligence etc.

Southend Raspberry Jam entered the Piwars robot building competition in 2015.
Most of the people making the robot hadn’t built a robot before and we didn’t have many tools, equipment or much of a budget.
You can see how basic our robot is.
However, we came 17th out of 30 robots overall, came second in the straight line challenge and reached the semi-finals of PiNoon balloon popping challenge – See 3:20 below – and had a fantastic time learning about electronics and coding. See 6:07 where the amazing Triangular robot burst our balloon in less than 5 seconds and even when trying to surrender ended up killing our robot. Triangular has wheels which can travel in any direction.

Here are the team’s young people explaining how our robot works:

Here’s a general video about Piwars :


If you would like to learn how to build a robot, there will be robot building workshops at the next Raspberry Jam on the 20th August.
You will also see the Southend Raspberry Jam robot and other robots (including some of the Piwars competitors).

Advice for 2017 Piwars Competitors

We started off playing with different motors and batteries (and batteries in series) to see how different voltages changed the speed of the motors.
Next we used a multimeter to look at the voltage across the motors and the current flowing through the motors and how they varied when the motors were free running and fully stalled (stopped). This was useful to get a feel for how motors could be controlled and the levels of current flowing at different speeds without worrying about blowing up a connected Raspberry Pi or too much physics !
(Check out inductive loads and back emf if you want to know a bit more.)
It was also noted that the size of the motors, their current draw or rpm did not correlate as might have been expected.

It would have been extremely useful to have then built a simple robot using a ready made kit or some low current motors and something like an Explorer Phat. The Raspberry Pi could power the motors directly from 5V (check the Github link about sinking vs sourcing power) and there are 5V inputs for the ultrasonics. We could then start writing code without worrying too much about the hardware. Once we were happy, we could then look at the H bridge to make the motors go forwards and backwards using code.
Of course, the Raspberry Pi would need a good power supply or the top right rainbow square of low voltage might appear or the Pi reboot.

The Cam Jam Edukit 3 would have made a good next step with a 4 AA battery pack powering the motors rather than the Pi. From there, you could increase the power of the battery, use higher power motor controllers and faster motors as suited you best, knowing how the code and hardware worked.

We missed out the easy step(s) and went straight for really expensive and fast 2A motors. We came second in the straight line speed test, but control was hard. Imagine driving a Porche in first gear with Wellington Boots.
Within 2 seconds, the robot was doing 7 mph and skidding everywhere if it hadn’t crashed into a person or wall. A metal on/off safety switch was introduced and quickly covered with red tape when it started bouncing around and shorting things.

To power the motors, we needed to buy an expensive LiPo battery pack and carefully consider how long we could run the robot compared to the charging time. There are some fun videos on Youtube of exploding LiPo batteries, which didn’t comfort us knowing how often the robot crashed !
We also used the more powerful L298N dual H bridge motor controller which can supply a steady 2A current max.
The astute reader may wonder what happens when two 2A motors are powered by a single L298N motor controllers. You can hear about it in the explainer video above !!

Also, we needed to use thick wires to join the motors to the motor controllers to be able to carry all that current. We also doubled up as we used two L298Ns. That made connecting the wires quite hard.

In the real world, electronics don’t work perfectly. The two motors would travel at different speeds and we did have some smoke from one of the motors once. We adjusted the code to compensate for this difference.

As we didn’t have much money and we were often blowing things up, we put an Arduino between the Pi and some of the components to get better real time processing.

It was useful to have different layers of code which different abilities could code in. With a simple robot.forward() robot.left(), the underlying left/right compensation and a “maximum speed limit” was hidden from beginners who could make the robot move in a three point turn quite easily. At the lowest level, there was Pi to Arduino communication over serial. There is also now the GPIO Zero Python library which you may wish to look.

So in summary, we had a great time learning to build a robot and on the day taking part.
2017 competitors may not wish to use really powerful motors…. although whether you wish to believe a potential fellow competitor is up to you….

There are likely to be quite a few 2017 Piwars entries from Essex and given that we are doing the Mozfest workshop as well, there may well be a robotics competition/show and tell display at a future Southend or Chelmsford Raspberry Jam.