Weapons of mass distraction.

While I’ve had the last few months to freak out about having no motors and therefore essentially no bot, I’ve had plenty of time to try and distract myself and design and build a range of add ons to cope with some fairly stiff challenges in this year’s competition.

I built a 4-way sensor rig from standard ultrasonic sensors. The wiring is pretty um… intense, but it does work and reads distance in all directions. I’ll be using this for the straight line speed test and the maze.

The wiring maze begins…..

IMG_6632

All wired up….

IMG_6651

I’ve also got a mount for the line sensors sorted and the code working nicely for that (fingers crossed this works on the day!). I’ve also got a simple holder for the golf challenge, although I suspect there may be far sneakier / trickier hazards than this will cope with! :/ The one on the left is the clamp for Pi Noon… Looking forward to that one.

IMG_6676

Skittles was great fun last year, and my ‘ball cannon’ worked well enough, sadly my driving let me down and I knocked the ball away from the bot and fluffed a shot. The ‘collect the ball’ component of the challenge has forced me to come up with something to avoid this completely this time round.

IMG_6678

The simple arm / servo arrangement should prevent the ball rolling away, and the spring in the tube has enough kick to give the ball a good whack!

Armed and (slightly) dangerous…

IMG_6471

I’ve got the bot driving properly and the mecanum wheels are performing really well – such a relief at this point. I’m now (slowly) working on the autonomous challenges and rapidly running out of time. Going to be a frantic dash to the finish line. I reckon I’ll get there :-)

I’ve got a bot that can compete and even with all the difficulties I faced, I’ve learnt so much again through the the build and it’s been really fantastic to be involved in Pi Wars again. I love the social camaraderie, particularly on Twitter. Very much looking forward to seeing old faces and new next weekend.

I’ll be there for both days, do come and say hello. I’ll be the one with the panicked look cos his bot just * shot out the door / took out a small child / knee-capped Eben Upton (*delete as applicable)

See you all next weekend!

Until then…

Read More

Motor Woes – Part Deux

It never rains…..

I have not as yet managed to assemble a complete set of four matching motors in the six months I’ve been in preparation for this competition. Unreal.

And, with 10 days to go, I managed to strip two of the gear boxes on the motors I have. I took them apart and discovered that the gears in my ‘metal gear motors’ were in fact…  plastic. Seriously? – After how long it took me to find them?

Something’s definitely not right…

Ok… DefCon 1 level panic time. Some great suggestions on Twitter (thanks folks!) and some fleabay scouring actually brought these beauties to my attention thankfully pretty quickly…

IMG_6657

Not cheap, but sooooo pleased I found these, 24hrs ago I was pretty much dead in the water.

These motors are 12v and I have been running at 9v. I’ve stepped it up to 10.5v which is the maximum voltage the Zeroborg controller I am using can handle. They are nice and torque-y and are rated at 500rpm, I reckon I am getting 430rpm (ish) at the voltage I am using.

Although I built the motor mounts to be removable it still required a complete strip down of the chassis to remove and replace all four motors (again).

IMG_6661

I’ve 3D printed a fake AA battery and run a wire through it so I can use an 8 cell holder with only 7 cells in it to give me the required 10.5v

Works a treat!…

IMG_6659

I’ve also removed and replaced the rollers for the ninetiteenth time. This time to add some thread lock. The wheels do put some fairly significant forces through the rollers and they’ve had a tendancy to spit bolts on the odd occasion so I took the opportunity to tighten everything up.

IMG_6662

Anyhoo. Another 48hrs flies by, and I have rarely been so grateful to be back where I was two days ago. Onwards – I still have a ridiculous amount to do. At least now I have four matching motors!

I’ll hopefully get time for one more post where I’ll do a quick overview of my wild and frankly heath-robinsonian attachments for some of the challenges.

Until then….

 

Read More

My Achilles Wheel…

