# data[].attributes.body
A sebességmérő radar a HC-SR04 ultrahangos érzékelő segítségével működik, amely két egymást követő időpontban méri a szenzor és a mozgó tárgy közötti távolságot. A Micro:bit a mért időintervallum alatti távolságkülönbség alapján számítja ki a tárgy sebességét. A kiszámított sebesség ezután megjelenik az I2C LCD kijelzőn, azonnali vizuális kimenetet biztosítva. Ezenkívül egy beépített hangjelző is van, amely jelzi, ha egy tárgy túllép egy előre meghatározott sebességküszöböt, azonnali hangjelzést adva. A Micro:biten futó program folyamatosan figyeli a szenzor adatait, frissíti az LCD kijelzőt, és vezérli a hangjelzőt, lehetővé téve a rendszer számára az autonóm működést és a tárgy mozgásának valós idejű pontos érzékelését.

# data[].attributes.attachment_link.title
Micro:bit project : Create Your Own Speed Radar with HC-SR04 sensor

# data[].attributes.attachment_link.title
Create Your Own Speed Radar with Micro:bit and HC-SR04

# data[].attributes.attachment_link.title
Tutorial micro:bit PODÓMETRO - Contador de pasos - Acelerómetro - ¡Y también como pulsera!

# data[].attributes.attachment_link.title
How to Pair your BBC micro:bit Bluetooth Connection

# data[].attributes.attachment_link.title
Tutorial micro:bit - MACHINE LEARNING - programar IA - reconocimiento de gestos - MUY FÁCIL

# data[].attributes.attachment_link.readable_text
Timing gates

Two gates are connected to the micro:bit so it can detect a car passing through them.

As the car passes through the gate 0, it sends an event to the micro:bit through the ||input:on pin pressed|| block. The micro:bit records the time in a variable t0.

As the car passes through the gate 1, it sends an event to the micro:bit through the ||input:on pin pressed|| block. The micro:bit records the time in a variable t1.

The rest is a bit of math and physics. The time taken to cross the gates is computed as the difference of t1 - t0. By dividing the distance between the gates by the duration, we get the speed of the car!

Materials

Cardboard

Aluminum foil

Double-side tape (carpet tape)

4 crocodile clips

A micro:bit board and USB cable

blocks

basic.showLeds(` . . . . . . . . . . . . # . . . . . . . . . . . . `) input.onPinPressed(TouchPin.P0, () => {}) let t = 0 input.runningTime() t - 1 control.eventTimestamp(); basic.showNumber(0)

Building the gate

The sensor is made by tapping two strips of foil on the cardboard as close as possible.

Add two strips of double-sided tape on the cardboard. Remove the protective film.

Lay the Aluminum foil on the double-sided tape. Press firmly on the tape to get a good bonding of the foil.

Pull off the foil that's not touching the tape strips. That's all the foil in between and around the tape strips. This clears out the extra foil and makes a gap between the foil on the tape strips. Make sure the gap is just enough so that both foil strips don't touch each other.

Connect a crocodile strip to each foil strip.

Connect the crocodile plugs to the GND and P0 pins on the micro:bit.

The gate is ready to use! Your circuit should look like the picture below:

Detecting the car with code

The micro:bit provides an event ||input:on pin pressed|| that is raised when a circuit between GND and a pin is detected. The circuit conductor could be a wire or even your body! We will attach a foil to the bottom of the car. When it passes over the gate, it connects both foil strips, closes the circuit and triggers the event.

Open the code editor and start a new project and add the following blocks. Notice that we are using pin P0 here.

basic.showLeds(` . . . . . . . . . . . . # . . . . . . . . . . . . `) input.onPinPressed(TouchPin.P0, () => { basic.showLeds(` # . . . . # . . . . # . . . . # . . . . # . . . . `) })

Testing the code with our finger, we see a LED column turn on when pressing on both strips.

Upgrading the car

In this lesson, we picked a random toy car and tapped foil to the bottom. As the car goes through the gate, it will connect both sides of the gate and trigger it. Make sure to add enough foil to get a good connection on the ground.

By moving the car (slowly) through the gate, you will see that it triggers the on pin pressed event.

Adding the second gate

Repeat the same process with tape and foil to build the first gate.

Connect the crocodile plugs to the GND and P1 pins on the micro:bit.

Detecting the second gate

Since the second gate is connected to pin P1, we add a second ||input:on pin pressed|| event that display 2 columns of LEDs.

