Amplifying Analog Voltages with the LM358
05.03.2025
Elektronik | Funk | Software
Der Technik-Blog
There is also a video on YouTube for this article: Arduino DC Motor Controller - Motorshield
The Arduino Motor Shield can be used to control servo, stepper and DC motors. Because multiple pins are used to control the driver, a library is recommended. Adafruit offers a good library, which is also compatible with non-original shields. For most shields, the first version is needed because the second version works only with i2c. The software can control the Moter as with PWM signals from 0-255. The shield requires an external voltage supply for the motors, which must also be suitable for the motors. The Arduino gets the power from the shield.
The shield can be used to control up to four DC motors. Each motor connection has two pins, depending on the direction of rotation (forward, backward) one of the pins has energy. The ground-pin is always used by two motors. To allow a simple DC motor to rotate in both directions, the motor must be reversed. Beginners can reverse the motor with a relay-card.
#include <AFMotor.h>
AF_DCMotor motor(1); //Set Motor (1 = M1, 2 = M2, 3 = M3, 4 = M4)
void setup() {
}
void loop() {
int i;
motor.run(FORWARD); //FORWARD = PIN A / BACKWARD = PIN B
motor.setSpeed(50); //Set motor speed
delay(2000);
motor.setSpeed(100);
delay(2000);
motor.setSpeed(255);
delay(2000);
motor.setSpeed(50);
delay(2000);
motor.run(RELEASE);
delay(1000);
}
PT1000 sensors can not be measured directly analog with a microcontroller. How to build a PT100 Converter with LM358 and Arduino?
read moreThe PT100 is a very precise industrial temperature sensor. This article is about building a measuring amplifier for reading a PT100 on the Arduino
read moreAEQ-WEB © 2015-2025 All Right Reserved