As I’ve previously mentioned my last Pi Wars bot was rudimentary to say the least. This time I wanted something that would push my skills further and also result in a better designed / built bot. There’s nothing like jumping in at the deep end so when I got my hands on the 3D printer last year, I had an idea. A mad, stupid, almost impossibly, ridiculously complex idea but hey – this is Pi Wars, right? I’ve kept this largely under my hat during the development of these as I honestly wasn’t sure I could get them to work…

MECANUM WHEELS!!

IMG_6233

So, I saw PiBorg and their mecanum wheeled robot at a couple of events and pretty much fell in love. This combined with witnessing the performance of the omni-directional bots last time was enough to convince me to attempt to do something similar. I looked around and found prices for mecanum wheels to be more than a little eye-watering and therefore decided to see if I could 3D print some. It became pretty clear, pretty quickly, to be honest that the full design is waaaaay beyond my capabilities so I adapted an original set I found on Thingiverse which were just so freakin’ cool.

The first frame appears on the printer…..

IMG_5271

They were designed for Lego motors originally so I adapted the hubs to work with Pololu 4mm hubs and gear motors. I also reconfigured the roller attachment to work with M3 bolts, rather than Lego axles.

Roller up…. Roller up.

Each frame takes around 7hrs to print at 0.2mm resolution – fortunately all four printed first time with no errors.

And now the fun really begins…. 4 Wheels. 8 rollers per wheel, 2 bolts per roller.

I’d originally intended to print in NinjaFlex – a really cool rubbery 3D printing filament but sadly it turned out my printer couldn’t use this so I had to get creative.

Printing the basic rollers….

IMG_5917

(Each roller takes 19 minutes to print)

I can print in PLA or ABS, both of which are basically solid plastic and therefore completely unsuitable to be used as rollers as they have no grip at all. So – a covering was required. To quote myself and many other Pi Wars contestants – ‘How hard can that be?’

As it turns out, very. Annoyingly, swearingly difficult actually. I have now tried and tested seven types of covering. That’s all 32 rollers removed, coated, replaced, tested. Often twice – just to be certain.

Hanging ’em out to dry….

IMG_6149

The list of what didn’t work includes…

  1. Balloons
  2. Heatshrink – thought this was guaranteed but failed completely!
  3. Rubber Cement – cracking idea from Graeme C. – sadly it peeled right off.
  4. Latex – dipping each roller many, many times to build up the layers. Very weird stuff – and ripped straight off.
  5. Grip Tape – stuff skateboarders use. Useless, wouldn’t adhere to rollers at all.
  6. PlastiDip – rubber coating stuff. Took ages, cost a fortune. And ripped off, again.

It can be seen from the above that coating and grippiness wasn’t an issue, durability was. So, as I was about to throw in the towel, Mark from Astro Designs came up with idea number seven…

7. Self Amalgamating Tape – aka plumbers tape.

And….. we have a winner!

IMG_6231

Here’re are the rollers wrapped with tape and ready for testing. It had become a proper love hate relationship with these damn wheels by this point in the process.

Thankfully, I think we’re looking good. Whilst the bot is ridiculously ‘slidey’ the wheels do actually work.

I conservatively estimate I have spent 100+ hours on the wheels alone so I am thrilled that I have a bot with ‘proper’ mecanum wheels. Whether this offers any advantage in the competition remains to be seen!

IMG_6236

The tape offers enough grip to get the bot to move and it’s durable enough not to tear straight off. It’s a complete riot to try and drive the thing however. It may yet be christened ‘Uncontrollabot’ !

It has of course made autonomous driving and the associated challenges much, much harder than they may well have been. But hey, we’ll cross that bridge when we get to it.

In about two weeks time :-O

Until next time….

Read More

Lightning does strike twice

Just a quick update this time. Got a lot on at the moment!

If you were around for the last Pi Wars you may remember I fried a Pi for the first time ever whilst mucking about with relays for the skittle ball release mechanism. It was sad. We had a minute’s silence. RIP RPi.

