Introduction: TrigonoDuino - How to Measure Distance Without Sensor

This project is made for measuring distance without commercial sensor. It's a project for understanding trigonometric rules with a concrete solution. It's could be adaptable for some other trigonometric calculation. Cos Sin and others function with Math.h.

It's a first version prototype of this kind of measure with laser beams, any suggestions or tips are welcome.

It's use mathematic for measuring distance with Trigonometry rules.

It's work with two laser diodes, a servo motor SG90, one potentiometer 10k and an Arduino Uno.

Precision is around +- 2 mm for <1 meter distance, the distance is display on centimeter. If you want convert on inch, 1cm = 0,393701 inch, you must divide by 2,54. You may lost accurate precision with bigger distance, cause of little offset angle on A (instead of 90° you may have 90.05°).

Explanation:

Potentiometer move the laser C on the servo motor, this gives angle C to Arduino. Laser A point give a right angle.Move the laser (C) point with potentiometer up to superimposing the two laser beams, this gives point B.

Tips: Adjust laser beams with laser screw lens up to obtain perfect laser point.

Step 1: Part List

Main:

- Arduino Uno:https://fr.aliexpress.com/popular/arduino-uno.html

- 10k Potentimeter:https://www.aliexpress.com/w/wholesale-10k-potenti...

- Dupont Wire: https://fr.banggood.com/120pcs-30cm-Male-To-Male-...

Tool:

(I have this one and it's very good soldering iron, at work I use a Weller but for myself I use it)

Optionnal:

Step 2: Wiring Electronics

Connect diode emitters, 5V to red wire and GND to blue wire.

Connect Servo Red to 5V, Black to GND and Orange to Arduino Digital Pin 3.

Connect Potentiometer left pin to Digital Pin 8, right pin to Digital Pin 9 and the middle pin to Analog Pin A0. Left pin is violet for me.

Look the schematic before powering. Be caution with laser beams, it could damaged your eyes. You may add resistors between red wire of diodes and arduino, 10k is used on module KY008.

Tip: Need solder Iron for preparing Dupont wires for lasers and potentiometer.

Step 3: 3D Print the Plate

Designed with Autocad and exported on STL format.

Print simplified version is better for you, use screw present with SG90 for fixed it. Center of servo need to be at the right of support looks like pictures.

Important:

Set servo to (0) degree before pasting the second piece to servo motor. Place lasers pointers on parrallel position with Servo on (0), replace val with 0 : monServomoteur.write(0);.

Do not paste yet, wait the end of next step.

Step 4: The Arduino Code

You could find the code for use it.

It's required to add the library Math.h on project.

Triangle is rectangle on the A corner, we know AC as 14cm, and servo motor give the angle C, also we calculate the angle B for measuring distance AB with Tan (B), B is the junction between 2 laser points. Total of angle on triangle is egal to 180°, with a 90° angle on A.

Distance measuring begin near the laser on A corner.

If you don't have OLED screen, use TrigonoDuinoSerial.ino. I used an SSD1306 Oled screen for use this without computer.

Nb: May you change 4064 by 1028 it's depend of Arduino board. For me Wavgat R3 analog pin returned value between 0 and 4064, but for some others it's 0 and 1028.

Edit: map function is not appropriate for precision, calculation mode was changed in the new code version for use double instead of long type of variable. "For" Loop was increase for a better stable value of servo motor.

Mounting lasers on their places set servo.write to 0 and paste the holding laser case on the center of servo. Lasers need to be parrallel. Adjust the laser beams to the same height and the pointers must be at the same distance as the lasers themselves.

Step 5: Test Measure

Now proceed to the measuring test. Adjust your AC lenght to the center to center of the lasers cases if needed.

Turn potentiometer slowly with little step. You may adjust laser focus (turn the screw head laser) for precision pointing big distance.

You could measuring some meters with this unit but precision will be less precise. Measurement under 1 meter are really good.

Forward:

For example, you could put a second servo under first laser for mesuring but it need more calculation. It could be a great thing for young student learning trigonometry, it given a real application of mathematics.

You could put a better servo motor and add some potentiometers for increase precision (1 potentiometer for 15° for example) and distance range of measuring.

Could add lateral displacement of the servo for changing quickly AC lenght.

Participated in the
3D Printed Contest