Introduction: Ultrasonic Based Access System

About: IT Teacher (Andalucía, Spain)

This time I present you an ultrasonic based access system I think it could be interesting.

It is based on ultrasonic waves so it is a contactless access system that doesn't need any other electronic device but whatever object even your hands to try to grant access to whatever you want.

The basics of the system: an ordered sequence of measured distances forms a key

I hope you like

Step 1: How It Works

The system uses an ultrasonic sensor to measure distances to an object placed in front of it.

Let's suppose we configure the system to admit 6 specified distances: 1/2", 1/5", ... and we define a sequence of 5 measured distances as access key, then the set of different combinations would be 6x6x6x6x6 = 7776

Playing with the numbers of specified distances and the lenght of the access key we can configure an access system with a huge number of combinations.

The system is always measuring distances.

If a valid distances is measured by the sensor during a specified time interval, the sketch saves it and lights up a white led during a brief time interval.

After that the sketch checks if all the distances previously saved matches in the same order with the configured access key.

If so, the sketch will light up the green led and will open the barrier.

Step 2: Supplies

  • One HC-SR04 ultrasonic sensor
  • One ARDUINO NANO or compatible microcotroller
  • One micro servo motor
  • One ARDUINO LCD
  • One I2C ARDUINO LCD adapter
  • One protoboard
  • Three 5 mm leds: white, red and green
  • Wires
  • Plywood
  • Cardboard

Step 3: Fritzing Diagram

Step 4: Building the System

The steps I have followed to build the system are the following:

  • Open several holes on the plywood to install the ultrasonic sensor, the micro servo motor, the ARDUINO LCD and the three leds.
  • Wire all components and connect to the microcontroller as you can see in the pictures.

Step 5: The Code

Several points to take into account in the sketch:

  • The constant string variable "accessequence" stores the value of the access key
const String accessequence = "234";
  • The distance value you can see on the ARDUINO LCD is not the distance value measured on inches or centimeters but the value of a "distance group". I mean if the distance measured by the sensor goes from 0,78" to (0,78" + step_distance) the "distance group" value is 1 and so on.
  • You can modify the constant integer "step_distance", the "min_distance" and the "max_distance" to adjust the system precision.

Step 6: Testing the System