arpschuino

Control DC motors (classic or brushless) with arpschuino.


motors

We will see how to control different types of motors, in DMX, with arpschuino (2 or 32).


Materials required:

  • An arpschuino² or an arpschuino32.
  • A motor (DC or brushless).
  • A power supply for the motors.
  • An H-bridge for conventional DC motors (L298N, cytronMD30C)
  • An ESC or a dedicated driver for brushless motors.
  • An arp>terminals² or an arp>breadboard.
  • An nappe HE10 ribbon.
  • If a separate power supply is required, une power supply for the arpschuino.
  • * We have no agreement with the mentionned companys, images and links are just provided as examples.


    In this tutorial, we will study:

    1. The choice of motor.
    2. The choice of power supply.
    3. With a classic DC motor (with brushes).
    4. With a brushless motor.
    5. Configuration with an arpschuino32.
    6. The code with an arpschuino².

    What type of motor?

    There are a multiple of types of electric motors and many ways to control them. stepper motors and servo-motors have already been the subject of dedicated tutorials, we do not We will therefore not discuss them here.

    Intéressons nous donc au moteurs électriques à courant continu et à rotation continue. Let us focus on direct current and continuous rotation electric motors. These motors can be dimmed to vary speed and rotate in one direction or the other.

    The two types of motors that we will encounter are:

  • Classic brushed DC motors.
  • Simple and inexpensive, these motors are easy to control, with an H-bridge if you need to be able to change the direction of rotation, or even with an arpower (mini) for rotation in only one direction.

  • Brushless motors.
  • There is no friction with this type of motor, less heating, the possibility of reaching high speeds and quiet operation. But unlike conventional motors, their control is more complex, given that they are synchronous motors: it is necessary to generate 3 frequency signals that are a multiple of the rotation frequency, and phase shifted by 120°: For this we use a dedicated driver or ESC. An ESC (Electronic Speed Control) is an electronic circuit dedicated to controlling this type of electric motor.

    More infos here.

    In both cases, we will be able to control them in DMX or Artnet, with our arpschuinos.

    An essential selection criterion is the value of the maximum torque. This is the “strength” of the engine. It can be expressed in different units (converter here).

    Calculer le couple dont vous aurez besoin n'est pas chose facile, ce n'est pas forcément notre spécialité ! You will find instructions to help you with this on this site. Remember that the torque value of a motor depends on the rotation speed and the supply voltage. In any case, we advise you to oversize a little so as not to have any unpleasant surprises.

    Also note that there are gear motors which multiply the torque at the expense of speed.


    Choice of power supply

    The output current of the power supply (in amps) must be greater than the current drawn by the motor. Don’t hesitate to oversize a little here too, by 30% for example.

    The arpschuino can be powered with the same power supply as the motor if it does not exceed 12V, 24V if the arpschuino is equipped with the optional pre-regulator.


    With a classic DC motor (with brushes):

    The operation of a DC motor is extremely simple. When a current passes through it, the motor turns. If you reverse the polarities, it turns in the opposite direction. We could therefore start them with a simple relay, dim them like an LED with, for example, an arpower, but to control the direction of rotation, we will need an H-bridge.

    The L298N is a very common H-bridge and widely used in the arduino sphere. It's a classic dual H-bridge that requires 2 PWM channels per motor to operate.

    LN298N wiring

    It is suited for 35v, 2A per motor, we find of course H bridges with higher limit values (BTS7960 for example). In all cases, it is necessary, once again, to oversize, the bridges heat up a lot at maximum values, to the point of becoming unusable...

    We also find H-bridge modules controlled by speed/direction (noted speed/dir or pwm/dir on the board), like the cytron MD30C. The wiring is done as follows:

    Driver wiring for speed/dir mode

    Both types of commands can be used in the arpschuino32 firmware, from version 1.2.


    With a brushless motor:

    There are many types of brushless motors on the market, we will classify them into two families: hoby motors and professional motors.

  • Brushless hoby motors:
  • Brushless motors are widely used in the world of model making and drones.

    Moteur brushless et contrôleur de Vitesse ESC

    For reasons of compatibility, there are many small motors supplied with an ESC which is controlled like a servomotor.

    They are generally relatively powerful for their size and very fast.

    On the other hand, their ESC does not allow the direction of rotation to be changed, except by physically reversing two of the motor wires.

    The three motor wires connect to the three large wires at one end of the ESC. At the other end, the other two large wires (usually red and black) should be connected to the motor power supply. What remains are the three small cables ending in a female Dupont connector, like on a servomotor. But beware ! There is a trap...

    The first cable, brown or black, is the ground. The last one, white yellow or orange, the signal. The middle one, red, 5V. The trap is here: on a servomotor this red cable is used to power the motor. With this type of ESC, the motor is powered separately and this red cable is there to provide current! Be careful not to apply 5v to the 3.3v output, damage guaranteed! The simplest way is to cut this cable to keep only the signal and the ground.

    As we can see in the following photo, this servo pinout allows you to connect an ESC to the gnd and to the Arp7 (port A) or Arp15 (port B) output of the arpschuino² or the arpschuino32.

    If you want to control more brushless motors, it is best to use our arp>servo.

    These motors are controlled exactly like servomotors, except that instead of controlling the position, we control the speed.

    It is possible to mix brushless motors and servo motors on the same port as illustrated in the following image.

    For more details on DMX or Artnet control, you can refer to our servo tutorial, for the arpschuino32 in its configuration guide or ask us questions on the arpschuino forum.


  • "Professional" brushless motors:
  • These motors are expensive but very efficient! They are equipped with 3 hall effect sensors which are used to indicate to the driver the exact position of the rotor. This allows sophisticated drivers to ensure perfect regularity to the motor and above all to perfectly manage accelerations and decelerations.

    They are controlled in speed/direction mode (speed/dir or SV/FR), commands used in the arpschuino32 firmware, from version 1.2.

    The EN (enable) and BK (braking) commands, often present, can be drived in on/off mode from another port if necessary.

    If your driver requires 5V controls, you will need to use a level shifter. See below an example of wiring, with and without level shifter.

    :



    With an arpschuino32: configuration

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

    DC motor page


    With an arpschuino²: the code

    You will need to load a code into the arpschuino² adapted to the type of motor you wish to use.

    For this we will need arduino software

    If you haven't already done so, start by installing the arpschuino core as described in this tutorial.

    There is no special DC motor code in the arpschuino² core examples, in the case of motors controlled in speed/dir we can get by with one of the PWM examples.

    Same with a classic H-bridge, even if we would prefer to adapt one of the many examples of controlling an H-bridge with an arduino, which can be found on the internet.

    For brushless model motors, we can of course use the example arpschuino_servo.

    Don't hesitate to get started with personal codes, and talk about them on the arpschuino forum.


    Let's try ?

    All that remains is to power the arpschuino (the red LED should light up) and the driver and to connect the Dmx cable. As soon as we receive a signal, the green LED starts flashing quickly.

    We can now test the assembly by increasing the levels of the DMX chanels concerned.

    Is the motor running?

    Yeh it's work !


    Go deeper.

    You can add limit switches, they are provided in the arpschuino32 firmware (see here).

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


    PAGE ARP>SERVO !