1.50m Social Distancing Tape Measure

1,962

7

2

Introduction: 1.50m Social Distancing Tape Measure

About: https://twitter.com/maartenweyn

In this build I adapt a regular tape measure to measure when a distance has been covered of 1.5 m. I will then say "one and a half meters". It will also indicate with a green or red light if you are above or under this distance.

This project was done because of a challenge started by Henk Rijckaert in his youtube series De Koterij and I wanted to link it to the current problems of COVID19 and social distancing.
A dutch spoken youtube movie about this build can be found on Youtube Weyn.Tech (English captions are added).

Used materials:

  1. A tape measure
  2. Optical Encoder: e4p-100-079
  3. Audio: DFPlayer Mini + sd-card
  4. Power: PowerBoost 1000C
  5. MCU: Adafruit HUZZAH32 - ESP32 Feather (any other arduino can be used as well since i do not use the BLE or Wi-Fi features in this build)
  6. Neopixel
  7. Speaker
  8. Battery
  9. On/off Switch

Step 1: Schematic

Connect the components as indicated in the schematic. The enclosure was reused and adapted from an other build but you can use any rectangular box which is large enough to fit the components. You need a whole for your speaker, the tape measure and the on/of button (and ideally for the usb min to charge the battery).

Attach the metallic plate with indicators to the rotating part of the measuring tape, make sure you center it as good as possible.

On the SD-Card for the DFPlayer you have to copy the mp3 which you want to be played when the distance you set is covered.

Step 2: Code

All code can be found on github.

The ESP32 (any other arduino can be used as well) will continuously poll the A en B output of the encoder and will increase or decrease a counter. When it exceeds -2150, I know for my tape measure it exceeded 1.5 meters. You will have to calibrate this for your meter. Depending on the value the led color is changed and the DFPlayer is ordered to play the mp3 which is on the sd-card.

Step 3: The Encoder Explained

How can we measure how far we have unrolled the meter?

This explanation is is the transcript of the video: https://www.youtube.com/watch?v=F3zZgtYZDA8&cc_load_policy=1&cc_lang_pref=en&t=425

Well, for that I use an optical encoder, namely an incremental rotary encoder. You also have others, for example absolute encoders. They are very suitable for knowing the exact position within 1 rotation. But an incremental, on the other hand, gives fixed pulses during a displacement, so you can measure the rotation yourself, also over a range of different rotations. This way you can measure the rotation itself, even over different rotations. I use a quadrature encoder, which gives two signals so that the direction can also be determined.

How does that work exactly?

There are black markings on the round disc. This disc is attached to the tape measure and will therefore rotate with it. The sensor itself consists of an LED and two photo detectors that measure whether the light is reflected. If the LED shines on the black line, less or no light will reflect than when it shines on the metal between the black mark. This signal will then be converted to a square wave at the output. The A and B output are placed in such a way that you can see from which combination of the 2 the direction is being turned.

Let's take a look at that in detail.

With every edge change of A you can change the value of B in which direction we turn. In the encoder I use, the A pulse will start before the B pulse if we turn clockwise. And vice versa if we turn counterclockwise. So we can recognise 3 pulses that tells us something about how much has been turned. My encoder has 100 cycles per revolution (CPR). in this case it has turned almost 10.8 degrees. If you look at datasheets, pay close attention to what is meant by CPR sometimes these are the number of cycles per revolutions, sometimes the number of counts per revolution (or individually different states per turn). Each pulse contains 4 different states. High or low at A and B. Which is 4 times more than with Cycles per Revolution. PPR or pulses per revolution are typically used to measure the number of pulses per full revolution. But some data sheets here mean the number of different pulse states per revolution. So also here, look carefully in the datasheet what is meant. We see here that the A pulse comes before the B pulse.

An easy way to process this in code is when the A signal changes to see what the value of the B signal is. If the B signal does not have the value of the A signal, we turn clockwise and we can increment or increment a counter each time.

We now get 200 edge changes per full turn because we have 2 per pulse. So, if the counter is at 200, we rotated a full turn. Or rotated 360 degrees The other way around if we turn in the opposite direction then you can see that the A signal will generate the same 3 pulses.

So, we also have here that it has turned 10.8 degrees. But this time the B signal has the same value as the A signal, so we know that the B signal is already ahead of the A signal. And hence, we turn counterclockwise. In this case we can therefore decrease the counter. Now we know how many times the tape measure has been cut. If we want to know a fixed distance, it is fairly simple.

For example, here, for one and a half meters, the counter should be -2150. In other words, 3870 degrees counterclockwise.

If you always want to know how much has been unrolled you have to take into account that the diameter is getting smaller in other words, there will be less and less distance on the tape measure per full rotation.

Audio Challenge 2020

Participated in the
Audio Challenge 2020

Be the First to Share

    Recommendations

    • Rocks, Gems, and Stones Speed Challenge

      Rocks, Gems, and Stones Speed Challenge
    • Lamps and Lighting Contest

      Lamps and Lighting Contest
    • Back to School: Student Design Challenge

      Back to School: Student Design Challenge

    2 Comments

    0
    tyamat
    tyamat

    Reply 1 year ago

    Thanks! ;-)