basic.showLeds(` . . . . . . . . . . . . # . . . . . . . . . . . . `) input.onPinPressed(TouchPin.P0, () => { basic.showLeds(` # . . . . # . . . . # . . . . # . . . . # . . . . `) }) input.onPinPressed(TouchPin.P1, () => { basic.showLeds(` # . . . # # . . . # # . . . # # . . . # # . . . # `) })

Strolling the car over both gates, you can see how the first gate triggers then the second.

Computing time

The micro:bit has a clock that measures time precisely. It measures how many seconds the micro:bit has been on. We will record the time where each gate is tripped in variables t0 and t1. We take the different between t1 and t0 to compute the duration between the gates.

let t0 = 0; let t1 = 0; basic.showLeds(` . . . . . . . . . . . . # . . . . . . . . . . . . `) input.onPinPressed(TouchPin.P0, () => { t0 = control.eventTimestamp(); basic.showLeds(` # . . . . # . . . . # . . . . # . . . . # . . . . `) }) input.onPinPressed(TouchPin.P1, () => { t1 = control.eventTimestamp(); basic.showLeds(` # . . . # # . . . # # . . . # # . . . # # . . . # `) let d = t1 - t0 basic.showNumber(d) })

Computing velocity

Measure the distance between the gates and apply Newton's laws to compute the velocity (how fast it's going) of the car.

We'll let you try to code this one on your own!

# data[].attributes.attachment_link.description
This project explains the principles of timing gates using household materials.

# data[].attributes.attachment_link.title
Microbit Smart Home Kit: Smart Fan #microbit #smarthome #diy

# data[].attributes.attachment_link.title
Microbit Smart Home Kit: Auto Plant Watering System #microbit #smarthome #diy #stem

# data[].attributes.attachment_link.title
Microbit Smart Home Kit: Auto Window #microbit #smarthome  #diy

# data[].attributes.attachment_link.title
5 Micro:bit Display - Automatic Sliding Door

# data[].attributes.attachment_link.title
micro:bit LIVE 2020 virtual | Interactive pets with micro:bit & machine learning, Tiffany Tseng

# data[].attributes.attachment_link.title
Crazy Circuits - Bit Board & micro:bit Projects

# data[].attributes.attachment_link.title
Forklift Robot Built With Cardboard And BBC Micro:Bit DIY

# data[].attributes.attachment_link.title
Robotic Whale Built With Cardboard and a Servo Motor

# data[].attributes.attachment_link.title
DIY Automatic Gate using Teachable Machine and Micro:Bit – Smart AI Project

# data[].attributes.attachment_link.title
Micro:Bit Robot - Remote Control Program

# data[].attributes.attachment_link.title
Let's Tinker. Automatic Door. Creative Designs on Servo Motor. STEM Project

# data[].attributes.attachment_link.title
Microbit Smart Home Kit: Smart Home [BM]

# data[].attributes.attachment_link.title
First in the World! Diy Automatic door no using Microcontrollers

# data[].attributes.attachment_link.title
Elecrow Micro:bit All-in-one Starter Kit with 13 Modules and 21 Lessons

# data[].attributes.attachment_link.title
DIY micro:bit Maze Game #stemeducation #fun

# data[].attributes.attachment_link.title
Electric Guitar Tutorial | Micro:bit | STEM activity

# data[].attributes.attachment_link.title
Learn how to code a Tetris clone on the Micro:bit with iNimbleSloth

# data[].attributes.attachment_link.description
Tetris for the Micro:bit? That’s right, you read that right. See how to code Tetris for the Micro:bit and play on the 5 x 5 LED matrix.

# data[].attributes.attachment_link.title
Magnets Collector - Detect Magnets With BBC Micro:Bit Magnetometer

# data[].attributes.attachment_link.title
How To Make A Pac Man Game With The Micro:bit

# data[].attributes.attachment_link.title
How to make a Pacman game on the micro:bit

# data[].attributes.attachment_link.title
Introducing Air:bit, the micro:bit drone

# data[].attributes.attachment_link.title
Ascensor | micro:bit + micro:shield | Tutorial MakeCode

# data[].attributes.attachment_link.title
Barrier Gate with micro:bit and MakeCode #microbit #blockprogramming

# data[].attributes.attachment_link.description
All the fun from the Flappy Bird game is coming to the micro:bit as Crashy Bird!