Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Erick Bacallao
Published © GPL3+

Stepper Motor from Windows 10 IoT Core

It shows how to use a stepper motor, an easy way to rotate a camera, sensor and many other thing.

BeginnerFull instructions provided11,011
Stepper Motor from Windows 10 IoT Core

Things used in this project

Hardware components

Raspberry Pi 2 Model B
Raspberry Pi 2 Model B
You can use a different board.
×1
Stepper motor 28BYJ-48
×1
Driver ULN2003
×1

Software apps and online services

Windows 10 IoT Core
Microsoft Windows 10 IoT Core

Story

Read more

Schematics

Diagram

I recommend not to use the Raspberry Pi as power supply for the motor.

You can connect the ULN2003 pins to any GPIO of the Raspberry Pi. In my case I connected them this way:
• 1N1 with GPIO 26
• 1N2 with GPIO 13
• 1N3 with GPIO 6
• 1N4 with GPIO 5

Code

Uln2003Driver class

C#
All the magic happens in this class. It is ready to use in a different project if you want.
The motor we are using supports 3 ways of driving:
1. Wave drive
2. Full step
3. Half step
#1 and #2 are similar. #3 gives you more precision.
Use the "TurnAsync" method to drive. By default it uses the drive mode #2. The other 2 parameters are the angle and direction.
var uln2003Driver = new Uln2003Driver(26, 13, 6, 5);
await uln2003Driver.TurnAsync(90, TurnDirection.Left);

Stepper Motor

Credits

Erick Bacallao

Erick Bacallao

1 project • 1 follower

Comments