Light category

Temperature Controlled Stair Lights

Temperature Controlled Stair lights With Raspberry Pi

Ever wished to know the temperature on your way to breakfast after waking up in the morning? Now you can find it out in a fascinating way as Lorraine Underwood at The MagPi magazine designed a temperature controlled colorful stair lights system with raspberry pi. In this tutorial, we’re going to discuss that project.

Temperature Controlled Stair Lights
Temperature Controlled Stair Lights

Required Parts

  • Strip of 50 neopixels
  • A 5V power source for the lights
  • 2 x terminal blocks
  • 2 x male to female jumper cables
  • A raspberry pi zero with SD card with Raspian installed
  • Power supply for the Pi zero (temporary)


Make sure that the raspberry pi power supply gives exactly 5 volts and is capable of outputting 2.5A current.

Make The Circuit

At first, examine your LED strip and find out which pin is what. Connect two wires to GND, one wire to Din, and one wire to +5V pin. Now, connect the 5V pin to the “+” terminal of the female jack and GND pin to the “-” terminal. Tighten the screws of the terminal block to ensure that the wires are connected properly.

Connect the Din and GND pin of the LEDstrip to the GPIO 18 and GND of the Raspberry Pi respectively, using the male-to-female jumper wires. Please note that Broadcom numbering (BCM) is used in this tutorial, not the physical numbering. It will look like below after making the connections:

Connecting Wires To The LED Strip
Connecting Wires To The LED Strip

Set Up The Weather API

You need to set up a weather API in order to get the outside temperature in your area. In this tutorial, is used as they allow you to make 1000 queries per day free of cost. Go to and select Developer option. Then, click sign up to create a developer account and provide your email address. A secret key will be sent to that address. Store it securely as you’ll need in the next step.

Prepare The Raspberry Pi

At first, you need to install the Adafruit NeoPixel library rpi_ws281x. Go here and follow the instructions to install the required files on your raspberry pi. Once installed, navigate to the examples folder, run any script you wish, and check if the LED strip is functioning properly.

Now, save the below script as in the Raspberry Pi:

from urllib.request import urlopen
import json
import time
from neopixel import *

apikey="get_your_own_key" # get a key from
# Latitude & longitude - current values are Lancaster University

LED_COUNT = 50 # Number of LED pixels.
LED_PIN = 18 # GPIO pin connected to the pixels (must support PWM!).
LED_FREQ_HZ = 800000 # LED signal frequency in hertz (usually 800khz)
LED_DMA = 5 # DMA channel to use for generating signal (try 5)
LED_BRIGHTNESS = 8 # Set to 0 for darkest and 255 for brightest
LED_INVERT = False # True to invert the signal (when using NPN transistor level shift)

def color(strip, color, start, end): 
 for i in range(start, end+1):
 strip.setPixelColor(i, color) 

count = 0
 while True: 
 #get the data from the api website
 meteo = meteo.decode('utf-8')
 weather = json.loads(meteo)

currentTemp = weather['currently']['temperature']

#negative number will always be on 
 color(strip, Color(0, 0, 255), 0,7) # Blue
 #what's the temp?
 if currentTemp > 0:
 color(strip, Color(75, 75, 255), 8, 15) # light Blue
 if currentTemp > 5:
 color(strip, Color(0, 255, 0), 16, 23) # dark Green
 if currentTemp > 10:
 color(strip, Color(75, 255, 75), 24, 31) # light Green
 if currentTemp > 15:
 color(strip, Color(255, 100, 0), 32, 39) # yellow 
 elif currentTemp > 20:
 color(strip, Color(255, 50, 0), 40, 47) #orange 
 elif currentTemp > 25:
 color(strip, Color(255, 0, 0), 48, 50) # Red 
 #check every 5 minutes (change to crontab)
except KeyboardInterrupt:
 color(strip, Color(0,0,0), 0, 49)

Enter your own secret key in the apikey field on the 7th line. Also, replace the longitude and latitude values on line 9 and 10 with the coordinates of your area. Now save the file and you are almost done.

To start the script automatically after each reboot and check the outside temperature every five minutes, set up a cron task by entering the following command:

sudoE crontab -e

A file will be opened and add the following lines at the end of the file:

*/5 * * * * /usr/bin/python3 /home/pi/
@reboot /usr/bin/python3 /home/pi/

Save the file and exit.

The Color Scheme

The following table shows which color represents which temperature range. You can modify the script to change the current color scheme.