Weeeeell, it would appear I doggone went and did it again. Nooooooo!! This time it was whilst trying to hook up the Adafruit servo board (which I’ve used successfully several times in the past.)

There was smoke this time too. Proper thick, acrid, really not good smoke type of smoke. Rapidly followed by lots of frantic wire pulling.

Was undoubtedly a classic ID10T error. A quick aide memoir for myself and others:

9v > 5v > 3v3

This is important. It goes wrong quickly if you mix them up. Very quickly.

I was in all honesty surprised when the Pi actually booted up again. Sadly though, a quick check of the i2c deelybob (that’s a technical term I think) revealed that all was not well…

snafu

I’m not sure therefore if it’s the i2c driver on the Pi that’s gone, or whether its the servo board. In reality, I’ve not had time to check, I swapped out the Pi for a fresh one and have limited myself to using the hardware PWM on GPIO 18 of the Pi. I’m only running one servo that holds an arm to hold the ball in place (hopefully) for the golf and skittles events.

I had another moment earlier this week when, on reviewing the challenges on the piwars.org site that I realised that there had been a small, but rather flippin important change to the skittles challenge – someone put a turn in the course! I’d not seen the important ‘competitors must collect the ball and then…’ bit. The wonderful @GeekyTim ‘fessed up on Twitter when challenged and admitted that it was indeed he who had added a little something extra. This should make it a lot more interesting and requires some thought in actually controlling the ball to even get it as far as going in the direction of the skittles.

I’ve still got a long way to go, have been manically designing and printing a wild and wacky range of attachments to serve in the array of challenges. More of these next time. The bot is being assembled and reassembled repeatedly as I test, fit and retest different configurations. I’ve got most of the manual challenges sorted now and am working on the challenges that require some form of autonomy. I *may* have made these an awful lot more difficult than they reasonably should be due to a critical design decision I took very early on in the process. I’ll let you know.

So – onward and PiWar’d. Ermm…. did I say there’s only two weeks to go? Gotta dash – I’ll catch up with you all later.

Until next time… (more…)

Read More

Chassis-tastic!

Finally feels like things are starting to come together. Literally. Since my last bot was made from two cobbled together project boxes, any amount of design is going to be a step forward. I’ve continued to experiment with OpenScad and am really loving it. There’s a really good cheat sheet here that gives you pretty much everything to design anything of any shape. It’s really a very powerful FREE tool and tbh makes much more sense to me than the AutoCad type programs. I’d also previously tried SketchUp and found it to be the same type of thing with a million incomprehensible buttons and a very steep learning curve. For my purposes OpenScad suits perfectly.

So, I’d made the motor mounts (for non-existent motors at the time) and wanted to build a fairly simple chassis to mount it all on. To the 3D printer, Batman! I put together a very basic shape, with holes for the motor mounts, and then, in trying to make it look at least a little less basic, began experimenting with chopping bits out of it. This can bo done really easily with the difference() function in OpenScad that takes one shape away from another.

I then saw fairly quickly where I wanted to go with this and….

xbot

Behold – X-Bot is born! :-)

I am printing in PLA with 20% fill, which gives plenty of rigidity without taking a age to print anything. Got to admit that having the 3D printer is an absolute gem. Being able to conceive an idea, design it and hold it in your hand a very short time later is still pretty science fiction to me!

The motor mounts went on really nicely. I’m really pleased with these considering my motors were held on with hot glue last time!

IMG_6184

And once all four were mounted…

IMG_6185

I started to lay out the electronics to get an idea for the spacing etc…

IMG_6186

I also attached the wheels for the first time – Yay! For the first time it actually looks recognisably like a Pi Wars bot.

bot1

Was also REALLY pleased to see my calculations were indeed correct and it does fit on an A4 sheet of paper – phew.

