Do you want to conserve energy and turn the Christmas tree lights on/off when not required? In IOT era, that can be done using MKR1000.
Things used in this project
Story
This project uses MKR1000 as a REST API server with the help of MKR1000RESTServer library. When POST method on the API is called, it initiates the relay pin in OUTPUT mode. When PUT method is called, the pin is set HIGH/LOW based on the value of the parameter. Effectively it turns the lights on/off.
API
The API on the server can be called using tools such as Postman or using the app source code that is supplied.
Steps:
- Connect the relay and the lights
- Download the MKR1000RESTServer.zip file from the github
- Start Arduino IDE
- Click Sketch Menu -> Include Library -> Add .zip library
- Choose the downloaded library
- Open the solution
- Update your SSID name and password
- Start the serial port monitor
- Build and upload the sketch to the MKR1000. It will print the IP address on the monitor. (e.g 192.168.0.13)
Using the App
To control the lights using the app (iOS, Android, Windows (UWP) platform).
- Download Visual Studio 2015 Community Edition.
- Install the necessary Xamarin Forms extensions.
- Run the app on the connected device.
- Enter the IP address
- Click “Start”. This will return message box with results.
- Switch the light on/off.
Using Postman
If you want to control the lights using Postman, here are the steps:
- Download Postman
- Select the POST verb and enter address as
http://192.168.0.13/Pin3/
- Click send. This will initiate the pin.
- Select PUT verb and enter address as
http://192.168.0.13/Pin3/on/
- Click send. This will turn the lights on.
- Select PUT verb and enter address as
http://192.168.0.13/Pin3/off/
- Click send. This will turn the lights off.