Control Large DC Motors with Arduino! SyRen Motor Driver Tutorial
Вставка
- Опубліковано 6 жов 2014
- I love Arduino's! One of the main reasons I was so excited about Arduino's potential back when I discovered them in 2006 was simple: controlling motors! Arduino's control small motors very easily; in fact, I've done a number of videos covering How to Control a Servo with Arduino, How to Control a Stepper with Arduino, and How to Accurate Control Steppers.
But another great thing about Arduino's is they make it very easy to control large motors - like the brushed DC gearmotors in this video buy using a motor controller.
In this video tutorial, we walk through a simple example in the Arduino IDE to show just how easy it is to get up and running to start, stop, control direction and speed of a large motor with Arduino!
In the second example, we use two proximity sensors as limit switches and two potentiometers to allow on-the-fly speed adjustment!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Links for this video:
Arduino: amzn.to/1E0gxVU
SyRen Driver: amzn.to/ZcpiOL
Power Supply: amzn.to/1TYYLMQ
Arduino Code: bit.ly/1v8wc65
Proximity Switches: amzn.to/1oHRPru
Potentiometer: amzn.to/1tMtsEX
12V Gearmotor: amzn.to/1wtQBla
Music copyrighted by John Saunders
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Reach us / CNC Info:
Manufacturing Entrepreneurship Resources:
www.nyccnc.com
Better Speeds & Feeds? provencut.com
Online Fusion 360 Training: bit.ly/LearnFusion
Hands-On CNC Classes: www.nyccnc.com/events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I discovered machining as an adult and am grateful to have found something I love and am able to share with others. We hope NYC CNC not only makes you a better machinist but helps you understand and learn more about how to succeed as a manufacturing entrepreneur! 5 Reasons to Use a Fixture Plate on Your CNC Machine: bit.ly/3sNA4uH - Наука та технологія
EXCELLENT VIDEO, one of the most technically correct, well done videos that I have Seen! Keep up the GOOD WORK!
Good day, this is EXACTLY what I am trying to build for my CNC automation installation; but I am using an Ethernet Smooth Stepper with Mach4 and Gcode. Thank you for your presentation, it helps a lot !
You could also try putting the input pins from the sensors on the Interrupt pins. In doing so it won't finish its cycle actually reverse the motor in the ISR interrupt service routine.
If you use interupt functions, the arduino would respond to the proximity sensors faster. Your program has to loop the complete program to read a sensor. An interupt function waits in the background for a signal on the pin, as soon as that condition is met, the main program is stopped, the interupt subprogram runs, and the main program resumes on completion of the interupt program.
great advice
Gotta say, you have a real gift for explaining complex concepts.
Thank you for this video! Now I'm confident enough to order SyRen 50A, because now I know that I can use the simplified library if all else fails. Instant subscribe
Nice widget John. I really like these arduino lessons.
I'm anxious to see the application of this setup in your shop. Keep these great videos coming!
While I'm not coming from CNC background or anything (java developer) I've learned python and I'm looking at controlling DC motors for doing semi-heavy lifting (can't physically hold a 3ft x 4ft plywood for a long time for my dad when he asks me for help holding heavy things, concrete bags, etc.) so I find this helpful from Arduino controller perspective. Thanks for making this video, glad I found someone who works on heavier side of machinery and machining using Arduino or Raspberry Pi.
Awesome! Keep em coming. Just what I was looking for.
Hello. Thanks for the great video! i am new in Arduino's and you really helped me with this demonstration! Great work!
Outstanding find! I'm toying with the idea of making a motorized camera slider and this is exactly what I needed to see! Thank you!
This has probably been mentioned but, you can get adjustable proximity sensors that could help avoid any contact at all. Great video, by the way.
Great. This just opened a whole new world of possibilities in my woodworking shop. Thanks
I really like your videos. Thanks for posting them.
There is probably quite a lot of rotational mass in that motor, and since it's actually turning at about 3600rpm full speed, I'm not surprised that it hits. The arduino has probably sent the 'reverse' signal a long time before the shaft starts spinning backwards :)
I did a similar thing using a h-bridge BTS7960 driver controlling an automotive window winder motor (it was for a motorised camera slider rig), and even that little thing has too much inertia to stop and reverse instantly.
BTW the 43A BTS7960 drivers on ebay are under $10, but the difference is that the arduino has to do the switching not the driver, and there's no comms between the 2 devices.
Loving the videos!
They have overtook my life. Being a programmer in the 1980`s these are just what I was after. At the minute I have a mega that does the door bell, tells me when post is here, buzzies when the gate is open, tells me when theres a power cut, waters my plants, alarm for the workshops, and just got the rain sensor on a servo motor to drip the rain away to bring the washing under cover when it rains (UK).
We did a project at work a few years ago that used one of those motor controllers. It was a machine to brush over wheat plants in a glasshouse and stimulate the stems to thicken and stiffen.
The raw data byte sent to the controller is indeed 0-255, but the Arduino library must be shifting the value to make it easier to understand.
NYC CNC
We used a power supply. There was just a single motor with worm drive gearbox, which may have been as small as 100Watt, certainly not over 250Watt.
You can try to attach the sensors to de arduino interrupts, it will help you a lot.
Thanks for Posting these! I am designing a planetarium projector where I need to control and measure positions of multiple motors so they agree upon position. Still have a lot to learn. I am feeling less intimidated now :-)
Very good explanation and work!!
brilliant video. might suit my electric gates project. Thanks.
Yeah excellent video john, I do love how your all bla-ze with the “its so simple”.... well I think it’s gonna take a lil thought, definitely very cool though, I’m looking to apply it to a power feed project on the mill.
Noticed your dingus got a bit loose there in the end, might have added to / been caused by the tappytaptap prox collisions?
Thanks for another great post!
Awesome lesson, thank you!
Amazing stuff mate
The reason for hitting the sensors maybe caused by the backlash in the transmission rather than the response speed of the electronics.
Nice video thanks.
Hi, I think all your video's are great and I salute you for putting this knowledge out there for everyone who follows. I am a beginner at Arduino and motor control, I was wondering how you can incorporate a start/stop button for all these projects?
Great stuff! You could mount the proxes at 90 degrees so the hammer passes by them instead of pounding them.
Its very useful learning for heavy motors application
I have worked with this sensors in many applications. The best way to mount them is to detect the side of the hammer so that any over travel will not damage the sensor.
Great job explaining
Very nice and instructive.
Pretty cool John.
Fun stuff. Thanks for the video.
Earned a sub!
very nice! it would be very interesting if you can use visuino in making the code and connections since many of us are not very familiar with programming. thanks
Just found this after I sub your channel and its awesome, thank you John, I'd like to build a cnc router and I'm pretty sure this is the way to go. Do you have any ideas for rails and bearings?
I liked the comment about rotating the prox switches by 90 degs. However if this wasn't possible, Allen Bradley makes strike face sensors with spring loaded mounts. Expensive? Yes! But they hold up well in industrial applications and are immune to water and oil. ( all s/s steel construction). Dc industrial drives also include nice features such as accel/decel rates as well as braking features which will lock the rotor instantly. My preference for motors are 3 phase brushless as employed in industrial as well as rc planes and cars. Great technology! They are not as torquey as dc motors but with gear reduction that could be resolved. I've been working with Maestro servo controllers that have programmable ports, input/output/pwm allowing you to do quite a lot of combinations with 6, 12 or 18 channels. The software has a built in compiler as well! They are available from Pololu as a very reasonable price as well as a host of other devices for steeper motors and jrk controllers. Industrial servos are by far the best for cnc applications but the price keeps them off my workbench. Thanks for taking the time to post your videos and keep them coming.
Nice video 👍
Great vid as allways! Thanks John!
pretty cool. you could safely test things at higher speeds without worrying about crashing in to the sensors by turning them perpendicular to their current orientation and slightly behind the hammer. if you just have it immediately stop when sensed you could get a feel for how far off the reaction time is. i'd imagine a higher baud rate would be your best bet unless there's a delay in the motor or sensor's reaction times in which case there'd be no solution.
there might be a tiny bit of gain to be had in the code. using switch statements in place of the multiple if's to avoid extra tests/jumps, but i'd be surprised if that helped.
Hi John,
Great video! I had a quick question- where did you get the cables that go from the motor to the power supply? I just bought this motor and the SyrRen, and am looking to control it similarly to your video!
Nice channel, I'm happy I found it.
I'm starting to learn arduino now and I'm starting a project.. but I am so clueless with regards to motors and voltages.
If I needed to lift a 80kg weight, what type of motor do I need? what is the difference between this motor and a stepper motor? Thank you...
nice. Have you tried using interrupts for the proximity sensors?
Great video. Considered making some gearing for the motor? I think that would be fun to see.
You the Man...(again).
Cool. Thanks!
Could initialize direction as 1 or -1 and have speed controlled by one pot instead of two. When you touch sensor it would multiply the direction state by -1 so switching direction. Just in case you wanted one pot instead of two giving matched speed in fwd and reverse.
Great stuff John! Love your channel! The speed deal is probably is a signed integer. In binary, there is no concept of a positive or negative value, so the way it is done is by dividing the byte in half. So while you're plugging in 0, the actual byte value is, indeed, a 128. That doesn't help the coder or documentation, though :) The discrepancy is probably between the actual hardware needs and the library provided for the hardware. Sloppy on their part, for sure.
I have two motors i need to power - they are 12volts but i'm not sure the amperage. i need two channels. i can't imagine needing more later. the unit is a Quantum Q6 Edge. so far your information looks good and i will proceed based on it. we will let you know how we get on. Thanks for the great videos.
Yes Sir, I was wondering if you had a video on how to create a controller for a bldc with 12v and up to 40 amps. I am only looking to make it rotate and control speed. Thanks
John, I never even thought to look for giant driver boards, easy! I was going to build one, this is better.
Great vid as always. Those poor proxy sensors...... You should always mount so they don't hit. Ideally mounting them the same polar orientation as the motor shaft so it senses it coming in hovering over the top rather than coming in on a collision course. Proxy sensor can only take so much of this punishment, and if one fails, can you imagine what would happen with a motor of this strength?
Fantastic info!
Can I in the code also program it to start slow and slow in when stopping?
Good work, John. My use is for an Arduino controlled drill press: I want to input the material, thickness of the material, size of the drill; input SFPM, RPM. Then I will input the total drill movement down. From there, on Start Command, the Arduino starts the motor, begins lowering the chuck, begins drilling, stops when through the metal, stops, reverses the motor, and retracts the chuck to the start position and then stops the motor. I will align the drill with the center punch start marker manually. What do you think?
You need to read the sensors in an interupt, newer place sensors in the way at the moving part, place it on the side or use a smal flag that bend in case of coding error.
cool project ;)
Hey great video! I have a need for a motor to turn slowly for one minute after a button is pushed then turning off until the button is pressed again. Any suggestion?
Thank you!!
nyc cnc, wow, this is so helpful and a great video! Any cheaper motor controller options? For a few smaller projects I don't really want to dish out $50-$100 just for one part.
excellent!
nick awesome!!!
ive already got the sabertooth 2x60 controller, whats different in the code?
im driving 2 motors for a wheelchair.
thnx
I really would like to have more info on this video! Video describes photo of layout & MOST important is the final CODE. Please help as i want to build one of there. Thank you.
Hi John, great video, but I think there is a problem with the code. Because you are sending the motor speed (ST.motor(1,ForwardSpeed)) and then setting the variable used (ForwardSpeed =) the new speed is not getting sent to the motor until the next time through the loop. Move the ST.motor line to the bottom of the block.
good stuff mate, id like to give it a go, where can i copy the upload code from mate?
Hi John have you done anything with the Adafruit motor shield or the Tiny G CNC controller board. Regards, Gerald
Hi John - Great video. One thing that I've noticed, but I'm not sure if it is just the angle of the video recording. It looks like the hammer touches the right sensor more than the left sensor. Maybe it's also a matter of differences in sensitivity of the two sensors, or the iron material that you used on each side of the hammer? Did you try adjusting the baud rate? If so, did it work?
I suggest you use pdi to stop contact with the sensor
Have you looked at the Adafruit motor control shield or the Tiny G CNC control board.
Gerald.
This is the first video I've seen of yours, I do plan on watching more but can you not have a low speed - high torque brushless DC motor in the 3000wat range?
That was really awesome. Way better than some dinky robot with a Lego character scaring a house cat. Subbed and liked. I am looking for 'practical' apps of Arduino, not just amusing little novelties to entertain relatives and friends. Interest in home apps of CNC work increased 1000%.
THANKS
Hey awesome video. ...I wonder if you can advise me... i have a 36 volt 350 watts DC motor. Im really new to this game..Just want to find out how can i best controll the direction of the motor(forward, backward,stop) and or throttle, what batteries to use, the amperage...Hopefully its not too complicated. Thanks... Keep up good work
good stuff!I am struggling with a project we are working on and I need help. We want to use a 72VDC 120A 12KW motor that we can operate wirelessly with a remote. We need to control forward, reverse, acceleration and monitor heat and battery life.
Please help.
Alexis likes the project
The general idea is great, but I would do some things different.
I never use pins D0 & D1 cos then you can send status data to you serial monitor in de Arduino IDE (and also receive data). But that's just a personal preference.
But much more important is something I see on many 'desktop' (open loop) CNC ( incl. 3D printers ) they all run in to the end switches. The motor should stop when it gets there but if it does not, it wil go through the switch (or proximity sensor). You should mount the switch (or sensor) in such a way that the arm (table / motor mount..) slides along the sensor and have an other sensor right after the first one which acts as an emergency stop.
Emergency stops should not go through software but switch off the power directly (at least) to the movement that goes bad, and notify the software and user that a manual intervention is needed.
May be I think this way because I come from an industrial back ground where the machines will destroy them selves or kill you if something goes wrong.
Desktop CNC is usually not strong enough to kill but I have seen many CNC'd bigger machines with the same problem. A 500 Watt spindel eats fingers for breakfast.
Please correct me if I'm wrong.
One of the projects I've been wanting to do but will probably never make the time to do is build my three wheeled electric LibertyMobile. It would charge from a solar panel when parked at home, so no stopping at a gas station. It would be designed to skirt in just under what my state requires for a licensed vehicle, so no drivers license, no property tax, no registration, no insurance. I'd make a custom microcontroller board to control all aspects of the LibertyMobile, from motor control to turn signals, but it would probably be faster for me to use an Arduino and a couple of these motor controllers, and for those without microcontroller experience, the Arduino route would definitely be the way to go.
There are all sorts of motion control applications for a DC motor and the Arduino, including cheap and easy industrial automation around the shop (automatically opening and closing machine guarding, automated chip conveyors and augers when the chips trip a prox switch, home made bar feeders, etc.). Thanks for this Wednesday Widget!
PS - I buy prox switches several at a time as used surplus on eBay and the name brands are fairly cheap!
/* Start button is Digital Pin 7, SyRen S1 is connected to Arduino Digital Pin 1 (TX), Proximities are Digital Pins 2 and 3, Pots are Analog Pins 1 and 2 */
#include
const int StopButton = 7;
const int ForwardButton = 3;
const int ReverseButton = 2;
const int ForwardSpeedPin = A1;
const int ReverseSpeedPin = A2;
int ForwardState = 0;
int ReverseState = 0;
int StopState = 0;
int ForwardSpeed = 0;
int ReverseSpeed = 0;
int CurrentState = 0; // 0 is stopped, 1 is forward, 2 is reverse
SyRenSimplified ST; // Simplified Serial Mode. Baud rate of 9600. Arduino TX->1 -> Sabertooth S1 Arduino GND -> Sabertooth 0V [ST.motor(1, X); X of 0 is full reverse, 128 is stop, 255 full forward]
please can u send me the complete code
Nick, at the end of your video when you talk about different motors, I noticed in the background the hammer with it's weight coming down to the right,....it looks like it falls an inch or so....or is it just my eyes :) ? ....if so, does that mean the weight is too much for this motor on the "braking part" when the weight comes down?
From Canada EH! lol i like your videos. Can i ask ya where the hell did you come with a brick of lead in NYC ??? If you ever need to get to the wide open spaces your always weclome !!!!!
Nice tutorial. I like those motors allot a little pricey though. Sometimes you can find old electric wheelchair's for cheap they use very similar motors but 24 volt. The wheelchair motors are built like a tank and usually have many more useful parts like wheels!
Great idea did not think of that.
Thanks for the video. I'm run a theatre and I'm trying to do some simple automation. A platform with a powered motor that glides into place either via RC or stoppers, encoder or similar. It would be a staight shot (no turning) and I would guess the total weight to be around 300-600 lbs total. Could a system similar to this help me control it?
Interesting video, gets people thinking and doing, love it. There is a problem with the code, though. Your code controls the motor with a speed, before it reads the sensor to calculate what the speed should be. It doesn't really make sense that way. First you should read the sensor, then calculate the speed, then control the motor with that number. Most of the time, it won't make too much practical difference -- since you're in a loop, you'll use the number you calculated last time to control the motor this time -- but it's bad practice.
Hi guys,
Could you please advise or refer me to one of your videos on controlling something like a 36V 3kW golf cart dc motor for a winch setup? Im looking at making a beach winch and need some help:)
Hey! Awesome video, everything that I needed to know. I just had one question, I am working on making a conveyor belt that will need to transport about 36 pounds. Do you think that this set up alone is enough to cover that, or should I go with a bigger motor? Thanks!
Thank you so much!
pls I've winding machine and I want to stop my motor when the counter reach the number is determined.
Do all Arduinos use Atmel chips?
I was considering using a 90V DC motor to drive a lead screw but with this video I can see the DC motor has more power in one direction than the other. Thank you for posting this. I'll go with a gear stepper motor. I'm making a portable line boring machine similar to a York setup. I want to make videos as I go but still gathering parts. Almost there. Thank again.
There is one company that is using a mag drill as the drive mechanism. York does use a drill also but uses a different movement method more like linear drive. York is like a OK good system and everything skyrockets from there. There are systems over $60K. Yikes. You can see the York stuff at www.yorkmachine.com Just Google portable line boring. Cool machinery. Yes, excavator booms and the like. I have drawings for line boring 6 foot bore. I'm going to have to build my own. $12K and up is a bit pricey. I'll post my videos of making the drive setup. Cheers.
NYC CNC Too rich for me. Gotta make almost everything. Home brew style. Get that yanky ingenuity warmed up.
Awesome
Congratulations ! this code could be used to: push the button and start the engine and it stops at the end of course? and when it rings again does it return to the other end of the course?
im intrested in building a electric boat engine (~90A @ 380V 3fase [ish 120hp equivalent ]) but i have no idea where to start with a the controle cards, so my idea is to have a arduino for the base line controle system and work from there, but for motor shield im looking for a nodd in the right direction....
John, aren't the logic outputs of the proximity detectors 0 to 12 volts and the Arduino binary inputs 0 to 5 volts? Are you limiting the proximity voltage somehow to protect the binary inputs on the Arduino?
normal use promix sensor connect to optotocoupler and then can use promix sensor normal 24 volt and safety use optocoupler output 5Volt, and bonus optocoupler filtering all peaks out go to arduino clear sensor data.
Do you have any experience with SPARK MOTOR CONTROLLER? I'm planning to use it instead of SyRen. It is up to 60A and the price is 1/3 ($40) of SyRen.
hi, i've 24 vdc motors with encoder and i wanted to make a robotic arm using arduino, are these sysren drivers the best option for my problem?
Can this be used for RC operations? I have Arduino Uno R3 on the Tx and Rx side and NRF2401 does the communication job. Potentiometer is on the Tx side sending commands to the Rx side.
what driver do you recommend for similar sized brushless dc motors?
Hi friend I love your video, I’d like to know about this motor how many pounds it’s?
Here is a link to a video of a test I did on this motor & the simple contact controller I built. ua-cam.com/video/c7q2Lq0P604/v-deo.html
John, great vid. I have to tell you early on I hated motors and motor theory. Well, decades later I see many applications and then there you are. So, interesting right before I watched this video I watched your target video. Well they are reset by hand fine if you are shooting with others or you can reset it via the rope or set up a motor to reset the target. Two ways of doing it. When the last target is triped a signal is sent and resets the target that would require sensors or other means to achieve the goal. I like the remote control. Well, have fun and thanks for the vids.... Oh, I hope you got my email on the Arduino's being bricked with the windows update. To all look out for the arduino's being bricked. Watch EEVBLog's video he writes code for the chips. Oh, thanks again.
No worries, because of your videos I now have an appreciation for them and unlike the rest of the electronics worl the motors can cause motion. Now there is the benefit. What plans do you have for that large motor? Hope it involves a video. It is large enough to open and close a large security gate to your property. I see using this setup I could use it to open and close the gates for our horses. Nice... I will be taking notes I have wanted to do that for a long time.
John
Very very good demonstration. As you have shown DC motors are easy to reverse and as you have shown it can be done quickly.
HOWEVER
There is no free lunch. Quick reversal will result in very high armature current which heats the armature. Doing this say at one minute interval lets motor cool itself. One second interval may result in motor overheating.
The other thing to consider is increased wear and tear of the gears in the gearbox. Yes your motor could reverse a greater load ie the lead block but this is more inertia for them poor ole gears to handle - greater armature current also.
Next step is to put in acceleration and deceleration ramps.
I would also like to see analog ammeter to show motor current when reversing or stopping (especially so if using braking resistor).
I have DC motor setups to show dynamic braking, reversal etc etc but I do this using old fashioned manual knife switches so class can clearly see what is happening.
Dan Bentler