Introduction: Smart Selfie With Arduino Esplora
This instructable is created by Rami Baddour, as a small prototype on how to setup the Arduino Esplora with couple of servo motors to remotely take pictures using your mobile's camera.
The name "Smart Selfie" was mentioned as a joke by an anonymous student participating in 10 year anniversary of the Universita della Svizzera italiana, where the prototype was first used, i liked it and adopted it.
Originally, I was checking how to use the Arduino Esplora I/O Tinkerkit connectors to read/write from/to external sensors/actuators. Here we make use only of the two Esplora digital outputs together with some of the LCD socket pins. As both the Esplora outputs supports PWM signals, it is quite straight-forward to be used to control a low-power servo motor. Later, we needed to connect a third servo for the picture shot mechanism, and we did that with a nice trick.
We can control the speed of movement (with the Potentiometer), move up-down and left-right (using the joystick), fix position (Switch 2), take picture (Switch 1) and reset to initial position (Swtich 3).
Step 1: Prepare Hardware
For the project we need the following hardware:
- Arduino Esplora board
- Arduino Tinkerkit Servo Motor
- SparkFun Pan/Tilt Bracket including 2 Servos (or similar)
- Touch stylus tip
- Connection wires
For powering up the project, I used USB power to the Esplora, no need to external batteries (unless you wanted to).
Step 2: Fixing Parts:
No special requirements here, just mount the bracelet to any stand which can handle the weight of your phone (I had to ask my minion for help ;) ) , and have it's front side free so the phone can move freely.
for the touch tip, tack all you need is only the rubber head (possibly with the metal ring around), and attach that to the head of your Tinkerkit servo's arm.
If you want, you can have extension cable (not necessary).. Thus, I fixed the servos' connectors aside on the mounting base for easiness of connection later.
Step 3: Connecting With Esplora
Basically, Arduino Esplora board has two Tinkerkit digital PWM outputs, connected to D3 and D11, each has three pin connector with (+5V, Data, GND) pins (in order from left to right). These two connectors will be used to control the two servos of the tilt/pan bracelet.
Note: take care of the pin order of your servos. usually, Tinker kit connectors has the data pin in the middle of Vcc and GND pins, while non-Tinkerkit servos has the order as (GND - Vcc - Data), so you may need to invert the Vcc and Data pins on your servo's connector.
Now, for the image shooting mechanism, we need additional servo, which basically will do only a 90 degree move back and forth to simulate a finger click on the. To do this, we need to exploit the Esplora LCD extension socket pins.
Here we will connect the third servo to GND, 5V and pin D1 (the first three bottom pins on the right socket).
Step 4: Code
In the code section, we programmed the following settings:
- the initial angles on the X,Y servos are set to 90, 45 degrees in order.
- to control the servos, you can use the Esplora joystick, the more you drag the joystick to the side the faster the servos will respond.
- you can control the overall speed of the servos using the Esplora slider.
- to tack a picture, click the joystick button
- to return to default position, click Button1 (Switch 1) on the Esplora.
- to reset to new default position, press Button1 for one second, you will hear a beep and the current position will be stored as the default position.
- shutter mechanism (controlling the third servo over the pin D1) is done by simulating a PWM signal using counters and sending different trains of 0s and 1s of 20ms length to the output pin
We have a be nice policy.
Please be positive and constructive.