Temperature (°C) Lights (Nos) Color
 0 – 4  9 – 16 Light Blue
 5 – 9 17 – 24 Dark Green
 10 – 14 25 – 32 Light Green
 15 – 19 33 – 40 Yellow
 19 – 24  41 – 48 Orange
 25+  48 – 50 Red


Sound Activated LED Light With Timer

Clap to light switch with timer project is very useful project for power saving applications. The project switches on the LED light for 45 to 60 seconds when receives two clap sound. This project can be used in store room, toilets, dark area where switch is not visible, night lamp, places where light on off switch is not accessible easily.

Single transistor used as microphone preamplifier, diode converts AC signal in to DC , and PIC micro-controller take care of LED On/OFF Time, LED  time depends on two jumpers J1, J2 which provides four options s 45, 50, 55, 60 seconds. MJE3055 transistor used in output to drive LED, one series resistor R10 helps to control the current going through LED, R10 can be alter as per LED Voltage and current. 3V to 12V LED with maximum current 500mA can be used. Use higher current Darlington transistor like TIP147 for higher current Load. Onboard potentiometer trimmer for sound sensitivity adjust. D1 power LED.

Sound Activated LED Light With Timer – [Link]

Fast Single-Pixel Camera

Compressed sensing is an new computational technique to extract large amounts of information from a signal. Researchers from Rice University, for example, have built a camera that can generate 2D-images using only a single light sensor (‘pixel’) instead of the millions of pixels in the sensor of a conventional camera.

This compressed sensing technology is rather inefficient for forming images: such a single-pixel camera needs to take thousands of pictures to produce a single, reasonably sharp image. Researchers from the MIT Media Lab however, have developed a new technique that makes image acquisition using compressed sensing fifty times more efficient. In the example of the single-pixel camera that means that the number of exposures can be reduces to several tens.

One intriguing aspect of compressed sensing is that no lens is required – again in contrast with a conventional camera. That makes this technique also particularly interesting for applications at wavelengths outside of the visible spectrum.

In compressed sensing, use is made of the time differences between the reflected light waves from the object to be imaged. In addition, the light that strikes the sensor has a pattern – as if it passed through a checkerboard with irregular positioned transparent and opaque fields. This could be obtained with a filter or using a micro-mirror array where some mirrors are directed towards the sensor and others are not.

The sensor each time measures only the cumulative intensity of the incoming light. But when this measurement is repeated often enough, each time with a different pattern, then the software can derive the intensity of the light that is reflected from different points of the subject.

Source: Elektor

Individually addressable incandescent lamps

Michael wrote an article on controlling a bunch of lamps individually with WS2811 drivers and Arduino. [via]

I simply used the same technology as LED strips to allow communication between lamp modules. LED strips have RGB LEDs with an embedded driver chip which uses PWM (pulse width modulation) to control the duty cycle on the red, green, and blue LEDs. This combined LED/chip is called WS2812 or WS2812B. On older LED strips, the driver chip was not embedded into the LED itself, but was a separate chip called WS2811. These standalone driver chips are somewhat obsolete now which means they are cheap! I got 50 of them on eBay for $5.00. Since these modules use the same technology as LED strips, the same code can be used. Adafruit’s NeoPixel library is a very simple way to control LEDs, so we can control each lamp easily. The lamp is controlled by the “blue” pin on the WS2811 so that is the value to set.

Individually addressable incandescent lamps – [Link]


The New Light-responsive Nano LEDs

A team of researchers from the US and South Korea reported a unique type of NanoLEDs with unprecedented brightness levels, that excess 80,000 cd/m2, and also can operate both as light emitters and light detectors.

These new LEDs are about 50nm long and 6nm in diameter. As described in the paper, they included quantum dots of two different types, one of which can enhance radiative re-combinations (useful for LEDs) while the other type leads to efficient separation of photo-generated carriers.

Low- and high magnification scanning transmission electron microscopy images of DHNRs (right) magnified image of the region within the white dotted box on the left.

The research of this invention had been published in a paper titled “Double-heterojunction nanorod light-responsive LEDs for display applications“. The researchers consider the dual-mode LEDs will pave the way to new types of interactive displays.

As we head toward the “Internet of things” in which everything is integrated and connected, we need to develop the multi-functional technology that will make this happen. Oh et al. developed a quantum dot-based device that can harvest and generate light and process information. Their design is based on a double-hetero-junction nano-rod structure that, when appropriately biased, can function as a light-emitting diode or a photodetector. Such a dual-function device should contribute to the development of intelligent displays for networks of autonomous sensors.

