WS2812 together with RGB5050

This is a small arduino project, especially for my office. The light for my desk is an LED stripe (WS2812 with RGB5050). So I’m able to change the color from each single LED. It’s great to need only three wire for all!

My little circuit consists of three potentiometer, nothing more. With each potentiometer I can change one color (the WS2812 needs a value between 0 and 255 for each color). I connect the potentiometer with the analog Input – A0 for red, A1 for green and A2 for blue.

I show you a little sketch …


And this is the code:

// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
// released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
 #include <avr/power.h>

#define PIN 5

// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 58

int r,g,b;

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

void setup() {

pixels.begin(); // This initializes the NeoPixel library.
 for(int i=0;i<NUMPIXELS;i++){
 pixels.setPixelColor(i, pixels.Color(0,0,0));; 

r = analogRead(A0)/4;
 g = analogRead(A1)/4;
 b = analogRead(A2)/4;

// rot from left to right
 for(int i=0;i<NUMPIXELS;i++){ 
 pixels.setPixelColor(i, pixels.Color(100,0,0));; 
 // blue from right to left
 for(int i=NUMPIXELS;i>=0;i--){ 
 pixels.setPixelColor(i, pixels.Color(0,0,100));; 
 //green from left to right
 for(int i=0;i<NUMPIXELS;i++){ 
 pixels.setPixelColor(i, pixels.Color(0,100,0));; 
 // white from right to left
 for(int i=NUMPIXELS;i>=0;i--){ 
 pixels.setPixelColor(i, pixels.Color(100,100,100));; 

void loop() {
 r = analogRead(A0)/4;
 g = analogRead(A1)/4;
 b = analogRead(A2)/4;
 for(int i=0;i<NUMPIXELS;i++){ 
 pixels.setPixelColor(i, pixels.Color(r,g,b));; 

Display and timer in a box

I’m back. In the last months I finished several small projects. But I haven’t enough time to document all this.

Today I show you a nice small project – a thermometer with the 3461BS display. And … all togethe in a selfmade casing, printed with the Anet A8 3d printer.

For what I’m using it?
When I create circuit boards, the temperature has to be right, and I need a timer. I realized both functions through this little box.


Update 23.05.2016 – Using the SD card modul

In the first tutorial (see below), I described the display. Please, read this tutorial first, so you understand this part better.
This display has backside a SD card slot. Normally, this modul is not connected. To use it, you must solder 4 pins.

And now, be carefull! This pins works with 3.3V too! If you connect this to 5V (arduino pins directly) you destroy your SD card!

You must use the level converter! …

Here is the full page:  QVGA Display 2.2 TFT SPI 240×320


ILC 1-1/8

After some days the clock got some malfunctions. I used ICs from an old project here.

Suspected quick came on, they are damaged. So I swapped the UDN2981 ICs with new ones. But a day later, the same malfunction recurred.

I use the UDN2981 drivers to switch with 5V (output Arduino) the 30V segments (tube). The UDN2981 can switch 500 mA. But that is a mistake. In the data sheet itself is, per output not exceeding 120 mA current can be used.


OK, back to basics.
The segments need 150 mA current. That can not be connected with a normal transistor. So we need a MOSFET. And these per segment.
All together 7 MOSFETs and 4 additional for the individual tubes. 11 MOSFETs!

My first contact with MOSFETs.
Now, a few days later I can say, it works. Of course, I had the wrong MOSFETs here. But the new p-channel MOSFETs came just one day later, and the control is ready. The sample circuit is working properly since yesterday. Of course, the UDN2981 would be easier, but what the heck …


The problem were not wrong ICs, the problem was a wrong datasheet for this type of tubes!
I spent a long time with searches in the internet and at the end I found Günter and his pages. I wrote him an email and ask him for help. He sent me the correct informations for this type of tubes. With him I talked about my problems and he described me another ICs, the LB1240.
I ordered this already and I hope, I will get them in the next couple of days.

To use the time, I probed another way – control the tubes with simple pnp transistors. Each segment needs only 3mA .. 4 mA current, not more! To realise this, a simple pnp transistor, i.e. a BC556 transistor is enough.

Great! It’s work!