Sunday, 30 August 2015

All aboard! - First controlled run

With the distraction of the Sense HAT put to one side I've returned focus to getting OptimusPi moving in a controlled manner. I've previously done a quick test of the motors with a PS3 controller physically connected to the Raspberry Pi, but of course that limits how far the robot can actually move, so its time to switch over to wireless.

As I'm trying to avoid having a USB Hub on the robot, trying to keep things compact, I'm using a 'Lindy USB Bluetooth & HS WLAN 11n Combo Adapter' that allows the single USB port on the Raspberry Pi A+ to provided both wireless and Bluetooth connectivity. Then its just a case of following the setup guide from an old MagPi article, strapping everything to the chassis and connecting the power.
To keep on top of these various steps I also made sure to update the README with install instructions, just in case I get a corrupted SD card and need to reinstall from scratch.

Its a bit messy, but it works.

With everything powered up its just a case of SSHing into the Raspberry Pi, running the MotorTest script from earlier and going for a little drive!


So a successful first test drive with only 2 real problems. Firstly I've still not fixed in the PVC pipes, so they move when turning, and secondly the motor driver doesn't go backwards on one side, making the turns a little cumbersome. I've checked the software, read the datasheet, examined the hardware and replaced the motor driver but with no improvement. Reading around it seems some of the more cheaply produced versions of this motor board can be unreliable, so to avoid wasting too much more time I've now ordered a completely different motor driver.

Leo


We interrupt this blog - Sense HAT released

This week I've been slightly distracted by the launch of the RaspberryPi Sense HAT. This little board contains a pressure, humidity, temperature and 9 DoF Gyroscope/accelerometer combo, as well as a 8x8 LED matrix and a mini joystick. What does this mean for my PiWars entry? Well it means I don't have to solder up the separate sensors and lights I was planning on putting on my robot, and can instead just drop on the Sense HAT itself, which makes things considerable easier. Of course the downside is that its just as easy for any of the other competitors to add a Sense HAT, which means I need to find more to add for the 'most featured robot' challenge!

Everything on the left is included in the board on the right.

Another bonus is that the Sense HAT comes with libraries to access all the sensors easily, and a quick python script quickly gets information out and display it on the LED matrix. So it only took a few minutes to get a python script running to output information from the cursor keys (It took longer to get the video!).In theory the joystick should trigger it as well, but I haven't gotten that quite working yet.


Of course the plan this year is to have a C/C++ based set of code, instead of a python script, so still need to investigate how to get at the information a bit more directly. But that's a future issue, for now its back to getting the robot itself driving around..

Leo

Tuesday, 25 August 2015

Coding, Coding, Coding - The Software

Let the coding commence!

With the motor controller wired up and (mostly) working its time to start on the software, as without that the robot isn't going to be moving far, and to allow you to follow on with development I've created a new Git repository at https://github.com/LeoWhite/OptimusPi
The motor driver haphazardly connected to the chassis.

To being with I've just taken some of the source code I used last year (The Arduino source and a cut down python test script), cut out the unused functionality and updated it to support the 'Monster Moto Shield' instead of the T'Rex controller. With a bit of fiddling I'm now able to drive the motors using a PS3 controller.




Obviously this is just an initial test and its going to take a lot more work to get the robot driving around autonomously (I can already see the watchdog firing on the Arduino.. an issue I had last year too), but its a good starting point!

Leo

Wednesday, 19 August 2015

New motor controller

The parts have arrived for the primary motor controller. I've gone with a 'Monster Moto Shield' (which has dual VNH2SP30 chips on it) and, for ease of integration, an AdaFruit Metro Arduino board to plug it into.This board allows a current draw of upto 30A which, in theory, is way more than I actually need. Although as I'm pretty certain I burnt out a motor board last year when the wheels locked up I'm happy to have the extra over head.

The shield + arduino is considerably smaller than the motor driver I've been testing with, being a little smaller than the Raspberry Pi A+ itself.  I still need to work out where to mount it... I could have it above/below the Raspberry Pi, or mounted on the bottom of the chassis...


Ideally I'd have preferred a self contained motor board that supported i2c, but struggled to find one that could handle the high current required. The PicoBorg reverse (Which I already have) is rated a little too low for safety (5A when the motors stall at 6.5A) and the Diablo board would be overkill (and is out of stock). Hopefully this Arduino board won't keep locking up in the i2c code like the one I used last year did, which left  my robot driving around in a circle in the middle of the obstacle course challenge until the hardware watchdog kicked in!

Next steps will be mounting the new motor driver and then starting on the software.

Leo

Monday, 17 August 2015

Moving on out - Driving the motors

With the basic chassis complete-ish the next task was to get it moving around so I can see if it actually works. The first step was to wire up the motors themselves, and for this I used a 15A rated figure 8 cable. Whilst this is overkill for the motors themselves (they have a 6.5A stall current) I would be connecting two motors on each side of the motor driver board, and its easier to use the same cable throughout instead of mixing and matching. As the back of the motors get a little close together I used a couple of pieces of heat shrink wrapping to cover the contacts to prevent shorts.

As this was only a test, instead of the final design, I left the leads quite long on the motors so I could cut them to fit later on. This should be easier than trying to remove the wires and solder on new ones in the future!
Having gotten rid of the large all-terrain tyres I was able extend the length of the pipes I was using to hold the motors, drilling a hole in the middle for the cables to come out of. To ensure the motors fitted better this time around I wrapped a strip of rubber around each one. This, combined with putting 4 notches in the end of the pipe instead of 2, gave a much firmer fit once the clamps were tightened.


