Arduino Dimmable LED On-Off With a Capacitive Touch Button

by RonFrtek in Circuits > Arduino

150 Views, 3 Favorites, 0 Comments

Arduino Dimmable LED On-Off With a Capacitive Touch Button

Arduino Dimmable LED On-Off With a Capacitive Touch Button

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!

What You Will Need

61UzE1KNpYL._AC_SL1170_.jpg
LED-RED.png
arduino.jpg
VisuinoAdvrtisemenESPNowESP32C3-1.jpg
resistor-1k-ohm-14w-5.jpg
breadboard.png
  • Arduino UNO (or any other Arduino)
  • Jumper wires
  • Capacitive touch sensor
  • LED
  • 1K ohm resistor
  • Breadboard
  • Visuino program: Download Visuino


Brought by PCBWay

2022-08-26_13-41-18.jpg

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 assembly3D printingCNC machining and a lot more.

The Circuit

2022-12-29_22-52-29.png
  • 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 [+]


Start Visuino, and Select the Arduino UNO Board Type

select-board-uno.jpg
Visuino-Select-Board-UNO.jpg

The Visuino: https://www.visuino.eu 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

In Visuino Add Components

2022-12-29_22-59-44.png
2022-12-29_23-00-28.png
2022-12-29_23-01-09.png
2022-12-29_23-01-52.png
2022-12-29_23-02-56.png
  • Add "Debounce Button" component
  • Add "Toggle(T) Flip-Flop" component
  • Add "Detect Edge" component
  • Add "Analog Value" component
  • Add "Ramp To Analog Value" component

In Visuino Set Components

2022-12-29_23-07-24.png
2022-12-29_23-04-25.png
2022-12-29_23-08-44.png
2022-12-29_23-09-00.png
  • 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

In Visuino Connect Components

2022-12-29_22-58-54.png
led-touch.png
  • 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]


Generate, Compile, and Upload the Arduino Code

FBR42I2KXBU01YW.jpg

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.

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: https://www.visuino.eu