Tuesday, 27 September 2011

This is the inside of a dead VHS video recorder/player. It turns out it is still full of lots of old-school eletronics. Sure, there are lots of PCBs, but due to the mecahnical nature of video players with their big motors and stuff, there are a lot of useful connectors in there, as well as some high power resistors, transistors, loads of potentiometers and so on. A good way to pick up cheap parts.
Here is a handy 10 pin connector with the wiring all nicely connected. Try soldering anything remotely as neat as this, and you will see how useful a ready made is!
Here it is connected up to the breadboard jump leads coming off the arduino
And here it is fed into the underside of the head, from the board

Wednesday, 14 September 2011

Having got the basic arduino servo options sorted (if not finished), I have been rooting about for ready-made compact controllers. I have decided not to overstretch and will use a wired system for now, but may change to wireless later. Anyway, I wondered what's in a PS2 controller...

Here's what the PS2 controller looks like taken apart:

Here's what the joystick looks like. The blue things are potentiometers

The other side, showing the press down button (the white bar pushes down on the black switch

Tuesday, 13 September 2011

THis is the latest version of lamp_head - the arduino test code for controlling my automaton lamp/head/thingy

a lot of this is redundant, but there are 2 functions
1. "readPots()" uses potentiometers to vary the voltage to analogue inputs, then converts this to a digital number then uses that to control servo position. This would allow 2 controls (up/down and left/right)
2. "manualUp() uses a switch to decide whether to incrementally increase the digital output . In this case, if the switch is on, then the output goes up, if it is off it sticks at the latest value. This could be used with a joystick, so that pushing up increases the UP/Down values incrementally, and pushing down would reduce it correspondingly. This would need four such inputs to be set up

circuit diagram
>>>>>>>>>>>>>>>>> here starts the sketch >>>>>>>>>>>>>>>>
/*
Lamp head version 3 - this programme is to control the automaton lamp head
Andrew Lewis September 2011
This code is in the public domain.
1. Turns on and off a light emitting diode(LED) connected to digital pin 13, when a switch attached to pin 2 is turned on.

// constants won't change. They're used here to
// set pin numbers:
// @@@@@@@@@@@@@@@@ stuff to do with LED controls
const int switchPin1 = 2; // the number of the pushbutton pin
const int ledPin = 10; // the number of the LED pin
int buttonState = 0; // variable for reading the pushbutton status
int delay_val_LED=10 ;
// @@@@@@@@@@@@@@@@@@@

// @@@@@@@@@@@ This defines aspects fo the digital control
const int pinUp =11; // constant to set the UP input to be digital pin 11 (d11)
// this
int delayer=10; // sets delay for digital control
int valUp=90; //set manual number conrol UP at mid point by default =90

int upPin=11; //defines up eyeball control value pin to be digital pin 11
// @@@@@@@@@@@@@@@@@@@@@ end

void setup() { // initialize the LED pin as an output: pinMode(ledPin, OUTPUT); pinMode(switchPin1, INPUT); // initialize the pushbutton pin as an input: pinMode(pinUp, INPUT); // sets digital PIN (defined by pinUp) to be the input for increases that make eyes go up UP // attach servos myservo.attach(5); // attaches the servo on pin 9 to the servo object myservo2.attach(9); // attaches second servo to pin 8 to second servo object}

void loop(){ // lamp controls // fade_on(); turn_on();manualUp(); //Include this function to check for digital increases in UP value (this would be one of four needed to control eitehr a joystick or other four point controller //readPots()// Include this function in the loop for dual analogue controls (1 potentiometer per servo)

// servo controls @@@@@@@@@@@@@@@@@@@@@ // Servo 1 ------------- valPot1 = analogRead(potPin1); // reads the value of the potentiometer (value between 0 and 1023) valPot1 = map(valPot1, 180, 800, 0, 179); // scale it to use it with the servo (value between 0 and 180) myservo.write(valPot1); // sets the servo position according to the scaled value delay(delay_val);

Saturday, 10 September 2011

Left/right is controlled by mounting the eyeballs on a sort of parallelogram hinging, with the servo attached to the connectors to convert the rotary action to a shear.
Up down is controlled by a bike brake cable attached to the other servo. This is loose connected to the eyeball rig and converts the rotary action to a push/pull

Sunday, 4 September 2011

Have successfully attached a mini servo to the eyeballs of my prototype automaton and it more or less works. Despite being piddly little motors running off USB 5V, they deliver surprising amounts of torque - enough to power left and right motion. The only unexpected side effect was that the servo weight affects the position due to the undamped eyeball socketsA satisfying weekends work though :)