[Arduino] Ping Pong Net Sensor

Part one, Ping-Pong NET vibration sensor using a simple piezo!

Arduino.cc reference of the KnockSensor if needed.

To connect the sensor to the Arduino, you can go deeper on the Arduino website,

or take inspiration from this picture:

 

Here a video!

What you need:
– Ping Pong table with net 🙂
– 1 Solar Panel (used to power on Arduino… optional)
– Arduino
– Piezo speaker
– Piezo transductor
– 1 resistor 1MΩ
– 1 LED (orange)
– Wires
– Breadboard

eeeee-nnnn-jjjjjjj-oooooooo-yyyyyyyyyyyyyyyyyyyyy!!!!!!!!!!!!!

Here Arduino C source code:

const int ledPin = 13;
const int knockSensor = A5;

int sensorReading = 0;
int ledState = LOW;

void setup() {
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  sensorReading = analogRead(knockSensor);
  Serial.println(sensorReading);

  if (sensorReading >= 1) {
    ledState = !ledState;
    digitalWrite(ledPin, ledState);
    Serial.println("NET!");
    delay(500);
    ledState = !ledState;
    digitalWrite(ledPin, ledState);
  }
  delay(10);
}

Ref: albertopasca.it

 

Alberto Pasca

Software engineer @ Pirelli & C. S.p.A. with a strong passion for mobile  development, security, and connected things.