Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Mirko Pavleski
Published © GPL3+

DIY simple Capacitive Proximity sensor

Extremely useful and adjustable sensor which have several advantages including high reliability, long lifespan, and resistance to environme

BeginnerFull instructions provided3 hours650
DIY simple Capacitive Proximity sensor

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
Buzzer
Buzzer
×1
LED (generic)
LED (generic)
×1
Two Aluminum plates
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free

Story

Read more

Schematics

Schematic

...

Code

Code

Arduino
...
#include <Capacitor.h>

Capacitor cap1(7,A2);

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

void loop() {
  Serial.println(cap1.Measure()); 
  int sensorValue = analogRead(A0) / 8;
   delay(10); 
  if (cap1.Measure() < sensorValue) {
  digitalWrite(5, HIGH);
   tone(10,500);
   delay(500);
  }
  else {
   digitalWrite(5, LOW); 
   noTone(10);
  }
                    
}

Credits

Mirko Pavleski

Mirko Pavleski

153 projects • 1301 followers

Comments