Windows IOT motor drivers and demo for PCA9695, ULN2003 and L298N chipsets controlling Servo, Stepper and DC motors respectively.

After working on numerous motors within various projects over the years, I decided it was time to create libraries for chip-sets, for ease of use. In the following post we will look into controlling Servo, Stepper and DC motors.

It is now available in Nuget


 Install-Package IOTMotorDrivers -Version 1.0.0-Pre


Please note all these libraries will build under any platform but it requires the Platform to be in "ARM->Remote device" to Debug (I will make it work with all platforms eventually)

DC Motors
Upon research, L298N H Bridge happens to be the best driver for a DC motor and it is great for controlling wheels. Based on my experience with PCA9685 and its reliable PWM output, I decided to extend golaat's library to support the H Bridge as follows:

// DC Motor Pins
private const int PCA9685_DC1_Pin = 15, DCInputAPin = 17, DCInputBPin = 27; private const int PCA9685_DC2_Pin = 14, DCInputCPin = 23, DCInputDPin = 24;
// Driver for PCA9685
pwmDriver = new PCA9685();
// Driver for L298N
dcMotorDriver = new L298N(new L298NMotors {
    ENPin = PCA9685_DC1_Pin, 
    INAPin = DCInputAPin, 
    INBPin = DCInputBPin 
}, new L298NMotors 
    ENPin = PCA9685_DC2_Pin, 
    INAPin = DCInputCPin, 
    INBPin = DCInputDPin 
}, pwmDriver); 
// Start and control Motor 1
dcMotorDriver.Start(motorSelection: L298NMotorSelection.Motor1, speedPercent1:
Stepper Motor
When you usually buy a 28BYJ-48 step motor, it comes with a ULN2003 driver containing loads of python libraries. Below is a simple library to control the motor, get real-time updates and simulate LEDs on board for fun :D