Pi Wars 2015

Here’s a short video by Cambridge TV covering the competition

Video  December 5th 2015

26/11/15 – Final tinker time

 

IMAG0870

Major mod’s paying off

Our final week of tinkering is upon us!  During the past two weeks we’ve made good progress on fettling pi-thagoras to operate as a robust and efficient bot-beast.

All of our recent concerns about the gearing, weight and power of the bot build were all put in context when we ran a few test runs and final mods on the chassis and gearing.

IMAG0867

New gearing pinned and chassis mod’s

Eliminating an idler gear to improve torque only resulted in slippage, so we reverted back to original gearing on the Lego motors. This resulted in the need to make build mod’s but nothing the team (mainly Jay) couldn’t handle. You can see the swivel caster at the back – which is tipping the bot at an angle – thus causing some problems with the camera on line following. The camera shroud is very (front) heavy – but is a necessity to ensure we get accurate camera line sampling.

A few test runs confirmed that this chassis configuration is unstable ( we can wheely it!) so some more mods were required. This video shows the initial test run:

new build 17th – nov- close up from kevbrace on Vimeo.

A few of things to note here:

We’ve added the Lithium Polymer battery to power the 9V Lego motors – giving loads of torque. This new battery  and new switch, plus the revised gearing is giving us plenty of low end torque when trying out a simulated obstacle course. This gave us the boost (quite literally) we needed to keep on tinkering with the chassis. And you can see that we still has on the camera shroud used on the line follow test. So the ideal solution is to ensure we remove that and keep the ‘bot lean and customised for each of the challenges. This is where the Lego build will prove to be an advantage – we hope.

IMAG0869

The two batteries we are using to power the Pi and Lego motors

 

IMAG0868

The LiPo battery delivering 8.3 V

 

So the next challenge in our tinkering was to remove the camera shroud, change the gearing to give us speed, and modify the rear trailing wheel to give better stability and improve the level. So we combined all of this to run on a second test – sensor autonomous straight line test!

 

IMAG0873

Bot reconfigured.

Much much better over the obstacles!

This configuration is looking like our choice for most challenges – obviously with additions (shroud, plough, proximity sensor, etc) for each unique challenge – together with the ability to change motor gearing.

The image below illustrates the modifications plus our new LiPo battery switch. This ensures we can eliminate battery drain between challenges.

IMAG0880

The other test we had not yet tested with the new configuration was the autonomous straight line drive. Martin fired up his Python code and began a few test runs.

IMAG0875

This took quite a few attempts to ensure we had enough sensitivity set up to ensure the proximity sensors detected the wall, then sent the correct signal to the motor to steer it.

We did have some problems with this test concerning the connections to the H-Bridge module. Another modification we had on the list to fix – soon!

IMAG0874

Proximity sensor in place with LED to light the way.

So we’ve still got tinkering to do when we meet up for the final time next week – and Jay will no doubt have added some cool LED bling.  We’re happy with the results and team effort that’s got us to Pi Wars.

Thanks must got to:

  • Claire & Rich & Rich  for fantastic line following code & management of version control
  • Martin for the vision, drive, and endless hours of coding and Lego tweaking
  • Jay & Jon for some amazing Pi-thagoras designs & use of their work space + Lego stash
  • John for his extensive battery powered knowledge
  • John for ideas on build and challenges
  • Mike for his soldering skills and general assistance
  • All of the Slice of Pi Club that helped us along the way.

We also had time to run some tests with our other bots we’re building at the some time using “standard” kits and the newly released CamJam edukit #3 robot kit.

IMAG0865

IMAG0876

IMAG0878

Final post will be after the competition on Saturday Dec’ 5th. Wish us well, and join us in 2016 for some master classes on the basics of bot building in Redditch and Bromsgrove.

14/11/15 – build update

Last Tuesday most of the core Jammers met up to continue the fettling. This is how we’re are progressing.

The Untrasonic sensor is in place with new connectivity.  Martin had established that we needed to set the sensor back a few centimetres from the front of the chassis to ensure maximum efficiency.  The photos below show the developments of the sensor.

utrasonics IMG_20151016_205851 WP_20151018_14_17_56_Pro

 

