Starter Kit

The SMD Starter Kit is designed to introduce you to the exciting world of motion control and mechatronics—without the need for prior experience. Whether you're a curious student, an enthusiastic hobbyist, or an educator building hands-on STEM content, this kit provides a smooth and intuitive entry point to smart motion systems.

SMD Starter Kit

Who Is It For?

  • Students exploring robotics and automation for the first time

  • Educators looking to implement hands-on STEM content

  • Hobbyists and makers wanting to build motion-based projects

  • Beginners seeking a plug-and-play introduction to Acrome’s SMD ecosystem

What’s Inside the Box?

Everything you need to start building right away:

1x SMD RED Smart Brushed Motor Driver with Speed, Position and Current Control Modes

1x 12V Brushed DC Motor with built-in encoder, 100 RPM speed

1x 37mm Motor Mount (90 degrees) with anodized black paint

1x USB Gateway Module for SMD Products

1x Joystick Add-On Module for SMD Products

1x 9x11 Plate for SMD Products

1x 12Vdc-5A SMPS Adapter

Note: A PC, Arduino (with additional SMD Arduino gateway) or controller with a USB host port (such as Raspberry Pi, Jetson etc.) is required to use the SMD products.

This video shows how to assamble the Starter Kit out of the box

Learn by Doing

The Starter Kit is fully compatible with:

  • SMD Blockly – Drag-and-drop programming for absolute beginners

  • Python SDK – Code and customize projects with real-time feedback

Use official sample codes or create your own—from the very first minute, you’ll be in full control of your hardware.

Key Features

  • Beginner-friendly: No prior coding or electronics knowledge required

  • Plug & Play: RJ-11 modular system—no wiring headaches

  • Multi-platform: Works on Windows, macOS, and Linux

  • Ideal for STEM: Teach motion control through hands-on learning

Expand as You Go

Already finished your first few projects? The SMD Starter Kit is fully expandable. Add new modules like joysticks, servo motors, or line sensors without changing your setup. Build on what you’ve learned and evolve your system into a complete smart robot.

Assembly Guide

A detailed step-by-step assembly guide is available as a PDF document:

Codes

from smd.red import *
from serial.tools.list_ports import comports
from platform import system
import math
import os
import time
import json
import logging
from datetime import datetime

logging.basicConfig(
    filename=f'motor_log_{datetime.now().strftime("%Y%m%d_%H%M%S")}.log',
    level=logging.INFO,
    format='%(asctime)s - %(levelname)s - %(message)s'
)

class MotorConfig:
    """Engine configuration class"""
    DEFAULT_CONFIG = {
        'CPR': 6533,
        'RPM': 100,
        'JOYSTICK_DEADZONE': 10,
        'MAX_SPEED': 100,
        'MIN_SPEED': -100,
        'UPDATE_INTERVAL': 0.1
    }

    @staticmethod
    def load_config(filename='Starter Kit/motor_config.json'):
        try:
            with open(filename, 'r') as f:
                return {**MotorConfig.DEFAULT_CONFIG, **json.load(f)}
        except FileNotFoundError:
            logging.warning("Configuration file not found, using default settings.")
            return MotorConfig.DEFAULT_CONFIG

class MotorModes:
    """Enum-like class for engine modes"""
    PWM = 0
    VELOCITY = 1
    POSITION = 2
    TORQUE = 3

    @staticmethod
    def get_mode_name(mode):
        modes = {
            0: "PWM Mode",
            1: "Speed ​​Mode",
            2: "Position Mode",
            3: "Torque Mode"
        }
        return modes.get(mode,"Unknown Mode")

