Introduction: Desktop Book Stand
This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com)
As an engineering student, I spent a lot of my time at home studying and completing homework at my desk. Sometimes, I have a hard time reading my textbook because I have to lean over it to avoid a glare or so I can read words at the far end of the page. That inspired me to create a desktop book display that would position the book in a way so that it would be easy to read.
If you follow this instructable, you'll be able to have your own desktop book display as well!
Step 1: Gather Supplies and Tools
Supplies:
- 1/2" wood board
- 1/4" wood board
- Arduino Uno
- Elegoo Dupont Wires
- 3 Smraza servo motors
- 4 wood screws (3/4" long)
- Push pins with flat tops
- LED light
- HC-SR04 Proximity Sensor
- Small nails
- 9-volt battery
- Small plastic box
Tools:
- Saw
- Screwdriver
- Hammer
- Laser Cutter
Step 2: Create Parts
Base:
The base is made from the 1/2" wood board. The length and width are 12" x 8".
The following parts I made using a laser cutter with the 1/4" wood board, but can be cut out using saws.
Table:
The table is 8"x11" with pins in each corner that are 1" long and 1/4" wide
Link:
The two links are 1" wide and 6" from the center of the semicircle to the center of the other semicircle. The hole on one end has a 0.4" diameter.
Pin-in-slot:
The two pin-in-slots are 1" wide and 8" long. The slot in the middle is 0.5" wide and 6" long.
Light arm:
The light arm is 1" wide and 6" from the top flat end to the center of the semicircle.
Step 3: Assemble Parts
Pin-in-slot:
The pin-in-slots can be screw into the back corners of the two small sides of the base using the wood screws like the picture above.
Servo for the light:
The servo for the light is screwed into the very middle of the back edge of the base. The light can be attached to the arm by drilling a small hole through the arm at the top and putting the wires through the hole.
Servos for table:
The two servos are screwed into the sides of the base. They should be positioned 1.65" from the back side of the base.
Links to servos:
The links can be attached to the servo arms by putting push pins through the small holes of the servo, then into the link. You may have to bend the top of the push pins in order for them to fit.
Proximity sensor:
The proximity sensor is attached to the center of the front of the base using push pins as shown.
Button:
Create two small holes that are about the same or smaller than the wires of the button. Insert two wires from one side of the button and it should remain steady.
Table:
Insert the pins of the table into the holes of the two links and the holes of the two pin-in-slots.
Step 4: Setup the Control System
The picture from Fritzing shows how the servo motors, proximity sensor, light, and button are connected to the Arduino. The two left servo motors are the motors that raise the table while the rightmost motor raises the light arm. This picture should show you how to wire your book display to the Arduino.
The block diagram above lays out how the different components of the book display work together.
It is recommended to put the Arduino, breadboard, and power source in a box on its own to make the book display cleaner.
Step 5: Create Your Arduino Sketch
Below is the Arduino sketch that I used in my project. The comments should explain more clearly how each of the parts of the control system connect and work together.
#include
#define echoPin 12
#define triggerPin 11
#define button 2 //button to turn on light and light arm servo
#define servo1 3 //table servo
#define servo2 5 //table servo
#define servo3 7 //light arm servo
#define ledPin 9 //light
Servo myservo1; //First servo for table
Servo myservo2; //Second servo for table
Servo myservo3; //Servo for light arm
byte buttonState; //variable for reading button1 on/off
int armon=-1; // shows that the light arm is initially off
void setup() {
Serial.begin(9600);
// Proximiety Sensor setup
pinMode(echoPin, INPUT);
pinMode(triggerPin, OUTPUT);
//Servo setup
myservo1.attach(servo1); //First servo for table
myservo1.write(80); //Starts at 90 degrees
myservo2.attach(servo2); //Second servo for table
myservo2.write(100); //Starts at 90 degrees
myservo3.attach(servo3); //Servo for light arm
myservo3.write(90); //Starts at 90 degrees
// Button setup
pinMode(ledPin, OUTPUT); // Declares the light as an output
digitalWrite(button, LOW);
pinMode(button, INPUT); // Declares the button as an input
digitalWrite(button, HIGH);
}
void loop() {
// Proximety Sensor loop
Serial.print("Distance:");
digitalWrite(triggerPin, HIGH); //sends a pulse
delayMicroseconds(10);
digitalWrite(triggerPin, LOW); //receives pulse
int distance = pulseIn(echoPin, HIGH); // reads pulse sent back by sensor
distance=distance/58; // changes distance to cm
Serial.print(distance);
Serial.print("\n");
delay(500);
// Servo loop for table
if (distance <=30) { //if object is closer than 30 cm, the servos will turn
myservo1.write(70); //servo1 final position
myservo2.write(110); //servo2 final position
}
else {
myservo1.write(80); //servo1 initial position
myservo2.write(100); //servo2 initial position
}
// Button, light, & Servo loop
buttonState=digitalRead(button);
if (buttonState == LOW && armon==-1) {
myservo3.write(10); //the light arm is at its upright postion
digitalWrite(ledPin, HIGH); //the light is on
armon=-armon; //changes the on/off of the arm
}
else if (buttonState == HIGH && armon==1) {
myservo3.write(10); //the light arm is at its upright postion
digitalWrite(ledPin, HIGH); //the light is on
}
else if (buttonState == LOW && armon==1) {
myservo3.write(90); //the light arm is at its resting postion
digitalWrite(ledPin, LOW); //the light is off
armon=-armon;
}
else {
myservo3.write(90); //the light arm is at its resting postion
digitalWrite(ledPin, LOW); //the light is off
}
}
Step 6: Test, Troubleshoot, Then Enjoy!
Test and troubleshoot your completed book display. If something is not working, look at these three suggestions.
Suggestions:
- Make sure that you have written your code correctly (make sure you have all your semicolons, defined your variables correctly, included Servo.h).
- Check to see if you have wired your Arduino correctly. Make sure you have power to every component and the wires are in the correct inputs.
- Make sure your wires work. Test each wire before you use it by inserting the wire into the positive and negative terminals. If the Arduino shuts off, then current can flow through the wire and it can be used. If not, then current cannot flow through the wire and it should not be used.
When you have worked out any possible kinks, you're done!
Enjoy!