Category Archive: Computing

2016
06/26

Category:
Computing

TAG:

COMMENTS:
Comments Closed

Powering the #PiZero

Putting the robot together, it occurred to me to wonder how to power the motors and the Pi. The original robot ran on 2xAAA batteries – chances of a Raspberry Pi Zero running properly off 3v, plus then powering a motor block? Absolutely, well, zero!

So, I managed to source some AAA Lithium batteries, like these. Each is supposed to provide 3.7v, so that should give me more than enough – and, happily, the Pololu motor board also then supports their voltage regulator which means that I can provide power from the batteries to the motor board and have that power the Pi.

Next problem turned out to be that fact that the original motors in the Tamiya 70097 would very quickly burn out at more than 3v. Thankfully it turns out that Pololu (again!) have clip-in replacements that are rated up to 7v (although I think the preference is 6v), which I very quickly sourced from Proto-Pic and so that’s that quandary settled.

On with the build…

2016
06/26

Category:
Computing

TAG:

COMMENTS:
Comments Closed

The first cut is the… scariest

A status update on my little yellow robot is long overdue, sorry for the huge delay (yeah, like anyone cares, Ian…)

I am now delighted to be at the point where I can almost put it all together. I have working code (which should be in my GitHub repository, if anybody wants to take a look). This has been a big step for me as I ended up not only experimenting with GPIO Zero, but actually submitting a pull request, as the motor board I picked up (the Pololu one) had a different motor control approach than the usual, default ones supported in the current library.

The final hurdle for me, then, was the actual “maker” side things. The part where I actually have to start cutting the robot to make the new innards fit. It was scary. I dithered, procrastinated and generally put this part off… until something else came up that I needed to escape from.

So now, after diligent use of a Dremel I am all-but ready for the final assembly.

There were a few decisions to make on how, why and where to cut. First, can the new motor block be squeezed into place? Answer, just… if I first:

  • trim off the screw pillar that holds the original motor block in place
  • shave off the interior buttressing on the two corner screw pillars
  • whittle away a few unnecessary bumps from the outer faces of the motor block, and
  • cut a small chunk out of the new motor mounting brackets so the entire assembly slots neatly into place:

The last little quandary was how I going to fasten the tracks back on, now that the motor block takes up so much space? Obviously I needed to trim just enough off the mounting points that they can still clip into place and be screwed down, but so that they don’t foul on the new motor block. Yup, we’re getting there.

What about the IR sensor? A quick Google tells me that I shouldn’t expect any success if I mount it inside the device, so where to put the sensor? My initial gut reaction was to put it at the back, so it was facing you when you drive it… but then I realised that at some point you could pretty much bank on turning the robot around, so the sensor wouldn’t be facing you any more! Thus it came down to maintaining that all-important balance between how it looks, and what’s easiest.

There were two possible mounting sites, one at the rear, in a fin, the other at the front in a cluster of fake headlights. In the end, I decided that the front was the best choice for both practical and aesthetic reasons, so another hole was duly cut to allow the sensor to poke out above the light cluster with the wires available to feed down into the chassis.

The final result in this regard work out very well indeed – I’m very happy with where the sensor will sit and don’t think it will look too out of place.

The last little part of the challenge, at this stage, was to fix the little roller back in place – this sits on the underside of the chassis and ensure a smooth roll for the robot as the tractor treads don’t hold the whole thing off the floor. For this, I had to carve up the original motor housing as it served to not only encase the motor, but also pin the roller in place.

Now all that remains is to try and fit/solder the various parts together and… well… test it! I can’t wait.

2016
03/14

Category:
Computing

TAG:


COMMENTS:
Comments Closed

Robot retro-fit update

I’m excited to go to the Coding Evening in Peterborough event tomorrow, but before I go I wanted to try something out that I was struck by when I was using my old PS2 remote control with my Pi (ahead of getting the motor wired up).

Although I’ve managed to “see” the old helicopter remote control signals, I decided that it was time I heeded my own device (like I keep saying to my 12yo-maker, “start simple, then gradually add complexity”) and so put the helicopter remote side in favour of a known device like the old PlayStation 2 remote control. Which turns out to have been very sensible advice.

I spent some time finally getting my head into the lirc libraries, configuration and sample code. It all worked nicely, but I wasn’t totally satisfied as it didn’t track the key down/up events that make for a smooth motoring experience (as demoed so nicely by the new GPIO Zero library recipes).

But as I tested, I noticed that the cursor was actually moving around the IDLE console output window, and it struck me that perhaps the lirc input could be read by the Python evdev library that I’ve been playing with in school recently…

And this evening I found that indeed it can! It appears that once the lirc configuration is set, the evdev library sees it as another input and from there all is good; I can now track key up, key down (and, should I need them, key held) events which means a smooth control for the all important 4yo soak testing, to come later.

Now I can really look forward to tomorrow evening ?

2016
02/05

Category:
Computing

TAG:




COMMENTS:
Comments Closed

Robot retro-fit

RoboRover