So, the basic chassis and control mechanisms are complete. I *still* have motor nightmares to confront. The seller who owes me a back order is yet to come up with the goods so I may yet have to find another plan.

I’m going to focus on the manual challenges next as planning / coding for the autonomous challenges is a non-starter with un-matched motors. I’ve got an idea for the golf challenge and am going to rework last year’s skittles cannon so hopefully can sort those two fairly quickly. I’m designing swap-able mods for each of the challenges, I spent too long having to reconfigure the bot during the day last time so want to avoid this as much as possible.

Can’t believe there is sooooo little time left!

Next time – Weapons of Mass Distraction.

Until then….

 

 

Read More

Motor woes… And tantrum throws.

We do this because we love it.

We do this because we love it.

We do this because we love it.

(Keep repeating the mantra)

It’s not that bad, but some parts of the process can make you swear a little. Additionally, it’s 48hrs to the Pi Party, I’ve got loads of prep left to do – and have had lovely tonsillitis for 3 days. Seriously hoping the antibiotics kick in soon!

So – four motors right, just four little motors. No problems. So, I started ordering motors back in November and after two hopeless ebay sellers took TEN WEEKS to fail to deliver anything to me at all I was getting a little sweaty by the time the new year crawled round. So, third time’s a charm (as the saying goes) and I found another supplier who actually delivered the goods in about a week.

IMG_5935

Last year’s motors at the front – new ones behind. Ooooh – look at the shiny shiny!

I was sooooo happy to get my hands on these then a few things started to dawn on me. The motors are 12v. I am using a ZeroBorg from PiBorg, the very neat little 4-channel controller they first launched as a Kickstarter campaign. Turns out the ZeroBorg can only take a maximum of 10.4v, so I am actually running it at 9v. Bang goes 25% of the power going to the motors immediately.

In addition to this, the motors are rated as ‘300rpm’ (when running at 12v) So I expected around 200-225rpm at 9v. This I would have been happy with. The motors I used last year were 130rpm but really torque-y. These new ones actually turned out to run SLOWER?!! Whoever gave these their speed rating needs a good talking to IMHO!

Back to square one.

Another year, another supplier (Ireland this time)….

‘Hi, you have 300rpm, 6v motors?’

‘Yes’

‘And they’re definitely 300rpm?’

‘Oh, yes’

‘And they’re definitely 6v?’

‘Oh, definitely sir’

Fantastic. So, I order and a week goes by. I am juuuust getting antsy when a parcel lands on my door step.

Containing three motors.

And a note ‘Sorry – we’ve only got 3 of those atm, we’ll send you the other on back order when we get it – possibly by March.’

Calvin-Facepalm

Are. You. Kidding me.

(Oh – it’s now March, and I am still waiting.)

So, I find my FIFTH supplier, in the US this time, who has the exact same motors that I have three of, but at a premium price plus US / UK shipping costs. I therefore spent a lot more than I should to get a matching forth motor. In fairness to the seller, he shipped immediately and it arrived within a week.

And guess what? – The SAME motor, from the SAME manufacturer, with the SAME label actually has a 6mm shaft not a 4mm as the others do. And it runs significantly slower than the other three. Utterly frustrating, but can’t really blame the seller for that one, although QC at this particular manufacturer obviously leaves a lot to be desired!

So, with 6 weeks to the competition, I am yet to find a fully matching set of motors. I have compensated in the code to allow for this, but it does mean slowing the other three down to match which isn’t really great – I certainly won’t be winning any speed runs I feel!

One a positive note, I’ve designed my own motor mounts for standard 25mm gearmotors, I’ll put these on Thingiverse so they’re available. Very pleased with the way they turned out…

IMG_6019

 

I’ve also got the Pi Zero / ZeroBorg wired up and have started tweaking the code. I’ve also got a PS3 controller set up for manual challenges. This is a significant step up in usability and complexity from last time round. Think I’m also going to need a lot more driving practice!

 

IMG_5970