class MotorController:
   """Main engine control class"""
    def __init__(self, port, motor_id=1):
        self.master = Master(port)
        self.id = motor_id
        self.config = MotorConfig.load_config()
        self.mode = 0
        self.setup_motor()
        self.last_update = time.time()
        
        # Durum değişkenleri
        self.motor_speed = 0
        self.angle_degrees = 0
        self.current_limit = 100
        self.current_value = 0
        self.previous_current = 0
        self.torque_status = True

    def setup_motor(self):
        """Engine start settings"""
        try:
            self.master.attach(Red(self.id))
            self.master.set_shaft_cpr(self.id, self.config['CPR'])
            self.master.set_shaft_rpm(self.id, self.config['RPM'])
            
            # Kontrol parametreleri
            self.master.set_control_parameters_velocity(self.id, 30.0, 5.0, 0.0)
            self.master.set_control_parameters_position(self.id, 0.5, 0.0, 20.0)
            self.master.set_control_parameters_torque(self.id, 3.0, 0.1, 0.0)
            
            self.master.enable_torque(self.id, True)
            logging.info("Engine started successfully")
        except Exception as e:
            logging.error(f"Engine start failure: {e}")
            raise

    def safe_joystick_read(self):
        """Secure joystick reading"""
        try:
            return self.master.get_joystick(self.id, 1)
        except Exception as e:
            logging.warning(f"Joystick reading error: {e}")
            return [0, 0, 0]

    def emergency_stop(self):
        """Emergency stop"""
        try:
            self.master.enable_torque(self.id, False)
            self.master.set_duty_cycle(self.id, 0)
            logging.info("Emergency stop was carried out")
        except Exception as e:
            logging.error(f"Emergency stop error: {e}")

    def handle_pwm_mode(self, joystick_x):
        """PWM mode handler"""
        self.master.set_operation_mode(self.id, OperationMode.PWM)
        if abs(joystick_x) > self.config['JOYSTICK_DEADZONE']:
            self.motor_speed = joystick_x
            self.master.set_duty_cycle(self.id, -self.motor_speed)
        else:
            self.master.set_duty_cycle(self.id, 0)
            self.motor_speed = 0
        return {"Motor Duty Cycle": self.motor_speed}

    def handle_velocity_mode(self, joystick_x, joystick_y):
        """Velocity​​ mode handler"""
        self.master.set_operation_mode(self.id, OperationMode.Velocity)
        if (joystick_x > 50 or joystick_y > 50) and self.motor_speed < self.config['MAX_SPEED']:
            self.motor_speed += 1
        elif (joystick_x < -50 or joystick_y < -50) and self.motor_speed > self.config['MIN_SPEED']:
            self.motor_speed -= 1
        self.master.set_velocity(self.id, -self.motor_speed)
        return {"Motor Speed": self.motor_speed}

    def handle_position_mode(self, joystick_x, joystick_y):
        """Position mode handler"""
        self.master.set_operation_mode(self.id, OperationMode.Position)
        if abs(joystick_x) < 10 and abs(joystick_y) < 10:
            try:
                current_position = self.master.get_position(self.id)
                self.angle_degrees = current_position * (360/self.config['CPR'])
            except:
                pass
        else:
            x = joystick_x / 100.0
            y = joystick_y / 100.0
            angle = math.atan2(y, x)
            previous_angle = self.angle_degrees
            self.angle_degrees = (math.degrees(angle) + 360) % 360
            
            if self.angle_degrees - previous_angle > 180:
                self.angle_degrees -= 360
                
            position = self.angle_degrees * (self.config['CPR']/360)
            self.master.set_position(self.id, position)
        
        return {"Engine Angle": f"{self.angle_degrees:.2f}°"}

    def handle_torque_mode(self, joystick_x, joystick_y):
        """Torque mode handler"""
        self.master.set_operation_mode(self.id, OperationMode.Torque)
        if joystick_x > 50 or joystick_y > 50:
            self.current_limit += 1
        elif joystick_x < -50 or joystick_y < -50:
            self.current_limit -= 1

        self.master.set_torque(self.id, self.current_limit - 50)
        
        try:
            self.previous_current = self.current_value
            self.current_value = self.master.get_torque(self.id)
        except:
            self.current_value = self.previous_current

        if self.current_value >= self.current_limit:
            self.current_value = self.current_limit
            
        return {
            "Motor Current": f"{self.current_value:.2f}",
            "Current Limit": self.current_limit
        }
def USB_Port():
	ports = list(comports())
	usb_names = {
		"Windows": ["USB Serial Port"],
		"Linux": ["/dev/ttyUSB"],
		"Darwin": [
			"/dev/tty.usbserial",
			"/dev/tty.usbmodem",
			"/dev/tty.SLAB_USBtoUART",
			"/dev/tty.wchusbserial",
			"/dev/cu.usbserial",
            		"/dev/cu.usbmodem",
			"/dev/cu.SLAB_USBtoUART",
			"/dev/cu.wchusbserial",
		]
	}
	
	os_name = system()
	if ports:
		for port, desc, hwid in sorted(ports):
			if any(name in port or name in desc for name in usb_names.get(os_name, [])):
				return port
		print("Current ports:")
		for port, desc, hwid in ports:
			print(f"Port: {port}, Description: {desc}, Hardware ID: {hwid}")
	else:
		print("No port found")
	return None

def main():
    # USB port bulma
    port = USB_Port()
    if not port:
        logging.error("No port found")
        return

    # Motor kontrolcüsü oluşturma
    controller = MotorController(port)
    
    while True:
        try:
            # Joystick durumunu oku
            joystick_x, joystick_y, button = controller.safe_joystick_read()

            # Mod değişimi kontrolü
            if button:
                controller.mode = (controller.mode + 1) % 4
                logging.info(f"Chance Mode: {MotorModes.get_mode_name(controller.mode)}")
                time.sleep(0.5)  

            logging.info(f"Current mode: {MotorModes.get_mode_name(controller.mode)}")
            if controller.mode == MotorModes.PWM:
                status = controller.handle_pwm_mode(joystick_x)
            elif controller.mode == MotorModes.VELOCITY:
                status = controller.handle_velocity_mode(joystick_x, joystick_y)
            elif controller.mode == MotorModes.POSITION:
                status = controller.handle_position_mode(joystick_x, joystick_y)
            elif controller.mode == MotorModes.TORQUE:
                status = controller.handle_torque_mode(joystick_x, joystick_y)
            else:
                logging.error("Invalid mode selected")

            print(f"=== {MotorModes.get_mode_name(controller.mode)} ===")
            print("-" * 40)
            for key, value in status.items():
                print(f"{key}: {value}")
            print("-" * 40)

        except KeyboardInterrupt:
            logging.info("The program was terminated by the user")
            controller.emergency_stop()
            break
        except Exception as e:
            logging.error(f"Unexpected error: {e}")
            controller.emergency_stop()
            break

if __name__ == "__main__":
    main()

Last updated