<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://studio.cse.chalmers.se/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ida+Allander</id>
	<title>IxD Studio - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://studio.cse.chalmers.se/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ida+Allander"/>
	<link rel="alternate" type="text/html" href="https://studio.cse.chalmers.se/mediawiki/index.php?title=Special:Contributions/Ida_Allander"/>
	<updated>2026-05-02T20:14:56Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://studio.cse.chalmers.se/mediawiki/index.php?title=DYNAMIXEL_servos&amp;diff=126</id>
		<title>DYNAMIXEL servos</title>
		<link rel="alternate" type="text/html" href="https://studio.cse.chalmers.se/mediawiki/index.php?title=DYNAMIXEL_servos&amp;diff=126"/>
		<updated>2026-03-06T11:31:20Z</updated>

		<summary type="html">&lt;p&gt;Ida Allander: /* Troubleshooting */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Dynamixel motor control (MKR Zero) =&lt;br /&gt;
&lt;br /&gt;
* Product DYNAMIXEL Shield for Arduino MKR Series: https://store.arduino.cc/products/dynamixel-shield-for-arduino-mkr-series?srsltid=AfmBOoq7ptPLfwzykpUecfmQo3vii_8N3padSzJVAQ7RiUqJHuECxUOW&lt;br /&gt;
* Product Dynamixel XL-320 Servo: https://store.arduino.cc/products/dynamixel-xl-320&lt;br /&gt;
&lt;br /&gt;
== Dependencies ==&lt;br /&gt;
&lt;br /&gt;
* Install the library DynamixelShield in the Arduino IDE&lt;br /&gt;
** GitHub: https://github.com/ROBOTIS-GIT/DynamixelShield&lt;br /&gt;
** Documentation: https://emanual.robotis.com/docs/en/parts/interface/mkr_shield/&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
This script is based on the example code provided with the DynamixelShield Arduino library.  &lt;br /&gt;
Some modifications were required to make it work with the MKR Zero board, the MKR shield, and the Dynamixel motor used in this setup.&lt;br /&gt;
&lt;br /&gt;
The main changes are:&lt;br /&gt;
&lt;br /&gt;
* The shield communicates through &#039;&#039;&#039;Serial1&#039;&#039;&#039; on the MKR Zero.&lt;br /&gt;
* The port baudrate had to be set to &#039;&#039;&#039;1,000,000&#039;&#039;&#039; because the motor did not respond when using the default baudrate in the original example.&lt;br /&gt;
* Debug output is sent to the Arduino Serial Monitor.&lt;br /&gt;
&lt;br /&gt;
The script first checks if the motor is connected using &#039;&#039;&#039;ping()&#039;&#039;&#039;.  &lt;br /&gt;
If the motor responds, torque is enabled and the operating mode is set to &#039;&#039;&#039;position control&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In the loop the motor is commanded to move to different positions.  &lt;br /&gt;
The position is set once using a raw value and once using degrees, and the current motor position is printed to the Serial Monitor.&lt;br /&gt;
&lt;br /&gt;
A raw position value corresponds to the internal encoder value of the motor, while &#039;&#039;&#039;UNIT_DEGREE&#039;&#039;&#039; allows the position to be set using degrees.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*******************************************************************************&lt;br /&gt;
* ROBOTIS Example - Fixed for MKR Zero&lt;br /&gt;
*******************************************************************************/&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;DynamixelShield.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define DXL_SERIAL Serial1&lt;br /&gt;
#define DEBUG_SERIAL Serial&lt;br /&gt;
&lt;br /&gt;
const uint8_t DXL_ID = 1;&lt;br /&gt;
const float DXL_PROTOCOL_VERSION = 2.0;&lt;br /&gt;
&lt;br /&gt;
DynamixelShield dxl(DXL_SERIAL);&lt;br /&gt;
&lt;br /&gt;
//This namespace is required to use Control table item names&lt;br /&gt;
using namespace ControlTableItem;&lt;br /&gt;
&lt;br /&gt;
void setup() {&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.begin(115200);&lt;br /&gt;
  while(!DEBUG_SERIAL);&lt;br /&gt;
&lt;br /&gt;
  // Set Port baudrate (motor responded at 1,000,000)&lt;br /&gt;
  dxl.begin(1000000);&lt;br /&gt;
&lt;br /&gt;
  dxl.setPortProtocolVersion(DXL_PROTOCOL_VERSION);&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.println(&amp;quot;Pinging motor...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  if(dxl.ping(DXL_ID))&lt;br /&gt;
    DEBUG_SERIAL.println(&amp;quot;Motor connected!&amp;quot;);&lt;br /&gt;
  else&lt;br /&gt;
    DEBUG_SERIAL.println(&amp;quot;Motor NOT detected!&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  dxl.torqueOff(DXL_ID);&lt;br /&gt;
  dxl.setOperatingMode(DXL_ID, OP_POSITION);&lt;br /&gt;
  dxl.torqueOn(DXL_ID);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() {&lt;br /&gt;
&lt;br /&gt;
  dxl.setGoalPosition(DXL_ID, 512);&lt;br /&gt;
  delay(1000);&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.print(&amp;quot;Present Position(raw) : &amp;quot;);&lt;br /&gt;
  DEBUG_SERIAL.println(dxl.getPresentPosition(DXL_ID));&lt;br /&gt;
&lt;br /&gt;
  delay(1000);&lt;br /&gt;
&lt;br /&gt;
  dxl.setGoalPosition(DXL_ID, 90, UNIT_DEGREE);&lt;br /&gt;
  delay(1000);&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.print(&amp;quot;Present Position(degree) : &amp;quot;);&lt;br /&gt;
  DEBUG_SERIAL.println(dxl.getPresentPosition(DXL_ID, UNIT_DEGREE));&lt;br /&gt;
&lt;br /&gt;
  delay(2000);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Alternative simple test ==&lt;br /&gt;
&lt;br /&gt;
The following script is a simpler test program that only moves the motor between two positions (0° and 90°).  &lt;br /&gt;
This can be useful to quickly verify that the motor and shield are working correctly.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;DynamixelShield.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define DXL_SERIAL Serial1&lt;br /&gt;
#define DEBUG_SERIAL Serial&lt;br /&gt;
&lt;br /&gt;
DynamixelShield dxl(DXL_SERIAL);&lt;br /&gt;
&lt;br /&gt;
const uint8_t ID = 1;&lt;br /&gt;
&lt;br /&gt;
void setup() {&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.begin(115200);&lt;br /&gt;
  while(!DEBUG_SERIAL);&lt;br /&gt;
&lt;br /&gt;
  dxl.begin(1000000);&lt;br /&gt;
  dxl.setPortProtocolVersion(2.0);&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.println(&amp;quot;Motor connected!&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  dxl.torqueOff(ID);&lt;br /&gt;
  dxl.setOperatingMode(ID, OP_POSITION);&lt;br /&gt;
  dxl.torqueOn(ID);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() {&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.println(&amp;quot;Move to 90°&amp;quot;);&lt;br /&gt;
  dxl.setGoalPosition(ID, 90, UNIT_DEGREE);&lt;br /&gt;
  delay(3000);&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.println(&amp;quot;Move to 0°&amp;quot;);&lt;br /&gt;
  dxl.setGoalPosition(ID, 0, UNIT_DEGREE);&lt;br /&gt;
  delay(3000);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Find motor ID ==&lt;br /&gt;
&lt;br /&gt;
If the motor ID is unknown, the following script can be used to scan for connected Dynamixel motors.  &lt;br /&gt;
The script tries to ping motors with ID values between 0 and 19 and prints the detected ID in the Serial Monitor.&lt;br /&gt;
&lt;br /&gt;
This is useful if the motor does not respond to commands because the wrong ID is used in the control script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;DynamixelShield.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define DXL_SERIAL Serial1&lt;br /&gt;
#define DEBUG_SERIAL Serial&lt;br /&gt;
&lt;br /&gt;
DynamixelShield dxl(DXL_SERIAL);&lt;br /&gt;
&lt;br /&gt;
void setup() {&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.begin(115200);&lt;br /&gt;
  while(!DEBUG_SERIAL);&lt;br /&gt;
&lt;br /&gt;
  dxl.begin(1000000);&lt;br /&gt;
  dxl.setPortProtocolVersion(2.0);&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.println(&amp;quot;Scanning for motors...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  for(int id=0; id&amp;lt;20; id++){&lt;br /&gt;
    if(dxl.ping(id)){&lt;br /&gt;
      DEBUG_SERIAL.print(&amp;quot;Motor found with ID: &amp;quot;);&lt;br /&gt;
      DEBUG_SERIAL.println(id);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Common issues when working with Dynamixel motors:&lt;br /&gt;
&lt;br /&gt;
* The motor does not respond → check that the correct &#039;&#039;&#039;baudrate&#039;&#039;&#039; is used.&lt;br /&gt;
* The motor is not detected → verify the &#039;&#039;&#039;motor ID&#039;&#039;&#039; using the script above.&lt;br /&gt;
* No movement → make sure &#039;&#039;&#039;torque&#039;&#039;&#039; is enabled.&lt;br /&gt;
* Communication problems → confirm that the shield switch is set to &#039;&#039;&#039;TTL&#039;&#039;&#039;.&lt;br /&gt;
* Motor not powered → check the external power supply connected to the shield.&lt;/div&gt;</summary>
		<author><name>Ida Allander</name></author>
	</entry>
	<entry>
		<id>https://studio.cse.chalmers.se/mediawiki/index.php?title=DYNAMIXEL_servos&amp;diff=125</id>
		<title>DYNAMIXEL servos</title>
		<link rel="alternate" type="text/html" href="https://studio.cse.chalmers.se/mediawiki/index.php?title=DYNAMIXEL_servos&amp;diff=125"/>
		<updated>2026-03-06T11:30:17Z</updated>

		<summary type="html">&lt;p&gt;Ida Allander: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Dynamixel motor control (MKR Zero) =&lt;br /&gt;
&lt;br /&gt;
* Product DYNAMIXEL Shield for Arduino MKR Series: https://store.arduino.cc/products/dynamixel-shield-for-arduino-mkr-series?srsltid=AfmBOoq7ptPLfwzykpUecfmQo3vii_8N3padSzJVAQ7RiUqJHuECxUOW&lt;br /&gt;
* Product Dynamixel XL-320 Servo: https://store.arduino.cc/products/dynamixel-xl-320&lt;br /&gt;
&lt;br /&gt;
== Dependencies ==&lt;br /&gt;
&lt;br /&gt;
* Install the library DynamixelShield in the Arduino IDE&lt;br /&gt;
** GitHub: https://github.com/ROBOTIS-GIT/DynamixelShield&lt;br /&gt;
** Documentation: https://emanual.robotis.com/docs/en/parts/interface/mkr_shield/&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
This script is based on the example code provided with the DynamixelShield Arduino library.  &lt;br /&gt;
Some modifications were required to make it work with the MKR Zero board, the MKR shield, and the Dynamixel motor used in this setup.&lt;br /&gt;
&lt;br /&gt;
The main changes are:&lt;br /&gt;
&lt;br /&gt;
* The shield communicates through &#039;&#039;&#039;Serial1&#039;&#039;&#039; on the MKR Zero.&lt;br /&gt;
* The port baudrate had to be set to &#039;&#039;&#039;1,000,000&#039;&#039;&#039; because the motor did not respond when using the default baudrate in the original example.&lt;br /&gt;
* Debug output is sent to the Arduino Serial Monitor.&lt;br /&gt;
&lt;br /&gt;
The script first checks if the motor is connected using &#039;&#039;&#039;ping()&#039;&#039;&#039;.  &lt;br /&gt;
If the motor responds, torque is enabled and the operating mode is set to &#039;&#039;&#039;position control&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In the loop the motor is commanded to move to different positions.  &lt;br /&gt;
The position is set once using a raw value and once using degrees, and the current motor position is printed to the Serial Monitor.&lt;br /&gt;
&lt;br /&gt;
A raw position value corresponds to the internal encoder value of the motor, while &#039;&#039;&#039;UNIT_DEGREE&#039;&#039;&#039; allows the position to be set using degrees.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*******************************************************************************&lt;br /&gt;
* ROBOTIS Example - Fixed for MKR Zero&lt;br /&gt;
*******************************************************************************/&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;DynamixelShield.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define DXL_SERIAL Serial1&lt;br /&gt;
#define DEBUG_SERIAL Serial&lt;br /&gt;
&lt;br /&gt;
const uint8_t DXL_ID = 1;&lt;br /&gt;
const float DXL_PROTOCOL_VERSION = 2.0;&lt;br /&gt;
&lt;br /&gt;
DynamixelShield dxl(DXL_SERIAL);&lt;br /&gt;
&lt;br /&gt;
//This namespace is required to use Control table item names&lt;br /&gt;
using namespace ControlTableItem;&lt;br /&gt;
&lt;br /&gt;
void setup() {&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.begin(115200);&lt;br /&gt;
  while(!DEBUG_SERIAL);&lt;br /&gt;
&lt;br /&gt;
  // Set Port baudrate (motor responded at 1,000,000)&lt;br /&gt;
  dxl.begin(1000000);&lt;br /&gt;
&lt;br /&gt;
  dxl.setPortProtocolVersion(DXL_PROTOCOL_VERSION);&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.println(&amp;quot;Pinging motor...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  if(dxl.ping(DXL_ID))&lt;br /&gt;
    DEBUG_SERIAL.println(&amp;quot;Motor connected!&amp;quot;);&lt;br /&gt;
  else&lt;br /&gt;
    DEBUG_SERIAL.println(&amp;quot;Motor NOT detected!&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  dxl.torqueOff(DXL_ID);&lt;br /&gt;
  dxl.setOperatingMode(DXL_ID, OP_POSITION);&lt;br /&gt;
  dxl.torqueOn(DXL_ID);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() {&lt;br /&gt;
&lt;br /&gt;
  dxl.setGoalPosition(DXL_ID, 512);&lt;br /&gt;
  delay(1000);&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.print(&amp;quot;Present Position(raw) : &amp;quot;);&lt;br /&gt;
  DEBUG_SERIAL.println(dxl.getPresentPosition(DXL_ID));&lt;br /&gt;
&lt;br /&gt;
  delay(1000);&lt;br /&gt;
&lt;br /&gt;
  dxl.setGoalPosition(DXL_ID, 90, UNIT_DEGREE);&lt;br /&gt;
  delay(1000);&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.print(&amp;quot;Present Position(degree) : &amp;quot;);&lt;br /&gt;
  DEBUG_SERIAL.println(dxl.getPresentPosition(DXL_ID, UNIT_DEGREE));&lt;br /&gt;
&lt;br /&gt;
  delay(2000);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Alternative simple test ==&lt;br /&gt;
&lt;br /&gt;
The following script is a simpler test program that only moves the motor between two positions (0° and 90°).  &lt;br /&gt;
This can be useful to quickly verify that the motor and shield are working correctly.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;DynamixelShield.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define DXL_SERIAL Serial1&lt;br /&gt;
#define DEBUG_SERIAL Serial&lt;br /&gt;
&lt;br /&gt;
DynamixelShield dxl(DXL_SERIAL);&lt;br /&gt;
&lt;br /&gt;
const uint8_t ID = 1;&lt;br /&gt;
&lt;br /&gt;
void setup() {&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.begin(115200);&lt;br /&gt;
  while(!DEBUG_SERIAL);&lt;br /&gt;
&lt;br /&gt;
  dxl.begin(1000000);&lt;br /&gt;
  dxl.setPortProtocolVersion(2.0);&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.println(&amp;quot;Motor connected!&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  dxl.torqueOff(ID);&lt;br /&gt;
  dxl.setOperatingMode(ID, OP_POSITION);&lt;br /&gt;
  dxl.torqueOn(ID);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() {&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.println(&amp;quot;Move to 90°&amp;quot;);&lt;br /&gt;
  dxl.setGoalPosition(ID, 90, UNIT_DEGREE);&lt;br /&gt;
  delay(3000);&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.println(&amp;quot;Move to 0°&amp;quot;);&lt;br /&gt;
  dxl.setGoalPosition(ID, 0, UNIT_DEGREE);&lt;br /&gt;
  delay(3000);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Find motor ID ==&lt;br /&gt;
&lt;br /&gt;
If the motor ID is unknown, the following script can be used to scan for connected Dynamixel motors.  &lt;br /&gt;
The script tries to ping motors with ID values between 0 and 19 and prints the detected ID in the Serial Monitor.&lt;br /&gt;
&lt;br /&gt;
This is useful if the motor does not respond to commands because the wrong ID is used in the control script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;DynamixelShield.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define DXL_SERIAL Serial1&lt;br /&gt;
#define DEBUG_SERIAL Serial&lt;br /&gt;
&lt;br /&gt;
DynamixelShield dxl(DXL_SERIAL);&lt;br /&gt;
&lt;br /&gt;
void setup() {&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.begin(115200);&lt;br /&gt;
  while(!DEBUG_SERIAL);&lt;br /&gt;
&lt;br /&gt;
  dxl.begin(1000000);&lt;br /&gt;
  dxl.setPortProtocolVersion(2.0);&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.println(&amp;quot;Scanning for motors...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  for(int id=0; id&amp;lt;20; id++){&lt;br /&gt;
    if(dxl.ping(id)){&lt;br /&gt;
      DEBUG_SERIAL.print(&amp;quot;Motor found with ID: &amp;quot;);&lt;br /&gt;
      DEBUG_SERIAL.println(id);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Common issues when working with Dynamixel motors:&lt;br /&gt;
&lt;br /&gt;
* The motor does not respond → check that the correct &#039;&#039;&#039;baudrate&#039;&#039;&#039; is used.&lt;br /&gt;
* The motor is not detected → verify the &#039;&#039;&#039;motor ID&#039;&#039;&#039; using the scan script.&lt;br /&gt;
* No movement → make sure &#039;&#039;&#039;torque&#039;&#039;&#039; is enabled.&lt;br /&gt;
* Communication problems → confirm that the shield switch is set to &#039;&#039;&#039;TTL&#039;&#039;&#039;.&lt;br /&gt;
* Motor not powered → check the external power supply connected to the shield.&lt;/div&gt;</summary>
		<author><name>Ida Allander</name></author>
	</entry>
	<entry>
		<id>https://studio.cse.chalmers.se/mediawiki/index.php?title=DYNAMIXEL_servos&amp;diff=124</id>
		<title>DYNAMIXEL servos</title>
		<link rel="alternate" type="text/html" href="https://studio.cse.chalmers.se/mediawiki/index.php?title=DYNAMIXEL_servos&amp;diff=124"/>
		<updated>2026-03-06T10:50:46Z</updated>

		<summary type="html">&lt;p&gt;Ida Allander: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Dynamixel motor control (MKR Zero) =&lt;br /&gt;
&lt;br /&gt;
* Product DYNAMIXEL Shield for Arduino MKR Series: https://store.arduino.cc/products/dynamixel-shield-for-arduino-mkr-series?srsltid=AfmBOoq7ptPLfwzykpUecfmQo3vii_8N3padSzJVAQ7RiUqJHuECxUOW&lt;br /&gt;
* Product Dynamixel XL-320 Servo: https://store.arduino.cc/products/dynamixel-xl-320&lt;br /&gt;
&lt;br /&gt;
== Dependencies ==&lt;br /&gt;
* Install the library DynamixelShield in the Arduino IDE&lt;br /&gt;
** GitHub: https://github.com/ROBOTIS-GIT/DynamixelShield&lt;br /&gt;
** Documentation: https://emanual.robotis.com/docs/en/parts/interface/mkr_shield/&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
This script is based on the example code provided with the DynamixelShield Arduino library.  &lt;br /&gt;
Some modifications were required to make it work with the MKR Zero board, MKR sheild and the Dynamixel motor used in this setup.&lt;br /&gt;
&lt;br /&gt;
The main changes are:&lt;br /&gt;
&lt;br /&gt;
* The shield communicates through &#039;&#039;&#039;Serial1&#039;&#039;&#039; on the MKR Zero.&lt;br /&gt;
* The port baudrate had to be set to &#039;&#039;&#039;1,000,000&#039;&#039;&#039; for the motor to respond correctly.&lt;br /&gt;
* Debug output is sent to the Arduino Serial Monitor.&lt;br /&gt;
&lt;br /&gt;
The script first checks if the motor is connected using &#039;&#039;&#039;ping()&#039;&#039;&#039;.  &lt;br /&gt;
If the motor responds, torque is enabled and the operating mode is set to &#039;&#039;&#039;position control&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In the loop the motor is commanded to move to different positions.  &lt;br /&gt;
The position is set once using a raw value and once using degrees, and the current motor position is printed to the Serial Monitor.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*******************************************************************************&lt;br /&gt;
* ROBOTIS Example - Fixed for MKR Zero&lt;br /&gt;
*******************************************************************************/&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;DynamixelShield.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define DXL_SERIAL Serial1&lt;br /&gt;
#define DEBUG_SERIAL Serial&lt;br /&gt;
&lt;br /&gt;
const uint8_t DXL_ID = 1;&lt;br /&gt;
const float DXL_PROTOCOL_VERSION = 2.0;&lt;br /&gt;
&lt;br /&gt;
DynamixelShield dxl(DXL_SERIAL);&lt;br /&gt;
&lt;br /&gt;
//This namespace is required to use Control table item names&lt;br /&gt;
using namespace ControlTableItem;&lt;br /&gt;
&lt;br /&gt;
void setup() {&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.begin(115200);&lt;br /&gt;
  while(!DEBUG_SERIAL);&lt;br /&gt;
&lt;br /&gt;
  // Set Port baudrate (motor responded at 1,000,000)&lt;br /&gt;
  dxl.begin(1000000);&lt;br /&gt;
&lt;br /&gt;
  dxl.setPortProtocolVersion(DXL_PROTOCOL_VERSION);&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.println(&amp;quot;Pinging motor...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  if(dxl.ping(DXL_ID))&lt;br /&gt;
    DEBUG_SERIAL.println(&amp;quot;Motor connected!&amp;quot;);&lt;br /&gt;
  else&lt;br /&gt;
    DEBUG_SERIAL.println(&amp;quot;Motor NOT detected!&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  dxl.torqueOff(DXL_ID);&lt;br /&gt;
  dxl.setOperatingMode(DXL_ID, OP_POSITION);&lt;br /&gt;
  dxl.torqueOn(DXL_ID);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() {&lt;br /&gt;
&lt;br /&gt;
  dxl.setGoalPosition(DXL_ID, 512);&lt;br /&gt;
  delay(1000);&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.print(&amp;quot;Present Position(raw) : &amp;quot;);&lt;br /&gt;
  DEBUG_SERIAL.println(dxl.getPresentPosition(DXL_ID));&lt;br /&gt;
&lt;br /&gt;
  delay(1000);&lt;br /&gt;
&lt;br /&gt;
  dxl.setGoalPosition(DXL_ID, 90, UNIT_DEGREE);&lt;br /&gt;
  delay(1000);&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.print(&amp;quot;Present Position(degree) : &amp;quot;);&lt;br /&gt;
  DEBUG_SERIAL.println(dxl.getPresentPosition(DXL_ID, UNIT_DEGREE));&lt;br /&gt;
&lt;br /&gt;
  delay(2000);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ida Allander</name></author>
	</entry>
	<entry>
		<id>https://studio.cse.chalmers.se/mediawiki/index.php?title=DYNAMIXEL_servos&amp;diff=123</id>
		<title>DYNAMIXEL servos</title>
		<link rel="alternate" type="text/html" href="https://studio.cse.chalmers.se/mediawiki/index.php?title=DYNAMIXEL_servos&amp;diff=123"/>
		<updated>2026-03-06T10:47:21Z</updated>

		<summary type="html">&lt;p&gt;Ida Allander: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Dynamixel motor control (MKR Zero) =&lt;br /&gt;
&lt;br /&gt;
* Product: https://emanual.robotis.com/docs/en/parts/interface/mkr_shield/&lt;br /&gt;
&lt;br /&gt;
== Dependencies ==&lt;br /&gt;
* Install the library DynamixelShield in the Arduino IDE&lt;br /&gt;
** GitHub: https://github.com/ROBOTIS-GIT/DynamixelShield&lt;br /&gt;
** Documentation: https://emanual.robotis.com/docs/en/parts/interface/mkr_shield/&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
This script is based on the example code provided with the DynamixelShield Arduino library.  &lt;br /&gt;
Some small modifications were required to make it work with the MKR Zero board and the Dynamixel motor used in this setup.&lt;br /&gt;
&lt;br /&gt;
The main changes are:&lt;br /&gt;
&lt;br /&gt;
* The shield communicates through &#039;&#039;&#039;Serial1&#039;&#039;&#039; on the MKR Zero.&lt;br /&gt;
* The port baudrate had to be set to &#039;&#039;&#039;1,000,000&#039;&#039;&#039; for the motor to respond correctly.&lt;br /&gt;
* Debug output is sent to the Arduino Serial Monitor.&lt;br /&gt;
&lt;br /&gt;
The script first checks if the motor is connected using &#039;&#039;&#039;ping()&#039;&#039;&#039;.  &lt;br /&gt;
If the motor responds, torque is enabled and the operating mode is set to &#039;&#039;&#039;position control&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In the loop the motor is commanded to move to different positions.  &lt;br /&gt;
The position is set once using a raw value and once using degrees, and the current motor position is printed to the Serial Monitor.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*******************************************************************************&lt;br /&gt;
* ROBOTIS Example - Fixed for MKR Zero&lt;br /&gt;
*******************************************************************************/&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;DynamixelShield.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define DXL_SERIAL Serial1&lt;br /&gt;
#define DEBUG_SERIAL Serial&lt;br /&gt;
&lt;br /&gt;
const uint8_t DXL_ID = 1;&lt;br /&gt;
const float DXL_PROTOCOL_VERSION = 2.0;&lt;br /&gt;
&lt;br /&gt;
DynamixelShield dxl(DXL_SERIAL);&lt;br /&gt;
&lt;br /&gt;
//This namespace is required to use Control table item names&lt;br /&gt;
using namespace ControlTableItem;&lt;br /&gt;
&lt;br /&gt;
void setup() {&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.begin(115200);&lt;br /&gt;
  while(!DEBUG_SERIAL);&lt;br /&gt;
&lt;br /&gt;
  // Set Port baudrate (motor responded at 1,000,000)&lt;br /&gt;
  dxl.begin(1000000);&lt;br /&gt;
&lt;br /&gt;
  dxl.setPortProtocolVersion(DXL_PROTOCOL_VERSION);&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.println(&amp;quot;Pinging motor...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  if(dxl.ping(DXL_ID))&lt;br /&gt;
    DEBUG_SERIAL.println(&amp;quot;Motor connected!&amp;quot;);&lt;br /&gt;
  else&lt;br /&gt;
    DEBUG_SERIAL.println(&amp;quot;Motor NOT detected!&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  dxl.torqueOff(DXL_ID);&lt;br /&gt;
  dxl.setOperatingMode(DXL_ID, OP_POSITION);&lt;br /&gt;
  dxl.torqueOn(DXL_ID);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() {&lt;br /&gt;
&lt;br /&gt;
  dxl.setGoalPosition(DXL_ID, 512);&lt;br /&gt;
  delay(1000);&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.print(&amp;quot;Present Position(raw) : &amp;quot;);&lt;br /&gt;
  DEBUG_SERIAL.println(dxl.getPresentPosition(DXL_ID));&lt;br /&gt;
&lt;br /&gt;
  delay(1000);&lt;br /&gt;
&lt;br /&gt;
  dxl.setGoalPosition(DXL_ID, 90, UNIT_DEGREE);&lt;br /&gt;
  delay(1000);&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.print(&amp;quot;Present Position(degree) : &amp;quot;);&lt;br /&gt;
  DEBUG_SERIAL.println(dxl.getPresentPosition(DXL_ID, UNIT_DEGREE));&lt;br /&gt;
&lt;br /&gt;
  delay(2000);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ida Allander</name></author>
	</entry>
	<entry>
		<id>https://studio.cse.chalmers.se/mediawiki/index.php?title=DYNAMIXEL_servos&amp;diff=122</id>
		<title>DYNAMIXEL servos</title>
		<link rel="alternate" type="text/html" href="https://studio.cse.chalmers.se/mediawiki/index.php?title=DYNAMIXEL_servos&amp;diff=122"/>
		<updated>2026-03-06T10:37:15Z</updated>

		<summary type="html">&lt;p&gt;Ida Allander: Created page with &amp;quot;= Dynamixel motor control (MKR Zero) =  * Product: https://emanual.robotis.com/docs/en/parts/interface/mkr_shield/  == Dependencies == * Install the library DynamixelShield in the Arduino IDE ** GitHub: https://github.com/ROBOTIS-GIT/DynamixelShield ** Documentation: https://emanual.robotis.com/docs/en/parts/interface/dynamixel_shield/  == Description ==  This script is based on the example code provided with the DynamixelShield Arduino library.   Some small modification...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Dynamixel motor control (MKR Zero) =&lt;br /&gt;
&lt;br /&gt;
* Product: https://emanual.robotis.com/docs/en/parts/interface/mkr_shield/&lt;br /&gt;
&lt;br /&gt;
== Dependencies ==&lt;br /&gt;
* Install the library DynamixelShield in the Arduino IDE&lt;br /&gt;
** GitHub: https://github.com/ROBOTIS-GIT/DynamixelShield&lt;br /&gt;
** Documentation: https://emanual.robotis.com/docs/en/parts/interface/dynamixel_shield/&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
This script is based on the example code provided with the DynamixelShield Arduino library.  &lt;br /&gt;
Some small modifications were required to make it work with the MKR Zero board and the Dynamixel motor used in this setup.&lt;br /&gt;
&lt;br /&gt;
The main changes are:&lt;br /&gt;
&lt;br /&gt;
* The shield communicates through &#039;&#039;&#039;Serial1&#039;&#039;&#039; on the MKR Zero.&lt;br /&gt;
* The port baudrate had to be set to &#039;&#039;&#039;1,000,000&#039;&#039;&#039; for the motor to respond correctly.&lt;br /&gt;
* Debug output is sent to the Arduino Serial Monitor.&lt;br /&gt;
&lt;br /&gt;
The script first checks if the motor is connected using &#039;&#039;&#039;ping()&#039;&#039;&#039;.  &lt;br /&gt;
If the motor responds, torque is enabled and the operating mode is set to &#039;&#039;&#039;position control&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In the loop the motor is commanded to move to different positions.  &lt;br /&gt;
The position is set once using a raw value and once using degrees, and the current motor position is printed to the Serial Monitor.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*******************************************************************************&lt;br /&gt;
* ROBOTIS Example - Fixed for MKR Zero&lt;br /&gt;
*******************************************************************************/&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;DynamixelShield.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define DXL_SERIAL Serial1&lt;br /&gt;
#define DEBUG_SERIAL Serial&lt;br /&gt;
&lt;br /&gt;
const uint8_t DXL_ID = 1;&lt;br /&gt;
const float DXL_PROTOCOL_VERSION = 2.0;&lt;br /&gt;
&lt;br /&gt;
DynamixelShield dxl(DXL_SERIAL);&lt;br /&gt;
&lt;br /&gt;
//This namespace is required to use Control table item names&lt;br /&gt;
using namespace ControlTableItem;&lt;br /&gt;
&lt;br /&gt;
void setup() {&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.begin(115200);&lt;br /&gt;
  while(!DEBUG_SERIAL);&lt;br /&gt;
&lt;br /&gt;
  // Set Port baudrate (motor responded at 1,000,000)&lt;br /&gt;
  dxl.begin(1000000);&lt;br /&gt;
&lt;br /&gt;
  dxl.setPortProtocolVersion(DXL_PROTOCOL_VERSION);&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.println(&amp;quot;Pinging motor...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  if(dxl.ping(DXL_ID))&lt;br /&gt;
    DEBUG_SERIAL.println(&amp;quot;Motor connected!&amp;quot;);&lt;br /&gt;
  else&lt;br /&gt;
    DEBUG_SERIAL.println(&amp;quot;Motor NOT detected!&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  dxl.torqueOff(DXL_ID);&lt;br /&gt;
  dxl.setOperatingMode(DXL_ID, OP_POSITION);&lt;br /&gt;
  dxl.torqueOn(DXL_ID);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() {&lt;br /&gt;
&lt;br /&gt;
  dxl.setGoalPosition(DXL_ID, 512);&lt;br /&gt;
  delay(1000);&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.print(&amp;quot;Present Position(raw) : &amp;quot;);&lt;br /&gt;
  DEBUG_SERIAL.println(dxl.getPresentPosition(DXL_ID));&lt;br /&gt;
&lt;br /&gt;
  delay(1000);&lt;br /&gt;
&lt;br /&gt;
  dxl.setGoalPosition(DXL_ID, 90, UNIT_DEGREE);&lt;br /&gt;
  delay(1000);&lt;br /&gt;
&lt;br /&gt;
  DEBUG_SERIAL.print(&amp;quot;Present Position(degree) : &amp;quot;);&lt;br /&gt;
  DEBUG_SERIAL.println(dxl.getPresentPosition(DXL_ID, UNIT_DEGREE));&lt;br /&gt;
&lt;br /&gt;
  delay(2000);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ida Allander</name></author>
	</entry>
</feed>