Other important developments included:

Claire managing to “tidy up” the code repository to ensure we submitted it to the judges by 14th. They’ve created code branches (in GitHub) to  decide which versions works best. Martin had managed to replicate the problem witnessed a couple of weeks ago –  of ambient (strip lighting) causing havoc with the line follow code. Hence the need for a new light hood over the new bright LED strip illuminating the floor.

Bot build-wise, there was some “re configuring” going on (see  photo below) to recover from a drop, and to change back the gearing to original spec’.  We’re now getting slightly concerned at the inability of our 9V Lego motors to overcome relatively small obstacles. Weight of Lego is to blame!   We’re also working on other back up bots (see previous week) to try out much simpler chassis designs against our Lego design.

 

Can we have a-build!
Can we have a re-build!

We think that John’s LiPo battery (discussed last week) is going to power Pi-thagoras.  Mike is investigating the addition of a switch on the motor/LED battery pack to give us more control, and prevent it draining when not in use. And, discussions of a smaller, lighter temperature sensor for Martin’s ultrasonics?

We now have some more spare USB battery packs thanks to Claire’s colleagues at Wider Plan Ltd lending them to the fighting cause, so there should be plenty available on the day to keep us rolling.

07/11/15

 

IMAG0858

Pi-thagoras gets a new LED protector hat

 

This week (Tuesday 3rd) we had a swiftly arranged Raspberry Jam meet up in Redditch. The plan is now to try and meet up once a week to ensure we’re competition ready!  This week’s meet was hasitly arranged but proved to be just what we needed to get us back on track.  Jon & Jay Rixon had been fixing some of the problems with the build experienced last week (pinning gearing), whilst Claire & Richard had been further refining their line following code. So we all met up at HoW College to bring all this together.

 

IMAG0855

Line following fully working

 

 

Jon also joined us to talk motors and LiPo battery options.  Note to self – don’t flail around with live battery terminals waiting to short out a battery! John informed me that he normally keeps that LiPo battery in an old army ammo box – just for safety! We had been wholly unaware if the need to be a tad more careful around this new technology!  Anyhoo – lesson learned, back to the build.

 

new build

Pi-thagoras in full working order

The night was a real success with Jay’s new chassis mods, and Claire & Richards new code resulting in a perfect line follow by the end of the night. The video below demonstrates a sampling rate of 60 frames per second level of accuracy and processing time – over a mobile wifi hotspot.

 

IMAG0856

close up of the LED cover to ensure the camera can “see” the line 

You can also see a new LED light hood placed over the front of pi-thagoras. This helped the camera differentiate between line and paper more effectively. No more reversing (better error checking in the code) we witnessed last week. We did not use a camera flash whilst in motion to help eliminate the “flash crash”  problem last week.  So the combination of removing flash cameras, better error checks in the code, a tiny LED hood, plus refined code = success. Now the challenge is to ramp up the sampling rate from 60 fps to 90fps!  There was even talk of cloud based processing to boot! No doubt Claire and Richard are tweaking the code as we speak.

 

 

new bot

New bot build

Alongside these developments, Kevin, and Jon completed a new robot build by using an off the shelf (£10:00) ebay kit, a Pi given to me, Raspbian OS, the original 4tronix  H bridge motor controller and the motion code from the 4 tronix site we’re using on our Pi-thagoras bot. So with about 45 mins build, and 45 mins connecting + tinker time = new bot :OD

Martin helped us get this set up:

wget http://4tronix.co.uk/picocon.sh -O picocon.sh

bash picocon.sh

Then run this from the directory:

sudo python picoTest01.py

We’ve decided to build a new bot in parallel with Pi-thagoras to prove concepts and prepare for some club masterclasses next year.  All  went to plan connected to the power – with 6V driving the pair of motors.  Next time we’re going to try out the LiPo battery without blowing anything up!

 

 

 

27/10/15 – Pi-thagoras bot build update

 

This 1/2 term week we met up with a core of Jammers building and coding to help move us ermm, move forward on the build!  Jay & John Rixon were keen to get the new ‘bot design up and running. Jay demonstrated her new design based upon previous meetings plans. She had cleverly designed modular additions to cope with the different competition challenges.

Listed below is the development of the build this week. Jay had also added a new gearing ratio to each of the Lego Technics 9v motors to give a smoother run.  The evening progressed by moving the PiCamera Noir to the new pi and retrying the line follow code.

During the previous week Richard and Claire had refined their line follow code .

 

IMAG0822

New chassis & pi mounting

IMAG0823

IMAG0842

Martin, John and Jay busy building and coding in unison.

 

IMAG0824

Modular additions (shove ball)

 

IMAG0825 IMAG0826 IMAG0827
IMAG0834

IMAG0835

New sensor hack in place
IMAG0836

IMAG0837

New H bridge motor controller in place

After running through a few options Claire came up with the new name of Pi-thagoras for our Lego based ‘bot.

During the course of testing we ran into a few problems with motor directions, and re-calibration of the camera. Needless to say, we were still tinkering by the end of the night; with the following jobs needed to be covered:

  1. second chassis needed building to work on projects in parallel,
  2. sort out gear slippage on 9V lego motors,
  3. re-calibration of camera on new chassis
  4. test out Lithium Polymer battery on bot

During the course of the eveing John Holmes demonstrated his home made remote car which had a smooth DC motor powered by that LiPo battery.

Also on the same night John Cartmell ran his Lego Mindstorms ‘bot to demonstrate the various functions we were trying to replicate.

By the end of the night we had tried (and failed) to replicate the line following success demonstrated previously. You can just see the new blue LED light strip that had been added to illuminate the line. This helped the camera differentiate between white & black more efficiently.

 

IMAG0849

 

Richard and Claire had even reconstructed in 1:1 scale the course from last year to test the new code. So you can see our classic three wheeled bot in action, with batteries powering the Pi and 2 X 9v batteries powering the Lego motors. Jay had also added a new rubber trailer wheel to add better traction. During the course of the evening the design of the Lego chassis was continually evolving and being refined after each line follow test.

 

IMAG0848

 

We’ve also decided to use a wireless keyboard to remotely control Pi-thagoras, which we also tested multiple times that night trying to sort out our reverse motor problems that evening.

This video summed up where we are at by the end of the night. We had changed quite a few parameters (new chassis, new gearing) so it was not surprising that we ran out of time to get the line following code to work as expected.

 

Work in progress.

20/10/15 – Bot build competition update

Cambridge Computer Lab’

Yesterday we got the news we were hoping for. Namely:

“One of our teams has dropped out from the competition, leaving us with a space to be filled. Would you guys and your club like to step up and out from your Show and Tell to become full-on competitors?”

Of course we said yes. So the comp’ is now properly on.

Weeks 4-5 of our ‘bot build – 13-16/10/15

 

 

bot
‘Legbot taking shape

Now we’re into our second meeting, things are moving on apace.

This week the Bromsgrove/Redditch Raspberry Jam crew met up and continued the build, by working on sub-tasks decided last meeting. Due to time constraints we’re meeting every two weeks.

I updated everyone with news from Mike Horne (of PiWars) of details of the competition day on Dec’ 5th – and URL of the list of challenges on the day to remind us all what we’re in for.  Research of other teams revealed some tantalising YouTube tasters – to see what we’re up against.

Then to ‘bot update (we really need a name!).  I’ll call her Legbot’ (with a silent T) for now :o/…

Last week Mike B soldered us a new H Bridge board to allow for access to more of the GPIO pins. That was already sited on Legbot, and Martin had been adding the distance sensor to try it out. We were given a demo’ – which worked perfectly. Martin had some rejigging of the  sensor place – to ensure optimum operation during trials.

 

New H-Bridge IC
New H-Bridge IC

 

 

sensor bot from kevbrace on Vimeo.

New sensor working by Martin Eyre

Jay Rixon had already begun designing  some of the finer details of Legbot using Lego 3D software, and was joined later in the night by Alex B, crafting some 3D rendered ideas.  Next week we’ll have a few buckets worth of Lego to begin our second model – built to these new plans.

 

Lego 3D plans
Lego 3D plans

