The project successfully integrates capacitive sensing into an Arduino Duemilanove connected to a Raspberry Pi 4 Model B. The goal was to create a setup where changes in capacitance of a sensor (aluminum foil) can be detected, leveraging the CapacitiveSensor library. This report documents the progress, circuit explanation, software implementation, and the underlying electronics.
The following links have been very useful.
The CapacitiveSensor library by Paul Stoffregen was used.
CapacitiveSensor cs = CapacitiveSensor(sendPin, receivePin);
Sensitivity was fine-tuned by adjusting the number of samples (default 30
).
By bringing a hand close to the aluminum foil, the change in capacitance was detected and printed via the serial monitor.
The capacitive sensing circuit relies on measuring the time delay caused by an RC (resistor-capacitor) network. The key components and their roles are:
The delay in the RC circuit depends on the RC time constant, given by:
τ = R × C
Voltage across the capacitor during charging follows:
V(t) = Vmax × (1 - e^(-t/RC))
At V(t) = 2.5V
, solving for t
:
t = -RC × ln(1 - 2.5/5) ≈ 0.693 × RC
Adding sensors increases processing time linearly. Optimization by adjusting sample size and RC values can ensure performance remains acceptable.
The circuit is functioning as intended for one sensor, with the ability to detect capacitance changes due to touch or proximity. Future work includes:
Initially, one capacitive sensor was tested using aluminum foil and a resistor to determine proper sensitivity levels. Success with a single sensor led to the addition of three more sensors, resulting in a total of four.
Sensor values were read and calibrated via the Arduino IDE Serial Monitor. Threshold values for activation were determined experimentally to minimize false positives and ensure responsiveness. The system successfully detected individual sensor activation without interference from the others.
Experimentation revealed that 1.4 MΩ resistors provided the best balance between sensitivity and stability. Lower values caused under-sensitivity, while higher values introduced excessive noise.
Each sensor was created with an aluminum foil area of approximately 40 square centimeters. This size offered a reliable detection range for finger touches while avoiding unintentional activation.
Sensors were mounted on the back of the canvas using adhesive to keep them flat and secure. A 3 cm gap was maintained between the canvas and a wooden back panel to accommodate the sensors and other components.
Non-conductive layers were added between the aluminum foil and the canvas to avoid false triggers caused by external electrical interference.
Speakers were fixed to the wooden back panel using screws and circular recesses to ensure stability and reduce protrusion.
All components were secured to the wooden panel, which was then mounted behind the canvas, ensuring easy access for maintenance.
Sounds were recorded using a sustained electric guitar. Each sensor corresponded to a folder containing four distinct sound samples, creating variety.
The Python program executed on the Raspberry Pi serves as the glue for the system, reading sensor data from the Arduino and triggering corresponding audio samples.
OpenAI's ChatGPT: Technical assistant for software development, troubleshooting, and documentation.
Special thanks to the OpenAI team for providing tools that empowered this innovative project.
This interactive sound canvas represents the fusion of art and technology, offering a dynamic platform for creative expression. It exemplifies the potential of collaborative efforts between humans and AI in the realization of artistic and technical visions.