Skip to content

dvelaren/dfrobot_dynamixel_spi_python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DFROBOT Dynamixel SPI with Python

This is a Python library for controlling DFRobot's Dynamixel motors using SPI communication.

Requirements

Wiring

Pin Type DFROBOT servo driver Raspberry Pi 4 or 5B
VCC (POWER) VCC N/A
GND (POWER) GND N/A
5V 5V 5V
GND GND GND
SCK GPIO13 GPIO11
MISO GPIO12 GPIO9
MOSI GPIO11 GPIO10
CS GPIO10 GPIO8

Setup

  1. Create a virtual environment:

    python -m venv venv
  2. Activate the virtual environment:

    source venv/bin/activate
  3. Activate I2C, SPI, Serial and Camera interfaces:

    sudo raspi-config nonint do_i2c 0
    sudo raspi-config nonint do_spi 0
    sudo raspi-config nonint do_serial_hw 0
    sudo raspi-config nonint do_ssh 0
    sudo raspi-config nonint do_camera 0
    sudo raspi-config nonint disable_raspi_config_at_boot 0
  4. Enable dtoverlay for spi0-0cs

    sudo nano /boot/firmware/config.txt

    Add the following line at the end of the file:

    dtoverlay=spi0-0cs
    
  5. Reboot the Raspberry Pi:

     sudo reboot
  6. Activate the virtual environment again:

    source venv/bin/activate
  7. Install Adafruit Blinka:

    sudo apt-get install -y i2c-tools libgpiod-dev python3-libgpiod
    pip install --upgrade pip
    pip install --upgrade RPi.GPIO
    pip install --upgrade adafruit-blinka
  8. (Optional for RPI5) Delete rpi.gpio and install rpi-lpgpio:

    sudo apt remove -y python3-rpi.gpio
    pip uninstall -y RPi.GPIO
    pip install --upgrade rpi-lgpio
  9. Execute servo_test.py to test the servo:

    python3 servo_test.py

About

This is a Python library for controlling DFRobot's Dynamixel motors using SPI communication.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages