Monthly Archives: May 2016

WS2811, WS2812, NeoPixel RGB Pixels/LEDs and Arduino

WS28WS281111 or WS2812 based LEDs / RGB pixels are cheap and easily available on the online stores. They run off 5 volts and can be addressed individually. Waterproof versions are also available.

On Ebay/Aliexpress/Alibaba they are sold as a set of 25 leds / RGB pixels connected together. Multiple such strips/chains can be connected together to form longer chains of light.

Unfortunately they mostly come without any power source or controller. Normally for a 25 RGB LED chain based on WS2811 consumes about .3W (please refer to manufacturer datasheet for exact requirements). So it can be powered from almost any ordinary 5v adapter, even mobile phone  chargers (with sufficient current supply capability) can be used.

For controlling the rgb lights and changing colors and effects an Arduino can be used. The “FastLED” project on GitHub is a nice library. It has many examples also. The library supports Arduino and various type of RGB LED / RGB Pixels. Here is the link to the GitHub repository:  https://github.com/FastLED/FastLED.
I am attaching the Master here as on 23-05-2016 in case the library goes off GitHub for some reason. The code belongs to the developers and contributors (https://github.com/FastLED/FastLED/graphs/contributors)
And here is the Arduino Library only as on 23-05-2016. The version is 3.1.0

LM35 Precision Cheap Temperature Sensor

The LM35 from Texas Instruments is a cheap but very good temperature sensor. It is available in various packages. Please refer to the LM35 Temperature Sensor for package and other details.

It can be powered directly from the 5v supply of Arduino.

The chip outputs  10.0 mV per °C. Below is a small snippet of code that can be used to convert the output voltage into temperature.

val = analogRead(tempPin);
mv = ( val/1024.0)*5000;  // mv = (val/1024) * (voltage * 1000) The 1024 is derived from  the fact that the Atmega ADC has 10 bit resolution, returning integers from 0 to 1023.
cel = mv/10; // cel = mv / 10.0 milli volt per °C
farh = (cel*9)/5 + 32;

Please refer the Datasheet for Pin Configuration.