Coding Guide
Last updated
Last updated
This detailed guide teaches you exactly how to write your first code for SMD Red from scratch, suitable for beginners with no coding experience. You'll learn step-by-step, clearly and thoroughly, how to program motors and modules.
SMD Red is a smart controller designed to simplify controlling Brushed DC motors, servos, and various sensors. It receives commands from your computer (Raspberry Pi using Python) or microcontroller (Arduino using Arduino IDE) and translates these commands into actions performed by your robot.
SMD Red ID: Every SMD Red controller has a unique ID number. Initially, these IDs might be the same, but you must assign unique IDs when using multiple controllers in one project.
Module ID: Every connected sensor, servo, or other module has a predefined ID, which is generally fixed but can be physically rearranged.
Motor ID: Motors do not have individual IDs. Instead, they use the ID of the SMD Red controller they're attached to.
To manage and test your SMD Red boards and modules, It is recommended to use the . This software allows you to:
Verify the IDs of connected modules and controllers
Change SMD Red IDs to unique values for project usage
Test functionality of motors and modules
Open VS Code, then open a new terminal ("Terminal" → "New Terminal"). Run this command:
Open VS Code, create a file called robot_control.py
. Below is a simple and detailed starter program:
Master connection: Links your computer to the SMD Red controller.
Motor commands: Uses the ID of SMD Red to send commands directly to connected motors.
Servo commands: Require specifying the SMD Red ID and servo module ID.
Sensor commands: Require specifying the SMD Red ID and sensor module ID to get sensor data.
In Arduino IDE, navigate to Sketch → Include Library → Manage Libraries
Search for "Acrome-SMD", then install it.
Connect Arduino to SMD Red using an Arduino Gateway module (RX/TX pins).
Connect SMD Red boards via RJ11 cables and modules via RJ45 cables.
Open Arduino IDE and create a new sketch:
Library Import: Adds the necessary commands to control SMD Red.
Setup: Initializes communication, sets operation modes, and enables power to motors.
Loop: Repeatedly executes motor movement, servo positioning, and sensor data reading.
Test each module separately before combining them.
Regularly test your code and debug using Serial Monitor or Python print statements.
Double-check connections (USB, RJ11, RJ45).
If errors occur, revisit installation and wiring steps.
Python: Download from . Choose the latest version and install it.
Visual Studio Code (VS Code): Download from . This will be your coding editor.
Download Arduino IDE from , install and open it.
Clearly verify and set unique SMD Red IDs using the app.
Verify module and SMD Red IDs using the app.