icon

How to Control Neopixel LED via Rotary encoder

The Neopixel LED module has many attractive features. With a microcontroller base, they can produce millions of different lights.

projectImage

Things used in this project

 

HARDWARE LIST
1 Arduino UNO
1 DFRobot EC11 Rotary Encoder Module
1 Digilent WS2812 Addressable LED Strip

Software apps and online services

Arduino IDE

Story

 

The Neopixel LED module has many attractive features. With a microcontroller base, they can produce millions of different lights. In this tutorial, we are going to change the status of the neopixel LED according to the required colors with the help of the rotary encoder module and Arduino board. In this way, by changing the rotary angle of the encoder in each step, the status of the neopixel LED will also change. Visit CiferTechfor more tutorials, and be sure to follow my Instagrampage to support me.

projectImage

Rotary encoder module

The rotary encoder is a type of position sensor used to determine the angular position of the rotating shaft. Which produces an electrical signal, analog or digital, concerning rotational motion. Due to its robust digital power and control, many projects, including robotics, CNC machines, and printers, use an encoder rotary module. Encoders are available in both absolute and incremental types. The absolute encoder gives us the exact position of the button in degrees, while the incremental encoder reports how many shafts it has moved. Rotary encoders are the digital equivalent of modern potentiometers. They can rotate completely without stopping at the end, while a potentiometer can rotate only about 3/4 of a circle. Inside the encoder, a slotted disc is connected to the common ground pin C and two contact pins A and B, as shown below. When you turn the knob, A and B make contact with the common ground pin C, depending on the direction in which you are turning the knob.

 

projectImage

Finally, they generate a signal by contacting common points. These signals are transmitted by contacting one pin before the other pin 90 degrees out of phase. This encoding is called quadrature. When you turn the knob clockwise, pin A first connect, then pin B connects. When you turn the knob counterclockwise, pin B is attached first, and then pin A will be attached.

projectImage

Arduino board

The Arduino board is one of the most popular development boards among embedded engineers. They are available in various models such as Micro, pro mini, Nano, Uno, and also Mega. The core of these popular boards consists of the AtMega328 series. Arduino is an open-source hardware and software platform. As mentioned earlier, the Arduino platform includes an open-source single-board microcontroller that forms part of the Arduino hardware. In addition, the Arduino platform includes an Arduino IDE software designed for programming for Arduino boards and a software bootloader that loads on the microcontroller.

Neopixel LED module

Neopixel LEDs are a separate addressable type all on a string that can be controlled from a stand on the microcontroller. This means that a stand can control all the colors of the LEDs and which LEDs are on at any given time. Compared to a regular RGB LED, you will notice that we need 3 pins to control the amount of Red, Green, and Blue, and all LEDs must be on or off. As you can see, using separate addressing can help create some interesting effects. Many companies sell addressable LED strips, but the most popular is neopixel LEDs.Made by Adafruit. Adafruit produces an addressable LED strip line. They have also developed a library to control them, called the Adafruit NeoPixel. Other companies have developed libraries to control these addressable LEDs. However, in my opinion, Adafruits has the best support and is a good choice to start with.

 

 

 

Additional explanation

In the neopixel LED control project, by specifying the values ​​of R, G, and B in the project code, the neopixel status will change by moving each step of the rotary encoder module. In this way, each step of the encoder represents a case in the project code. Each case comes with certain values, which are displayed by changing the status of the encoder. Take a look at the image below.

 

 

projectImage

The article was first published in hackster, August 7, 2021

cr: https://www.hackster.io/CiferTech/how-to-control-neopixel-led-via-rotary-encoder-420507

author: CiferTech

License
All Rights
Reserved
licensBg
0