Hi everyone! I'm trying to do a very simple paper-based project, but I know almost nothing about electronics, although I'm sure the problem I'm having is simple.
I want to measure the contact between two people and send this measurement via MIDI to make a synth play. In theory, thanks to AI, I wrote the code and created the circuit in just a few minutes (initially with an Arduino UNO, then with an ESP32), and everything seems to work. However, for some reason, for the first few seconds and then randomly every now and then, the code detects a measurement even when the two people are not touching.
Currently, I'm using an ESP32 S3 and I've connected a 1Mohm resistor between GPIO4 and the 3.3v. One person touches the GPIO4, and the other touches the GND. How can I stabilize this measurement that sometimes measures something invisible? A capacitor somewhere? Is there something bigger I'm missing? Do you know similar projects?
This is a debug code just to test the values:
#include <Arduino.h>
// --- Configurazioni ---
const int SENSOR_PIN = 4; // Pin collegato al partitore resistivo
const float R1 = 1000000.0; // Resistenza fissa (1MΩ)
const int READ_DELAY_MS = 100; // Intervallo tra letture
void setup() {
Serial.begin(115200);
analogReadResolution(12); // Massima risoluzione ESP32-S3 (0-4095)
delay(1000);
Serial.println(">>> Test lettura sensore (partitore resistivo)");
Serial.println("RAW | Vout (V) | Rbody (ohm)");
}
void loop() {
int raw = analogRead(SENSOR_PIN);
float voltage = raw * (3.3 / 4095.0);
float Rbody = (voltage > 0.01) ? R1 * (3.3 / voltage - 1.0) : 9999999.0;
Serial.print(raw);
Serial.print(" | ");
Serial.print(voltage, 3);
Serial.print(" V | ");
Serial.print(Rbody, 0);
Serial.println(" ohm");
delay(READ_DELAY_MS);
}
Thank you!
Touch detection between two people
-
lbernstone
- Posts: 1132
- Joined: Mon Jul 22, 2019 3:20 pm
Re: Touch detection between two people
The touch driver has methods to change the timing, frequency, and threshold for the touch sensors on the -S2 & -S3. If you need even more control, the IDF driver has hardware level filtering and some other tuning parameters.
Who is online
Users browsing this forum: No registered users and 5 guests