Skip to content

Samuel-Gbadamosi/BuggyRobot-RaspBerryProject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

19 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Alt text

BuggyRobot-RaspberryProject ๐Ÿค–

This project is a Raspberry Pi-controlled buggy robot powered by the gpiozero library. The robot can move in all directionsโ€”forward, backward, left, and rightโ€”with adjustable speed. It is controlled via a keyboard interface using the curses module for smooth operation.

Features ๐Ÿš€

  • Movement Control: Forward, backward, left, and right
  • Adjustable Speed: Low, Medium, High ๐ŸŒŸ
  • Status Logging: Logs robot status in status.txt ๐Ÿ“
  • Graceful Shutdown: Shutdown Raspberry Pi safely ๐Ÿ“ด

Hardware Requirements ๐Ÿ”ง

  • Raspberry Pi (Tested on Pi 5) ๐Ÿ–ฅ๏ธ
  • L298N Motor Driver ๐Ÿ”‹
  • 2 DC Motors โš™๏ธ
  • Power Source: 12V battery recommended ๐Ÿ”‹
  • Male-to-female jumper wires ๐Ÿ”Œ

Wiring Diagram ๐Ÿงฉ

Motor Driver Pin Raspberry Pi GPIO
IN1 GPIO 22 (Pin 15)
IN2 GPIO 17 (Pin 11)
IN3 GPIO 23 (Pin 16)
IN4 GPIO 24 (Pin 18)
ENA Connected to 3.3V or PWM control
ENB Connected to 3.3V or PWM control

Installation ๐Ÿ› ๏ธ

  1. Install Dependencies:

    sudo apt update
    sudo apt install python3-gpiozero
  2. Clone the Repository:

    git clone https://github.com/Samuel-Gbadamosi/BuggyRobot-RaspBerryProject.git
    cd BuggyRobot
  3. Run the Robot Script:

    python3 robot.py

Controls ๐ŸŽฎ

Key Action
โ†‘ (UP Arrow) Move Forward
โ†“ (DOWN Arrow) Move Backward
โ† (LEFT Arrow) Turn Left
โ†’ (RIGHT Arrow) Turn Right
'l' Set speed to Low
'm' Set speed to Medium
'h' Set speed to High
'p' Shutdown Raspberry Pi
'q' Quit the program

Status Logging ๐Ÿ“

The robot's current status (movement direction and speed) is logged in status.txt for future reference and debugging.

Troubleshooting โš ๏ธ

Motors Not Moving?

  • Check wiring connections.
  • Ensure the motor driver is powered properly.
  • Run gpioset commands to test individual GPIO states.

Only One Motor Works?

  • Swap motor connections to confirm if the issue is wiring-related.
  • Ensure both ENA and ENB are powered or controlled via PWM.

No Key Presses Detected?

  • Run robot.py with sudo.
  • Add print(f"Key pressed: {char}") in the loop to debug key inputs.

Contributing ๐Ÿค

Feel free to fork the repository and submit pull requests for improvements! Contributions are always welcome ๐Ÿ˜Ž.


Before : firstPic

After : Final-result

Enjoy building and controlling your BuggyRobot! ๐Ÿš—..๐Ÿ’จ

Created by Samuel Gbadamosi

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages