Smart lighting

One of the easy, fun and creative things you can do with IoT.Cafe is to create some colorful interactive lighting.

Be it for the interior of your living quarters, the exterior of your home, for styling a vehicle or for staging an artistic setup - lighting can make wonders, especially when it's reactive to environment or user input and has multiple sources!

  • Control from phone, computer, internet or knobs, switches and remotes - there's many options really. The point is, your smart lights are not limited to a predefined way of control and you're free to improvise
  • Reactive lighting - combine with other IoT.Cafe features like temperature/humidity/air pressure sensors, proximity, sound, motion sensors and so on, to make your lighting environmentally reactive
  • Interactive lighting - depending on what type of control you've choosen to have, you or in general - the users of your device can change in real time whatever properties you've given to your device
  • Motorized lighting - attach lights to moving mechanisms such as servos or stepper motors and control them along with your IoT.Cafe device to create some dynamic lighting
  • Multiple light sources and colors - having multiple light sources and multiple light colors easily makes things look more complex and impressive
  • Programmable - for those who need a very specific functionality for their lighting, remember that your IoT.Cafe devices are fully programmable via the official free and open source libraries

You can control LEDs and RGB lights by using the PWM pins on your main board with a PWM Output peripheral for each color channel.
Note that the pins on your main board can't provide enough power for lighting, so you'd generally need some kind of transistor like MOSFET for each color channel.

You can control other kinds of lights simply as an on/off switch through a relay.
This way you can at least turn on and off conventional AC lighting powered by the mains and decorative lights like incandescent bulbs.

Tips

Here are a few tips for home LED and RGB lighting

  • If you're making color lighting, you may want to add a white LED along with the RGB one - color is all fine, but adding white gives the overall light a more pleasant and natural feel and it can serve not just as a decoration, but as an actual source of illumination
  • For RGB lighting, use the HlsToRgb peripheral - it allows for more intuitive adjustment of the color. Insted of trying to achieve a color you like by directly setting amounts of Red, Green and Blue, you can instead use HlsToRgb and set color by Hue, Lightness and Saturation
  • Use diffused rather than direct lighting - Diffused light is much softer and pleasant. It looks more natural, leaves the light source a hint rather than a blare into your eyes, and doesn't cause sharp shadows. You can either use some kind of shade, or better - hide the light source and illuminate something with it - even a white wall is good.
  • Wonder what color to choose with RGB? Easy, choose all of them! - Since you'll be using IoT.Cafe, make some good use of it and make the color of your RGB light change automatically. For example, use the HlsToRgb peripheral and animate the Hue value. To animate it means simply to make it gradually change with time. You can do this with the Animation peripheral - just add it to your project and assign its value to the Hue value of the HlsToRgb peripheral.
  • Switch on and off smoothly - Instead of instanly going on and off, you can make the light do it gradually in a short period of time - half a second would do.
    To do this, you could use the Transition peripheral. It works by accepting an input value, which is your target value, and producing an output value, which is a value that gradually goes toward the input value. So instead of simply feeding 1 or 0 to the Lightness property in the HlsToRgb peripheral, you could feed the 1 or 0 to the Transition peripheral first, and then feed its output to Lightness
  • Remote control your light - There's always the question of how to turn the light off and on. Well, think of what's always around you when you need the light and what would be the most convenient thing.
    • You can use the IoT.Cafe app on your phone, but that's a bit too complicated for what its worth
    • You can always make a physical switch - a single action and it's done.. that is, if you're close to the button
    • You can use the IR Input peripheral to make your light remote-controlled by a remote you may have lying around
  • Make it adjustable - Leave some practically useful properties in your device's project visible as settings, so that you could later connect to the device whether by your phone or by the internet and change them.
    For example, given the previously mentioned points, you might have settings such as speed of color change, white light intensity, color saturation, on-off speed, remote control button.