Introduction: Arduino Pressure Switch to LED

This project shows how to use pressure sensor as a switch, which will make an LED grow brighter as long as there is pressure applied to the sensor.

Step 1: What You Need

I used

  • 1 IEFSR pressure sensor
  • 1 LED
  • 1 547 Ohm resistor
  • 1 10k resistor
  • 5 wires
  • 1 Arduino
  • 1 breadboard

Step 2: Circuit Setup

I prepared my breadboard like this. Connect the Sensor to the 5V Arduino power supply, then connect the other prong to the 10k resistor and then to ground. Connect the same prong to A0.

Then connect the other resistor to one of the digital ports (I used 6 for no particular reason). Wire the LED in series, and then connect that to ground.


Your basic circuits are all set up.

Step 3: Programing

After setting up the circuits, open up the Arduino program on your computer and make sure the correct Arduino is selected, as well as COM port.

You can simply copy my code here, although it isn't very descriptive. The basic idea is that Arduino will setup the pins as OUTPUT and INPUT, and use the information coming from pin A0 to tell pin 6 what to do. Unfortunately, this instructable will NOT show you how to make the LED brighter with relation to pressure, but simply make the LED brighter over time as long as the sensor is being pressed. The circuits and code are very similar for that, though, and can easily be modified with a google search if that is what you are looking for.

Attached is the code (ignore the file name in the photo, that was an error).

Step 4: Testing

You should now see that the longer you hold the pressure sensor, the brighter the LED will get (until it resets)