A Simply Useless Machine - USB Powered.
by drharishkumark in Circuits > Arduino
399 Views, 3 Favorites, 0 Comments
A Simply Useless Machine - USB Powered.
A useless machine - USB powered and using a plastic hand off an old doll. Plywood box and Arduino Uno circuitry. There are so many varieties out there ranging from multiple switches to one that has wheels.
I made one based on rsucgang. I made it simpler than his with a single servo motor without the need for a battery. I used the USB cable to directly power the circuit.
Downloads
Supplies
Wood related:
- 16 x 16 cm plywood 1.2 cm thick x 6
- Saw
- Wood glue or screws to put the box together.
- Drill
- 2 pcs of small hinges and screws
- Sandpaper
- Paint (colour of your choice)
- Dremel (if available). Else use chisel and hammer and knife to fine-tune your woodwork.
Arduino/ circuit related
- Arduino UNO
- Laptop (I use a Macbook)
- Arduino software - https://www.arduino.cc/en/software
- 10k ohm resistor
- small SPDT switchservo motor
- Hookup wires/ jumper wires male to male
- Mini Solderless Breadboard
- Wire stripper
Circuitry and Programming the Arduino
Download the Arduino software for your computer and run it
Connect the Arduino UNO to the computer using USB cable. For more info, check out: http://arduino.cc/en/Guide/MacOSX
Below is the code I used to program the Arduino
There are loads of variations you could do like random/ variable timing and move the arm to control the lid and so on.
The code given below is a simple one with a single function to switch off the button, but randomises the time taken for the servo to return to the original position.
========== CODE BELOW ========
// Sweep
// by BARRAGAN <http://barraganstudio.com>
// This example code is in the public domain.
#include <Servo.h>
const int buttonPin = 2;
int buttonState = 0;
Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
int pos; // variable to store the servo position
long timeDelay;
void setup()
{
pinMode(buttonPin, INPUT);
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop()
{
buttonState = digitalRead(buttonPin); // Read the button position
if (buttonState == HIGH) {
for(pos = myservo.read(); pos >=20; pos -= 1) { // goes from 90 degrees to 20 degrees in 1 step
myservo.write(pos); // tell servo to go to position in variable 'ONpos'
// randomize wait time for the servo to reach the position
}
}
else {
timeDelay = random(1, 4);
for(pos = myservo.read(); pos <=180; pos += timeDelay) {// goes from 20 degrees to 90 degrees in 1 step
myservo.write(pos); // tell servo to go to position in variable 'OFFpos'
delay(15); // randomize wait time for the servo to reach the position
}
}
}
Making the Wooden Box
- Glue the plywood at the edges to make the box. 5 sides only. Leave the lid for the end
- Clamp.
- Use self-tapping screws (if necessary)
- Cut the lid at a 45 degree angle across the midline.
- Place arduino board and screw it to the floow.
- Drill the hole for the USB port in the side accordingly. (If you are using a battery to power your project, skip this step)
- Paint the box with a colour of your choice.
- Screw in two hinges on the side that opens
My wooden box was simple with simple joinery.
I glued all the plywood boards together. If you want to use screws or complex joineries, you could experiment.
The size chosen was to accommodate for enough space inside for the moving parts as well as circuit placement.
Just make sure you don't make the box too small.
Since it is a USB-powered circuit, I screwed the Arduino to the floor of the box and then drilled a hole where the USB of the Arduino board was sticking out as shown in the pic.
The lid needs to be cut at a 45-degree angle to accomodate for opening when the servo arm curves up to switch itself off.
Mounting the Servo Motor
- Mount servo motor onto a wooden piece.
- Stick this wooden piece onto the lid just below the switch.
Making the Wooden Arm
The wooden arm design depends on its most crucial function - Pushing the switch off.
Therefore, before designing the wooden arm,
- Make a cardboard cutout first.
- Figure out the angles and the curves required.
- Arc of rotation by changing the angles in the arduino code.
- Then you could finally trace the cardboard cutout onto wood and then proceed to cut it.
Woodwork: (use either plywood or icecream sticks) I used plywood
- Plywood/ regular wood. Thick enough to push the switch.
- Cut the wood (chisel and saw) or a jigsaw. I used a chisel and saw.
- Sand the piece and make the curves smooth
- I drilled a small hole the diameter being slightly less than the servo arm
- I fixed the servo arm into this wooden piece using glue.
Power the Circuit and Voila!
I used the USB cable to power the circuit and voila, the useless machine is ready.
This was both my first Arduino as well as woodworking project. Thoroughly enjoyed it.