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 Zerynth 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:
- Zerynth Studio: a multi-platform and browser-based Python development environment with cloud sync and board management features. No matter which OS you use, Zerynth runs! Just download Zerynth Studio and install it.
Zerynth App: the Zerynth mobile interface for smart objects and IoT systems. Any mobile will become the objects display and remote controller.
Zerynth Shield: A ready to use multi-sensors board that adds smart functions to your everyday life objects
- Arduino DUE or ST Nucleo or Particle Photon or UDOO or Flip&Clip by Mikroelektronika. No matter which board you use, Zerynth is multi-board compatible! You can find all the supported boards details here.
- 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 of Adafruit. However you can use any other adapter that mounts the wifi chip CC3000 Texas Instruments (http://www.ti.com/product/cc3000).
- a strip (or a ring) of NeoPixel LEDs from Adafruit (available here https://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 Zerynth Shield onto your Arduino (or ST Nucleo or UDOO). If you use Particle Photon just piggyback it onto the dedicated connectors on the Zerynth Shield.
- Connect the NeoPixel LEDs to the related port on the Zerynth Shield.
- Put all the boards and the LEDs into the Lamp.
Step 3: Programming
Using Zerynth is very easy!
- connect and "virtualize" your board (already explained here https://www.instructables.com/id/A-multithreaded-bl...)
- create a new project in Zerynth Studio (already explained here https://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
- 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 Zerynth App,which will go in search of Zerynth objects connected to the network, select the object of interest, in this case the "Zerytnh Lamp", and you can interact with it! In this case the Zerynth 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 Zerynth community forums.
Step 4: Make IoT Brighter!
Did you like it? Let’s get hardcore!
The Zerynth 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 Zerynth Shield to extend the functionalities of the Lamp!
Luigi F. Cerfeda (@L_F_Cerfeda) - Zerynth team