Next time…. Get it together, man. – Time to get chassis-tastic and try and actually build a bot!

Until then…

DP.

 

 

 

Read More

Pi WAAAAAAAAARS!

Well, I think I can be forgiven for the title, hey – I’m a little excited, ok?

The last competition was undoubtedly one of the highlights of 2015 and indeed of my Raspberry Pi experiences (and I have a fair few of those now!) So I was thrilled when in October (REALLY?!) I, along with the other teams, received the email from Mike and Tim telling us we had been successful and had been selected to take part in the 2017 competition. There were many more applicants than places so I am extremely pleased to have got in. However, the next week or so were taken up writing a PhD. proposal and in the latter part of October I found I had been successful. I was not due to start until February but my supervisor wanted me to start ASAP so life sort of went out the window at that point. I am currently living away from home and am based in Milton Keynes from Monday to Friday. This has made planning and particularly building a bot more of a challenge than I had expected.

Last year my entry, sHazBot was built almost entirely from recycled junk – something I am very proud of. She came a respectable 4th overall and had the brazen cheek to walk (well, roll) off with first place in the obstacle course challenge. I was even lucky enough to have my wife capture it on film…

sHazBot certainly performed admirably but with significant short comings. Whilst the motors I chose were extremely torque-y they were also pretty snail like and the bot certainly was not going to be setting any speed records. The control system was also fairly rudimentary with simple on / off controls for the motors. This was ok for some events, but really not suited to the events where precise, directional, control was required.

I therefore came up with a hit-list of what I wanted to achieve this time round:

  • Faster. Much faster
  • Proportional Control
  • Encoders on wheels
  • Better chassis design
  • More aesthetic. (I came LAST for aesthetics last time round!)

From winner… to the bits box.

It happens to us all eventually. We go from the top of our game to the rest home in a far quicker time frame than we can possibly imagine…..

shazbot

In this case, most of the parts have been donated to other projects – including this one! I took the motors out and did some tests before deciding that I was going to invest in some new ones. I also wanted a better designed chassis – well, to be frank, one that had been designed at all would be a good start.

If you follow me on Twitter, you’ll be aware of my latest acquisition and new found inspiration, I finally sold off a lot of old gear and scraped the funds together to invest in a 3D Printer. And a damn fine one too. I have seen too many people spend too much time fixing, calibrating and building 3D printers. While I’ll concede that this is a fine way to learn, I wanted a 3D printer to actually print things. So, I did a lot of research, settled on the exact model I wanted and set up alerts on eBay and Gumtree. I only had to wait a week or two until what I wanted popped up at the right price so after a quick trip to Leicester I returned home the proud owner of a (wait for it..) Wanhao Duplicator D5S Mini.

IMG_4661

All I can say is very impressed indeed. The version I bought was a 2015 model which did not have a heated bed. The 2016 model does, which is kind of an admission that it needs one. It does. I experienced warping on large, square prints and tried pretty much every combination of glue / tape / spray etc and was still having problems. I therefore bought a third party heated bed which is considerably cheaper than the Wanhao version and have had perfect prints since. I’ve had enormous amounts of fun mucking around learned an awful lot and have printed many useless, and a few useful, things.

I really wanted to design the full chassis for the bot and 3D print it. I was much impressed by Tito, Hitchen Hackspace’s fully 3D printed bot from Pi Wars 2015. I’ve been teaching myself to use OpenSCAD which is a language based 3D modelling application. Really powerful but simple to get started and to be able to do enough with easily.

This week I have been mostly designing motor mounts and brackets.

mount

 

I was very impressed that the printer managed to print the complete piece with no supports necessary. I’ve got loads more design work to do on the chassis, I’ve got the motors and control board / controller to sort out and that will then give me the basic bot to work up from. I’ve got most of the sensors I am planning to use but need to get the main bot functioning before I can start to add complexity.

