Arduino Introduces the Plug and Make Kit: A Beginner-Friendly Approach to Electronics

Arduino Introduces the Plug and Make Kit: A Beginner-Friendly Approach to Electronics

Arduino, renowned for its versatile microcontroller boards and expansive ecosystem of sensors...
Read more
Arduino Unveils IoT Remote v3.0.0: Introducing Native Tablet Support for Android and iOS

Arduino Unveils IoT Remote v3.0.0: Introducing Native Tablet Support for Android and iOS

Exciting news for Arduino enthusiasts! Arduino has just announced the release of...
Read more
Compute Module 4S - SB Components

Compute Module 4S by Raspberry Pi - Now Available!

  Raspberry Pi enthusiasts and industrial users alike have reason to celebrate...
Read more
LoRaWAN Series for Raspberry Pi, Pico, Espressif, and Beyond: Gateways & Nodes for IoT Integration

LoRaWAN Series for Raspberry Pi, Pico, Espressif, and Beyond: Gateways & Nodes for IoT Integration

  The LoRaWAN Series Designed to transcend boundaries and empower innovation, this series of...
Read more
Arduino kicked off Embedded World 2024 by introducing Arduino Pro 4G Module and Portenta Mid Carrier

Arduino kicked off Embedded World 2024 by introducing Arduino Pro 4G Module and Portenta Mid Carrier

Arduino enthusiasts, gear up for some exciting news as Arduino unveils not...
Read more
Individuals with paralysis may operate robots more easily because to motion control interface

Individuals with paralysis may operate robots more easily because to motion control interface

Twenty years ago, Henry Evans experienced a brain-stem stroke that left him...
Read more
Crafting a Wooden Desk Lamp with Levitating Dimmer and WS2812b Addressable LED Strip Controlled by Esp8266

Crafting a Wooden Desk Lamp with Levitating Dimmer and WS2812b Addressable LED Strip Controlled by Esp8266

Looking for a unique addition to your workspace? RoughWood81 brings an innovative...
Read more
Harnessing the Sun: Arduino GIGA R1 WiFi Powers Solar EV Charging System

Harnessing the Sun: Arduino GIGA R1 WiFi Powers Solar EV Charging System

The future of transportation is electric, and the quest for sustainable energy...
Read more
Subscribe Us
Subscribe to our newsletter and receive a selection of cool articles every weeks

PiCoder: Effortless Parking with Automatic Garage/Barrier Gate Opening System

PiCoder: Effortless Parking with Automatic Garage/Barrier Gate Opening System

Experience effortless parking with the PiCoder, an automatic garage/barrier gate opening system powered by the Raspberry Pi Pico Learning Ki

Effortless Parking: Automatic Garage / Barrier Gate opening system

Story:

Automatic barrier/garage door opening is a system that enables the opening and closing of garage doors without manual intervention. The system typically utilizes sensors and motors to detect the presence of vehicles and activate the door-opening mechanism accordingly.

One common approach is to use a motion sensor or a proximity sensor to detect the presence of a vehicle in the garage. Once the sensor detects the presence of a vehicle, it sends a signal to a microcontroller or a computer that activates the motor responsible for opening the garage door. The door is then automatically opened to allow the vehicle to enter or exit the garage.

Automatic door opening systems provide a number of benefits, including convenience, and energy efficiency. They also reduce the risk of accidents or injuries associated with manual door-opening mechanisms. 

Pin Connection:

Let’s get started,

To complete this project, we will be using the Picoder Learning kit's onboard Ultrasonic sensor and servo motor. Here's the pin connection information that you'll need to follow:

  • Raspberry Pi Pico W <-> Ultrasonic sensor

Connect 5V to VCC

Connect GPIO17 to ECHO

Connect GPIO16 to TRIG

Connect GND to GND

  • Raspberry Pi Pico W <-> Servo motor

Connect GPIO15 to the signal (usually the orange wire)

Connect 5V to VCC

Connect GND to GND

Don't worry if this seems daunting; the kit includes simple jumpers for the GPIO pins, which are plainly labeled as "GP" in the figure below.

 

The basic operation of the system is portrayed in the graphic below.

To setup Raspberry Pico W watch this tutorial -> BlinkLED project

After that, simply copy the code script file below to your Picoder and your system is ready to automate your garage or any barrier Gates.

import sleep
from machine import Pin,PWM
import utime

#configure ultrasonic sensor pins
trigger = Pin(16, Pin.OUT) #set GP16 as OUTPUT connected to Trig pin of Ultrasonic
echo = Pin(17, Pin.IN) #set GP17 as INPUT connected to Echo pin of Ultrasonic

buzzer = Pin(22, Pin.OUT) #set GP12 as OUTPUT where buzzer connected

servo = PWM(Pin(15)) #configure GP15 for PWM where servo sig connected
servo.freq(50)

def ultrasonic():
timepassed = 0
trigger.low()
utime.sleep_us(2)
trigger.high()
utime.sleep_us(10)
trigger.low()

while echo.value() == 0:
signaloff = utime.ticks_us()
while echo.value() == 1:
signalon = utime.ticks_us()

timepassed = signalon - signaloff
distance_cm = (timepassed * 0.0343) / 2
distance_cm = round(distance_cm,2)
return distance_cm

def doorOpen():
buzzer.value(1) #Switch ON Buzzer for audio alert
for position in range(1000,6000,50):
servo.duty_u16(position)
sleep(0.01)
buzzer.value(0) #Switch OFF Buzzer


def doorClose():
buzzer.value(1) #Switch ON Buzzer
for position in range(6000,1000,-50):
servo.duty_u16(position)
sleep(0.01)
buzzer.value(0) #Switch OFF

thresholdDistance = 4 # change this as per your requirement, when to trigger servo gate

while True:
distance = ultrasonic()
print("Distance =",distance)

if distance < thresholdDistance: #Check if vehicle close to sensor,
doorOpen()
print("Door Opened!!")
while distance < thresholdDistance: #Wait for vehicle to pass
distance = ultrasonic()
sleep(1)
doorClose()
print("Door Closed!!")

utime.sleep(0.5)

 

0 comments

Rock_a167a6e8-604a-4627-8734-3a15a19bbdd8
Comments 

No comments

Leave a comment
Your Email Address Will Not Be Published. Required Fields Are Marked *