Arduino UNO Q - DRV8833 DC Motor Driver

The DRV8833 is a tiny, cool-running driver that can spin two small DC motors from a battery pack — a perfect fit for a first robot car built on the Arduino UNO Q. The STM32 MCU produces the PWM signals, and the Linux side can later take over as the "remote control" through Bridge and Telegram.

In this tutorial, you will learn:

Arduino UNO Q DRV8833 DC Motor Driver

Hardware Preparation

1×Arduino UNO Q
1×USB Cable for Arduino Uno Q
1×DRV8833 Motor Driver Module
2×5V DC Motor
1×5V Power Adapter
1×DC Power Jack
1×Jumper Wires
1×Recommended: Screw Terminal Block Shield for Arduino Uno
1×Recommended: Sensors/Servo Expansion Shield for Arduino Uno
1×Recommended: Breadboard Shield for Arduino Uno
1×Recommended: Enclosure for Arduino Uno
1×Recommended: Prototyping Base Plate & Breadboard Kit for Arduino UNO

Or you can buy the following kits:

1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .

Part 1 needs only one motor. The second motor is for Part 2.

Overview of the DRV8833 Module

The DRV8833 is a dual H-bridge chip from Texas Instruments. One module can run two brushed DC motors in both directions (or one small bipolar stepper motor). Its outputs use MOSFETs, so very little voltage is lost inside the chip — your motors get almost the full battery voltage and the board stays cool, unlike the older L298N.

DRV8833
Motor Supply (VCC / VM) 2.7V to 10.8V
Logic Input Level 3.3V or 5V (no separate logic supply needed)
Output Current about 1.5A RMS per channel, 2A peak
Channels 2 (motor A and motor B)
PWM Frequency up to 50 kHz
Protection under-voltage, over-current, over-temperature
DRV8833 Motor Driver Pinout

Control pins (to the Arduino UNO Q MCU):

  • IN1, IN2: Control motor A — direction and speed (PWM)
  • IN3, IN4: Control motor B — direction and speed (PWM)
  • EEP: Enable pin (nSLEEP). Must be HIGH for the driver to work — connect it to 3.3V. LOW puts the chip to sleep.
  • ULT: Fault output (nFAULT). Goes LOW on over-current or over-heat. Optional — you can leave it unconnected.

Power and motor pins:

  • VCC: Motor power, 2.7V to 10.8V, from an external supply
  • GND: Ground — shared by the supply, the module, and the Arduino UNO Q
  • OUT1, OUT2: Motor A wires
  • OUT3, OUT4: Motor B wires

Labels vary between makers: some boards print AIN1/AIN2/BIN1/BIN2, AOUT1/AOUT2/BOUT1/BOUT2, SLP and FLT instead. The job of each pin is the same.

Truth Table — How the DRV8833 Moves a Motor

There is no ENA/ENB speed pin like on the L298N. Each motor is controlled by just its two IN pins:

IN1 IN2 Motor A
LOW LOW Coast (free-runs to a stop)
HIGH LOW Forward
LOW HIGH Reverse
HIGH HIGH Brake (fast stop)

For speed, send PWM to one IN pin and hold the other LOW: PWM on IN1 for forward, PWM on IN2 for reverse. That is why all four IN pins must go to PWM-capable pins of the Arduino UNO Q. Motor B (IN3/IN4) works the same way.

※ NOTE THAT:

  • Power the motors from the external supply on VCC — never from the 3.3V or 5V pin of the Arduino UNO Q.
  • The GND of the power supply, the DRV8833, and the Arduino UNO Q must all be connected together.
  • For one bigger motor you can join both channels to get about 3A, but that is not needed for small 5V motors.

Part 1 — Control One DC Motor

Wiring Diagram

The wiring diagram between Arduino UNO Q DRV8833 one DC motor

This image is created using Fritzing. Click to enlarge image

