Kinetic Actuator Circuits
There are a variety of motors in circuitry, such as direct current, stepper, and servo motors. There are a variety of ways of driving these motors, via relays, transistors, chips or straight from an Arduino.
Starting with the most basic demonstration of controlling the on/off function, we will use a solenoid with a TIP122 Transistor.
![]() |
| 1.1 Schematics for Solenoid driven by a TIP122 |
![]() |
| 1.2 Photo of solenoid driven by TIP122 |
By following this schematic and using the Arduino Blink code (File > examples > basics > blink). Doing this it should turn the solenoid on and off. *note 100k resistor.
Now let's do the same function differently, by using a relay. This does the same action but through a mechanical action vs. an electrical one.
![]() |
| 2.1 Schematics for Solenoid/DC motor driven by a relay |
![]() |
| 2.2 Photo Example of Relay DC motor |
This semantic can be completed with either a solenoid or a DC motor. We will use the same code as before. What this does is it triggers a switch much like in a solenoid to complete a circuit.
So that maybe too simple for what you need to accomplish. So let's try adjusting the speed of the motor instead.
![]() |
| 3.1 Schematics for DC Motor driven by TIP122 |
![]() |
| 3.2 Photo of DC motor driven by TIP122 |
By using the transistor we are able to alter the amount of power that the TIP122 emits, changing the speed of the motor.
3.3 Code for Motor
int motorPin = 13; //Motor pin
void setup(){
pinMode(motorPin, OUTPUT); //establish output
}
void loop() {
for(int motorValue = 0 ; motorValue <= 255; motorValue +=5){ //accelleration speed and peak
analogWrite(motorPin, motorValue); //drive motor from pin 13, at motor speed (motorValue)
delay(30);
}
for(int motorValue = 255 ; motorValue >= 0; motorValue -=5){ //decelleration spped and bottom
analogWrite(motorPin, motorValue); //drive motor from pin 13, at motor speed (motorValue)
delay(30);
}
}
![]() |
| 4.2 Photo of L293D Chip driving motor |
The TIP122 isn't the only way to drive through this motor, the L293D chip is a way to drive 2 motors with 1 tool.
![]() |
| 4.1 Scematic for driving DC motor with L293D Chip |
4.3 CODE
int motorPin = 8; //two imputs are required (one)
int motorPin2 = 7; // imput 2
void setup(){
pinMode(motorPin, OUTPUT); //establish outputs
pinMode(motorPin2, OUTPUT); //establish outputs
}
void loop() {
digitalWrite(motorPin, HIGH); // turn the motor on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(motorPin, LOW); // turn the motor off by making the voltage LOW
delay(1000);
digitalWrite(motorPin2, HIGH); // turn the motor on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(motorPin2, LOW); // turn the motor off by making the voltage LOW
delay(1000);
}
Now lets move onto 2 very different motors, the servo and bipolar stepper. The hobby servo is something we can drive right from the arduino. Like so...
![]() |
| 5.1 Servo Motor driven by Arduino |
By using code built into Arduino (file > Examples > Servo > Sweep) we will be able to drive this motor up to 180 degrees.
Finally, the stepper motor requires a special driver, in this case, we will be using the A4988 driver chip.
![]() |
| 6.1 Stepper motor driven by A4988 Chip |
The code we can follow to drive this motor is as follows. sourced from Dejan
const int stepPin = 3;
const int dirPin = 4;
void setup() {
// Sets the two pins as Outputs
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
}
void loop() {
digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction
// Makes 200 pulses for making one full cycle rotation
for(int x = 0; x < 200; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(500);
digitalWrite(stepPin,LOW);
delayMicroseconds(500);
}
delay(1000); // One second delay
digitalWrite(dirPin,LOW); //Changes the rotations direction
// Makes 400 pulses for making two full cycle rotation
for(int x = 0; x < 400; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(500);
digitalWrite(stepPin,LOW);
delayMicroseconds(500);
}
delay(1000);
}
That concludes all of the motors, here is a compilation of videos that show these motors functioning.












Comments
Post a Comment