+21622886281
Micro:bit Project

Simulation of the functioning of railway barriers with Micro:bit

Objective of project

There are barriers between a railroad train and a pedestrian or car crossing.

In this project we will realize a system that simulate the operation of automatic barriers for railways trains.

We will design this system using:

  • Micro:bit card
  • two ultrasonic sensors hc-sr04 for the detection of the arrival of the train.

  • two servomotors to lower or raise the barriers

Operation of the barrier controlled by Microbit:

Components required

  • Micro:bit card
  • HC-SR04 sensor

  • Servomotor
  • Motor driver GPIO card

  • LEDs
  • test plate

  • connecting wires

  • toy train

Assembly:

To do the assembly, we connected:

For the first sound sensor HC-SR04:

  • the VCC pin to the 3.3V pin of the Micro:bit

  • the Trig pin to the P12 pin of the Micro:bit

  • the ECHO pin to pin P13 of the Micro:bit

  • the GND pin to the GND pin of the Micro:bit

For the second sound sensor HC-SR04:

  • the VCC pin to the 3.3V pin of the Micro:bit

  • the Trig pin to pin P14 of the Micro:bit

  • the ECHO pin to the P15 pin of the Micro:bit

  • the GND pin to the GND pin of the Micro:bit

For the first servomotor:

  • red wire: power supply wire to be connected to the 5V terminal of the GPIO card

  • brown wire: wire to connect to the GND pin of the Micro:bit

  • Yellow: Positioning signal wire connected to Micro: bit pin S1

For the second servomotor:

  • red wire: power supply wire to be connected to the 5V terminal of the GPIO card

  • brown wire: wire to connect to the GND pin of the Micro:bit

  • Yellow: Positioning signal wire connected to Micro:bit pin S2

For LEDs:

  • the terminals (-) of the LEDs to GND of the Microbit

  • the (+) terminal of the first red LED at P0 of Microbit

  • the (+) terminal of the first green LED at P1 of Microbit

  • the (+) terminal of the first red LED to P2 of Microbit

  • the (+) terminal of the first green LED at P8 of Microbit

Makecode Program

Here is the makecode program which allows you to:

  • calculate the distance between the HC-SR04 sensor and the detected object

  • raise or lower barriers

  • turn LEDs on or off




0 commentaire


Leave a comment

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Scroll to Top