DRV8833 Pin Connect To
IN1 Arduino UNO Q D10 (PWM)
IN2 Arduino UNO Q D9 (PWM)
EEP Arduino UNO Q 3.3V
GND Arduino UNO Q GND and power supply (-)
VCC 5V power supply (+) via DC power jack
OUT1, OUT2 DC motor wires

How To Program For DRV8833

  • Pick two PWM pins for motor A and set them as outputs:
#define AIN1_PIN 10 #define AIN2_PIN 9 pinMode(AIN1_PIN, OUTPUT); pinMode(AIN2_PIN, OUTPUT);
  • Spin forward at a chosen speed (0 to 255) — PWM on IN1, IN2 LOW:
analogWrite(AIN1_PIN, 200); digitalWrite(AIN2_PIN, LOW);
  • Spin in reverse — IN1 LOW, PWM on IN2:
digitalWrite(AIN1_PIN, LOW); analogWrite(AIN2_PIN, 200);
  • Coast (outputs off, the motor rolls to a stop):
digitalWrite(AIN1_PIN, LOW); digitalWrite(AIN2_PIN, LOW);
  • Brake (fast stop):
digitalWrite(AIN1_PIN, HIGH); digitalWrite(AIN2_PIN, HIGH);

The sketch wraps these lines in one helper, motorA(speed), where a positive speed means forward and a negative speed means reverse.

Arduino UNO Q Code — One Motor

The Arduino UNO Q has two processors:

  • The STM32 MCU creates the PWM signals for the DRV8833 — motor timing is real-time work, so it lives here
  • The Qualcomm MPU runs Debian Linux with Wi-Fi and Python
  • Here only the MCU is programmed. The Linux side joins in the Bridge section below.

The sketch ramps the motor up in the forward direction, holds full speed, coasts, reverses at speed 150, and finally brakes — printing each step.

/* * This Arduino UNO Q code was developed by newbiely.com * * This Arduino UNO Q code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-drv8833-dc-motor-driver */ // Arduino UNO Q - DRV8833 DC Motor Driver: control ONE DC motor (channel A) // The STM32 MCU of the Arduino UNO Q drives IN1/IN2 of the DRV8833. // Both pins must be PWM-capable because the DRV8833 has no separate speed (enable) pin. #define AIN1_PIN 10 // Arduino UNO Q MCU pin D10 (PWM) -> DRV8833 IN1 #define AIN2_PIN 9 // Arduino UNO Q MCU pin D9 (PWM) -> DRV8833 IN2 // speed: -255 (full reverse) ... 0 ... 255 (full forward) void motorA(int speed) { speed = constrain(speed, -255, 255); if (speed >= 0) { analogWrite(AIN1_PIN, speed); // PWM on IN1 digitalWrite(AIN2_PIN, LOW); // IN2 LOW -> forward } else { digitalWrite(AIN1_PIN, LOW); // IN1 LOW analogWrite(AIN2_PIN, -speed); // PWM on IN2 -> reverse } } // IN1 = LOW, IN2 = LOW -> outputs off, the motor free-runs to a stop void motorCoast() { digitalWrite(AIN1_PIN, LOW); digitalWrite(AIN2_PIN, LOW); } // IN1 = HIGH, IN2 = HIGH -> both motor wires shorted, fast stop void motorBrake() { digitalWrite(AIN1_PIN, HIGH); digitalWrite(AIN2_PIN, HIGH); } void setup() { Serial.begin(115200); delay(1500); pinMode(AIN1_PIN, OUTPUT); pinMode(AIN2_PIN, OUTPUT); motorCoast(); // start with the motor off Serial.println("Arduino UNO Q + DRV8833: one motor ready"); } void loop() { // 1. Forward, speed goes up step by step Serial.println("Forward: speeding up from 0 to 255"); for (int speed = 0; speed <= 255; speed += 5) { motorA(speed); delay(40); } // 2. Stay at full speed for a while Serial.println("Forward: full speed (255)"); delay(2000); // 3. Coast: let the motor slow down by itself Serial.println("Coast: motor rolls to a stop"); motorCoast(); delay(2000); // 4. Reverse at about 60% speed Serial.println("Reverse: speed 150"); motorA(-150); delay(2000); // 5. Brake: quick stop Serial.println("Brake: fast stop"); motorBrake(); delay(2000); }

