CameronT
Published

Where am I? Photo Frame that Shows your Location

This device points to your location in a picture frame.

IntermediateFull instructions provided4 hours1,920
Where am I? Photo Frame that Shows your Location

Things used in this project

Hardware components

Photon
Particle Photon
×1
Breadboard - Green - 170 Points
×1
Mini Servo - Emax ES08A
This one also came in the Particle Maker Kit - https://store.particle.io/collections/shields-and-kits
×1
Male/Male Jumper Wires
I used jumper wires to connect the servo connector to the breadboard. If you had the right equipment (wires/connectors) I'd suggest soldering or making clip in leads to make it more secure.
×1

Software apps and online services

IFTTT - Android Location
This detects when you change locations or enter/exit areas.
IFTTT - Particle
This moves the servo by calling a Function on the Particle device when IFTTT - Android location detects your location change
Particle Build Web IDE
Particle Build Web IDE
Use this to configure your particle with the custom code.

Hand tools and fabrication machines

Box Cutter
Use this to cut a space for your servo to fit into the frame.

Story

Read more

Schematics

Image Wiring Diagram

Wiring Diagram

Rear Photo

Code

Code used

C/C++
This code is used to:
1. Setup the servo
2. Set the pin D0 to control the servo
3. Create a function we can trigger from IFTTT
4. Set the function to move the servo to the position we specify via IFTTT
Servo myservo;  // create servo object to control a servo
                // a maximum of eight servo objects can be created
 
int pos = 0;    // variable to store the servo position
 
void setup()
{

//Setup the Servo to the function 
Spark.function("servo", updateServo);
//Set pin D0 to be an output
pinMode(D0, OUTPUT);
//Attach the servo to D0
myservo.attach(D0);
//Take control over the LED on the board
RGB.control(true);
//Turn off the LED - we dont want it flashing behind the photo frame at night
//There may be a better way to do this like turning it off, I found it just as easy to set the colour to nothing
RGB.color(0, 0, 0);
}
 
void loop()
{
// We don't need to do anything here
 
}
 
//This function is triggered by IFTTT - the 'command' word represents the object used to store the 'position' we send to the function.
//The 'position' we send represents where we want the servo to move to
int updateServo(String command)
{
//Convert string to integer, the code after this requires the 'command' object to be in a number format. IFTTT however passes the object as a 'string' even if it is a 'number'.
uint8_t pos = command.toInt();
//This tells the servo, attached to D0 to move to the position defined in the 'command' object that was passed when we triggered this function from IFTTT
myservo.write(pos);
//Flash the LED on so we can see that a message has been recieved - just because we can
RGB.color(0, 0, 255);
//Remember to add the delay for 2 seconds, otherwise the LED will just flash for a period of time too small for us to see
delay(2000);
//Now set the LED back to off
RGB.color(0, 0, 0);
//We return something to signify the end of the function - doesn't really matter what it is
return 0;
 

  }

Credits

CameronT

CameronT

2 projects • 4 followers

Comments