IMAG0821

 

Jon had also bought along one of his Lego Mindstorms working robots to give us some inspiration regarding the line following, size of wheels/clearance and the “push ball” idea for one of the specific competition rounds. All grist to the mill.

 

Lego Mindstorm bot
Lego Mindstorm bot
A Mindstorm
A Mindstorm

 

But most of the night concentrated on Rich and Claire who had 99% completed the line following program in Python. They had used a test RPi camera on a test chassis. In tests it had worked well, now was time to put their code onto Legbot and try it out for real. The program sampled the black line multiple times per second and used arrays and error correction to check what was white or black, then drive the wheels accordingly. Neat programming and a solid idea built upon the previous session C# real time demo. These next set of photos show the camera on the test chassis, then placed onto Legbot. Martin used an old Mindstorms placemat to follow a line.

first of all – the test without a bot to control

PiCamera line follow

 

 

IMAG0794 IMAG0795 IMAG0796 IMAG0797

 

Deep breath – time to test! IMAG0798

 

Kinda nearly working! But just not quite there!

IMAG0808

A few tweaks and recalibration of the camera, then a second set of tweaks.

Then….

IMAG0809

Success. Yes, by the end of the night Rich & Claire had proved their code and it worked a treat. Legbot followed a line by using the camera to continually sample the image underneath it – and send error corrections to the motor wheels to keep it on track. OMG. Clever people that there team at Redland Solutions.  Claire had used Bitbucket to host the code and GitHub to manage revisions, etc…

Legbot with PiCamera
Legbot with PiCamera + sensor

Meanwhile, John & I were trying out Weaved IoT and webioPi to try and remotely control the Pi. This was a proof of concept to test the latency of the signal using a proxied web service to control to Pi from anywhere. I was inspired to try this by reading a recent MagPi article.  By the end of the night John had managed to get it working for us. We tested it out using a Pibrella HAT. It worked, but I”m not sure if it’s a real solution to remote control.  Maybe more of a tool to change channels of radio or turn your watering system or central heating on from work, etc…

Pibrella controlled by Weaved IoT
Pibrella controlled by Weaved IoT
Weaved IoT + WebiopI - IOs app.
Weaved IoT + WebioPi – IOs app run from an iPad.

 

Other discussions during the night focused on the longevity of the battery. We were given this to try – which we’ll talk more of next time.

 

9v battery
9v battery

 

By October 16th Rich & Claire had out some more work into the camera line following program. This video shows the results:

 

And also by the end of the same day Jay had begun building Legbot to plans. This is her progress below:

Legbot takes shape
Legbot 2.0 takes shape

IMG_2226 IMG_2227

 

Pi wars 2015 logo
Pi wars 2015 logo

After a summer hiatus we reconvened our Raspberry Jam to learn that Martin Eyre had entered us into the next Pi Wars competition!  So we met at our new venue in Redditch – many thanks to Jay Rixon & John from Lansalot for giving us a new home. We decided back at the end of the summer to alter the format from our initial “demo/lecture” evening to more of a project/hands on format. And so the Pi Wars challenge will provide exactly that format to focus on multiple wheeled robot related projects – throughout the coming months. We’re hoping to be able to construct something like the bot below (but in Lego).

RPi Bot – Linux User Mag’

Other typical robot kits are available:

Get some more inspiration from:

 

We're all ears
We’re all ears

So there we were on Tuesday September 29th getting the full SP from Martin about the “rules” of Pi Wars. It was great to meet up with familiar faces who had joined us regularly during our inception earlier this year.  Martin lead the evening by firstly demonstrating his new bot that was the start of our entry into the Pi Wars comp’. Well we’ve been accepted into the show & tell part – not the actual competition! But we’re working on the premise that we just may get lucky & get  the call! In any case we’re planning to organise a couple of cars to attend the event in Cambridge to give our (Lego based) bot a full workout – and be able to “show & tell.”

testing out the code
testing out the code

For those of you who need to know more about Pi Wars – “it is a challenge-based robotics competition in which Raspberry Pi-controlled robots are created by teams and then compete in various challenges to earn points.

Martin plugging in the bot
Martin plugging in the bot