Detailed Instructions

New to Arduino UNO Q? Start with the Getting Started with Arduino UNO Q tutorial.

  • Wire it up: Connect the DRV8833, one motor, and the 5V adapter as in the wiring diagram. Double-check that EEP goes to 3.3V and all grounds are joined.
  • Connect: Plug the Arduino UNO Q into your computer with the USB-C cable.
  • Open Arduino App Lab: Wait until it finds your Arduino UNO Q.
  • Create a new App: Click the Create New App button.
Create New App in Arduino App Lab on Arduino UNO Q
  • Name it, for example DRV8833OneMotor, and click Create.
Arduino App Lab App folders and files on Arduino UNO Q
  • Paste the sketch: Copy the code above into sketch/sketch.ino. Leave the other files as they are. No extra library is needed — the sketch uses only analogWrite() and digitalWrite().
  • Run: Click the Run button.
Click Run button in Arduino App Lab on Arduino UNO Q
  • Watch the motor: It speeds up slowly, runs fast, rolls to a stop, turns the other way, then stops sharply on the brake step. If "forward" turns the wrong way, swap the two wires on OUT1/OUT2.

App Lab Console Output

DIYables_Apps
Stop
sketch.ino
1#include "Arduino_RouterBridge.h"
Serial Monitor
Python
Message (Enter to send a message to "Newbiely" on usb(2820070321))
New Line
9600 baud
[2026-10-10 14:20:02] Arduino UNO Q + DRV8833: one motor ready [2026-10-10 14:20:02] Forward: speeding up from 0 to 255 [2026-10-10 14:20:04] Forward: full speed (255) [2026-10-10 14:20:06] Coast: motor rolls to a stop [2026-10-10 14:20:08] Reverse: speed 150 [2026-10-10 14:20:10] Brake: fast stop

You can hear the difference: on Coast the motor winds down for a moment, while on Brake it stops almost at once.

Part 2 — Control Two DC Motors

Now use both channels. Think of a two-wheel robot car: motor A is the left wheel, motor B is the right wheel. Turning is done by spinning the wheels in opposite directions.

Wiring Diagram

The wiring diagram between Arduino UNO Q DRV8833 two DC motors

This image is created using Fritzing. Click to enlarge image

DRV8833 Pin Connect To
IN1 Arduino UNO Q D10 (PWM)
IN2 Arduino UNO Q D9 (PWM)
IN3 Arduino UNO Q D6 (PWM)
IN4 Arduino UNO Q D5 (PWM)
EEP Arduino UNO Q 3.3V
GND Arduino UNO Q GND and power supply (-)
VCC 5V power supply (+) via DC power jack
OUT1, OUT2 Left motor (motor A)
OUT3, OUT4 Right motor (motor B)

Arduino UNO Q Code — Two Motors

The sketch adds a setMotor() helper that works for either channel, then builds five car moves from it: forward, backward, turn left (A reverse, B forward), turn right, and stop.

/* * This Arduino UNO Q code was developed by newbiely.com * * This Arduino UNO Q code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-drv8833-dc-motor-driver */ // Arduino UNO Q - DRV8833 DC Motor Driver: control TWO DC motors (small robot car) // Motor A = left wheel, Motor B = right wheel. // All four IN pins use PWM-capable pins of the Arduino UNO Q MCU. #define AIN1_PIN 10 // D10 (PWM) -> DRV8833 IN1 (motor A) #define AIN2_PIN 9 // D9 (PWM) -> DRV8833 IN2 (motor A) #define BIN1_PIN 6 // D6 (PWM) -> DRV8833 IN3 (motor B) #define BIN2_PIN 5 // D5 (PWM) -> DRV8833 IN4 (motor B) #define DRIVE_SPEED 180 // 0..255, a calm speed for testing on the desk // Set one channel with a signed speed: -255 (reverse) ... 255 (forward), 0 = coast void setMotor(int pin1, int pin2, int speed) { speed = constrain(speed, -255, 255); if (speed > 0) { analogWrite(pin1, speed); digitalWrite(pin2, LOW); } else if (speed < 0) { digitalWrite(pin1, LOW); analogWrite(pin2, -speed); } else { digitalWrite(pin1, LOW); // both LOW = coast digitalWrite(pin2, LOW); } } void motorA(int speed) { setMotor(AIN1_PIN, AIN2_PIN, speed); } void motorB(int speed) { setMotor(BIN1_PIN, BIN2_PIN, speed); } void driveForward() { motorA(DRIVE_SPEED); motorB(DRIVE_SPEED); } void driveBackward() { motorA(-DRIVE_SPEED); motorB(-DRIVE_SPEED); } void turnLeft() { motorA(-DRIVE_SPEED); motorB(DRIVE_SPEED); } // left wheel back, right wheel forward void turnRight() { motorA(DRIVE_SPEED); motorB(-DRIVE_SPEED); } // left wheel forward, right wheel back void stopAll() { motorA(0); motorB(0); } // coast both motors void setup() { Serial.begin(115200); delay(1500); pinMode(AIN1_PIN, OUTPUT); pinMode(AIN2_PIN, OUTPUT); pinMode(BIN1_PIN, OUTPUT); pinMode(BIN2_PIN, OUTPUT); stopAll(); Serial.println("Arduino UNO Q + DRV8833: two motors ready"); } void loop() { Serial.println("Car: forward"); driveForward(); delay(2000); Serial.println("Car: backward"); driveBackward(); delay(2000); Serial.println("Car: turn left"); turnLeft(); delay(1000); Serial.println("Car: turn right"); turnRight(); delay(1000); Serial.println("Car: stop"); stopAll(); delay(2000); }

Detailed Instructions

  • Wire the second motor to OUT3/OUT4 and connect IN3 → D6, IN4 → D5.
  • Create a new App in Arduino App Lab (for example DRV8833TwoMotors), paste the sketch into sketch/sketch.ino, and click Run.
  • Lift the wheels off the desk, or the "car" will drive away! Watch both motors go through the move sequence.

App Lab Console Output

DIYables_Apps
Stop
sketch.ino
1#include "Arduino_RouterBridge.h"
Serial Monitor
Python
Message (Enter to send a message to "Newbiely" on usb(2820070321))
New Line
9600 baud
[2026-10-10 14:31:15] Arduino UNO Q + DRV8833: two motors ready [2026-10-10 14:31:15] Car: forward [2026-10-10 14:31:17] Car: backward [2026-10-10 14:31:19] Car: turn left [2026-10-10 14:31:20] Car: turn right [2026-10-10 14:31:21] Car: stop

Bridge: Linux + MCU

Keep the Part 2 wiring. In this section, the Linux side becomes the "driver" of the car:

  • The DRV8833 is wired to the MCU (STM32) — only the MCU can write PWM to IN1..IN4
  • The MPU (Linux) sends commands with Bridge.call() — forward, backward, left, right, stop, brake
  • set_speed takes a number (0..255), so Python can change the speed while the car runs
  • The motor functions touch hardware pins, so the MCU registers them with Bridge.provide_safe()
  • ⚠️ /dev/ttyHS1 (Linux) and Serial1 (MCU) are RESERVED by the router — never open them in your code

In short: Python calls a move → MCU sets the IN pins → DRV8833 drives both motors.

MCU Code (Bridge)

/* * This Arduino UNO Q code was developed by newbiely.com * * This Arduino UNO Q code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-drv8833-dc-motor-driver */ // Arduino UNO Q - DRV8833 two-motor car, controlled from Linux via Bridge // The MCU owns the DRV8833 pins. Linux (Python) only calls the functions below. #include "Arduino_RouterBridge.h" #define AIN1_PIN 10 // D10 -> DRV8833 IN1 (motor A, left) #define AIN2_PIN 9 // D9 -> DRV8833 IN2 (motor A, left) #define BIN1_PIN 6 // D6 -> DRV8833 IN3 (motor B, right) #define BIN2_PIN 5 // D5 -> DRV8833 IN4 (motor B, right) int drive_speed = 180; // 0..255, changed from Linux with set_speed void setMotor(int pin1, int pin2, int speed) { speed = constrain(speed, -255, 255); if (speed > 0) { analogWrite(pin1, speed); digitalWrite(pin2, LOW); } else if (speed < 0) { digitalWrite(pin1, LOW); analogWrite(pin2, -speed); } else { digitalWrite(pin1, LOW); digitalWrite(pin2, LOW); } } void car_forward() { setMotor(AIN1_PIN, AIN2_PIN, drive_speed); setMotor(BIN1_PIN, BIN2_PIN, drive_speed); Monitor.println("Car: forward (speed " + String(drive_speed) + ")"); } void car_backward() { setMotor(AIN1_PIN, AIN2_PIN, -drive_speed); setMotor(BIN1_PIN, BIN2_PIN, -drive_speed); Monitor.println("Car: backward (speed " + String(drive_speed) + ")"); } void car_left() { setMotor(AIN1_PIN, AIN2_PIN, -drive_speed); setMotor(BIN1_PIN, BIN2_PIN, drive_speed); Monitor.println("Car: turn left"); } void car_right() { setMotor(AIN1_PIN, AIN2_PIN, drive_speed); setMotor(BIN1_PIN, BIN2_PIN, -drive_speed); Monitor.println("Car: turn right"); } void car_stop() { setMotor(AIN1_PIN, AIN2_PIN, 0); // coast setMotor(BIN1_PIN, BIN2_PIN, 0); Monitor.println("Car: stop (coast)"); } void car_brake() { digitalWrite(AIN1_PIN, HIGH); // both IN pins HIGH = brake digitalWrite(AIN2_PIN, HIGH); digitalWrite(BIN1_PIN, HIGH); digitalWrite(BIN2_PIN, HIGH); Monitor.println("Car: brake"); } void set_speed(int value) { drive_speed = constrain(value, 0, 255); Monitor.println("Speed set to " + String(drive_speed)); } void setup() { Bridge.begin(); Monitor.begin(); pinMode(AIN1_PIN, OUTPUT); pinMode(AIN2_PIN, OUTPUT); pinMode(BIN1_PIN, OUTPUT); pinMode(BIN2_PIN, OUTPUT); car_stop(); // These functions touch hardware pins, so they are registered with provide_safe Bridge.provide_safe("forward", car_forward); Bridge.provide_safe("backward", car_backward); Bridge.provide_safe("left", car_left); Bridge.provide_safe("right", car_right); Bridge.provide_safe("stop", car_stop); Bridge.provide_safe("brake", car_brake); Bridge.provide_safe("set_speed", set_speed); Monitor.println("DRV8833 Car Bridge ready"); } void loop() {}

Python Code (Bridge)

The Python script runs a short demo route: forward, left, right at speed 150, then backward at speed 230, brake, and stop.

""" This Arduino UNO Q script was developed by newbiely.com This Arduino UNO Q script is made available for public use without any restriction For comprehensive instructions and wiring diagrams, please visit: https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-drv8833-dc-motor-driver """ from arduino.app_utils import * import time # Linux side: drive the DRV8833 car by calling the MCU functions over Bridge def move(action, seconds): print(f"Car: {action}") Bridge.call(action) time.sleep(seconds) def loop(): print("Speed: 150") Bridge.call("set_speed", 150) move("forward", 2) move("left", 1) move("right", 1) print("Speed: 230") Bridge.call("set_speed", 230) move("backward", 2) move("brake", 1) move("stop", 2) App.run(user_loop=loop)

Detailed Instructions

  • Create a new App: In Arduino App Lab click Create New App, name it DRV8833Bridge, and click Create.
  • Paste the MCU sketch into sketch/sketch.ino.
  • Install the library: Click the Add sketch library button (the open book icon with a + sign) in the left sidebar.
