YwRobot High Brightness LED Control With Rotary Encoder | Arduino Visual Programming
In this Visual Programming (Visuino) tutorial, weāll use the YwRobot High Brightness Lighting LED Module and a Rotary Encoder to control LED brightness and blinking modes.
Rotate the encoder to smoothly adjust LED brightness from low to high (and vice versa).Press the encoder button to toggle between steady glow and blinking mode.Brightness can be adjusted in both modes for complete flexibility.This project shows how simple it is to build interactive lighting effects with Arduino and Visual Programming (Visuino).
Note: you can use any other LED, it will work the same.
Watch the Video!
Step 1: What You Will Need
YwRobot High Brightness Lighting LED ModuleArduino (or any other board)Rotary Encoder moduleJumper wiresVisuino program: Download VisuinoĀ
Step 2: The Circuit
Rotary Encoder Module Connections
Connect Encoder pin [CLK] to Arduino pin [2]Connect Encoder pin [DT] to Arduino pin [3]Connect Encoder pin [SW] to Arduino pin [4]Connect Encoder pin [+ (VCC)] to Arduino pin [5V]Connect Encoder pin [GND] to Arduino pin [GND]Ā
Connect LED module pin [+ (VCC)] to Arduino pin [5V]Connect LED module pin [GND] to Arduino pin [GND]Connect LED module pin [IN] to Arduino digital PWM pin [5]Ā
Step 3: Start Visuino, and Select the Arduino Board Type
Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "Arduino UNO" as shown on Picture 2
Step 4: In Visuino Add & Set Components
Add "Rotary Encoder Sensor" componentAdd "Integer To Analog" componentAdd "Debounce Button" componentAdd "Toggle(T) Flip-Flop" componentAdd "Analog Multi Source" componentAdd "Square Analog Generator" componentAdd "Analog Toggle Switch" componentĀ
Ā
Select "RotaryEncoderSensor1" and in the properties window:set "Max" > "Roll Over" to Falseset "Max" > "Value" to 0set "Min" > "Roll Over" to Falseset "Min" > "Value" to 0Select "IntegerToAnalog1" and in the properties window set "Scale" to 0.05
Select "MultiSource1" and in the properties window set "Output Pins" to 3
Select "SquareAnalogGenerator1" and in the properties window select "Amplitude" click on the pin icon and select "Float SinkPin"
Select "SquareAnalogGenerator1" and in the properties window select "Offset" click on the pin icon and select "Float SinkPin"
Ā
Ā
Step 5: In Visuino Connect Components


Ā
Connect Arduino.Digital.Digital[ 3 ] OutputPin to RotaryEncoderSensor1 pin [Clock|Connect Arduino.Digital.Digital[ 2 ] OutputPin to RotaryEncoderSensor1 pin [Direction|Connect RotaryEncoderSensor1 OutputPin to IntegerToAnalog1 InputPinConnect IntegerToAnalog1 OutputPin to MultiSource1 InputPinConnect MultiSource1 OutputPins.Pin [0] to SquareAnalogGenerator1 pin [Amplitude]Connect MultiSource1 OutputPins.Pin [1] to SquareAnalogGenerator1 pin [Offset]Connect MultiSource1 OutputPins.Pin [2] to ToggleSwitch1 False InputPinConnect SquareAnalogGenerator1 OutputPin to ToggleSwitch1 .True InputPinConnect Arduino.Digital.Digital[ 4 ].Output Pin to Button1 InputPinConnect Button1 OutputPin to TFlipFlop1 Clock InputPinConnect from TFlipFlop1 OutputPin to ToggleSwitch1 Select InputPinConnect ToggleSwitch1 OutputPin to Arduino.Digital.Digital[ 5 ] AnalogInputPin (PWM)ĀStep 6: Generate, Compile, and Upload the Arduino Code
In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.
Ā
Step 7: Play
Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this Instructable, you can download it and open it in Visuino: https://www.visuino.com
Ā
Download Visuino file: YwRobot High-Brightness Lighting LED module.visuino
Ā
