Arduino Dimmable Led On-off With A Capacitive Touch Button

About the project

In this tutorial we will learn how to make a Dimmable LED With a Capacitive Touch Button and Arduino. Watch the Video!

Project info

Difficulty: Easy

Platforms: ArduinoVisuino

Estimated time: 1 hour

License: GNU General Public License, version 3 or later (GPL3+)

Items used in this project

Hardware components

Breadboard (generic) Breadboard (generic) x 1
Jumper wires (generic) Jumper wires (generic) x 1
Resistor 1k ohm Resistor 1k ohm x 1
Capacitive touch button Capacitive touch button x 1
Arduino UNO Arduino UNO x 1
LED (generic) LED (generic) x 1

Software apps and online services

Visuino Visuino
Arduino IDE Arduino IDE


By touching the "capacitive touch" sensor the LED will slowly turn ON or OFF.

Step 1: What You Will Need

1 / 7

  • Arduino UNO (or any other Arduino)
  • Jumper wires
  • Capacitive touch sensor
  • LED
  • 1K ohm resistor
  • 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

1 / 2

The Visuino: 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

1 / 5

  • 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

1 / 4

  • 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

1 / 2

  • 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:

Schematics, diagrams and documents

Visuino File


Visuino File


Photo of Ron


Arduino Developer


Leave your feedback...