Add sketch library in Arduino App Lab on Arduino UNO Q
  • Search for Arduino_RouterBridge created by Arduino and click the Install button.
My Apps / DIYables Apps
Run
Bricks
No bricks added...
Sketch Libraries
No sketch libra...
Files
python
sketch
.gitignore
README.md
app.yaml
sketch.ino
Add sketch library
Arduino_RouterBridge Arduino

This library provides a simple RPC bridge for Arduino UNO Q boards, allowing communication between the board and other devices using MsgPack serialization.

0.4.1
Install
More Info
  • Paste the Python code into the Python file of the same App.
  • Run: Click the Run button. The car repeats the demo route.
  • Check both consoles: The MCU Monitor shows what the motors do; the Python console shows what Linux asked for.

App Lab Console Output

DIYables_Apps
Stop
sketch.ino
1#include "Arduino_RouterBridge.h"
Serial Monitor
Python
Message (Enter to send a message to "Newbiely" on usb(2820070321))
New Line
9600 baud
[2026-10-10 14:45:01] DRV8833 Car Bridge ready [2026-10-10 14:45:03] Speed set to 150 [2026-10-10 14:45:03] Car: forward (speed 150) [2026-10-10 14:45:05] Car: turn left [2026-10-10 14:45:06] Car: turn right [2026-10-10 14:45:07] Speed set to 230 [2026-10-10 14:45:07] Car: backward (speed 230) [2026-10-10 14:45:09] Car: brake [2026-10-10 14:45:10] Car: stop (coast)
DIYables_Apps
Stop
sketch.ino
1#include "Arduino_RouterBridge.h"
Serial Monitor
Python
[2026-10-10 14:45:03] Speed: 150 [2026-10-10 14:45:03] Car: forward [2026-10-10 14:45:05] Car: left [2026-10-10 14:45:06] Car: right [2026-10-10 14:45:07] Speed: 230 [2026-10-10 14:45:07] Car: backward [2026-10-10 14:45:09] Car: brake [2026-10-10 14:45:10] Car: stop

Telegram

Drive the two-motor car from your phone. Each move command starts the motors, and /stop or /brake ends it. As a safety net, the script stops the car by itself if no new command arrives within 10 seconds — handy if your phone loses signal.

Need a bot first? See How to Create a Telegram Bot.

MCU sketch: Keep the Bridge MCU sketch from the previous section — no change.

Python Code (Telegram)

""" This Arduino UNO Q script was developed by newbiely.com This Arduino UNO Q script is made available for public use without any restriction For comprehensive instructions and wiring diagrams, please visit: https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-drv8833-dc-motor-driver """ from arduino.app_utils import * import requests import time BOT_TOKEN = "YOUR_BOT_TOKEN" API_URL = f"https://api.telegram.org/bot{BOT_TOKEN}" MOVE_TIMEOUT = 10 # seconds: the car stops by itself if no new command arrives last_update_id = 0 last_move_time = 0 is_moving = False HELP_TEXT = ( "DRV8833 car commands:\n" "/forward - drive forward\n" "/backward - drive backward\n" "/left - turn left\n" "/right - turn right\n" "/stop - coast to a stop\n" "/brake - fast stop\n" "/speed 0-255 - set the speed" ) MOVES = { "/forward": ("forward", "Car driving forward."), "/backward": ("backward", "Car driving backward."), "/left": ("left", "Car turning left."), "/right": ("right", "Car turning right."), } def send_message(chat_id, text): try: requests.post(f"{API_URL}/sendMessage", json={"chat_id": chat_id, "text": text}, timeout=10) except Exception as e: print(f"Error sending message: {e}") def get_updates(): try: resp = requests.get(f"{API_URL}/getUpdates", params={"offset": last_update_id + 1, "timeout": 5}, timeout=10) return resp.json().get("result", []) except Exception as e: print(f"Error getting updates: {e}") return [] def loop(): global last_update_id, last_move_time, is_moving for update in get_updates(): last_update_id = update["update_id"] msg = update.get("message", {}) chat_id = msg.get("chat", {}).get("id") text = msg.get("text", "").strip() if not chat_id: continue print(f"Telegram: {text}") if text in MOVES: action, reply = MOVES[text] Bridge.call(action) is_moving = True last_move_time = time.time() send_message(chat_id, reply) elif text == "/stop": Bridge.call("stop") is_moving = False send_message(chat_id, "Car stopped.") elif text == "/brake": Bridge.call("brake") is_moving = False send_message(chat_id, "Car braked.") elif text.startswith("/speed"): parts = text.split() if len(parts) == 2 and parts[1].isdigit() and 0 <= int(parts[1]) <= 255: Bridge.call("set_speed", int(parts[1])) send_message(chat_id, f"Speed set to {parts[1]}. Send a move command to use it.") else: send_message(chat_id, "Usage: /speed 0-255 (example: /speed 200)") else: send_message(chat_id, HELP_TEXT) # Safety: stop the car if it has been moving too long without a new command if is_moving and time.time() - last_move_time > MOVE_TIMEOUT: Bridge.call("stop") is_moving = False print("Safety timeout: car stopped") time.sleep(1) App.run(user_loop=loop)

