Introduction: L239D Motor Driver for Capacitive Touch

I was looking into using a L239D Motor Driver to drive some RGB LEDs in an infinity mirror project and I somehow accidently discovered the if you touched the input wire it would output a low level signal, just enough to make the LED glow.

Step 1: Materials

For tutorial:

- Arduino Nano

- L239D Motor Driver

- (Optional) LED

For a very rapid pulsing LED when you touch it you can also just use the following:

- L239D Motor Driver

- LED

Step 2: Circuit Assembly

The following hookups are required:

L239D VIN -> Arduino VIN or 5V

L239D GND -> Arduino GND or 5V GND

L239D 5V -> Arduino 5V or 5V

L239D IN-1 -> Touch 1

L239D IN-2 -> Touch 2

L239D IN-3 -> Touch 3

L239D IN-4 -> Touch 4

L239D OUT-1 -> Arduino Analog Input Pin, or LED Positive Lead

L239D OUT-2 -> Arduino Analog Input Pin, or LED Positive Lead

L239D OUT-3 -> Arduino Analog Input Pin, or LED Positive Lead

L239D OUT-4 -> Arduino Analog Input Pin, or LED Positive Lead

Step 3: Program the Arduino

#define INPUT_PIN A0
#define OUTPUT_PIN 2

int READINGS[30] = {0};

int POS = 0;

int I = 0; void setup()

{

Serial.begin(9600);

pinMode(INPUT_PIN, INPUT);

pinMode(OUTPUT_PIN, OUTPUT);

}

void loop()

{

POS++;

if (POS > 29)

{

POS = 0;

}

READINGS[POS] = analogRead(INPUT_PIN);

float average = 0;

for (int reading : READINGS)

{

average += reading;

}

average /= 30;

if (average > 27)

{

digitalWrite(OUTPUT_PIN, HIGH);

}

else

{

digitalWrite(OUTPUT_PIN, LOW);

}

}