hello all,
I havn't posted in a while but I have written a little program to help with ripping DVDs. It's for use with DVD::Rip by Joern Reder. And it queues up the projects so you can leave your computer running over night.
The program is written in python and pretty thoroughly commented (though all in one file). I hope someone finds this useful. Note: I applied for a SourceForge project space, bur for now, here is the code:
dvdrip-queue-0.1b.tar.gz
MD5: 0ab561032354c2e2261838524637d65f
update: The project is now on sourceForge. Please submit bugs as you find them
The program is licensed under the GPLv3 so I encourage you to do what you like with it. And Please feel free to comment if you have any problems, I'll respond quick, promise :)
Dvd::Rip Queue 0.1 Beta
Posted on
Thursday, June 12, 2008
0
comments
Tags: dvdrip, queue, sourceforge
I havn't forgotten about you!
Hello all,
I havn't forgotten about this blog, I've just been really busy learning lots of interesting things!
Also, doing school work, trying to build up my recording studio (shameless plug), and workin on that hexapod.
Speaking of which, here is a short video of it in operation:
This bot was built using the following components:
- Arduino Decimilia w/protoshield (from adafruit)
- Lynxmotion SSC-32 Servo controller
- 6 - Hitec HS-645MG Servos
- 6 - Hitec HS-322HD Servos
- 6 - sets of pan/tilt servo brackets
- ~2 feet of 1/2" PVC Tubing
- lots of little miscellaneous screws, washers, nuts, and bolts ammounting to around $5 at your local hardware store
Right now I'm just writing functions for things like walking that take speed, direction, and turning radius into consideration.
I'm trying to make it nice and simple to use so I can start writing AI without having to relearn my own code (that means comment galore)
Next up:
Adding sensors to give the little lady an idea of her surroundings. Did I mention this particular hex is a gentle fun-loving young female who enjoys walks on the beach and firefighters? Her name is baby, and I have to say she's definately entered the awkward teenaged years about now (notice stumbling all over the computer equipment and cables in the video).
Posted on
Wednesday, April 30, 2008
4
comments
Arduinos & servos & batteries: oh my!
So you want to control more than 2 servos with your arduino... you're in luck! I'm about to tell you how to do it!
A little bit about servos:
- Whether you're using a separate power supply for the servo or not, all grounds (black servo wire) must be connected together. That includes the ground of the arduino, the ground of the servo, and the ground (negative side) of the battery or power supply.
- Using a separate battery to power the servos is usually a good idea if you're using more than 2 servos. Otherwise you risk damaging your arduino.
- Most servos expect between 4.5V and 6V on the red lead (center pin), and a signal on the yellow or white lead to indicate position. This signal is called Pulse width modulation (PWM)
OK, let's say you have:
- 6 servos
- Arduino with proto-shield
- A battery of ample size to power the servos

so here's how you'd hook up the first servo:

Now the servo has power, everything is grounded, and we're all set to start telling the servo what to do... Looks like we need to write some code! If you're not familiar with programming there is a great tutorial from ladyada. Otherwise... just use the Reference Page when you're unclear on something.
First we need to define some constants. This makes it easy to read the code, and also lets you change the value without going through all your code:
Now whenever a function requires the pin number of the servo, we'll put servoPin instead.#define servoPin 1
The next thing we need to do is create two functions. They're required and without them nothing will happen. They functions are called setup and loop:
void setup() {
}
void loop() {
}First the arduino runs the function called setup one time then proceeds to run the funtion loop over and over until the arduino is turned off. We're going to use the setup function to set Digital pin 1 as an output since that only needs to be done once.void setup() {
pinMode(servoPin, OUTPUT);
}Now we need to send the servo a pulse every 20ms so here's how to do it: We need a variable to store the time of the last pulse. We'll call it lastPulse. We need to declare it outside the functions because if you declare it inside the setup function the loop function won't be able to see it; this is called variable scope. I'm going to put the variable declaration just above the setup function:Now we just check if 20ms have passed, and if they have, send a pulse to the servo:long lastPulse = 0;
void setup() {
...
The millis() function is essentially a timer. It tells you how much time has passed since the arduino was turned on. if the last pulse happened at 20 ms, and it's currently 35 ms... the arduino will skip the loop and try again, whereas if the last pulse was as 20 sec and it's currently 41ms the arduino will run the code inside the brackets.void loop() {
if (millis() - lastPulse > 20) {
...
}
}
Now it's time to send the pulse!
The first digitalWrite() sets pin 1 to high (5V), which begins the pulse. It then waits the duration of the pulse width, 1500us in this case, and then sets pin 1 back to low (0v/Ground). There's your pulse!digitalWrite(servoPin, HIGH);
delayMicroseconds(1500);
digitalWrite(servoPin, LOW);
One more thing: you need to save the time at the time you sent the pulse so we know how long to wait before we send another:
Here's the program so far:lastPulse=millis();
Now we have some solid code to make one servo move to the middle of it's range and stay there.#define servoPin 1
long lastPulse = 0;
void setup() {
pinMode(servoPin, OUTPUT);
}
void loop() {
if(millis() - lastPulse > 20) {
lastPulse=millis();
digitalWrite(servoPin, HIGH);
delayMicroseconds(1500);
digitalWrite(servoPin, LOW);
}
}
To add the other 5 servos you just hook them up to the 6V Battery in parallel, while making sure to keep everything grounded. Then you hook up each servo's PWM lead to it's own digital i/o pin.

Lets say we want to set each servo to different set values:
Servo 1: 1000us
Servo 2: 1200us
Servo 3: 1400us
Servo 4: 1600us
Servo 5: 1800us
Servo 6: 2000us
Now the code is:
Not very elegant... but it works.#define servo1Pin 1
#define servo2Pin 2
#define servo3Pin 3
#define servo4Pin 4
#define servo5Pin 5
#define servo6Pin 6
long lastPulse = 0;
void setup() {
pinMode(servo1Pin, OUTPUT);
pinMode(servo2Pin, OUTPUT);
pinMode(servo3Pin, OUTPUT);
pinMode(servo4Pin, OUTPUT);
pinMode(servo5Pin, OUTPUT);
pinMode(servo6Pin, OUTPUT);
}
void loop() {
if(millis() - lastPulse > 20) {
lastPulse=millis();
digitalWrite(servo1Pin, HIGH);
delayMicroseconds(1000);
digitalWrite(servo1Pin, LOW);
digitalWrite(servo2Pin, HIGH);
delayMicroseconds(1200);
digitalWrite(servo2Pin, LOW);
digitalWrite(servo3Pin, HIGH);
delayMicroseconds(1400);
digitalWrite(servo3Pin, LOW);
digitalWrite(servo4Pin, HIGH);
delayMicroseconds(1600);
digitalWrite(servo4Pin, LOW);
digitalWrite(servo5Pin, HIGH);
delayMicroseconds(1800);
digitalWrite(servo5Pin, LOW);
digitalWrite(servo6Pin, HIGH);
delayMicroseconds(2000);
digitalWrite(servo6Pin, LOW);
}
}
What we could do is write a function to send the pulse:
void sendPulse(int pinNumber, int pulseWidth) {
digitalWrite(pinNumber, HIGH);
delayMicroseconds(pulseWidth);
digitalWrite(pinNumber, LOW);
}Now the loop function looks like this:void loop() {
if(millis() - lastPulse > 20) {
lastPulse=millis();
sendPulse(servo1Pin, 1000);
sendPulse(servo2Pin, 1200);
sendPulse(servo3Pin, 1400);
sendPulse(servo4Pin, 1600);
sendPulse(servo5Pin, 1800);
sendPulse(servo6Pin, 2000);
}
}That's much better!Here's the finished program... happy coding!
#define servo1Pin 1
#define servo2Pin 2
#define servo3Pin 3
#define servo4Pin 4
#define servo5Pin 5
#define servo6Pin 6
long lastPulse = 0;
void setup() {
pinMode(servo1Pin, OUTPUT);
pinMode(servo2Pin, OUTPUT);
pinMode(servo3Pin, OUTPUT);
pinMode(servo4Pin, OUTPUT);
pinMode(servo5Pin, OUTPUT);
pinMode(servo6Pin, OUTPUT);
}
void loop() {
if(millis() - lastPulse > 20) {
lastPulse=millis();
sendPulse(servo1Pin, 1000);
sendPulse(servo2Pin, 1200);
sendPulse(servo3Pin, 1400);
sendPulse(servo4Pin, 1600);
sendPulse(servo5Pin, 1800);
sendPulse(servo6Pin, 2000);
}
}
void sendPulse(int pinNumber, int pulseWidth) {
digitalWrite(pinNumber, HIGH);
delayMicroseconds(pulseWidth);
digitalWrite(pinNumber, LOW);
}
Next time I'll be posting an example of how to use external input to control the servos!
Posted on
Wednesday, March 12, 2008
3
comments
Tags: arduino, batteries, battery, multiple servos, servo