The device can reach a maximum brightness in excess of 80,000 cd/m2 with a low turn-on voltage (around 1.7 V). It also exhibits low bias and high efficiencies at display-relevant brightness. The research team reports an external quantum efficiency of 8.0% at 1000 cd/m2 under 2.5 V bias.

Energy band diagram of DHNR-LED along with directions of charge flow for light emission (orange arrows) and detection (blue arrows) and a schematic of a DHNR.

One of the experiments was operating a 10×10 pixel DNHR-LED array under reverse bias as a live photodetectors, combined with a circuit board that supplied a forward bias to any pixel detecting incident light. And by alternating forward and reverse bias at a sub-millisecond time scale, light-detecting pixels could be “read out” as they illuminated the array.

Future applications of the DNHR LEDs include:

  • Translate any detected signal into brightness adjustments;
  • Automatic brightness adjustment in response to external light–intensity change;
  • Direct imaging or scanning at screen level;
  • Display-to-display data communication.
  • Displays can harvest or scavenge energy from ambient light sources without the need for integrating separate solar cells.

Sources: elektor, EETimes

LED Based Strobe For Entertainment, Events & Warning Signals

Strobe provides regular flashes of light. Usually Strobes are designed using Xenon Tubes. Here is LED based simple solution that can be used as strobe for entertainment and events and also as warning signals. Project is based on PIC16F1825 micro-controller with two digit frequency display.

Project provides TTL output signal, frequency 1Hz-25Hz, Tact switches provided to set the frequency.

This project works along with DC Output Solid State Relay


  • Supply 4.5 to 5V DC
  • Frequency 1Hz To 25Hz
  • Easy Interface with Relay Board
  • Easy Interface with Solid State Relay
  • On Board Power LED
  • On Board Output LED
  • Onboard Switch to set the frequency
  • 2X7 Segment 0.5 Inch Display

LED Based Strobe For Entertainment, Events & Warning Signals – [Link]

iKeybo, The Advanced Projection Keyboard

Serafim is a company of some talents and experts in optoelectronics industry, and it aims to offer affordable, useful, and cool consumer electronics for a better computing experience. The latest amazing product by Serafim is: iKeybo!

iKeybo is a virtual projection multilingual keyboard that can turn any flat surface into a keyboard. iKeybo can work as a piano too.

Check this video to see iKeybo in action:

iKeybo uses a non-contact technology and has 90Hz frame rate. It turns your 5 inch display into 12 in a surface since the projection surface is 268*105mm. The keyboard consists of 78 keys where other competitors only have 66. It has a instant reaction around 11.11ms what makes it more convenient while using.You can use iKeybo with you PC, mobile devices and tablets since it works via Bluetooth and USB.

For developers, a SDK for iOS and Android is available! It supports all functions of touch screen which include single tap, double tap, rotate, press and drag, press and hold. Install the framework and make connections with your apps.

It differentiates from other laser projection keyboard because it implements a new patented technology that uses camera sensor and double linear sensors for faster calculation speed and less energy.

“What distinguish iKeybo from traditional projection keyboards is that it is the world’s first laser projection “piano” that allows users to create music instantly with piano, guitar, bass, or drums. When not in use, iKeybo can also serves as an external charger to power up devices with 10 hours of battery life. Its cellphone stand design is also perfect for desk or table to watch movies or start live streaming.“ – iKeybo team

iKeybo Features

4 Language Layouts you can choose from 4 different languages keyboard layouts (English, Spanish, Arabic, and Chinese) to type the language special characters that you need. You can’t add more language layouts to your iKeybo because each layout projection needs a different optical lens. Once you select a language edition or a bilingual one it will be fixed.

4 Musical Instruments with iKeybo you can play piano, guitar, bass and drums! Check this piano demo video:

Round Key Designs a special design to make it easier for typing. Other competitors use square keys with no space in between that make it possible to do a lot of typos.

Portable Charger & Cell Phone Stand  iKeybo also serves as an external charger to power up your devices with 10 hours of battery life. You can also use it as your cellphone stand to turn your mobile device into a computer within just a second.

iKeybo is not the first optoelectronics product by parent company Serafim. Check this page to know more about its products.

iKeybo is now live on a Kickstarter campaign and still has 10 days to go! You can pre-order your iKeybo with one language layout and piano for $89 and also you can get a bilingual iKeybo for $99. More information are available at the campaign page.

AS7221, An IoT Smart Lighting Manager

ams AG, a multinational semiconductor manufacturer and provider of high performance sensors and analog ICs, had announced the AS7221, an integrated white-tunable smart lighting manager that can be controlled through its network connection by means of simple text-based commands.

