Hackster is hosting Hackster Holidays, Ep. 5: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 5 on Friday!
Aaron Parecki
Published © CC BY

Magic Checkin Clock

This magic clock moves its hand to show where you last checked in on Foursquare.

AdvancedFull instructions provided2,263

Things used in this project

Hardware components

DragonBoard 410c
Qualcomm DragonBoard 410c
×1
Servos (Tower Pro MG996R)
×1
6-Channel Servo Controller
×1

Software apps and online services

Foursquare API
When you check in, the Foursquare API sends a message to the Amazon API Gateway
AWS API Gateway
Amazon Web Services AWS API Gateway
The API gateway receives the notification from Foursquare and runs a Lambda function
AWS Lambda
Amazon Web Services AWS Lambda
The Lambda service receives the notification from the API gateway and sends it to the MQTT channel via the IoT platform
AWS IoT
Amazon Web Services AWS IoT
The IoT platform sends messages to the clock via MQTT

Story

Read more

Schematics

Clock Circuit Diagram

Wiring the Micro Maestro to the motor

Code

index.js

JavaScript
This AWS Lambda function passes messages from the Amazon API Gateway to the IoT platform
var AWS = require('aws-sdk');
var url = require('url');

exports.handler = function(event, context){
    var client = new AWS.IotData({endpoint: 'xxxxxxxxxxx.iot.us-west-2.amazonaws.com'});
    client.publish({
        payload: JSON.stringify(event),
        topic: 'MagicClock/checkin'
    }, function(err, data){
        if(err) {
            context.fail(err);
        } else {
            context.succeed({published:true});
        }
    });
};

MagicClock

This code runs on the device and controls the clock hands.

Credits

Aaron Parecki

Aaron Parecki

2 projects • 8 followers

Comments