Detailed Instructions

  • Replace YOUR_BOT_TOKEN with the token from @BotFather.
  • Paste the code into the Python file of your App (the MCU sketch stays the same).
  • Click Run, then open your bot in Telegram and send /forward.
  • Try /speed 120 followed by /forward to drive slower, and /left or /right to turn.

App Lab Console Output

DIYables_Apps
Stop
sketch.ino
1#include "Arduino_RouterBridge.h"
Serial Monitor
Python
[2026-10-10 15:02:11] Telegram: /speed 120 [2026-10-10 15:02:18] Telegram: /forward [2026-10-10 15:02:24] Telegram: /left [2026-10-10 15:02:27] Telegram: /stop [2026-10-10 15:02:40] Telegram: /backward [2026-10-10 15:02:51] Safety timeout: car stopped
Telegram
Telegram 12:45
Welcome to Telegram!
ArduinoBot 10:19
Chatting with Arduino...
telegram-botfather
BotFather Yesterday
Your bot has been created.

ArduinoBot

bot
Today
/speed 120
10:15 AM ✓✓
Speed set to 120. Send a move command to use it.
10:16 AM
/forward
10:17 AM ✓✓
Car driving forward.
10:18 AM
/left
10:19 AM ✓✓
Car turning left.
10:20 AM
/stop
10:21 AM ✓✓
Car stopped.
10:22 AM
/brake
10:23 AM ✓✓
Car braked.
10:24 AM

OpenClaw

You can adapt the OpenClaw to this tutorial by refering the instruction on Arduino Uno Q - OpenClaw Tutorial

Project Ideas

Some builds that suit the DRV8833 and the two brains of the Arduino UNO Q:

  • Wi-Fi Robot Car: Two motors on a small chassis, steered from Telegram — the Linux side handles the network, the MCU handles the wheels
  • Battery Line Follower: Run on 4 x AA batteries (about 6V) and add IR sensors; the low-loss DRV8833 keeps more power for the wheels
  • Motorized Blinds: One channel rolls a blind up or down; the Linux side opens it at sunrise on a schedule
  • Pet Treat Spinner: A small geared motor turns a dispenser wheel when you send a Telegram command
  • Desk Fan Mixer: Two small fans at different PWM speeds, set from a Python script based on room temperature

Challenge Yourself

Ready to push the DRV8833 further on the Arduino UNO Q?

  • Easy: Wire the ULT (fault) pin to a digital input with INPUT_PULLUP and print a warning when it goes LOW.
  • Medium: Add a set_motors(int, int) Bridge function that takes a signed speed for each wheel, so Python can make smooth curves instead of sharp turns.
  • Advanced: Use EEP as a GPIO output: put the driver to sleep when the car has been stopped for 30 seconds and wake it on the next Telegram move command, then report the idle time with a /status command.

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!