Low power wireless standards combined with low cost, ultra-miniature LEDs, sensors and communications devices has made smart lighting a catalyst for the Internet of Things and home automation.
In this tutorial we'll see how to control a NeoPixel LED strip via mobile using the VIPER App, that shows a color picker and a menu for the selection of various pre-configured animations.
Step 1: Required Material
The project requires few elements:
- VIPER IDE: a multi-platform and browser-based Python development environment with cloud sync and board management features. No matter which OS you use, VIPER runs! Just download VIPER and install it (http://www.viperize.it/download/).
- VIPER APP: the VIPER mobile interface for smart objects and IoT systems. Any mobile will become the objects display and remote controller. Download:http://bit.ly/ViperApp
- TOI Shield (available here: http://bit.ly/TOI_Shield-Futura_Shop ). A ready to use multi-sensors board that adds smart functions to your everyday life objects
- Arduino DUE or ST Nucleo F401RE or Particle Photon. or UDOO. No matter which board you use, VIPER is multi-board compatible! You can find all the supported boards details in the dedicated section of the VIPER documentation: http://doc.viperize.it/0.2.0.0009/supported_boards...
- If you not use Particle Photon (which has a wifi module onboard), you need an element that connects the board to the web, such as the wi-fi shield ofAdafruit. However you can use any other adapter that mounts the wifi chipCC3000 Texas Instruments (http://www.ti.com/product/cc3000).
- a strip (or a ring) of NeoPixel LEDs from Adafruit (available herehttps://www.adafruit.com/products/1426)
- a glass or 3D printed lamp. The choice is yours.
Step 2: Assembling
- Just piggyback the wifi Shield and the TOI Shield onto your Arduino (or ST Nucleo or UDOO). If you use Particle Photon just piggyback it onto the dedicated connectors on the TOI Shield.
- Connect the NeoPixel LEDs to the related port on the TOI Shield.
- Put all the boards and the LEDs into the Lamp.
Step 3: Programming
Using VIPER is very easy!
- connect and "viperize" your board (already explained herehttp://www.instructables.com/id/A-multithreaded-bl...)
- create a new project in VIPER (already explained herehttp://www.instructables.com/id/IoT-Notes-Printer-... )
Attention: you need to create 3 (+1) files: main.py, animation.py, template.html (and project.md)
- copy the code presenting here https://github.com/viper-dev/projects/tree/master/...
- upload the code on your board and you're done!
After turning on the lamp, this will automatically connect to the preset network.
Then just open the VIPER App, which will go in search of "viperized" objects connected to the network, select the object of interest, in this case the "VIPER Lamp", and you can interact with it! In this case the VIPER App shows a color picker and a menu for the selection of various pre-configured animations.
The code is very simple and has a lot of comments. For any questions or suggestions please feel free to post on the VIPER community forums:http://community.viperize.it/
Step 4: Make IoT brighter!
Did you like it? Let’s get hardcore!
The TOI Shield presents a set of sensors and actuators, including sensors for touch detection, infrared LED, microphone, light sensor and temperature sensor. You can start from this very simple example code to develop the behavior you prefer. Use the TOI Shield to extend the functionalities of the Lamp and #viperizeit!
Luigi F. Cerfeda (@L_F_Cerfeda) - VIPER team