For this test I laid the rest of the components out in a line. The motor driver on the front, Raspberry Pi in the middle and the battery on the end. The motor driver was one I got last year off ebay and, whilst a little large, is the only one I currently have that is rated for the motors. The battery and UBEC I'm re-using from one of my BigTraks.
Using a couple of terminal blocks, and several cable ties, I was able to wire everything up. I did start looking at installing software and a python script on the Raspberry Pi to do some basic controls, but ended up connecting the motor driver directly to the 5V power rail, which should in theory cause it to drive forwards and full speed.


With everything connected up, and checked several times, I powered up the Raspberry Pi and (after making sure the wheels weren't touching the ground) connected up  the motor driver board. At this point the left hand set of motors burst into life, but the right hand side didn't move. I'd already checked that all four motors worked before installing them, so I knew it wasn't that, so I spent a bit of time checking connections but was unable to spot any issues, meaning its probable the motor driver at fault.

As it was getting late I decided to leave things as they were for now and see how things looked driving around. I was happy to see that the motors were being held in place and the pipe itself didn't end up turning. With the unbalanced power (only the left motors working) the pipes themselves did get pushed to one side, but I was pretty much expecting that to happen. A holding screw would deal with that, but there seemed little pointing adding it to this prototype.

video

So overall it was a successful run, with several known limitations. I've got a slightly more compact (and powerful) motor driver turning up this week, and once that's here I can start thinking about the software side of things.
As for the hardware, I still need to work out the best way of setting things up as there needs to be a clear space at the front for adding sensors and other challenge related components. My initial scribblings have the Raspberry Pi being raised and the battery installed underneath it.  I'm also considering mounting the motor driver and battery underneath, but I need to ensure I have sufficient ground clearance for the obstacle course... So still plenty of things to try out and test before finalizing the chassis design.

Leo

Monday, 10 August 2015

Lets get physical! - Hardware prototyping



Yesterday I started putting together the first hardware prototype of my robot. Starting from a piece of plywood I marked it up and cut it based on the whiteboard scribbling I had done last month, before drilling a couple of holes for mounting the motors on.



To hold the motors in place I'm currently using some plastic piping and butterfly hose clips to squeeze it tight. The pipe is larger than my current motors (32mm vs 25mm) and the idea was to allow easy switching between different sized motors. However it doesn't look like the pipe is gripping the motors sufficiently enough to stop them moving when underway. I'll have to play with this a bit more.. Maybe taking another cut out of the pipe will help (so its in quarters), or I'll just have to switch to a smaller pipe. Its not as if I currently have any larger motors!


Next I tried attaching my large, all terrain wheels, which is where the first problem cropped up.
Whilst the chassis and wheels should, in theory, fit inside the A4 size restriction, in practise they don't. The issue here is the length of the motors plus wheel mounts. For these large wheels to fit they need to be positioned so they are almost touching the chassis itself and, unfortunately, the length of the motors preclude this.





Flipping the wheels so the connector goes inside the tyre might work, but the hubs only connect one way round on this make, so that's not possible. In theory I could offset the wheels or add some sort of 90 degree adaptor to the motor shaft, but that would add extra complexity and more things to go wrong. I always thought it would be a tight squeeze to get the all-terrain wheels on, so like last year I'll just have to drop them and go with something a little smaller. This should mean that I can make the main part of the chassis a little wider, but I'll test my other wheels first before cutting up any more wood!

Leo


Sunday, 9 August 2015

Pre-planning - There's so much to do





Whilst waiting to hear if I had been selected as one of the competitors for PiWars 2015 I did start some initial planning by scribbling all over a white board.

First I started with a list of all the challenges, trying to work out what components would be required to enter the challenge, as well as any that would improve my chance of winning the challenge (Such as faster motors for the speed test).

As I'm targeting the A4 size category I started to sketch out on the board the max size I had to work with, and started seeing how much space I'd have left after taking tyres, the RPi and battery into account. If I want to be able to use my largest wheels... well there isn't much space left.

Finally I sketched out some of the software modules needed to pull everything together.... That started to add up to quite a lot too!
But with my initial thoughts down I can start to refine them, deciding which ones are really needed, which should be done first and so on.

The initial focus will be, as always, getting the basic chassis and manual controls working.  Then with a good base to work on add the extra components required for the autonomous challenges, and then finally adding the flashy LEDs and other extras!  Assuming I have enough time to get that far!

Leo

Friday, 7 August 2015

It begins! The road to PiWars 2015

Hi all!

Welcome to my shiny new blog thingie...

I'm Leo White, a software developer and hacker of toy robots, and this blog will track my progress towards PiWars 2015 that is being held December 5th in Cambridge.  So that gives me just over 3 months to design, build and get running a (hopefully) competition winning robot!

Last year I was a competitor in PiWars 2014 with my Pirate Ship/Robot 'BiggerTrak' which was built around a Wild Thumper chassis and won the 'Best Remote-Controlled Robot' category. This year the plan is to build the robot from scratch.. which will be a bit more of a challenge!
'BiggerTrak' from PiWars 2014

So join me for the next few months as I track the highs, lows and potential destruction of my PiWars 2015 entry 'Optimus Pi'!


Leo