WiFi Stepper Motor Controller with Web-based Interface

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
today in the workshop we'll be working with the Wi-Fi stepper a versatile board for controlling stepper motors of all sizes learn what makes it work and how to use its web-based interface we'll also see how we can run a script on a Raspberry Pi to control a stepper motor remotely we're stepping without wires today so welcome to the workshop [Music] hello and welcome to the workshop today I'm going to be doing a rather special edition of the drone bot workshop and that I'm taking a look at a product that one of my viewers has sent to me now my viewers name is Andrew and he's got a company called good robotics and this is the product this is a Wi-Fi stepper motor controller now as the name implies this allows you to control a bipolar stepper motor over Wi-Fi now the devices in esp8266 for its Wi-Fi capabilities and a power step 0-1 module to drive the motor and as such it can drive a very heavy-duty stepper motor it's rated at up to 85 volts and several amperes so you can drive a very big stepper this makes this ideal for applications not only in robotics but for things like antenna movement solar tracking opening and closing remote doors and windows it's a very versatile device now it comes with a web-based interface that allows you to control every aspect of the stepper motor and you can also do scripting so you can use a Wi-Fi enabled computer and run scripts on it and automate the control of the stepper motor without actually having to be able to be connected to it so it's great for controlling a large stepper motor in a remote location now I should mention that the device I have is a preliminary release and as such there are a couple of features that are still not enabled on it by the time you see this the crowdfunding campaign for this will be active on the crowd supply crowdfunding site and the device that is going to be on the crowdfunding site will of course have all of the features enabled now if you're not familiar with crowd supply and I have to admit I wasn't that familiar with it as well it's a really interesting crowdfunding platform it uses the same principle as you've seen on other crowdfunding platforms like IndieGoGo but in the case of crowd supply most of the equipment seems to be things that are of interest to people like us modules for robotics things for people who work with Arduino and Raspberry so the site is a really interesting site in itself and so at any rate what I'm going to do today is put the Wi-Fi stepper controller through its paces and see what it can do now we're going to start off by taking a look at what components are included on this little board so let's get going so here are the details on the Wi-Fi stepper controller the Wi-Fi stepper controls a single bipolar stepper motor over Wi-Fi it is rated at up to 85 volts and 10 amperes meaning even large stepper motors can be controlled it has an easy-to-use web-based interface it supports both bosch and Python scripts and has a JSON API in current control mode you can step down to 1/16 micro steps at very high torque in voltage control mode you can step down to 1 128 micro steps with very low noise the Wi-Fi stepper has four major components the esp8266 Wi-Fi controller a power step 0-1 stepper motor driver an act tech 5:08 a crypto authentication module for security Animax one five zero six two high efficiency voltage regulator now here are the connections on the Wi-Fi stepper controller first there's a 2.1 millimeter barrel connector for power input this can handle up to 50 volts next to terminal strip the bottom four terminals are for the coils of your stepper motor the top two terminals are an alternate power input it can handle up to 85 volts here at the top we have some power step zero one breakout pins at the bottom or breakout pins for the esp8266 there is also a reset button and some status LEDs so now let's start experimenting with the Wi-Fi stepper controller so now that we've looked at the components of the Wi-Fi step aboard I just want to show you the board itself as you can see it's a relatively compact little board it's a really good quality build here's the esp8266 you're doing the Wi-Fi it's antennas on this side here's the power step zero one stepper driver and you'll notice it's got a heatsink on it to dissipate any excess heat the connector at the back with the screw terminals is used for connecting the stepper motor itself the first four connections go to the two coils and a bipolar stepper and the other two connections can be used as a power input for voltage of up to 85 volts DC this barrel connector can also be used as a power input that's the one I'm going to use in my test and it can handle up to 50 volts there's also a connector over here for power and these two male header pins in the middle now the male headers on either side are basically the i/o for the stepper down this side you've got the i/o connections to go to the esp8266 and on this side IO connection is to go to the power step zero one now if you flip the board over there's a couple of places where you can make a solder bridge what that is for is when you're running it in voltage instead of current mode you can bridge this to get a little bit more current into the motor and thus increase its torque otherwise the motors actually have these resistors over here which are being used primarily for current mode to measure the current you can use it in voltage mode without doing that however which is what I'm going to do but you'll get a slight reduction in torque which is not really a big deal in the experiments we're going to be doing today there's also a reset button on it over here and a couple of LEDs over here to indicate power on and the status of the Wi-Fi and also a flag when there's an error you'll get a little red LED that lights up the flag is also displayed on the web-based interface so now that we've seen the Wi-Fi step four board let's go and hook it up and put it through its paces ok so to begin I'm going to show you the test setup that I'm going to be using to test the Wi-Fi stepper I'm actually going to be using both of my workbench that is the one I have on either side of my workshop so let me show you what I have on this workbench over here first I've got the Wi-Fi stepper itself over here this is the circuit board over here for it and I've got a stepper motor it this is a NEMA 17 size stepper it's a 12 volt bipolar stepper motor and I've got it connected to the Wi-Fi stepper controller I've made sort of a little gig over here to adapt the connector so I can use the screw terminals and I'm going to power this through the barrel connector instead of the two screw terminals over here and so I'm using the 2.1 millimeter barrel connector and I've got that going to the two power supply terminals on my solderless breadboard and from there I'm just running some wires out to my power supply that I'm going to be using the power everything currently the power supply is in standby mode I've also connected a ground connection to a ground rail on the solderless breadboard and that's for some experiments that I'm going to be doing with the Wi-Fi stepper now if we move to the other side of the room you'll see over here I've got a computer it's a Windows 10 computer that I'm going to be using to connect via Wi-Fi to the Wi-Fi stepper but I've also got a second over here this one now this is a Raspberry Pi 3 and you might wonder why am i using a second computer can't I do everything with the Windows computer and yes of course you can but there is a demo I want to do that requires a Linux computer or is a lot easier I should say with a Linux computer and my own workshop computer of course is a Linux box but it doesn't have a Wi-Fi adapter so I thought well a Raspberry Pi 3 is a Wi-Fi computer and it's Linux so why not use that so we're going to be using this for one of the experiments as well so now that you've seen my test setup the first thing to do is to power up the Wi-Fi stepper and then to go over to the windows computer here connect to the Wi-Fi and load the web-based interface and so let me show you that now alright so the first step of course is to power up the Wi-Fi stepper board so I'm going to do that right now I'm going to give it 12 volts now it's a bit difficult to see on camera but there's a couple of LEDs over here there's a green one which indicates power and an orange one that indicates Wi-Fi activity and so now I'm going to move over to the computer and connect to the network so let's take a look at my networks and this is it over here wsx 100 - 8 P is its SSID I'll connect to that there's no pass key or password involved in this network ok so we're connected right now now of course after you've established the connection you can go back and add a password or passkey to secure the network but I'm going to do my experiments without that so let's move over to another desktop or I've got a web browser and we'll go to the URL 192.168.0.1 and that brings up the Wi-Fi stepper web-based interface so now that we've done that we're going to look at the web-based interface and then we're going to use it to control the stepper motor now here's the web-based interface to the Wi-Fi stepper controller now the settings page is the page that defaults to when you first go there and you go there by going to 192.168.1.1 the settings page or the settings for the esp8266 so these are all the network connection settings you can change the mode although I would leave that at access point then you can change the SSID if you wish and you can also enable a password which is a good idea now I'm not going to do that for these demonstrations but when I put this into actual use later on I'm certainly going to do it you can also hide the SSID if you wish on the browser and API interface you can enable HTTPS and add some authentication for that and then you can reset the motor or do a factory reset of the entire device now below this we have a documentation section and as you can imagine this contains some documentation about hooking up a stepper motor to the controller and some issues about high voltage in hardware reset the troubleshooting section gives you some troubleshooting tips that you can follow if you're having difficulties getting something to work and the About section is a typical About section it tells you about good robotics and gives you a link off to the crowdfunding campaign of course if you don't have another Wi-Fi connection or another network connection rather on your computer that link isn't going to work because currently I'm disconnected to the stepper motor controller the QuickStart is where most of the action is now under Quick Start you can set up a number of different parameters for the stepper motor itself you can select which mode you want to use servo control speed control or external step clock I'm going to cover all three of those modes in a few moments there are some flags that get indicated over here if there's some form of an error command error overcurrent under voltage with thermal errors now you'll also get a red light on the stepper controller if you get one of these flags raised and then there are some motor configuration parameters that you can set if you need to for your motor you can also go into advanced settings for both the current mode and the voltage mode I'm going to leave these as they are but you can fine tune them for your own application if you wish and then we have the quick code section which I will cover a little bit later in this video this basically gives you some code samples and Basch and Python that you can use to write code to control the stepper motor from an application without using the web-based interface so there you have it the web-based interface now that we've seen this let's start using our Wi-Fi stepper motor controller so now that we've looked at the web-based interface it's time to put the Wi-Fi stepper controller through its paces now when we looked at the web-based interface you no doubt noticed that the motor could be driven in a number of different modes there was speed control mode servo control mode and external step clock mode and we're going to cover all three of those there also was the selection between current and voltage control which can make a very big difference in the performance of your stepper motor and we'll examine that as well so let's begin by looking at speed control mode so we're going to start off in speed control now I've used the drop down here to select speed control and it's telling me I'm using a NEMA 17 style motor with 12 volts input and I'm currently I'm using current control will examine voltage control in a moment now I've got the speed set at 30 rpm and a micro stepping at 1/16 which is the highest resolution but you can change the resolution here if you wish I'm going to keep it at 1/16 and if I want to go forward I'll just hit the forward button and you'll observe my motor is turning forward now I can hit the reverse button and send the motor around in the other direction and of course I can stop it as well now over here we have a switch for both heart stopped and Heisey stop z stands for impedance now what I want you to look at right now is on my power supply at the bottom you can see the amount of current that I'm consuming and it's not a great deal this is kind of the idle current right now now watch what happens when I put this into hard stop mode and I'll spin the motor and stop it and now look at how much current I'm consuming in hard stock mode the shaft of the motor is being held in place right now it's got current in it so the motors getting kind of warm but this is something you do if you want to hold something in position when it stopped when you're at high Z stop let me spin the motor again and stop it you'll notice again I'm drawing hardly any current and I can freely spin the shaft on the motor if I wish and so these are two different stop modes now before we move on I want to examine two other things in speed control the next one being the stop on switch now for this demonstration I want to draw your attention to this blue wire that I've connected to the Wi-Fi stepper board I've connected this to the SW input and SW is this an abbreviation for switch this it put is pulled high but I can take it low by just attaching it to the ground rail that I've got over here because this is grounded to the same ground that the board is using so I'm just going to leave it aside for now and on the interface you will notice there's a function that says stop on switch and what that will do is it will stop the motor when that line goes low and the switch is pulled low the motor will stop so I'm gonna set the motor in motion again and once I ground it as you can see the motor is stopped now if I remove the ground the motor is still stopped I have to start it again this effectively is very similar to hitting the stop button over here on the web-based interface so I'll do this in Reverse is to show you that this works in both directions and it does and what this would be very useful for would be for a limit slip either a physical switch or an optical switch driving a transistor that could be used when you're moving a mechanism and want to know when it's got to the end of its travel so a very useful feature indeed I've got one more feature to show you on the speed control before we move on and look at the servo control now one final concept I want to go over which actually affects all of the different control modes is whether you're using current or voltage control which you can set over here now the difference being in current control mode the amount of current is regulated into the stepper motor coils not the amount of voltage and so you could very well be putting more than the 12 volts that my stepper motor is rated at as long as you don't exceed a maximum amount of current now in this mode the stepper motor is going to give you its maximum torque and maximum holding power however of course is going to take a lot more current and it will build up a lot more heat in voltage control mode you are regulating the voltage to the voltage that the stepper motor requires which in my case is 12 volts and so the amount of current will be far less now if you go down in the interface over here and go to advanced settings you can actually set the current control mode settings I'm just using the ones that came by default but you can set those if you wish now what I want you to observe is my power supply here the very bottom of the supply shows the amount of current that I'm drawing and this indicates I'm sending it 12 volts and so what's the current now right now everything is idle so it's not taking that much current but I'm in current control mode and so let's start the motor and take a look at the amount of current I'm drawing that's quite a bit that's over half an ampere of current this little stepper motor is drawing and the torque on this is now very very high it would be very difficult for me to stop this now let's stop the motor now let's switch the voltage control and you'll observe a couple of things let's start the motor again now it's at the same speed and step rate but look at the amount of current I'm drawing it's a lot less current and there's not quite as much torque on the motor though I can stop it a lot easier then I couldn't current control mode the motor is also as you'll probably notice a lot more silent than it was in current control modes so voltage control mode is very useful if you want to run the motor and consume very little current and also to make the motor run silent whereas current control mode is definitely useful when you want to get the maximum amount of torque out of your motor but of course you're going to consume more electricity so having said that let's move on so now we've seen the speed control mode and we also saw the different effects between using it in voltage control and current control and we also saw how the stop switch works it's time to move on to another control mode and this time we're going to look at servo control mode now as the name would imply it allows you to use the stepper motor a little bit like a servo motor it's not exactly like a servo motor and in some respects it's actually better than a servo in servo control mode you can move the motor shaft a specific number of degrees and then it will stop so you can use it quite a bit like a servo you can use it with the web-based interface either by inputting the number of degrees that you want to move the shaft or by using the graphical user interface and actually dragging the motor shaft into the position you want to put it into so it's quite versatile so let's take a look at that right now now the best way of understanding how the motor controller operates in servo control is to observe the position of the motor shaft as I manipulate it with the web-based interface so you notice it's facing straight backwards right now and I'm going to grab the handle and move it to the 90 degree position roughly and as you can see the motor corresponds with the position that I've selected on the web-based interface and I can move it back and forward it will I can also use this box over here to set the position so I can set it back to zero if I wish or if I wish perhaps to go to 180 and the motor moves exactly where I want it to and so as you can see this would be a very useful mode if you want it to precisely position the servo shaft in a specific angle okay we've seen both speed control mode and servo control mode but there's one more mode we need to look at and that's external step clock mode now the external step clock as the name might imply allows you to use an external clock source to step the motor and this external clock source just needs to be a 3.3 volt logic signal so you can get that from something else like another microcontroller perhaps in Arduino that could send out the pulse if it's a 5 volt pulse you could use a logic level converter to change it over I'm going to be using a signal generator actually as my source of pulses and so I've got a little experiment set up over here to show you external step clock mode so let's go take a look at that right now so here I have the web-based interface set to external step clock mode and it's still under current control now the only controls will need to be familiar with here are these down here the start and the stop controls right now it's in a stopped mode but first before we start it I want to show you my test setup over here now as you can see I've brought a signal generator into here and currently it's set for a 1 hertz square wave at 3.3 volts so it's sending out a pulse every second and I've got that connected into the step input on the Wi-Fi stepper that's what this yellow wire is here and of course the other end is this my ground and I've still got the switch connection over here I'm going to demonstrate what that does in this mode in a few moments but first let's start it right now so I'm going to hit the start button on the web-based interface and you'll notice that I'm in micro step one to one mode so every pulse is making a step on the stepper motor and if you can see the motor it is slowly moving right now and I'll increase the frequency here so now I'm at 10 Hertz and every pulse is stepping the motor right now now let me stop this for a second and I'm going to set this over here to 16 step mode and we'll start at the gain now it's sixteenth step mode of course it's moving very slow so let's bring the frequency up quite a bit this is 64 Hertz right now so basically 64 Hertz divided by 16 it's basically stepping like a boat one step is doing about a quarter of a second over here okay so you can see how that works now the next thing I want to demonstrate is what happens with this wire over here the external switch wire now the function of the SW input on the Wi-Fi stepper is a bit different in external step clock mode than it is in speed control mode now if we go into the interface we have a check box that says dirrection on SW and if we highlight this question mark it tells us it chooses the step direction from reading the SW pin so I'm going to check that right now I'm gonna run this now right now I'm still at 1/16 micro step and I've set my oscillator now to a hundred and sixty Hertz so I'm feeding it a one hundred sixty Hertz square wave and you can see right now the motor is spinning counterclockwise now watch what happens when I ground this input and you'll notice that the motor changes direction now it's internally pulled high so I don't need to use the positive rail but I could if I want to so when I'm putting 3.3 volts into here or no voltage because of the internal pull-up it spins counterclockwise and when I ground it it goes clockwise and so there's a simple method for using an external logic controller an external switch to control the direction of the motor when your an external step clock mode so now we've looked at the three different control modes that we can use with the web-based interface to control the Wi-Fi stepper but there's another way that we can control the Wi-Fi stepper and it doesn't even require the web-based interface we can control the Wi-Fi stepper with a computer that's Wi-Fi capable using a script running on that computer and the Wi-Fi stepper supports two different types of scripts bash scripts and Python scripts now as I said at the beginning of the video I have a pre-release version of the Y by stepper board and currently my virgin only supports the bass script so I can't tell you the Python scripts so let me show you the bash scripts now you may or may not be familiar with bash scripts bash scripts have been around for a long time with about 30 years and they essentially let you run any command that you can type at the command line in a script and they're very useful for automating things now they work best on a Linux command line and as I said earlier I brought a Raspberry Pi into the picture so I could demonstrate this so I'm going to show you how I hook up the PI connect it to the Wi-Fi stepper and get it prepared to run some bash scripts and then I'll show you a utility that's already built into the web-based interface that simplifies creating a bash script or write a script and we'll use it to run our motor so let's go on and do that now alright so I've booted up my Raspberry Pi and I'm on my raspbian desktop now before I get started I actually need to be connected to the Internet in order to install something called JQ now JQ is a command line json processor if you're not familiar with JSON it's a text-based format that allows computers to communicate with each other in many respects it's similar to XML JSON stands for JavaScript object notation now in order to install JQ I naturally need to be on the internet so if you're using something like a Raspberry Pi 0 W or WH you only have one connectivity option and that's the Wi-Fi and if that's the case you're going to need to connect your Wi-Fi first to your own network and then go and install JQ and then you can connect up to the Wi-Fi stepper now I'm using a Raspberry Pi 3 B+ so I can be connected to both so right now I have my Wi-Fi connected to the ws x100 but I've also got an Ethernet cable plugged into the device so I can be on the Internet as well essentially I've got two networks attached to this raspberry pi now to install g8q you're going to need to open up the terminal to get at the command line and at the command line you're going to type sudo apt that get install JQ now when I do this it's going to just tell me that I already have date you installed but when you do it it will probably prompt you for a password now the password is for your Raspberry Pi Super User and unless you've changed it the password is going to be raspberry after that it will go through the steps of installing JQ + JQ does take a little bit of time to install so you're going to need to wait until that finishes after that if you're using a Raspberry Pi 0 W or W 8 you can disconnect from your note local area network and then you can connect up to the Wi-Fi stepper using the Wi-Fi over here again I've already done that on mine and once you've done all this you can probably just leave the command line window open I'm just going to minimize it because we're going to be using it later so the next thing you're going to do is you're going to want to connect to the Wi-Fi stepper and again you'll open up the web browser the chromium browser that comes with the Raspberry Pi desktop and you're going to go to one 92168 4.1 and we'll get into the Quick Start now what I'm going to be doing is I'm going to actually be doing a sequence here in my case I'm in servo control I'm just going to move the motor and then after that I'm going to get some scripting information from the bottom over here if you scroll down here you'll see in this quick code there's Bosch and Python I'm going to take some bash scripting information I'm going to copy that into a text editor and then I'm going to edit it slightly and save it as a bash script and from then on I can just run it from the command line without the web-based interface and it will move the motor in the same direction so I'm going to show you that right now so now that I've installed JQ I'm ready to start creating a bash script now I've opened up the web-based interface for the stepper motor controller as before it is at 192 168 dot 4.1 and I've put it into servo control mode under current control now that was just for this particular test you could choose a different mode and the principle will be the same now what I'm going to do first is I'm going to move my motor so I'm going to move it 180 degrees and as you see the motor moved 180 degrees and now I'm going to go down here where it says quick code now I've got a bash and a Python tab over here now as I have a preliminary version of the stepper controller only the bash is functioning on mine but by the time that you get this the Python will also function in a similar fashion so I'm gonna copy this code I'm going to open up a text editor now I'm using Genie kinis one of my favorite text editors actually and it's included with raspbian but you could use another editor if you want if you want to use genie just go into the programming section on the raspbian menu and you will see it over here I'm going to paste my code into genie and we're going to save the code now I could name it anything I want but I need to end it with a dot s H in order to be a Bosch file so now that I've saved the code and told Jeannie what type of code it is you'll notice that it's done some text highlighting to make it easier to work with now this code is actually got too much in it it's got something for all of the different functions that the Wi-Fi stepper can do and I only want to do the 180 degree thing so what I'm going to do is I'm going to remove the zero position I'm going to keep the servo commands I'm going to remove the speed the step clock and the stop and so now basically my code is going to set everything up it's going to write the motor configuration it's going to have a curl string over here it's going to read the motor configuration it's going to send my servo command and you'll notice my servo command has angle equals 180 in it and this is the curl string that's going to send out and then it'll read the status back and read the state back and that's what comes back with JQ as you'll notice over here and so now I'm going to save this and I'm going to go now onto my terminal now because I saved it in the PI directory my terminals in the right place and if I do in LS you can see that stepper 180 dot s H is over here you'll notice however that unlike this step 180 which is an earlier attempt I made at this it is not highlighted in green and that's because it's not executable yet I have to change that so that it is so what you do is type in chmod and a space and a plus X to make it executable and then the name of the file and do that and now the file is executable if they list it again you'll notice now it is in bright green in order to run this file first thing I want to do is go back here clear that flag and reset the position of my stepper and set myself back to zero as well too I just want to set everything so that it is as it was when I captured this and you'll do a dot and a slash and then the name of the file and you'll notice that the motor now moved 180 degrees so this is a simple demonstration on how you would create a bash file using the web-based interface and now I can step the motor 180 degrees without actually having to use the web-based interface I call this bash file from another program and so this is a very versatile utility all right well that about wraps it up by look at the Wi-Fi stepper controller I'd like to thank Andrew over good robotics for sending me this preliminary version of it I've found it to be a really innovative and well-designed product that I think has a lot of applications not only in robotics but all sorts of remote-control and IOT apps could benefit from something like this now if you're watching this video when I first released it you will find this device on the crowd supply crowdfunding site and you can go there for more information about the device as well as information about ordering one for yourself now if you'd also like some more information about the Wi-Fi stepper there is an article that accompanies this video you'll find on the drone bots workshop comm website while you're on the website I would really appreciate it if you would subscribe to my newsletter if you haven't done so already my newsletter is not a sales letter it's a way of keeping in touch with you keeping you up to date as to what I'm doing here in the workshop and most importantly soliciting your opinion as to what video and articles you would like me to create for you because creating content that's relative to you is very very important to me I would also appreciate it if you haven't done so already if you would subscribe to the YouTube channel it means a lot to me when I get new subscribers and it's just a matter of clicking the button below this video to do that so until the next time please take care of yourselves and I hope to see you very soon here in the workshop good bye for now [Music]
Info
Channel: DroneBot Workshop
Views: 71,042
Rating: undefined out of 5
Keywords: Stepper Motor, Wireless Controller, ESP8266, wifi stepper motor controller, nema 17, raspberry pi
Id: 3CSEmAAK7VM
Channel Id: undefined
Length: 39min 9sec (2349 seconds)
Published: Sat Jan 19 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.