Advanced AVR 3.0 time management - Juno Edu 1.0 + HC-SR04

Channel:
Subscribers:
579
Published on ● Video Link: https://www.youtube.com/watch?v=VbIe0aUcsMw



Duration: 2:19
1 views
0


No hard core math or physics. Just by adjusting the timer's compare value, I am able to get the HC-SR04 to output a very precise and responsive 8-bit value with nothing but a ruler. Distance is arbitrary, and 20mm-4000mm can be represented with an 8-bit number if precision is not as critical. Here the distance is represented in millimeter, with near pinpoint accuracy.

Because distance is proportional to ping-back-time, the speed of sound is irrelevant. The speed is the factor or ratio between distance and time, and according to the datasheet, it's us/5.8= 1 millimeter; 0.001/333=3*2=6us, so about 6us for 1 millimeter, and it's about right.

The actual formula for the timer is 16000000/(1/0.000006)=96; 95 is the actual compare value, and 96 is the number of 1-clock-cycle-cpu instructions clocked at 16MHz for one increment of the counter at 1 millimeter assuming the speed of sound is 333m/s. It's possible for the HC-SR04 to measure in 1 millimeter precision.

PS. Speed of sound is different at different ambient temperature, and 333m/s is nice because it's easier to remember.




Other Videos By Flyandance


2023-11-13Light Tower 3.0 - Driver and TM update - Nixie tube clock High Voltage Advanced AVR time management
2023-11-12What Juno Advanced AVR Core can do? Demonstrated with Light Tower 3.0
2023-11-11Light Tower 3.0 - Display mode 1 Demo + Advanced AVR 3.0 time management Nixie tube clock
2023-11-07Light Tower 3.0 Driver creation and Hardware Test - Nixie tube clock AVR High Voltage MCU control
2023-11-06Light Tower 3.0 Assembled - (Hardware preview) Nixie tube clock - Dual High Voltage converter DC-DC
2023-11-03Infinity Ring of Love and Light 1.0 ---- Advanced CD 4017 + NE555 LED chaser
2023-11-02New Kit: Light Tower 2.0X - 10+1 Neon Lamp Chaser 70mA No LED mini transformer CD4017 + NE555
2023-11-01Open box - 4 New PCB - Components - Goodies - 4.5kg - 7 days shipping vis UPS Trade Direct® Air
2023-11-01Advanced AVR 3.0 time management Finalized - Elegant delay code + new HC-SR04 library
2023-10-29Advanced AVR 3 0 time management
2023-10-26Advanced AVR 3.0 time management - Juno Edu 1.0 + HC-SR04
2023-10-25Advanced AVR 3.0 time management - HC-SR04 Ultrasonic distance measurer test
2023-10-17Mini Power supply controller - Universal PWM MCU 5v 12v 5-20v
2023-10-15Light Tower 3.0 - Final Product (PCB preview)
2023-10-14Light Tower 3.0 - Create Silkscreen with Photoshop bitmap
2023-10-13Light Tower 3.0 - The essence of flyandance
2023-10-12Secret of youtube enhanced bitrate Exposed
2023-10-09The art of creating an extremely high quality PCB
2023-10-06OS/HD/SSD -- clone/backup - PNY CS900 240GB SSD Real Test
2023-10-05Perfect Mini Gas Stove - Campingmoon Z23-CB - Water boiling (Short Film)
2023-10-04$15 PNY 240GB SSD Test - CS900