Introduction: Social Distance Measuring Device

About: IT Teacher (Andalucía, Spain)

Keeping space between you and others is one of the best tools we have to avoid being exposed to this virus.

I present you a portable distance measuring device to keep the social distancing at work.

I have built this device for my wife because she works serving the public behind a counter.

The device will continously watch somebody doesn´t go too close. If somebody goes too close to her, less than the social distance (about 6 feet, 200 centimeters), a beep will begin to sound and the LED matrix begin to blink. The device can be powered using a USB port in its computer as you can see in the above image or using an internal 3,7 V LIPO battery as you can see in the video at the end.

It would be useful too, if you worked in a business where you needed to stablish around you and your products a safety distance (fresh fish, fresh fruit or fresh meat). Several devices could help to watch everybody maintain the social distancing all the time.

One thing's for sure: our lifestyle won't fully return to "normal" right away.

Like me, I hope be useful for somebody.


ARDUINO board or compatible microcontroller

Ultrasonic sensor HC-SR04

Passive buzzer

8x8 LED Matrix

3,7V old mobile battery

Power boost charger (3,7V-5V) or micro USB charger and a boost step up converter DC-DC (3,7 V-5 V)




Step 1: The Circuit and the Code

The circuit is very simple. I have used an ultrasonic sensor that is continously measuring distances. To display the measured distances I have used a MAX7219 LED dot 8x8 matrix.

Finally I have used a passive buzzer to produce a beep when the measured distance is less that the social distance (about 6 feet or 200 centimeters).

I have used in the Fritzing circuit a single power boost charger device (best solution) but I have implemented the circuit with a micro USB LIPO charger and a boost step converter 3,7V to 5V.

As you can see in the Fritzing drawing I have used two little switches. One of them is the main switch and the other one allow us to disable the buzzer.

The left digit in the LED matrix is the integer value we obtain when we divide the distance by 100 and the right one. Only thiss value will be displayed if it is greater than 0.

The second digit is the remainder distance divide by 10.

Example: 50 centimeters -> (no left digit, 5 in the right digit), 120 centimeters -> (1 in the left digit, 2 in the right digit), 230 centimeters -> (2 in the left digit, 3 in the right digit).

So it means the minimum distance the device is able to measure is 10 centimeters.

Step 2: Cutting the Plywood

The dimensions of the device are the following: 15 x 5 x 3 centimeters.

As you can see in the second image you need to open several holes to install the sensor and the LED matrix.

Step 3: Soldering the Sensor, the LED Matrix and the Buzzer

Step 4: Testing the Device

Step 5: Next Steps

This is just a prototype that could be built using better materials and other devices like an OLED display or, instead of using plywood, using plastic materials previously printed by a 3D printer. Everything will allow to reduce the device size

Another interesting improvement is to equipped the device with a PIR sensor to ensure what the ultrasonic sensor detects is a human body. So the buzzer would sound only if both the ultrasonic sensor and the PIR sensor detect anything at the same time.

Step 6: Similar Project

The Assistive Belt project I published here on December, could help elder people to keep the social distance when the quarantine end, at least, during several months.
Basically it is a belt equipped with two ultrasonics sounds (front and rear) and several vibration motor. It works in a similar way: when somebody goes too close, the motors begin to vibrate in the belt and several blue leds will begin to flash warning the others they are not keeping the social distance.