Internet of Things - Christmas tree project
With IoT a 2015 buzz word, I thought I would connect my christmas tree to the internet and secure access to it using 2 factor authentication. See below video.
Hardware...
- Arduino Uno
- Ethernet shield
- Relay
- 4-way adapter
Software\Services...
- Arduino IDE 1.6.6
- Pushingbox as an easy way to email out from the project.
- AirWatch 8.2 (kinda!)
Arduino code: Download
Description...
So the code is pretty easy as there are 'includes' available to setup the ethernet fundamentals so that you only then have to give basic information like IP address and MAC address to gain a DHCP address and connect to the internet. The Relay again very simple to implement as you just need to define the PIN that is going to control the on\off function of the relay.
I am using the Arduino as a HTTP server to host the controls in HTML to flick the switch on and off. Arduino code is based on C/C++ so in order to create HTML you need to print lines of HTML using C. This is interesting as there are variables that I wanted to pass from the C code into HTML and JavaScript. It gets tricky as double quotes cannot be sent to HTML as they break in C. So some thought is needed to code using quotes. The switching of the relay is flicked using when the "submit" checkbox in the HTML form is enabled. Using JavaScript this was only enabled if the correct token was entered by the user hence the 2 Factor Auth.
The 2 Factor Auth is again really basic. When the client accesses the HTTP Server a random number is generated in C. This variable is transferred to a JavaScript variable for validation when the user enters the emailed PIN. Also there is a call to pushing box with this random number. Pushing box is a free push notification service that allows you to email, tweet or Push to any platform with a HTTP call. I have used this in the past to mail me when a camera motion detector goes off for example. Calling the API and sending the random number will email me my token.
The end user experience is that I load the HTTP server, a random code is generated and emailed to me. I enter this code from my email into the form and it enables the checkbox to flick the Christmas Tree on and off.
Merry Christmas!!!
Senior Electronics Design Engineer at Haldex Brake Systems
9 年Hi Dave, check out this year's IOT Christmas tree lights. This year I am using a Particle Core to locally sequence the Christmas lights. PWM outputs are used to drive automotive low-side drivers to give the 36V required by the lights. This means that I can re-code the lighting sequence algorithm from any internet enabled device over our wi-fi and read back the local spark variables. Two local potentiometers allow the fade time and dwell at end settings to be adjusted without changing the code. Dad.
Presales Engineer at Okta, really interested in identity management, cloud and infrastructure.
9 年Always learning from you!! Merry Christmas, mate.
Sr. Director, Solutions Engineering, EMEA
9 年WOW!!!! next year cert based auth for your main door. You're the MAN!!!
Technical Product- and Sales Manager Omnissa Modern Private Cloud (MPC)
9 年Awesome!!
EMEA & LATAM Technical Lead, GSI Systems Engineering @ Palo Alto Networks | Cyber Security | DDI | Digital Workspace | EUC | Cloud | SaaS | GRC
9 年You the man Dave!