You must measure the distance from the floor to the ceiling you do not have an elevator, you will measure how? In life or daily work, there are times when you need to measure the distance from point A to point B but if a normal size can not help you measure the distance, you'll have to do like? You will be roughly that distance or order a size laser with up to several million price? In today's article we will guide you to a measure of restraint in space with features similar to the laser to measure the cost of only a few hundred thousand. Prepare An Arduino UNO R3 kit (priced at about 180,000 VND) An ultrasonic sensor or SRF-05 SRF-04 well (30.000- cost about 50,000 dong) A 16x2 LCD display (approximately 50,000-100,000 VND Price type Keypad your choice whether to use the type of article is the type of keypad) A hug 10K variable (cost about 10,000 dong) A test circuit Broad (priced around 20,000) Germany's line, the Duc. (Price 7000 contract) You can consult and order products How to assemble and operate Step 1: Ultrasonic sensors SRF-05 and 10K variable hug Ultrasonic sensors SRF-05 and 10K variable hug 10K variable hug 10K variable hug Ultrasonic sensors plugged SRF-05 and turn onto broad embrace 10k circuit test Plug the cord into the foot of ultrasonic sensors SRF-05 and turn 10k hug With ultrasonic sensors SRF-05 plug into the pins GND, VCC, Trig and legs Echo With 10K of your variables plugged into 3 feet of rheostat. Step 2: 5V and GND wires plugged into circuits Broad test. 5V wires you plug in the foot strip (+) GND cord plugged into the vacuum range (-) Then plug the VCC and GND of ultrasonic sensors on the two strips (+) and (-) on the broad test this circuit. Next you plug the outside of turn two outside back into two bands. You just plug any two strings are. Trig's sensor plug into the foot 9 and Line Echo on foot No. 10 Step 3 Connect with 16x2 LCD display with Ardduino The legs of the LCD screen, from foot to foot K VSS The legs of the LCD screen, from foot to foot K VSS Pinout: GND VSS plug into foot foot 5V VDD foot plug in leg VO foot rope connected between the variable resistor 10K RS leg plugged into the Arduino foot 1 RW foot plugged into GND pins E plug on the leg leg 2 D4 foot plugged into the Arduino foot 4 D5 foot plugged into the Arduino foot 5 D6 6 feet plugged into the Arduino foot D7 foot 7 foot plugged into the Arduino A plug into 5V foot foot Chan K plugged into GND pins GND VSS plug into foot foot GND VSS plug into foot foot VO foot rope connected between the 10K potentiometer, RS plug on pins 1 Legs, Legs RW plugged into GND pins VO foot rope connected between the 10K potentiometer, RS plug on pins 1 Legs, Legs RW plugged into GND pins E plug on foot 2 feet, legs and feet D4,5,6,7 plugged into the Arduino 4 5 6 7 E plug on foot 2 feet, legs and feet D4,5,6,7 plugged into the Arduino 4 5 6 7 A foot strip plugged into the (+) pins plugged into the strip k (-) on the broad test circuit A foot strip plugged into the (+) pins plugged into the strip k (-) on the broad test circuit Step 4: Load the code for the Arduino You connect to the computer and open Arduino Arduino on the computer and then copy this code. #include LiquidCrystal LCD (1, 2, 4, 5, 6, 7); const int trigPin = 9; const int echoPin = 10; ThoiGian dragon; distance: int; void setup () { lcd.begin (16.2); pinMode (trigPin, OUTPUT); pinMode (echoPin, INPUT); } void loop () { digitalWrite (trigPin, LOW); delayMicroseconds (2); digitalWrite (trigPin, HIGH); delayMicroseconds (10); digitalWrite (trigPin, LOW); ThoiGian = pulseIn (echoPin, HIGH); distance: = ThoiGian * 0034/2; lcd.setCursor (0.0); lcd.print ( "the distance is:"); lcd.setCursor (0.1); lcd.print (distance:); lcd.print ( "cm"); delay (10); } The formula for calculating the distance is: The distance (distance) = (time x speed of sound) / 2 The speed of sound is 340 m / s Have you noticed the bold line in the above code. As far as the right formula, it is however the actual 0034 with ultrasonic sensors and temperature environment in which we test, they must adjust to the speed of sound is 380m / s, ie 0038, the sensor will operate correctly and without error. You need to customize this recipe and temperature sensor with your environment in order to most accurately measure activity. The reason that the formula to calculate this skewed sensor part and partly because the sound velocity in the air is affected by the temperature of the environment. The speed of sound is proportional to the coefficient of elasticity of the medium and inversely proportional to the density of the environment. When the temperature rises, the air expands causing the density of air is reduced. So when the ambient temperature increases, the sound velocity will increase. Additionally velocity depends on the moisture in the air again by altering the humidity of the air specific weight. Click the symbol V to translate code Click the symbol V to translate code Click the arrow icon to load the code conduct Click the arrow icon to load the code conduct After loading is complete, the code size can have size See at: http://adf.ly/1hvOhc