Groq Chatbot-Controlled Robot

The Groq Chatbot-Controlled Robot project demonstrates an advanced, AI-assisted mobile robot interface that interprets natural language commands and executes real-time physical movements. This project integrates the power of Groq LLMs, Flask-based REST API, and a Flutter mobile app, enabling full-stack control of a robot equipped with Acrome's SMD Red motor controllers.

About Tools and Materials:

2x SMD Red (Purchase Here)

SMD USB Gateway (Purchase Here)

Arduino Gateway Module (Purchase Here)

2x BDC Motor (Purchase Here)

Step 1: Hardware & Software Overview

Project Key Components

  • SMD

    The SMD acts as a bridge between the script and the modules. It is responsible for interpreting the commands sent by the script and translating them into actions that read input from the Ultrasonic Distance Sensor Module and meanwhile, actuate the motor for the continuous reading of the script.

  • BDC Motor

    The 100 RPM BDC Motor with Encoder is used to rotate the radar mechanism in a full circle. The user can precisely control the motor and get the position through the built-in encoder.

Key Features

The robot is capable of:

  • AI-based command parsing and execution

  • Angle-based rotation

  • Wi-Fi connection fallback with Hotspot mode

Step 2: Assemble

1. Connect the Hardware:

  • Mount the Raspberry Pi onto your robot chassis.

  • Connect the USB Gateway Module to the Raspberry Pi via USB.

  • Connect SMD Red 0 and SMD Red 1 (for left and right motors) to the USB Gateway via RJ-45 cables.

2. Motor and Sensor Setup:

  • Attach 100 RPM BDC Motors with encoders to the robot frame.

  • Connect left motor to SMD Red 0, right motor to SMD Red 1.

  • (Optional) Connect an ultrasonic distance sensor to SMD Red 1, using Module ID 5 for obstacle detection.

3. Wiring and Power:

  • Power the SMD Red modules using a 12V battery or adapter.

  • Power the Raspberry Pi using a USB-C power source or power bank.

  • Confirm that all RJ-45 cables are securely plugged in between the gateway and the SMD modules.

4. Software Setup on Raspberry Pi:

  • Install required packages:

  • Install SMD Python SDK (if not already installed):

  • Set USB port permissions (run once after boot):

5. Final Check:

  • Ensure the camera, motors, and sensors are securely mounted.

  • Verify the USB Gateway is detected via /dev/ttyUSB0.

  • Your Raspberry Pi is now ready to run the AI-based robot server.

Project Wiring diagram

Step 3: Run & Test

1. Start the Backend Server:

  • On the Raspberry Pi, run the Flask app:

  • This will start the AI server on http://<raspberrypi-ip>:5000.

2. Connect with the Mobile App:

  • Launch the Flutter-based app on your mobile phone.

  • Enter the IP address of your Raspberry Pi.

  • Send a voice or text command like:

    “Go forward 40 cm and turn left 90 degrees.”

3. Observe Robot Behavior:

  • The robot initializes and parses the command using Groq API.

  • Motors execute linear_movement, turn_left, etc.

  • If distance_movement is triggered, the ultrasonic sensor is used to avoid obstacles.

4. Debugging Tips:

  • If the robot doesn’t move:

    • Check motor power and RJ-45 cables.

    • Make sure smd.red modules are properly initialized in the code.

  • If Wi-Fi connection fails:

    • Use the /connect_wifi endpoint or fallback to Hotspot mode as handled by nmcli.

5. Fine-Tune Performance:

  • Adjust PID values inside set_control_parameters_velocity() in the script for smoother movement.

  • Use print() statements and app.log file for debugging AI decisions and motor execution.

6. Shut Down the System:

  • Send a shutdown request:

Codes

Last updated