Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

The device's physical mechanism took care of the complexities of motion, which left the circuitry requirements simple. We required a single (albeit powerful)
motor, speed and direction control, and an on/off switch.

An Arduino Uno accepted potentiometer input and mapped it to a 5V output. This was fed to a SaberTooth I motor driver board, which ran our Pololu gearmotor.
We soldered a switch inline with the power cord so we could switch the device on and off while keeping it plugged into the wall.

The housing for the electronics was made from laser-cut 1/8" acrylic, and was designed to fit together without any metal fasteners, instead using puzzle-piece
like shapes. This reduced the chance of shorting out any important electronic components. The acrylic was bonded together with Loctite epoxy.

Our Arduino code used was modified from the AnalogInOutSerial demo. We modified the code so that the motor does not turn when the system is first booting up.

const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
const int analogOutPin = 9; // Analog output pin that the SaberTooth is attached to
int sensorValue = 0; // value read from the pot
int outputValue = 128; // value output to the PWM (analog out). Default to 128 (=2.5V = no motion)

void setup() {
	analogWrite(analogOutPin, outputValue); //write it out so the motor stays still to begin with
}
void loop() {
	// read the analog in value:
	sensorValue = analogRead(analogInPin); 
	// map it to the range of the analog out:
	outputValue = map(sensorValue, 0, 1023, 0, 255); 
	// change the analog out value:
	analogWrite(analogOutPin, outputValue);
	// wait 2 milliseconds before the next loop
	// for the analog-to-digital converter to settle
	// after the last reading:
	delay(2); 
}
  • No labels