In this tutorial we will learn how to make a Dimmable LED With a Capacitive Touch Button and Arduino.
By touching the “capacitive touch” sensor the LED will slowly turn ON or OFF.
Watch the Video!
Step 1: What You Will Need
- Capacitive touch sensor
- Arduino UNO (Or any other Arduino)
- LED
- 1K ohm resistor
- Jumper wires
- Breadboard
- Visuino program: Download Visuino
Step 2: Brought by PCBWay
Thank you PCBWay for supporting this tutorial and helping users learn more about electronics.
What I like about the PCBWay is that you can get 10 boards for approximately $5 which is really cost effective for professional made boards, not to mention how much time you save!
Go check them out here. They also offer a lot of other stuff in case you might need it like assembly, 3D printing, CNC machining and a lot more.
Step 3: The Circuit
- Connect Capacitive touch sensor “Signal” pin to Arduino Digital pin[2]
- Connect Capacitive touch sensor “VCC” pin to pin [5V]
- Connect Capacitive touch sensor “GND” pin to pin [GND]
- Connect Arduino board pin [GND] to LED negative pin [-]
- Connect Arduino board digital pin [6] to 1k ohm resistor
- Connect 1k ohm resistor second pin to LED positive pin [+]
Step 4: Start Visuino, and Select the Arduino UNO Board Type
The Visuino: https://www.visuino.com also needs to be installed. Download Free version or register for a Free Trial.
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 5: In Visuino Add Components
- Add “Debounce Button” component
- Add “Toggle(T) Flip-Flop” component
- Add “Detect Edge” component
- Add “Analog Value” component
- Add “Ramp To Analog Value” component
Step 6: In Visuino Set Components
- Double click on “AnalogValue1” and in the “Elements” window drag “Set Value” to the left side and in the Properties window set “Value” to 1
- Drag another “Set Value” to the left side and in the Properties window set “Value” to 0
- Close the Elements window
- Select “RampToValue1” and in the properties window set “Slope (S)” to 0.5
Step 7: In Visuino Connect Components
- Connect Arduino Digital Out pin [2] to “Button1” component pin[In]
- Connect “Button1” component pin[Out] to “TFlipFlop1” component pin[Clock]
- Connect “TFlipFlop1” pin [Out] to “AnalogValue1“>”Set Value1” component pin[In]
- Connect “TFlipFlop1” pin [Inverted] to “DetectEdge1” pin[In]
- Connect “DetectEdge1” pin [Out] to “AnalogValue1“>”Set Value2” component pin[In]
- Connect “AnalogValue1” pin[Out] to “RampToValue1” pin[In]
- Connect “RampToValue1” pin[Out] to Arduino Digital > Analog PWM pin [6]
Step 8: 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 9: Play
If you power the Arduino UNO module, and touch the “capacitive touch” sensor the LED will slowly turn ON or OFF.
Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this Instructable. You can download and open it in Visuino:
Download LED-TOUCH-BRIGHTNESS.zip