Control servomotors, in DMX with arpschuino.

servomoteur DMX

This tutorial was updated in October 2022, with the arrival of arpschuino32.

Let us see how to drive servo motors, in DMX, with arpschuino (2 or 32).


* We have no agreement with the mentionned companys, images and links are just provided as examples.

Set up

Let's start by observing the specifications of the servomotor(s) that we are going to use. In particular the usable voltage range and consumption (Current Drain).

The power supply must be chosen according to the motors, do not hesitate to oversize it a little. The higher the voltage, the higher the torque and speed. 6v power supplies are not common, you can choose a 5v power supply, their output voltage can most often be raised to around 5.5v thanks to the adjustment potentiometer.


Always work power off.

You can connect a servo (2 if the consumption of the servos is low) directly on the arpschuino². In this case, set the voltage selection jumper to the "5V" position.

This is not possible with the arpschuino32 which operates under 3.3v, except with certain micro-servos which can operate with such a low voltage.

As you can see in the following photo, the pinout of the servos will allow you to connect to the VCC (+ 5V), the gnd and the Arp7 (top port) or Arp15 (bottom port) of the arpschuino.

servo motOr DMX

With the arpschuino32, or with the arpschuino² if you want to use more servomotors or supply them with a voltage higher than 5V, the best is to use our arp>servo.

Connect the servo power supply to the terminal block, then each motor plugs directly into the arp> servo. attention to the direction !


Depending on the brand, color cable changes ... The most common cases :













With an arpschuino32 : configuration

No need to program the arpschuino32, you simply configure it via a web browser, as described in this tutorial.

Servo page

With an arpschuino² : upload

The default code of the arpschuino² does not allow to drive servomotors.

So we will have to reprogram the arpschuino (tuto here). We will use the code arpschuino_servos which is available in the examples of the arpschuino libray, from version 1.0.8 of the arpschuino core.

source code

Such as this code should work directly for 8 servo motors connected to the outputs Arp0 to Arp7.

It's time now to power the arpschuino (the red LED should light up) and the arp>servo. As soon as the signal is received, the green LED blink rapidly

As soon as the signal is received, the green LED blink rapidly

We can now test it by raising the level of the first DMX address (by default 1 or that defined by the arpdress board).

Is the servo motor run ?

Yeh it's work !

The maximum stroke is not always indicated in the datasheet, but if your servo vibrates or has erratic behavior at the end of the stroke, it is probably because this value is exceeded.

You may need more than 8 servos ? To modify their stroke ?

So many reasons to custom the code to adapt it to your needs.

advanced settings.

Let's take a closer look at this source code:

The lines in light grey and/or preceded by // are comments, they are not considered in the program, they are addressed to the human who reads this code (you).

Creation of objects :

 Servo servo_0;  // create servo object to control a servo
 Servo servo_1;
 Servo servo_2;
 Servo servo_3;
 Servo servo_4;
 Servo servo_5;
 Servo servo_6;
 Servo servo_7;

 //Servo servo_8;
 //Servo servo_9;
 //Servo servo_10;
 //Servo servo_11;
 //Servo servo_12;
 //Servo servo_13;
 //Servo servo_14;
 //Servo servo_15;

Here it is the creation of "servo objects", one is needed per servomotor used. Depending on your usage, comment (writing // at the start of the line), or uncomment a part of these lines to create the number of motors desired.

Support for the arpdress board :


Here we tell the arpschuino to support the arpdress board. If you do not use it, comment this line and define a fixed address by writing for example:


Servo motors to outputs :


	//  servo_8.attach(Arp8);
	//  servo_9.attach(Arp9);
	//  servo_10.attach(Arp10);
	//  servo_11.attach(Arp11); 
	//  servo_12.attach(Arp12);
	//  servo_13.attach(Arp13);
	//  servo_14.attach(Arp14);
	//  servo_15.attach(Arp15); 

We comment or uncomment as for the creation of objects. And we indicate the output of the arpschuino which will be used (Arp0, Arp1 ...) for each of the motors.

Patch and stroke :

 servo_0.write(map(ArduinoDmx0.RxBuffer[0], 0, 255, 0, 160));
 servo_1.write(map(ArduinoDmx0.RxBuffer[1], 0, 255, 0, 160));
 servo_2.write(map(ArduinoDmx0.RxBuffer[2], 0, 255, 0, 160));  
 servo_4.write(map(ArduinoDmx0.RxBuffer[4], 0, 255, 0, 160));
 servo_5.write(map(ArduinoDmx0.RxBuffer[5], 0, 255, 0, 160));  
 servo_6.write(map(ArduinoDmx0.RxBuffer[6], 0, 255, 0, 160));  
 servo_7.write(map(ArduinoDmx0.RxBuffer[7], 0, 255, 0, 160));

//    servo_8.write(map(ArduinoDmx0.RxBuffer[8], 0, 255, 0, 160));          
//    servo_9.write(map(ArduinoDmx0.RxBuffer[9], 0, 255, 0, 160));
//    servo_10.write(map(ArduinoDmx0.RxBuffer[10], 0, 255, 0, 160));  
//    servo_11.write(map(ArduinoDmx0.RxBuffer[11], 0, 255, 0, 160));       
//    servo_12.write(map(ArduinoDmx0.RxBuffer[12], 0, 255, 0, 160));
//    servo_13.write(map(ArduinoDmx0.RxBuffer[13], 0, 255, 0, 160));  
//    servo_14.write(map(ArduinoDmx0.RxBuffer[14], 0, 255, 0, 160));  
//    servo_15.write(map(ArduinoDmx0.RxBuffer[15], 0, 255, 0, 160)); 

Once again we comment or uncomment.

Then two things :


Indicates that the servo (0) will obey the first DMX address. In other words at address 1 if the arpschuino is addressed in 1, 24 if it is addressed in 24 ... Board start address + [0].

	0, 255, 0, 160

Ddefines the servo stroke. 0, 255 that is DMX levels will be received, do not change it. 0,160 that is the servo stroke, 0 to 160°.You can reduce or increase it, without exceeding the maximum stroke of your servo.

After that you may want / need to modify the code, combine it with another etc ... There is a lot of documentation on the net on Arduino programming, so don't hesitate to get started.

In case of difficulties, do not hesitate to ask questions on the arpschuino forum .