I got a lovely friendly yellow robot (a WowWee RoboRover, as it turns out) as a leaving present from my last school. It’s lovely. But it only goes in one direction: two tractor treads, but only one motor. My 4-year-old loves playing with it, but I can’t help but feel that we could do more…

Over the Christmas break this year, I decided the time had come (particularly in light of the advent of the Raspberry Pi Zero) to upgrade the cute little critter. Tamiya 70097 Today, I finished phase 1 (it sounds better in my head if I pretend I have some kind of structured plan), and proved that the motor unit I’ve picked out will fit in the chassis of the Roborover. It’s a Tamiya 70097 geared twin motor unit, from a range of remote control vehicles (promising start…) and was, itself, rather fun to put together.

I’ve also bought an infra-red receiver, a TSOP38238, to hopefully make use of an old r/c helicopter handset, so that’s this weekend’s challenge; let’s call it phase 2 🙂

Phase 3 will be modifying the chassis to be be able to get the motor unit embedded and running. Ideally, it’ll allow me to use PWM to accurately control the robot speed and direction from the r/c handset stick.

Phase 4 will be re-fitting the body back on top (with modified eye LEDs – I’m hoping to get colour-changing ones in there that will be controlled by the spare stick on the r/c handset.

Phase 5 will be seeing (a) if my 4-year-old is still the same age(!), and (b) whether she likes it!

Wish me luck 🙂

2015
10/29

Category:
Computing

TAG:


COMMENTS:
Comments Closed

Raspberry Pi theremin

This was the supposed to be just a quick project to fill some time while waiting on an eBay purchase from China. I had been building up parts ready to build a simple Raspberry Pi-powered robot (inspired by articles in both Linux Format and The MagPi magazines).

The distance sensor is an HC-SR04, only a couple of quid on eBay, and I then found a simple guide on ModMyPi showing how to wire the sensor into a Raspberry Pi and read the distance in Python.

It being half-term, I had ordered the required resistors and was delighted at how easily the code work. “Fabulous!” I said to myself, “Now I just need to make it round the distance to, say, the nearest 5cm and then play a tone from there.”

How wrong can one statement be?!

After a good two days of intermittent playing, I have managed to get *something* working, basing my theremin on Zulko’s Pianoputer as I simply couldn’t find an easy way to just get Python to play a pitched tone. His code was set to use a keyboard, mine now reads the distance from the HC-SR04 and plays the relevant sound from there. In place of his “bowl.wav” I’ve grabbed (and trimmmed, and down-sampled) a clarinet sample from freesound.org and use that as my base sound, which Zulko’s code then down/up-samples to make the various pitches required, at startup.

So yes, it’s a little clunky. And yes, it can take a while to start up and transpose the various samples.

But I’m a happy geek – I built my own personal theremin!

2015
03/09

Category:
Computing

TAG:

COMMENTS:
Comments Closed

Developing for Android on Android

Just a quick post to mention that I’ve been experimenting with developing an Android app. I actually felt I’d come up with a semi-decent idea (for once) and determined that this time I really was going to actually build an app myself. But, as ever, there’s a reasonably steep learning curve for getting into app development (mostly a question of time, not my most abundant commodity) and so I cast around for ways of developing on the device itself… and, ladies and gentlemen, I found a couple of options.

The one I’m using most is DroidScript (available for free on the Play Store). For me, it’s perfect – you write in JavaScript, which I know pretty well, and it takes care of getting the thing going.

I should also give a mention to AIDE, which feels to be a more comprehensive, in-depth approach to getting apps built for Android on Android. I haven’t yet given that a full “crack of the whip” given how easy it is to rattle things up in DroidScript. But, never say never, eh?

2015
01/22

Category:
Computing
Teaching

TAG:




COMMENTS:
Comments Closed

Embedding movies in DokuWiki

We have a solution in school that is using a mirrored DokuWiki instance to share lessons between ourselves and a partner school (or, at least, will do).

The “main” instance is running on this server, for the moment, and the slave is running on a Raspberry Pi. The two instances are kept “in sync” by using the synchronisation plugin available from the standard DokuWiki repository.

The primary idea was to allow students to video science experiments, which our partner school may not have the resources to do for themselves, then upload it to the wiki along with a commentary, so that pupils at the partner school could learn from seeing and hearing our experiments, not just reading about them in a science textbook.

The first hiccup was finding out that the default installation of DokuWiku didn’t allow uploading of the .mov files generated by iMovie on iOS. Ah… After some thought, we decided we could just upload them to YouTube and link to them there, or maybe even try and embed them.

Part-way through the process, it occurred to me that we had somewhat broken one of our initial design goals, which was to have all of this running on the RaspberryPi instance, so that it could serve wiki pages even if their internet link was down. No point stressing over that, if all the videos are on YouTube! D’oh!

Back to the drawing board, we looked into plugins that could embed videos. The main one we found uses HTML5 to embed videos from the wiki media library directly on a page, but it clearly states that it only supports the encodings speed by native HTML5, of which QuickTime is not one. Boo!

After a number of fruitless experiments altering the source on my host and a fair bit of reading up on the supported codecs, I was all set to try option “b” (or was I up to “q”?) and instead simply convert the videos into MP4 files and upload those. So I found a free app in the AppStore and converted a short sample video, when I noticed something potentially useful: both the original .mov and the converted .mp4 were using H.264/AAC encodings, the only difference being the envelope!

A glimmer of hope shone through!

I tired simply renaming the file. Bingo! Hosted, embedded video!

Taking it one step further, it turns out that if I simply redefine the MIME type for mov from video/quicktime to video/mp4 and amend the plugin code to allow the .mov extension through, then all is shiny!

W00t – iPad-generated videos, uploaded straight to the wiki can now be embedded in the wiki pages. Result!

I am a happy geek 🙂

2013
06/10

Category:
Computing

TAG:

COMMENTS:
Comments Closed

RaspBMC FTW!

I already loved my little RaspberryPi – so far, I’ve

  • played classic games on it
  • brushed up my bash-scripting and general Linux-y knowledge
  • and of course used it in school as an extra-curricular programming environment (Python against MinecraftPi, anyone?).

But it’s also had a fair amount of use as a media player (I use the rather fabulous, IMO, RaspBMC distro) – from videos on our NAS box, to catch-up TV (thanks to a minimal amount of Googling) and then using tvcatchup.com’s plugin to watch live TV. This evening, I’ve also managed to get Google Music to play flawlessly, playing (and occasionally paused) happily for several hours.

I am a happy geeky-bunny!

2013
05/24

Category:
Computing

TAG:




COMMENTS:
Comments Closed

Programming on an iPad

Just a quick jotting to mark the occasion of my first real programming success in an iPad. Rather chuffed, really, that it all worked out as hoped and seriously impressed with the software involved.

So, then, to details – what have I achieved? Nothing too spectacular in terms of visible results, but I’ve managed to get the Minecraft Pi Python API into the Pythonista app (by means of copy/paste as there seems to be no way to import code from, say, DropBox) and then quickly code a simple class that uses the API, connects to a running instance and posts a chat message.

Like I said, nothing too glamorous, but it proved the idea – now on to some more exciting ideas. I’m going to aim for the tried-and-tested platform that follows the player around, so you can never fall. Then, who knows? The sky is, as ever, the limit 🙂

2013
04/24

Category:
Computing
Teaching

TAG:





COMMENTS:
Comments Closed

After-school MinecraftPi sitrep

So I’ve have a few weeks of running the RaspberryPi after-school programming club and I have to say it’s been an interesting ride. In a way I’m a little disappointed with the lack of programming we’ve managed to achieve. But, on the other hand, the amount of Linux experience they’ve gained (to say nothing of the un-spoken appreciation – there’s been little to no grumbling – they’ve developed for the smoothness of systems like Windows and OSX) has been incredible.

So far, then, we’ve managed to set up and boot a RasPi. We then added configuration to try and work through the school proxy (more on that, later) and then managed to grab MinecraftPi (the “hook” I’m using to get them thinking about coding). This last week we finally managed to get a sample program working (this sample, actually, which draws an analogue clock in the sky) against a couple of the pupil’s MCPi instances.

From here, then, I hope to draw out the programming aspects of the club (using Geany to code Python against their own Minecraft instance, initially, although I hope to work up to running mini-competitions, eg building races, in one world) starting from more simple coding challenges like building a cube of a given material, working up to pyramids (well, ziggurats I s’pose, which I’m thinking must be possible with recursive calls).

So, what have I learned?

Well, it’s mostly been about what I’d do differently next time

Like, having a proxy-configured system image and working from there, instead of having to think on the hoof and get them to change configurations as we go. I could still get them to startup, update and install packages, run X and then shutdown… but I could do it from a position of strength, knowing that the proxy side of things will simply work!

Or, about double-checking the amount of background knowledge required, in order to be able to follow instructions I carefully set out, on how to set up the environment to use the proxy.

Finally, there’s a lesson in terms of not testing, testing and then re-testing (just to test that the testing was working) ideas, configuration and systems before blithely assuming that they would “all work okay” when put in front of pupils; no matter how keen and self-motivated they are, they’re only KS3 and don’t have my 13+ years of programming experience to fall back on when it doesn’t quite work first time because they mis-spelt “Aquire” or didn’t match case in a function definition.

So, one final thing about the proxy. We’re in one of the ex-EMBC counties that stuck with the Capita solution, which means we’re now using the WebShield proxy solution (albeit with custom certificates so I can now actually access Twitter across the school network) – this has been a right royal pain to work around, but for those interested, the answer seems to have been to actually put the proxy login in the configuration, as well as the proxy address.

So, for example, environment variables need to be set like http_proxy=http://user:password@webshield.embc.uk.com:80/ or, for apt-get to function, settings like Acquire::http::proxy "http://user:password@webshield.embc.uk.com:80/"; in the apt.conf file.

Anyone needing fuller details on any of this, don’t hesitate to comment/tweet me – I’m happy to answer questions.