Long way to go, and the weeks are flying by. Did I mention I’m moving house too between now and the event?

Next time……. Motor woes and tantrum throws!

Until then….

 

 

 

Read More

Halloween Fun – A Spooky Ghoul-in-a-Box!

So it’s that time of year again. The UK seems to have become more upbeat about Halloween in the last few years, certainly a difference from my youth when trick or treating was distinctly frowned upon! We always get lots of little horrors dropping by so we have a big bowl of treats waiting – along with a little surprise.

You may have seen the ‘Pumpkin Pi’ I made last year, this was a complete hoot and worked very successfully.

This year I thought I’d try something different – and a little more animated! I like the ultrasonic sensor that the Pumpkin Pi uses, it’s really easy to set up and there are loads of resources online – Python is my favourite flavour and it’s really easy to set up simple distance measuring with the sensor which can lead to all sorts of Hocus Pocus.

The initial thought was, I want something hidden that can jump out of a box with a ghastly scream. Achieving that took a fun afternoon of hackery and a lot of bits and pieces I had lying around.

So, to build a motion-sensing-ghoul-in-a-box I used the following recipe:

1 garden fence trellis

1 bicycle inner tube

Lots of scrap wood

Lots of glue, staples, tape and wishful thinking.

1 Raspberry Pi

1 Ultrasonic Sensor

1 mask (35p from Tesco!)

1 box

Making the base…

IMG_5076

 

I saw the trellis in the back of the shed and knew that it would be perfect. Getting enough spring for it to ‘jump’ quickly and effectively was going to be tricky. I looked at elastic bands and the few springs I have lying around and none was going to have enough oomph. I’d seen some really powerful catapults made using tyre inner tubes so I found an old one with a puncture and re-purposed this.

IMG_5077

I stapled the sliced up tube to the trellis and then attached them to the frame like this..

IMG_5079

