Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Capacitive Touch Sensor Music Player

View and Edit Project In Cirkit DesignerImage of Arduino UNO Capacitive Touch Sensor Music Player

Circuit Documentation

Summary

This circuit utilizes an Arduino UNO microcontroller to read capacitive sensor inputs and produce corresponding tones through a piezo buzzer. The capacitive sensors are created using resistors and cucumbers, which act as touch-sensitive elements. When a cucumber is touched, the corresponding sensor value increases, and the Arduino generates a tone on the piezo buzzer.

Component List

  1. Arduino UNO

    • Description: A microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  2. Resistor

    • Description: A passive electrical component with a resistance of 10k Ohms.
    • Pins: pin1, pin2
    • Properties:
      • Resistance: 10k Ohms
  3. Cucumber

    • Description: A touch-sensitive element used in the capacitive sensor.
    • Pins: 1
  4. Piezo Buzzer

    • Description: An audio signaling device.
    • Pins: pin 1, pin 2

Wiring Details

Arduino UNO

Resistor

Cucumber

Piezo Buzzer

Documented Code

#include <CapacitiveSensor.h>

CapacitiveSensor a = CapacitiveSensor(2,3);
CapacitiveSensor b = CapacitiveSensor(4,5);
CapacitiveSensor c = CapacitiveSensor(6,7);
CapacitiveSensor d = CapacitiveSensor(8,9);
CapacitiveSensor e = CapacitiveSensor(10,11);

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  long SEN1 = a.capacitiveSensorRaw(30);
  long SEN2 = b.capacitiveSensorRaw(30);
  long SEN3 = c.capacitiveSensorRaw(30);
  long SEN4 = d.capacitiveSensorRaw(30);
  long SEN5 = e.capacitiveSensorRaw(30);

  if (SEN1 > 10)
  {
    tone(13, 262, 100);
  }

  if (SEN2 > 10)
  {
    tone(13, 294, 100);
  }

  if (SEN3 > 10)
  {
    tone(13, 330, 100);
  }

  if (SEN4 > 10)
  {
    tone(13, 349, 100);
  }

  if (SEN5 > 10)
  {
    tone(13, 392, 100);
  }
}

This code initializes five capacitive sensors connected to the Arduino UNO. In the setup function, the serial communication is started. In the loop function, the raw sensor values are read, and if any sensor value exceeds a threshold of 10, a corresponding tone is generated on the piezo buzzer.