Arduino Project- to Remember You to Bring Your Thing
by Weberwu in Circuits > Arduino
279 Views, 4 Favorites, 0 Comments
Arduino Project- to Remember You to Bring Your Thing
By: Weber Wu
This year, I am having a Arduino class, I told my teacher that I want to make a device that Let me to Bring My things. I want to make this device is because I like to play golf, but I sometimes forgot to bring the card. ( The card is to buy the practice golf balls, I sometimes forget to bring it. )
So, this time I want to make this Arduino Device.
Supplies
These are the supplies I use to make this Arduino Device:
1. A Arduino Leonardo Board
2. Servo motor
3. 12 cm electric wire
4. 30 cm electric wire
5. solderless breadboard
6. Ultrasonic sensor
7. A Shoebox
Put the Arduino Leonardo Board and Breadboard in a Shoebox and Cut Holes to Let the Wire Out
This is step 2 on my Arduino project.
The materials that we need to use in step 2:
- shoebox
- Arduino Leonardo Board
- Breadboard
In this step, we need to put the Arduino Leonardo Board and the Breadboard in the shoebox, and poke 2 holes and the left and right in the shoebox, so we can put the wires in the holes and out.
Put the Electric Wires to the Servo Motor, Ultrasonic Sensor, Arduino Board, and Breadboard
This is step 1 of my Arduino Project.
In Step 1, the materials that we need to use is:
- Servo motor
- Ultrasonic sensor
- 2 12 cm electric wire
- 30 cm electric wire
- Arduino Leonardo board
- Solderless Breadboard
In the First Step, we need to put the 30 cm electric wire to the Servo motor and the Ultrasonic sensor.
And put the 12 cm electric wire from the Arduino Leonardo board to the solderless breadboard.
Last, put the 30 cm electric wire to the Arduino Board and the Solderless breadboard.
Make the Shoe Cabinet a Lock
Materials for step 3:
- Cardboard ( to make the lock )
- servo motor
- Ultrasonic Sensor
step 3, I make the shoe cabinet a lock so I can control it lock or unlock. And I make a hole in the shoebox and put the golf card in the hole, and use the Ultrasonic sensor to sensor if the Ultrasonic sensor is shorter to (<) 10 cm, then the lock will be locked but if the sensor is longer or same as (>=) 10 cm, it will be unlocked. and when we finished that, we can test it and let it work!
Write the Arduino Code
Materials I use in this step:
- Arduino
- Ardublock
I use Ardublock to make this Project, Ardublock is in Chinese, so sorry for the inconvenience. Thank you.
This is the link I use when it translated to English:
#include <Wire.h>
#include <LiquidCryctal_12C.h>
#include <Servo.h>
// For these LCD controls to work you MUST replace the standard LCD library from... // https://github.com/marcoschwartz/LiquidCrystal_I2... // Direct download https://github.com/marcoschwartz/LiquidCrystal_I2... // Your project will not compile until this is done. LiquidCrystal_I2C lcd_I2C_27(0x27,16,2); // set the LCD address for a 16 chars and 2 line display int UltrasonicSensorCM(int trigPin, int echoPin) //Ultrasonic Sensor Code Auto Generated Return CM max distance 200 { long duration; pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(20); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); duration = duration / 59; if ((duration < 2) || (duration > 200)) return false; return duration; }
Servo servo_pin_10; // create servo object to control a servo
void setup(){ // put your setup code here, to run once: lcd_I2C_27.init (); // initialize the lcd lcd_I2C_27.backlight(); digitalWrite( 6 , LOW ); //set ultrasonic sensor trigPin
servo_pin_10.attach(10); // attaches the servo on pin to the servo object }
void loop(){ // put your main code here, to run repeatedly: lcd_I2C_27.setCursor(0 , 0) ; // set the cursor, counting begins with 0 lcd_I2C_27.print( "Distance:" ); // Print a message to the LCD. lcd_I2C_27.setCursor(0 , 1) ; // set the cursor, counting begins with 0 lcd_I2C_27.print( UltrasonicSensorCM( 6 , 7 ) ); // Print a message to the LCD. lcd_I2C_27.setCursor(4 , 1) ; // set the cursor, counting begins with 0 lcd_I2C_27.print( "cm" ); // Print a message to the LCD. if ( UltrasonicSensorCM( 6 , 7 ) < 50 ) { servo_pin_10.write( 150 ); // tell servo to go to position } else { servo_pin_10.write( 90 ); // tell servo to go to position } delay( 2000 ); // waits a few milliseconds }q
Upload My Arduino Code and Let My Arduino Work
This is my Arduino Project- to Remember You to Bring Your Thing. If you like it, please press Favorite on my instructable. Thank You!