Then added a small screw as a latch to hold it down under tension (you can’t see the screw in this picture – but you can see it holds it nicely!

IMG_5080

Then it was time to go inside and put together the electronics. This was quite straightforward, I set up the sensor and the Python code to measure the distance. I then took a relay board I designed for sHazBot, my PiWars robot and used this to turn a motor backwards and forwards rapidly to act as a ‘trigger’ Releasing something held under load can be tricky but this method works very well.

IMG_5084

I 3D printed a little cam to push against the trellis and release the spring…

IMG_5085

Time to put it all in the box – added a speaker to play some horrible screams, and a battery so it can all run headless (how appropriate) and it all fitted in nicely.

IMG_5089

Finally I added a *really scary* (?!) mask that cost the grand sum of 35p! I also added LEDs to the eyes for extra effect.

Spooky Ghoul-in-a-box – primed and ready!

IMG_5093

I think the end result works really well, think I’ll be leaving this out on our front drive on Monday to welcome any callers who may happen to pass by!

The video is a bit dark and best viewed in a dark room. But hey, it’s a horror movie! It’s also a LOT louder when you’re standing next to it (I turned it up to 11)

(No ghouls were harmed in the making of this video.)

Have a terrifyingly happy Halloween everyone!

Until next time..

DP.

 

 

 

Read More

Jack of all trades, Master of Computer Science – and now a PhD. student!

moi

This is Jester Coder, my little mascot, standing on the little computer that could. And the one that’s made this journey possible. As many of you who follow me on Twitter already know I was a fairly lousy student in a fairly lousy school. I always used to joke that double ‘not-getting-stabbed’ on a Wednesday afternoon (also known as German) was by far my favourite lesson. There was, however, one dedicated teacher (thanks Mr Glazier) who instilled in me a passion for coding and computing that never left me. Sadly circumstance meant going to University was not an option at the time so I left with almost no qualifications and no idea what I was going to do.

I’ve always worked for companies doing generally techy things, but always in sales or management. Fast forward 20yrs and several life-times and in 2012 and I was one of the first in the queue for this new little wunderkind called a Raspberry Pi. If I’m honest, I actually did very little with it. I’d never touched Linux or Python and really had little idea what I was doing. I did a little experimenting but it wasn’t until a visit to Bletchley Park and The National Museum of Computing a few months later where I saw adverts for something called a Pi Jam (or Raspberry Jam) which piqued my interest no end.

I returned less than a week later to the next Jam where I met Mike Horne, the now esteemed PiWars organiser, PiPod Podcaster, and Cambridge Jam Organiser. I also met Peter Onions, another famous Pi-Face. Some of the projects on display blew me away and I couldn’t help but think I’d missed a trick with this little device. So, I worked through ‘Invent with Python’ by Al Sweigart – highly recommended, via ‘Learn Python the Hard Way’ – also excellent, and eventually worked my way up to doing a MOOC with Rice University (An introduction to interactive programming in Python.)

3 years and many projects later I was lucky enough, based on the work I had done with the Pi and my self taught experience, to be accepted to read for a Masters in Computer Science at the University of Hertfordshire. I am thrilled to report that I received the final grade for my dissertation today and I got a distinction for this, which happily guarantees me a distinction for the MSc. overall.

With that in the bag I can now reveal that I have been awarded a fully funded PhD. studentship with The Knowledge Media Institute. This is a part of the Open University and is based, rather perfectly just down the road from Bletchley Park where this journey really began. I will be studying full time for three years – and they even pay me to do it which is unbelievable. I would never have thought four years ago that this would ever be in the realms of possibility.

I cannot give enough thanks to my wife, to Raspberry Pi, and to the Pi community and all those who encouraged me to pursue that which I have always wanted to.

I was a part of the 8-bit generation, and I still missed out. The Raspberry Pi is a phenomenal success and I believe is vitally important in the growth of interest in CS and STEM subjects for the next generation of coders, hackers and engineers. Long may it continue. I for one would be in a very different place without it.

Until next time.

DP.

 

Read More

Raspberry Pi ‘Air Drum’ Kit

So, what’s always interesting to me is where we find our sources of inspiration. These can be a person, a book, a tweet, a website – anything at all. A lot of my project ideas start when I find something at the local car boot sale. If you follow me on Twitter you’ll already know my obsession with Robosapien robots!

Anyway, I was at the booty on Sunday, when this caught my eye…..

airdrum

Ohh – It’s an Air Drum! 😀 Couldn’t really say no, especially for just £1. Not only did it have batteries in it – it worked too.

So this got me to thinking. I’ve been playing recently with the excellent Python cwiid library that lets you use Wii controllers with the Raspberry Pi. I’d only managed to ever get one controller working with a single Pi before so the first challenge was to get a pair of controllers working as the ‘sticks’ That took a lot of mucking about – until I found the excellent post by WiiGate that detailed how to set up 2 controllers properly using the MAC addresses. You can find it HERE.

I then found a bunch of open source drum samples which were available as .wav files – there are literally thousands of these out there to choose from. I wrote a small Tkinter app that displayed the position of the controller to give me an idea of the data that was being produced. Interestingly the position and accelerometer data is all wrapped up in one xyz Python tuple. This caused some confusion initially as if you move slowly from point A to point b this produces a very different reading than if the same movement is done rapidly. After playing around for a while (quite a long while!) I managed to map four distinct movements to four different drum sounds. I initially wanted to get 3 sounds on each controller but the movement scale was a bit too tight to do it successfully every time and 2 sounds often overlapped. So, I am using the trigger button combined with the movement for one of the sounds on each controller. This gives 6 different drums sounds, 3 per controller, that can be played without them overlapping.

I am fairly pleased with the end result! (Please excuse my total lack of rhythm)

(That boy’s got no rhythm!)

I’ve uploaded the Python script and drum samples to Github so you can have a play too….

Github – RPi AirDrum

Enjoy.

Until next time…..

 

Read More