Menu Close

THE EXPERIMENTS DONE ALREADY…

In recent times I have of course also been experimenting myself, but my limited knowledge of Electronics and combination with my limited knowledge of certain components mean that I do not get much further.

In a test situation with an Arduino, an ultrasonic sensor and a piezo beeper, I have come a long way, but the problem I encounter is the limited opening angle of the ultrasonic sensor and the battery usage of 20mAh @ 5V.

By changing the circuit and putting the program on an ATtiny85, a little power consumption can be saved, but this is not nearly enough to run the device from a small battery for a long time (16mAh @ 3.3V using a zener diode circuit to bring 3.7V down to 3.3V).

Another problem is that when the battery runs out, the user is not aware of it, so the device actually stops protecting the wearer.

Arduino Prototyping
Prototyping a neck worn device to warn when a user comes close with his/her hands to the device. Made for the project StopCoronaWithElectronics.com

The Arduino Code

/*
This sketch is made for the StopCoronaWithElectronics Project
The electronics have an arduino based board with a HC-SR04 ultrasonic sensor
mounted around the neck of a person and a piezo beeper.
The beeper sounds when the hands come close to the face

Made by: Brian Dragtstra

Problem: The detection angle is to narrow
*/

#define echopin 7
#define triggerpin 8
#define beeperpin 6

long duration;
long distance;

void setup() {
Serial.begin(9600);
pinMode(echopin, INPUT);
pinMode(triggerpin, OUTPUT);
pinMode(beeperpin, OUTPUT);
}

void loop() {
digitalWrite(beeperpin, LOW);
digitalWrite(triggerpin, LOW);
delayMicroseconds(2);

digitalWrite(triggerpin, HIGH);
delayMicroseconds(10);

digitalWrite(triggerpin, LOW);

duration = pulseIn(echopin, HIGH);

distance = duration/58.2;

if(distance <16) {
digitalWrite(beeperpin, HIGH);
delay(1000);
}

Serial.println(distance);

delay(10);

}