Archive

Archive for July, 2010

Genesis of the Arduino Dalek

July 24th, 2010 No comments

As previously mentioned here, I was recently given a broken toy Dalek, which I promptly took apart (in the name of Science).

Here it is before surgery commenced…

Having stripped the thing down, I found inside two perfectly good electric motors, and when you find two working motors inside a toy there is only one thing to do: Work out how to use a computer to control them!

So, figuring out that the easiest way of doing this was with an Arduino, I bought one.

I won’t bleat on about how good the Arduino is, or how easy it is to use. There are hundreds of sites that do that.

Instead, here is a list of things wot i dun to get a PC controlling the Dalek.

To start with, I think we’ll have a bit of circuit design. Below is a simple circuit that takes 2 inputs from the Arduino and runs a motor either forwards or backwards. One input decides the direction of the motor, the other whether it is on or off.

All very nice and abstract, but to be of any use it’ll need to be built. The quickest and easiest way is on Veroboard. So here is the design for that:

The relays do the switching, and the diodes are there to protect the Arduino from back-emf currents when the relays toggle. Two of these circuits will be used, one for each motor. I built them on separate strips of board to make things easier for myself. This is what they look like when all connected up and dumped onto the Dalek chassis:

The small board in the top left of the picture is just a plug I bodged up to make connecting the thing easier.

The parts used are 4x 1A5VDC DPDT relays, 4x 1N4004 diodes, a 10×39 strip of Veroboard and some wires.

After all that soldering and burning my fingers, the next step is to write some code to make the thing move.

Each motor can be controlled to go backwards, forwards or stop. This gives nine possible movements, as this table shows:

And now its time to test this whole think by writing a program that takes keyboard commands (the letters in red, above) and sending signals to the circuitry to control the motors. Heres it is:

// Project: Dalek control system
// Version 0.1 - Written before my Arduino even arrived
// Tony Blews tony@tonyblews.co.uk

int MotorDirectionR = 10;
int MotorDirectionL = 11;
int MotorPowerR     = 12;
int MotorPowerL     = 13;

void setup()
{
 pinMode(MotorDirectionR, OUTPUT);
 pinMode(MotorDirectionL, OUTPUT);
 pinMode(MotorPowerR, OUTPUT);
 pinMode(MotorPowerL, OUTPUT);

 Serial.begin(9600);
 Serial.println("Serial control Dalek system starting...");

}

// modes for the motor control
// convention here is modeXX - where X is F for forward, S for stationary and B for backwards
// first X is the left motor, second X is the right one
// for direction control, the LOW if forward and HIGH is backward
// for power control, LOW is off and HIGH is on

// all stop
void modeSS()
{
 digitalWrite(MotorDirectionR, LOW);
 digitalWrite(MotorDirectionL, LOW);
 digitalWrite(MotorPowerR,LOW);
 digitalWrite(MotorPowerL,LOW);
}

// move straight ahead
void modeFF()
{
 digitalWrite(MotorDirectionR, LOW);
 digitalWrite(MotorDirectionL, LOW);
 digitalWrite(MotorPowerR,HIGH);
 digitalWrite(MotorPowerL,HIGH);
}

// move straight backwards
void modeBB()
{
 digitalWrite(MotorDirectionR, HIGH);
 digitalWrite(MotorDirectionL, HIGH);
 digitalWrite(MotorPowerR,HIGH);
 digitalWrite(MotorPowerL,HIGH);
}

// spin left
void modeBF()
{
 digitalWrite(MotorDirectionR, LOW);
 digitalWrite(MotorDirectionL, HIGH);
 digitalWrite(MotorPowerR,HIGH);
 digitalWrite(MotorPowerL,HIGH);
}

//spin right
void modeFB()
{
 digitalWrite(MotorDirectionR, HIGH);
 digitalWrite(MotorDirectionL, LOW);
 digitalWrite(MotorPowerR,HIGH);
 digitalWrite(MotorPowerL,HIGH);
}

// move forward left
void modeSF()
{
 digitalWrite(MotorDirectionR, LOW);
 digitalWrite(MotorDirectionL, LOW);
 digitalWrite(MotorPowerR,HIGH);
 digitalWrite(MotorPowerL,LOW);
}

// move forward right
void modeFS()
{
 digitalWrite(MotorDirectionR, LOW);
 digitalWrite(MotorDirectionL, LOW);
 digitalWrite(MotorPowerR,LOW);
 digitalWrite(MotorPowerL,HIGH);
}

