Episode:#25. I did not like this HAT for Step motor Controlling using Raspberry Pi!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello hi so after a couple of months I'm back again with another episode so I'm sorry guys I was away I was very busy especially I doing a project at home and I will announce it uh hopefully very soon uh what what did I do with this project uh but it's uh just as a sneak preview I would say that it's something about the uh Automation and uh cheap automation especially with Raspberry Pi so um but today I would like to talk uh about Raspberry Pi itself and the hats that are specifically built for Raspberry Pi and the problem that I have found uh during my working time with Raspberry p hats there are different types of hats available in the market uh but specifically I I I used uh one um hat for for stepping Motors uh to control them and I am really getting a lot of problems so just as as someone who has guns through this uh Road uh I got some um experiences that I would like to share with you so let's uh discuss a little bit about raspberry piie and then the hat and find out what what was the challenge that I actually faced so let's do it all right um so as I explained uh I was looking for for uh a hat for Raspberry Pi to control one step motor and the available uh uh boards uh for this specific uh task uh mainly I could find two manufacturer one of them was Ada fruits I hope that I pronounced it correctly the other one was wave share and um so because wave share was cheaper I actually decided to buy wave share and um yeah I test it uh but I'm actually uh not really happy with that because of the reason that I will tell you now and so I just uh brought my raspberry pie so this is the raspberry piie and I hope you see it this is the raspberry pie and this this guy is the wave share uh for the um yeah so for the step motor basically and uh this the board itself is really really clean very very very um clean and I would say that uh it looks very nice and the connection and everything works fine um I mean you have the opportunity for example there are some small switches here oh here uh that you can uh change the uh stepping like from C2 to the full step uh sorry um 32 it means that 1 over 32 so uh it means that amount of rotation per step uh over um you you will create pulses for each step it will be uh divided to 32 so it would be more precise motion I would say uh but for my task I don't need it so I would put it to 0 0 0 so there are three parameters that you can change to create to Define this um 32 step um but uh as I said I don't need that high Precision motion so I put it to 00 0 this is one thing um another thing is that if your uh motor you have the possibility on this board to connect two step motor and uh the connection basically either you connect it through these two ports the the white ones or you connect it from this uh green ports uh basically yes and these green ones basically have four uh wires coming out of the uh motor and you have to connect it based on yeah sometimes up A+ a minus B+ B minus which is roughly the the same so minus SP positive negative and um so you have to connect these guys this uh wires uh correctly and the rest is basically nothing the rest is basically programming um there there are also three uh I think three or four um uh pins available on the on the gpio G GP iio yes uh which belongs to Raspberry Pi and the connection or controlling of this board basically is show these pins so uh for example for this uh by the way I have got this um yeah motor uh Nema I guess yeah so similar with my name Nema but this one is Nema and the Nema Motors uh they are powerful uh step Motors usually you see a lot of these motors in 3D printers there are uh they're all right they have they are a little bit jittery but they are all right basically for a cheap price and um yeah so um this guy I think takes 12 volts I mean optimal is almost 12 volt and uh you can also apply more more W I think up to 28 something and uh it takes um the board itself I guess I'm not sure how much Amper it takes uh but I think there is a limitation up to one and a half Amper I guess for each motor so um the thing that I realize it that if you keep the board for a long time on it gets really hot so maybe using a fan or something especially for the controller motor controller board uh it's a good idea and yes so as I was explaining if you want to control this one yeah this one H with this board you basically need um control links via the software there are uh as I said uh specific pins and that are uh made basically to to create uh pwm pulse V modu that you can Define exactly how much the policy is and how much the delay is the cycle time and also the frequency and everything about that to create these pulses so for for this port uh as I said there are two Motors available and the the the the the motor that I connected uh needs one um um pin for direction of the motor which should be uh uh should be used the other one is the enable that you enable this uh uh motor to be to be used and the third one the most important one is the stepping so the stepping which are high frequency uh part of these iOS available on the rasp pie so yeah so these three guys are the most important one and then if you want to control this wave Share Board uh with um s the software like the stepping you can use also three other pins I think 23 24 and something I don't remember and you can exactly they play the role of this switches that I showed you these guys here so you can also enable or disable and create the um steps so this so the software so that's the the the whole thing about this board that I I wanted to explain you and also it needs an external um power supply for the motors itself because you cannot depend on the power supply from the Rasberry Pi because the poor guy does not have that much power so uh you have to best uh Supply U um power from the external supplier yes so these are the most important ones and if your motor requires a lot of um current uh you're moving something heavy for example then you have to uh use this uh potential potentiometer I don't know what it's called Uh so these switches here uh to the maximum to get the maximum uh basically Uh current but don't do that uh so always leave some tolerance at the end because it gets really hot as I said all right so this was the hardware point of view but what I uh found it very hard or not good uh was okay honestly I am using or programming this Ras P guy uh with Cod CIS I don't know if you have heard about the CODIS or not it's a very cool software for PLC programming and my intention basically was uh modifying the Raspberry Pi to a PLC um platform which uh for cheap project it's okay but for um real industrial project um I don't recommend it it's um I really don't know uh why but hm I hope that the Raspberry Pi version five somehow gets more in industrialized I don't know I I have not this is Raspberry Pi U three old one uh very old um 2015 I guess this is yeah but anyway um it is not reliable as as as as a industrial controller but for hobbies or whatever I mean like home projects yeah definitely go for it and it's cheap so um let's let's go to cesis and find out why I don't like this board so um this is basically um CODIS and and um I have connected the Raspberry p to the quis Z ethernet and I would like to just tell you that why um this hat uh is not basically suitable uh or at least what is what is the uh reason that I say that it is better to go for alter alternative of wave share because okay the same is that we are here we have gpios so and I click here and um yeah just let's like for example update this device you see that uh you have two option the option one is for old uh Raspberry Pi the option two is for New Generation or new raspber pies so this one is the one that I actually uh taken and I use this gpio for uh B+ rasp pie and when you go inside and you will see a lot of things like you see you will see gpio Pro these are the gpio that exist and here you can Define for example which one of these gpos are um as a value as input or as a output if they are not used so they are not used but if they are output and input you have to Define them so as I said for step motor for this specific step motor I need at least three outputs so GPI 12 gpio 13 and gpio 19 I will consider them as yeah I will consider them as what and output so and then um I have the mapping the mapping here is to define the address of channels basically so you have input channels and digital output channels for us the digital output channel is important because of the uh yeah controlling the motor so uh for example the bit 12 that was defined as H why here okay uh the B12 uh here is defined or I have defined actually as the step motor underline enable as a value or variable uh number 13 as the direction I guess and um number 19 I have to find the value here as a step mode or under underline step or whatever this is the one the high frequency ones so basically both of these pins are high frequency so you have to Define everything here the variables and you will find this in the main program that you write here in the PLC basically for under the application so this is working until now and all right the problem is here that if you want to program this board basically it's not easy so there are some written libraries for STP Motors that you can you can find probably online on uh CIS which I will show you later H but uh basically it's working based on soft motion and for soft motion all right I have to be honest here I did not get the license for soft motion so because it costs about30 or something so if you want to have the license for Rasberry P it costs around 50 itself but if you want to control and access you have to also pay €1 130 or something for just for the soft motion and um this is actually a little bit too much for me at this moment so uh the question the problem is that if I go here and if I go at a device and if I go here position control uh drivers I see these two libraries that yeah as I said it was written by uh people in codices uh SM Drive rasp steer direct and SM Drive rasby stepper pulse Direction so the first one is for the DC motor and the second one for step Motors so if you select this one and add this device it comes here so far so good right so you have basically your drive installed and you have have to go inside this and then there are some parameters values so for example the access type and limits so let's say this fin it and then you have to define the velocity that you would like the acceleration the acceleration jerk and everything uh here and then you go here you define the motor type is it rotary or linear and then you say that okay for every motor turn how much the increment is is defined let's say for example 200 so every 200 increment uh will cause the Moto to turn one and uh Etc if you have a gearbox you have to also Define the relationship between your input and output and if if you have extra uh scaling you have to Define and then commissioning nothing here and you go here here's some important stuff and access reference motor setting you have to define a maximum frequency I don't know let's say I don't know 1,000 and then you have to Define again the pulse system the pulse system for me was I don't know 19 and the direction was uh I guess uh what was the direction 13 and then enable which was 12 I guess I don't know and yeah so so so far so good I guess number 18 there is a disable option which we don't basically use it I think so this is a yes um let's go forward next next looks everything okay so here um this is the statues but the problem everything looks fine until now so if I go to my main uh program I've written some stuff which is not really related I think and we can ignore let's let's go online so I go here I will have my I guess I messed it up let's see if I can connect y Tak some times all right so if I click this one and go to this run mode you see two thing unfortunately when you are using gpios the soft motion does not function properly I don't know why why is that when you use soft motion you do not you cannot use gpios so uh if I go to gpios and if I go to the statues they say there is a message the boss is not running the shown values are perhaps not actual which is the case it's true so whenever I use this block for controlling the motor step motor which is written I cannot use gpios anymore so it means that you cannot at all connect any kind of sensors to your gpios when you are using soft motion yes so this this problem exists and it's very very yeah Nish I would say in German I don't know what is in English so yeah is embarrassing I would say so if you go to this drive you also see okay uh you see that the license is missing or invalid the PLC runs in demo mode this is also something which because I don't have license for soft motion so basically uh the moral story uh is that um don't uh yeah if you don't want to pay too much uh do not buy this wave share things um in the next video uh well I basically I don't have out other fruit uh other fruit is actually this one you see I have open it but I don't have the board yet as soon as I get it uh I will test it and I will show you in a video why ad of fruit is much better uh to work and uh instead of using gpio or soft motion to use i2c and why i2c is much compatible and easier to use for uh controlling your uh external Motors yeah all right I hope that you enjoyed this video and short introduction that uh to uh go forward in the right direction I will put this in my blog and I will also explain um another uh way that I Tred to control this uh with uh PW pwm uh option without any using of soft motion but the results the result was not really satisfactory for me uh even using this uh technique uh creating a PD pwm block by myself um I will share it on my blog if you have comments I would be really happy to follow and hear from yourselfs and uh as soon as I get this uh ad ad fruit uh step motor board I I will update you what what was the result all right guys thank you so much and see you in the next video bye
Info
Channel: Dynamic Machines Podcast
Views: 221
Rating: undefined out of 5
Keywords:
Id: _fm78P14c5M
Channel Id: undefined
Length: 22min 28sec (1348 seconds)
Published: Thu Oct 19 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.