Hi, Welcome to Arduino Tutorial from Robojax. May name is Ahmad Shamshiri
I'm presenting this tutorial from Canada. in this tutorial I'm going to
show you how we can control this 28BYJ-48 tiny stepper motor using two push
button and Arduino such that when you press one push button the motor will
rotate in clockwise direction as long as you keep the button pressed. when you
release it the motor will stop and when you press the other push button it will
rotate in counterclockwise and keep running as long as you keep the button
depressed. you can get the code for this by clicking at the link below the video
in the description which will take you to www.robojax.com/learn/arduino
let's get started with this.
I've separate video introducing this motor with further detail and
information and datasheet and how this stepper motor works. in this tutorial we
are not going to do that I'm just going directly providing you the code and
showing you how this works if you need to learn about this watch that video the
link for that video is below this video in the description. i've separate videos
showing you how to control this motor with three push-button and motor rotates
to the right stop to the left or maybe directly to the right or just stop. I've
separate video how to control the speed of this motor using a potentiometer the
length for that video is below this video in the description. I separate
video showing you how to control this motor over Wi-Fi with ESP 32 and also
esp8266 node MCU the link for this video is below this video in the description.
I'm gonna use external power supply because this motor when it runs
continuously it needs 180mA I
just measured it so the power supply that you're using must be capable of
continuous supplying of 200 milliamperes or higher otherwise the power supply
that you will have it will die and powering this up using Arduino is not a
good idea because the 5 volt regulator that we have here will not be able to
handle it if you power it from outside if you are using your computer or other
devices from usb it might be possible to power it up but it is risky because
different devices will supply different powers to this.
Wiring Explained
let me now show you the wiring first I have these two push buttons they're long
pins so they can be easily inverted they can purchase them from eBay or Amazon
one side I'm going to connect it to ground this line
so I've inverted this in here this will be connected to ground this the other
also will need ground so I have connected this one to the ground
this line is ground and it is connected here now I have here three wires one
wire is for ground these two wires one is for clockwise the other one is for
counterclockwise they are side by side so I'm inserting one on this side that
is for the ground because it goes this way and the other one will go to the
first push button where there is nothing else and also the last one will be for
this one now. it's connected to Arduino the ground will be connected to ground
here at this point and these two wires which are side by side they go to pin 2
and pin 3. so this portion is done. for the motor driver module we have the
wires here labeled as in 1 & 2 & 3 & 4 and from this right white gray purple
and blue they have been connected to 10 11 12 and 13 so you will not make
mistake there in the same way. and here I have corrected these two wires make sure
that this jumper is connected here and you can connect external 5 volts the
battery the power must be 5 volts because this motor is 5 volts otherwise
it will die. now the motor for the motor we don't need any wiring you just plug
it in everything will be fine. if you need the wiring diagram for this project
it is available as part of my Arduino course at udemy.com. if you want to learn
Arduino I have a best seller course on udemy where you can learn or do know
from ground up with hundreds of projects all course material library codes wiring
diagram everything available in one place the link for my Arduino course is below
this video in the description.
Code Explained
let me now explain the code you don't need any library or anything. here I have
defined these pins for the motor driver 10 11 12 13 these are side by side you
don't make any mistakes and we are defining pin 2 4cw clockwise switch
and then there are pin 4 for counterclockwise we can get the full
explanation of this code from my Arduino course at udemy.com the link to my
courses below this video in the description.
Demonstration
and here's a demonstration that could have been loaded to the module the
wiring is ready I have external 5 volts connected to
this module and let me just hold this so you can see it better this is for
clockwise and that's for counterclockwise when I press it it goes
to counterclockwise this is the maximum speed you can slow it down but you
cannot make it faster so keep that in mind and ice Lisa it won't stop when I
press the other push button that's going clockwise and when I release it it will
stop. I wrote this code because a lot of people needed this for other
applications let's say getting signal from a sensor or something so you can
replace this push button with the signal from your within your program so this
can be triggered let's day an obstacle arrives at
certain distance so it can rotate in the other direction and if you want to just
stop it or so you can do this one so the motor is running in one direction I'm
going to receive some kind of signal it just stopped the motor as if the button
is released.
Demonstration #2 :Power from Arduino
and he'll now I'm testing it by connecting the director to five volts of
Arduino and it works perfectly fine but in the long run I would advise against
it because you should have separate power supply
Subtitle corrected and typed on May 19, 2020 by Ahmad Shamshiri in Ajax, Ontatio,Canada
I would like to thank my Patrons from Patreon.com
I did my part to help you learn. Now it is your turn.
You can Subscribe to my channel, thumb up 👍 the video .
and type simple word of "Thank you " in the comment section.
If you want to donate cash, I have PayPal account. The link is below this video.
thank you for watching this was how to control this 28 byj 48 with this motor
control module and arduino. if you liked this video and learned something please
stamp up 👍 as this will help my video in the search algorithm of youtube. if you
have comment or question posted a comment section below I try to answer
and reply. if you want to get updates of my upcoming videos make sure to
subscribe
<>hi welcome to an Arduino tutorial from Robojax. May Name is Ahmad Shamshiri
<>I'm presenting this tutorial from Canada in this tutorial I'm going to show you
how we can control this 28 byg 48 stepper motor using Arduino and two push
buttons such that when you press one push button