shukla_03
Published

Automated Guided Wheelchair for Indoor Navigation

Autonomous wheelchair with sensors and mapping tech navigates indoor spaces, enhancing independence for mobility-impaired users.

IntermediateWork in progress258
Automated Guided Wheelchair for Indoor Navigation

Things used in this project

Story

Read more

Schematics

Circuit diagram

Code

Reading LiDAR Data

Python
import serial

def read_lidar_data(port='/dev/ttyUSB0', baudrate=115200):
    try:
        with serial.Serial(port, baudrate) as ser:
            while True:
                line = ser.readline().decode('ascii').strip()
                # Process the LiDAR data
                print(f"LiDAR Data: {line}")
    except Exception as e:
        print(f"Error reading LiDAR data: {e}")

if _name_ == "_main_":
    read_lidar_data()

Reading Ultrasonic Sensor Data

Python
import RPi.GPIO as GPIO
import time

TRIG = 23
ECHO = 24

def setup_gpio():
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(TRIG, GPIO.OUT)
    GPIO.setup(ECHO, GPIO.IN)

def get_distance():
    GPIO.output(TRIG, False)
    time.sleep(2)
    GPIO.output(TRIG, True)
    time.sleep(0.00001)
    GPIO.output(TRIG, False)
    
    while GPIO.input(ECHO) == 0:
        pulse_start = time.time()
    
    while GPIO.input(ECHO) == 1:
        pulse_end = time.time()
    
    pulse_duration = pulse_end - pulse_start
    distance = pulse_duration * 17150
    distance = round(distance, 2)
    return distance

def main():
    setup_gpio()
    while True:
        distance = get_distance()
        print(f"Distance: {distance} cm")
        time.sleep(1)

if _name_ == "_main_":
    main()

Simple Obstacle Avoidance Logic

Python
def avoid_obstacles(distance, threshold=30):
    if distance < threshold:
        # Stop or reverse
        print("Obstacle detected! Taking action.")
        # Example: Stop the wheelchair or navigate away
        stop_wheelchair()
    else:
        # Continue navigating
        print("Path clear. Proceeding.")
        move_forward()

def stop_wheelchair():
    # Code to stop the wheelchair
    print("Wheelchair stopped.")

def move_forward():
    # Code to move the wheelchair forward
    print("Moving forward.")

Credits

shukla_03
1 project • 1 follower
Contact

Comments

Please log in or sign up to comment.