// move backward left
void modeSB()
{
 digitalWrite(MotorDirectionR, HIGH);
 digitalWrite(MotorDirectionL, LOW);
 digitalWrite(MotorPowerR,HIGH);
 digitalWrite(MotorPowerL,LOW);
}

// move backward right
void modeBS()
{
 digitalWrite(MotorDirectionR, LOW);
 digitalWrite(MotorDirectionL, HIGH);
 digitalWrite(MotorPowerR,LOW);
 digitalWrite(MotorPowerL,HIGH);
}

//main program loop
void loop()
{
 if (Serial.available() >0)
 {
 char inByte = Serial.read();
 // this version uses the QWEASDZXC "square" on the keyboard
 // as my laptop doesn't have a numeric keypad
 switch (inByte)
 {
 case 'q':
 modeSF();
 break;
 case 'w':
 modeFF();
 break;
 case 'e':
 modeFS();
 break;
 case 'a':
 modeBF();
 break;
 case 's':
 modeSS();
 break;
 case 'd':
 modeFB();
 break;
 case 'z':
 modeBS();
 break;
 case 'x':
 modeBB();
 break;
 case 'c':
 modeSB();
 break;
 default:
 modeSS();
 break;
 }
 }
}

And with that done, I suppose all that is left to do is show a video of the bottom bit of the dalek trundling around under computer control…

… which have to wait until the next post.

Share

More Citroen Picasso Hating

July 5th, 2010 No comments

In 1998 Claudia Schiffer made an advert for the excrable Citroen Xsara. The car, although bad in every respect, was only the second worst Citroen of recent years. That dubious honour goes to the Xsara Picasso.

The Picasso is one of only two cars that I completely refuse to drive (I’ll reveal the other one in the future). To celebrate the removal of the Picasso from the Citroen UK catalogue I present a badly thought out and poorly executed video:

Anyway, why would a German supermodel want to be associated with a shite French saloon car (apart from the cash – £3,000,000 allegedly)? Surely she’d have been better off whoring herself for the benefit of BMW or Mercedes?

Share

WowWee PaperJamz Guitar

July 2nd, 2010 2 comments

I’ve always wanted a “Flying V” guitar, so when Postman Pat called today I was overjoyed. For about 10 minutes. What he brought was this: a WowWee PaperJamz Guitar, bought from Amazon for £25.99.

The PaperJamz Guitar is essentially a paper thin toy guitar, or at least thats what the marketing bumph says. In reality it is only paper thin if the paper in question is The Mail On Sunday (including all supplements).

The reason for this is simple. Whilst the actual capacitive sensors and sound transducer are paper thin, batteries are not. Plus, it it were paper this, it would flop about like a rabbit’s ears. So its actually about an inch thick at its fattest point.

This particular “guitar” is number 4 in a series of 6. Each one has a different look and is programmed with three songs to strum along to. On this model they are:

  1. You Really Got Me (The Kinks)
  2. Blitzkrieg Bop (The Ramones)
  3. Godzilla (Blue Oyster Cult) – I had never heard of this one!

For each song, you can either play in “Perfect Play Mode”, where you just bash away at the strumming area to hear the song play, and “Rhythm Mode”, where you have to get the strumming at least vaguely correct. Neither of these are really that interesting.

What is interesting about the thing is the “Freestyle Mode”, which allows you to play your own songs by using the fretboard as a, well, fretboard. While you can’t actually make real chords on it, you can play pre-recorded chord samples by touching parts of the fretboard to select the base chord and modifiers, and strumming the strum area. They even include a handy chord chart to help you:

To sum this up briefly, to get the major chord, starting at E (don’t touch the fretboard), the frets count up FGABCDEFGA. To get a sharpened major, select the appropriate chord and also touch the next fret towards the body of the guitar. To get minor chords, select the base chord and also the fret two places towards the body. Sort of. Note that the frets don’t count up in the usual F F# G G# A etc. manner, and that they are all the same distance apart (a minor niggle – and a pisspoor joke on my part there, if you spotted it).

But, can you actually use this thing to bash out a real tune? Well lets have a look (and play Name That Tune at the same time)…

So there you have it. Its a sort of guitar, but not a really good one. If your could form real chords on it, then it would be a winner. Currently its just an amusing toy. I’m sure a future version will allow proper playing, and when it does I’ll buy one. Cos i’m sad like that.


Share