How to Wire and Control an AC Servo with Arduino: Step-by-Step Guide

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone thank you for the response on our initial video of the servo it was only really meant to be a sort of a blog post regarding what I was doing with the Arduino but since the response I've decided to share some of the secrets that I discovered along in the making of the video so here is the setup that was used last time and this time here I'm actually going to show you all of the wiring as well as some of the programming that I've done around the computer so without further Ado let's go and take a look here at the wiring so on this side here I've got a 24 volt power supply you saw this in the last video and we've got the green wire which is just the ground so there are about that I'm going to White Fire which is the voltage negative and the red wire which is the voltage positive these two wires are coming along over here into this breadboard so we have the white wire going into the black wire right here now if you want to take a look here at the server manual and go over to the correct page you can see here the chapter for the control mode of position and then the schematic type we're given here we want to use the com negative which is pin 37 along with the negative anode of the power supply now the other one would just be compositive or pin 36 it's going to be connected to the voltage positive of the power supply that's really the most important and critical thing already done that's the only thing you can really mess up here everything else does really matter if you correct it correct or not the server might just do some weird things you're not going to do any damage by disconnecting any of this but again don't hold me liable if you do pin number three which is di0 is the server enabling and the servo enabling as well as your ROM release the forward limit for the reverse limit we can go over these in a moment they'll all be connected to the dv0 which is the negative anode of the power supply so if you have a look here at the breadboard this orange wire here is connected to pin number three which is also connected to the negative voltage of the power supply so this will actually enable the server to be on and off right now this is plugged in and that is why if we go over here to the servo and try and move this thing it's going to be very difficult to uh it's going to be very difficult to try and move the servo it's completely stuck however if I go out and disconnect this orange wire just like so and go over back here to the servo I can move this around freely okay and I'll reconnect it now and as you can see it's not possible for me to move this thing here at all now let's go and talk about the actual movement of the servo it's important to note that we're doing something called position moving in which case we're actually sending steps to the servo and telling it how much it wants to move per step in the server Manual of your Servo you're going to have a parameter that sets the electronic gearbox ratio of the servo on this particular Servo here we have a 28-bit encoder however I've changed the electronic gear ratio on this Servo to be 1 000 years per Revolution that reason is merely because an Arduino such as this bulb can only produce a set amount of toe if you try and go too fast with these the microcontroller won't be able to switch on and off quick enough and you'll end up having just noise instead of an actual outputs differently if you have something like a Mesa board the Mesa board will actually be able to produce the amount of frequency required to run the summer button SPD mic once of course within reason that is generally speaking I don't think pulses should be less than a couple of nanoseconds at most but in any way let's go ahead and take a look at what we're connected here in the servo manual it says very clearly that if you're using 24 volts or 12 volts you need to be using an external resistor with the 24 volts and unless you're connecting it to the OPC we're not doing any of these actually we're going to be using the Arduino instead and that is because these photo transistors inside of here are perfectly capable of running at 5 volts it's just in an electronic in an industrial area with lots of noise Electronics you might get some noise however this is not the case and we're able to run it is fine what we're going to do here is that we're going to connect pin number one and two as well as pin number 17 and 16. to these three pins here on the Arduino pin number 12 number 12 just there is going to be the direction positive pin number 13 is going to be the pull okay excuse me pin number 13 on the Arduino is going to be the pole positive so that's going to go over this one more time pin number two and this connector is going to pin number 13 in this connector pin number let me see here pin number 17 and this connector is going to pin number 12 in this connector the pole minus and the pole direct are both connected to each other so pin number one is connected to pin number 16 and they are both going to ground in this connector that's all the wiring done it looks a lot more complicated than the last layers and now that we've gone over the wiring let's go ahead and take a look here at the code this code here is going to be in the description of the video in case it's a little bit difficult to see here at any rate we're creating a constant integer pin 12 which is equal to 12. we're creating a constant integer pin 13 which is equal to 13. in our setup module we're going to we're going to switch on the pin 12 as an approx as well as the pin 13 as an upwards the ground is always going to be enabled in an Arduino so we don't need to do anything about that the serial begin is going to be in 1969 9600 and that is just the baud rate of the Arduino why it's set that way I don't know now let's go ahead and start some programming I've already written in a couple of lines here we're going to talk about what this will do in a moment pin number 12 is going to be such a high when it's set to high the servo will be going in the clockwise Direction when this is set to low it will be going in the counterclockwise Direction we're going to be playing a tone here which is a frequency on pin 13 which means that pin 13 is going to go up going to be high it's going to go down it's going to be low at a frequency which is going to be this so my server was set up with parameter number 48. I can go over here to the server option and we parameter number 48 is set at 1000. this means it'll take 1 000 pulses to move the servo one rotation right so it'll take 1000 pulses to move this over one rotation this is happening every second so we're going to have 10 rotations on the servo every single second we're going to wait five seconds and then we're going to say take the digital right pin 12 low and maybe play a tone here um pin 13 which is going to be the two times that's awesome and then another delay of two seconds there we go and let's go and change this down so if you don't get such an Abrupt change motion all right that seems about good there you can go ahead and verify our servo code and it appears this is fine now we can go over to the actual servo you can take a look here so right now I'm going to upload a code pressing upload and we should see some movement here on the server there we go into this and moving backwards I'll be going forward that once more I'll leave it up to you guys what you want to do with this really it's none of my concern however I hope that I've given you guys all the tools that you'll need in order to connect to your own server before I leave this video I want to show you one more thing these extension boards can be very useful with these connectors as you can see we have a lot of pins if you want to be filling out all the pins which you should do in an industrial setting you absolutely need to fill it up out all these pins however do be careful not all of these pin layouts are the same your PIN layout should be present in your Servo manual guide do not trust any other guide to show you where your pins are in worst case scenario you can take off this cover and have a look at the photo transistor wiring that is behind this cover make sure to double and triple check all of your connections before turning on the power that's it thank you a lot for watching and I wish you great success in your Servo endeavors goodbye
Info
Channel: Tarehjerne Tarehjerne
Views: 8,310
Rating: undefined out of 5
Keywords:
Id: W1lqBNQX9AY
Channel Id: undefined
Length: 10min 11sec (611 seconds)
Published: Wed Aug 23 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.