The site for those who love tinkering with Arduino, Raspberry Pi & Co.
by

The main low-medium power electric motors driven with Arduino

In this article we will talk about the small and medium power electric motors that we could use in the course of our projects.

These motors have a more varied use, they can be used to create small rovers, drones or some robotic arms. Today we will look more specifically at engines:

  1. DC motors (with / without brushes);
  2. Servomotors;
  3. Stepper motors.

DC motor

As the name suggests this type of motor works on direct current, and is composed of 2 parts:

  1. The stator, a magnet that creates a magnetic field;
  2. The rotor, a winding of copper wire;

When energized, the rotor creates a magnetic field and starts spinning by electromagnetic induction. The electromagnetic field of the rotor tends to move away from the magnetic field of the stator, producing a continuous rotation.

In motors that have more poles, there are brushes (With brushes) that supply the windings with the current necessary to create the electromagnetic field, sequentially during rotation. By doing so we will have an exchange of field polarity.

learn arduino dc motor

Brushless motors consist of permanent magnets (in the rotor) and sequentially powered windings. The main advantage of this motor is the reduced mechanical resistance and the complete absence of sparks that were created with the contact between the rotor and the brushes. This brushless motor is used almost everywhere especially in CD players and the like. the latter are also very useful in the field of drones and rovers.

int motorPin = 13;
void setup () {
  // put your setup code here, to run once:
  pinMode (motorPin, OUTPUT);
}

void loop () {
  // Lit for one second maximum speed
  digitalWrite (motorPin, HIGH);
  delay (1000);
  digitalWrite (motorPin, LOW);
  delay (500);
  / * Lit at controlled speed
   * 0 = motor stopped
   * 255 = maximum speed
   * /
  analogWrite (motorPin, 200);
  delay (1000);
  analogWrite (motorPin, 0);

  delay (1000);
}

Stepper Motor

Bipolar Stepper Motor
Bipolar Stepper Motor

The stepper motors (step or stepper motor) are brushless motors in which we can control the position of the rotor in steps.

Unlike the DC motor, the step motor can be used in applications where it is necessary to control rotation and stop the motor shaft in a precise point. This type of motor is mainly used in robotics and 3D printers.

Stepper motors are mainly of two types:

  1. unipolar: equipped with two windings with a common pole;
  2. bipolar: equipped with two separate windings.

Bipolar differs from unipolar because they have four pins corresponding to the two separate windings. The unipolar have five or six pins depending on whether the central pairs are in common with a single pin or with two distinct pins.

This type of engine will be explored further in a new article.

Servomotor

SG90 servomotor

The servomotor is a stepping motor which includes mechanisms controlled by an internal microprocessor. Designed for various uses, servomotors can be of various sizes and angles (usually with rotation from 0 to 180 degrees or with full rotation or up to 360 degrees). The control of servomotors is different from stepping motors.

#include <Servo.h>

Servant myservo;
int pos = 0;

void setup ()
{
  myservo.attach (9);
}
void loop ()
{
  // move from position 0 to 180
  for (pos = 0; pos <= 180; pos ++)
  {
    myservo.write (pos);
    delay (15);
  }
  delay (500);
  // move from position 180 to 0
  for (pos = 180; pos> = 0; pos--)
  {
    myservo.write (pos);
    delay (15);
  }
}

Sources for the article:


Ti è rimasta una domanda o un dubbio?

Iscriviti e chiedi nella community

Leave a Reply

Your email address will not be published. Required fields are marked *