Project tutorial
Mother's Day Gift

Mother's Day Gift

Here is a special box that opens itself and rotates a mobile inside, then LEDs, music, camera and twitter will be turned on.

  • 662 views
  • 0 comments
  • 3 respects

Components and supplies

About this project

Since Mother's Day is in those few days:

video of the project

We should be ready to give our mothers what leads her to know how much we love them. All the traditional ideas are those such as buying her gifts like kitchen tools, cloths, house instruments, etc. So we don’t typically make anything special for that day. Here is a special box that opens itself. Inside is a rotating mobile and LEDs, which can be positioned as whatever we want to write, draw or say when lit. After that, music will be turned on from the mobile. Finally, the camera flash will be opened and take a photo and then upload it on twitter with a caption "happy mothers' day". In that video, I used the laptop as a power supply for the Arduino, so you can use a 5V battery connected the the Arduino.

Cschematic of project circuit omponents:

  • Arduino UNO
  • 1Sheeld
  • Servo motor
  • 11 Red LEDs
  • Breadboard

Follow this tutorial for how to 1Sheeld with Arduino: https://1sheeld.com/tutorials/getting-started/

The Servo Motor

Servo motor has 3 pins:

  • VCC, which is the red one, is connected to the 5V pin.
  • GND, which is the black and brown one, is connected to the GND of the Arduino.
  • Signal pin, which is the yellow one, is connected to any digital pin of the Arduino - here I have connected it to pin 9.

The LEDs

I chose red LEDs for the event. It's easy to connect the LEDs to the Arduino. The positive terminals of then are connected to digital pins 13, 12, 11, 10, 8, 7, 6, 5, 4, 3 and 2. And the negative terminals of them are connected to common GND on the breadboard.That’s easy to assemble, as we see:

About the process

Let's imagine what we want to do to determine the shields we need in our project. Here we want the box to be opened by rotating the mobile phone in the direction of the X-axis.

Then the LEDs, which are positioned as whatever we want to write, draw or say, will light, music will play from the mobile, and finally the camera flash will open, taking a photo and uploading it to twitter with a caption "happy mothers' day". So when we decide what we want to do, it becomes easy.

The Box

The box I used is made from carton and was covered. The trick that makes it open is not only the servo motor, but there's a hidden knob behind the box which is tied to the upper surface of the box and attached to the back side.

And I bought a small piece of metal and fixed it on the servo blades using wax.

The Coding

This is the code:

And here is the PDF of the project: http://www.mediafire.com/file/7txu86ikc591zuu/project.pdf

And here's another video:

Code

Arduino codeArduino
/*mothers' day project*/


#define CUSTOM_SETTINGS
#define INCLUDE_ACCELEROMETER_SENSOR_SHIELD
#define INCLUDE_MUSIC_PLAYER_SHIELD
#define INCLUDE_CAMERA_SHIELD
#define INCLUDE_TWITTER_SHIELD
/* Include 1Sheeld library. */
#include <OneSheeld.h>
#include <Servo.h>
/* create servo object to control a servo*/
Servo myservo;
int pos = 0;

void setup() {
  // put your setup code here, to run once:
  /* Start communication. */
  OneSheeld.begin();
  /* attaches the servo on pin 9 to the servo*/
  myservo.attach(9);
  /* Set the LEDs pin as output. */
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(2, OUTPUT);

}

void loop() {
  // put your main code here, to run repeatedly:
  /*create a variable which it puts the values of accelerometer in*/
  float X = AccelerometerSensor.getX();
  /*multiply the values of X in (360/18)((angles of rotaion/maximum position of the servo in X axis))*/
  myservo.write(X * 20);
  /* Check X-axis acceleration. */
  if (X > 8)
  {
    /* Set the volume. */
    MusicPlayer.setVolume(5);
    /* Turn on the music. */
    MusicPlayer.play();
    /* Wait for 300 ms. */
    OneSheeld.delay(300);
    digitalWrite(13, HIGH);
    digitalWrite(12, HIGH);
    digitalWrite(11, HIGH);
    digitalWrite(10, HIGH);
    digitalWrite(8, HIGH);
    digitalWrite(7, HIGH);
    digitalWrite(6, HIGH);
    digitalWrite(5, HIGH);
    digitalWrite(4, HIGH);
    digitalWrite(3, HIGH);
    digitalWrite(2, HIGH);
    /* Turn on the camera flash. */
    Camera.setFlash(ON);
    /* Take the picture. */
    Camera.rearCapture();
    /* Wait for 20 seconds. */
    OneSheeld.delay(20000);
    /* Post the picture on Twitter. */
    Twitter.tweetLastPicture("Posted by @1Sheeld and @Arduino,happy mothers' day ");


  }
}

Schematics

schematic of project circuit
Fwezqv6j0ief4u2 9zna5ddzef

Comments

Similar projects you might like

Heartbeat Lamp - Mother's Day Gift

Project showcase by TheTNR

  • 546 views
  • 0 comments
  • 0 respects

ATTiny Dice Christmas Gift Project

Project in progress by wrightmac

  • 1,292 views
  • 1 comment
  • 3 respects

SMS your Home

Project tutorial by Mohamed Hassan AbdulRahman and Abdulrahman Elsharqawy

  • 5,425 views
  • 0 comments
  • 14 respects

Ergonomic Chair Using Arduino

Project tutorial by Mona Mohamed

  • 1,113 views
  • 0 comments
  • 0 respects

4 bit up/ down counter using 1sheeld

Project tutorial by Maha Raafat

  • 3,258 views
  • 1 comment
  • 18 respects
Add projectSign up / Login