So, obviously – being Pi aficionados, we had to give it a go!  The problem is not lack of enthusiasm, knowledge or skill – in our group; but a distinct shortage of time. The competition is Saturday December 5th! So our first meeting of the autumn covered everything we needed to know about building a bot capable of competing in the range of challenges (remote control, obstacles, speed run, autonomous driving, etc, etc..). We reviewed the work that Martin and Rich had done, then got down to business of splitting up tasks and . More of that further down the page.

So first Martin gave a short demo’ his experimental bot.  Lego had been the chosen for the chassis and addons , as Martin had plenty ( and so had other group members it transpires).

prototype lego bot
prototype Lego bot

IMAG0767

Martin & I had some prior knowledge of last year’s range of obstacles by reviewing YouTube vid’s. This inevitably dictated the style of bot suitable to compete in a wide range of remote controlled and autonomous challenges. That is;

  • Two DC motors driving the main large wheels
  • H Bridge IC to control the directions of the two DC motors driving each wheel
  • Existing and new Python libraries controlling the wheels
  • A third trailing wheel / castor to provide stability
  • Lego construction (ease of build – but heavy)
  • standard RPi camera module (lightweight, and compatibility)
  • Blue tooth keyboard as a possible remote control option

Most of the above was discussed in depth, including the construction of the H Bridge control board by Martin.

proving the prototype
proving the prototype

So we debated the design of the bot, and all agreed that we would stick with Lego and the 3 wheeled format. But a sub team would meet up on Tuesday Oct’ 13th to finesse the aesthetics. A decision was made to build two identical chassis – in case of catastrophic failures, and help with failures/problem solving. We cold then easily swap modules across between the two bots.

Rally the troops
Rally the troops

Martin also went into detail bout the construction and operation of the H Bridge controller board. This helped explain the need for two DC motors, and associated mobile battery packs to be able to drive each wheel independently via Python and keyboard commands. I had experimented with a simplified Lego car and Pibrella board to drive a single motor – driving a rear axle, but had learned of the inability to drive a DC motor in reverse using either Scratch or Python via the Pibrella. The need to operate each driving wheel independently and in reverse is paramount for ultimate maneuverability in most of the Pi Wars challenges.

H Bridge schematic
H Bridge schematic
H Bridge home made board
H Bridge home made board
much discussion about the build
much discussion about the build

As we got into the details of some challenges we debated some of the known/proven methods of controlling a three wheeled bot – including the line follow challenge. Martin and his work colleague Rich J, had already been working out a logic for getting a camera to scan a line and process the image in real time to be able to turn wheels. Rich had coded an example of the idea to demonstrate the theory in action. This had been done on C# – and it worked a treat. I’ll blog more about this innovative method next time – when I get some facts. Needless to say it worked and was impressive. See the video below.

line following
line following

This video displays the program sampling the line and then altering the path of the car in real time.

line-follow from kevbrace on Vimeo.

After discussing the challenges and bot build, etc we split up the tasks, and even began to experiment with different Pi camera modules (Rich & Claire).

Pi Camera tests
Pi Camera tests

When coding new Python scripts and creating libraries we decided to use version 2.7 of Python and GitHub to manage and distribute code.

The tasks we split between group members are:

  1. Blogging: Kevin Brace (me) and Jay Rixon
  2. Camera: Rich J, Rich G, Claire G
  3. Bot build/design/aesthetic: John C, Andy W + Olly, Jay Rixon, Alex B,  Sue
  4. Research: Johnathan D
  5. Batteries: John H
  6. Github: Claire G
  7. Remote control: Kevin Brace
  8. Soldering new H Bridge: Mike B

So we all left the evening fired up ready to take on Pi Wars. We’re meeting every two weeks until the competition to get things Erm moving.

Bromsgrove Raspberry Jammers. September 29th 2015.
Bromsgrove Raspberry Jammers. September 29th 2015.

Finally; Martin shared a vid’ on Tuesday October 6th of the prototype scuttling around. More of this when we discuss progress next week.

prototype bot from kevbrace on Vimeo.

Pi Wars blog post #1 – October 2015. Kevin Brace.