AS7221 Block Diagram

AS7221 is a networking-enabled IoT Smart Lighting Manager with embedded tri-stimulus color sensing for direct CIE color point mapping and control. IoT luminaire control is through a network connection, or by direct connection to 0-10V dimmers, with control outputs that include direct PWM to LED drivers and analog 0-10V to dimming ballasts. A simple text-based Smart Lighting Command Set and serial UART interface, enable easy integration to standard network clients.

Key features of AS7221:

  • Calibrated XYZ tri-stimulus color sensing for direct translation to CIE 1931/1976 standard observer color maps
  • Autonomous color point and lumen output adjustment resulting in automatic spectral and lumen maintenance
  • Simple UART interface for connection to network hardware clients for protocols such as Bluetooth, ZigBee and WiFi
  • Smart Lighting Command Set (SLCS) uses simple text-based commands to control and configure a wide variety of functions
  • Directly interfaces to 0-10V dimmer controls and standard occupancy sensors
  • Built-in PWM generator to dim LED lamps and luminaires
  • 12-bit resolution for precise dimming down to 1%
  • 0-10V analog output for control of conventional dimming ballasts in a current steering design
  • 20-pin LGA package 4.5mm x 4.7mm x 2.5mm with integrated aperture

“The next generation of lighting will be defined by three key characteristics: controllability, adaptation and connected architectures,” said Tom Griffiths, Senior Marketing Manager at ams. “Our new family of smart lighting managers meet those criteria. With this latest entry, we are addressing the luminaire manufacturers’ critical time-to-market challenge for developing and deploying a spectrally tunable luminaire that is cost-effective, accurate, and which smoothly integrates into the Internet of Things”.

The AS7221 is the first extension to ams’s recently announced Cognitive Lighting™ smart lighting manager family. The compact AS7221 will be available in a 5x5mm LGA package, for flexible integration into both luminaires and larger replacement lamps.

There are main domains of AS7221 applications, some of them are:

  • Smart home and smart building
  • Variable CCT general lighting industrial lighting
  • Retail and hospitality lighting with white-color tuning
  • LED tro ers, panel and downlights
  • LED replacement lamps (LED bulbs)
AS7221 Functional Diagram

Pricing for the AS7221 Spectral Tuning IoT Smart Lighting Manager is set at $3.13 in quantities of 10,000 pieces, and is available in production volumes now.

You can find AS7221 datasheet here.

Laser for sending music over a distance

Light is a very popular means of communication. Today, optical fiber communication is the backbone of telecommunication and internet. Light is guided through a fiber optic cable in such systems to achieve low-attenuation and high speed data transmission. Question is: Is it possible to use light for communication without a guiding medium? The answer is positive. Because of the highly collimated nature of the laser beam, it is feasible to use a laser output to transmit information without a guiding medium even in daylight, provided that the line of sight occurs between the sending and receiving units.

Armand & Victor from DIY Experiments Youtube channel illustrates a very simple example of modulating a laser diode output with an analog audio signal and sending it over a distance of more than 400 meters. The laser diode used in this project was of 250 mW capacity, which is ~ 100 times more powerful than a regular laser pointer. A single-transistor class-A amplifier circuit was used to amplify the audio input signal prior to use it for modulating the laser output light. A 1:25 turn ratio transformer is used as a coupling device between the audio and the laser module. The transformer is necessary to ensure only the AC variations (and blocks any DC component) in the audio signal will modulate the laser beam.

Circuit setup for modulating Laser with an audio signal

Circuit setup for modulating Laser with an audio signal

On the receiving end, the audio is reconstructed back by aiming the modulated laser beam at an array of four mini solar panels. The solar panel output voltage varies according to the signal variation contained in the laser and is directly fed to a high power (250W) guitar amplifier. The audio quality was quite remarkable for such a simple setup. Check out the following demo video of this project:


Headlight Modulator for Motorcycle


William Dudley @ has designed a motorcycle headlight modulator based on 555 timer IC and photoresistor. A headlight modulator will make the headlight to pulse during the day and be steady at night. He writes:

Unhappy with a headlight modulator I purchased, I decided to make my own. Even though it would be a trivial programming project to use an Arduino Teensy or similar to do this, I decided to do it the “old fashioned” way, using a 555 timer. The 555 is a clever chip; not only will it supply the oscillator for the flashing effect, it has a reset pin that can be used to force the output to a known state (low) when (other circuitry tells it that) it’s dark outside.

Headlight Modulator for Motorcycle – [Link]