Let's Make Robots!

Code help for Robot arm - High current motor

My project is a 5 motor robot arm.  I have a megamoto  plus mega2560. I got the test program running (megamoto test code) ramp up/down and modified enough to show that the high amp 9 vdc drill motor motors I am using can be handled by the megamotoplus.  I am currently zeroing in on the 2nd 8 inch arm and one motor for now.  I need help with  code that will run one loop  when a switch or button is pushed.  (and act as a one shot-(switch on or button pushed for short or long time))  I am using a 50/1 worm gear and 3.3/1 belt pulley ratio so about 2.2 motor  revs per degree. I have run with a direct toggle switch to show it will run.   I want the loop to ramp up and travel 180 degrees  then ramp down , delay stop and repeat back to home.  I want to use a pot on the output shaft or an encoder on the motor. ( I have both, but 1st want to see if the accuracy of a pot will be good enough.)
Eventually I will add the other arms etc
I can pay some so am interested if someone could help me.  I have some knowledge with PLCs, but my background is Mechanical.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I answered his question to the best of my abilities because he had put in the work. Jlhoffa probably has the docs because he knows how to use the sample code. Yes, there are more bits of data i would like were I to accept this contract, but for giving him advice they aren't necessary.

As to why I don't think that rhis was a bad request for help, well, when I was a proffesional working for Penn State, I got worse requests from faculty..

And, to be perfectly frank, I signed up for this site believing that it helped beginners of all stripes. You have given me cause to rethink this assumption. Perhaps I will find someplace else.

BTW: Mocking somebody is always rude. And if this was there first question, maybe they'll never come back.

We do help begginers at all levels but they still need to ask their questions better and provide the basic information necessary to answer their question.

We cannot read minds.

If you want help then you should start by posting a link to the megamotoplus instruction manual. Most people will have never heard of it before.

Make sure you have read the manual from front to back because I guarantee that anyone who can help you will also have to read the manual.

If it turns out that you didn't then Max's little tease will be very kind in comparrison to the abuse you will receive for not reading the manual.

Do we expect beginners to have read and understood every bit of documentation they can get their hands on? Do we expect beginners to know which bits of data are important and which aren't? Yes, it would have been nice to have put in links to the documentation. Perhaps he was thinking that this would be more of a dialog, rather than a public pillorying. I started robotics late in life, around 40+. I had always been extremely shy. Had somebody did to me what Maxhirez did to jlhoffa, I doubt I'd have asked for help with that group (comp.misc.robotics?). It would have been much kinder and more useful to point him to a posting or FAQ that explains what is needed.
This community has existed longer than you've been a member, DangerousThing, and it has its established social order, rules and morés. We can be very rude, yes, but as I pointed out, my mockery is by comparison mollycodling . I myself have been a campaigner for kindness to newbs, which is why I tried to diffuse this help-bomb with humor before someone smacked Him with a RTFM or a LMGTFY.com.

If you don't like this group (of which I think you're starting to get a sense of the social order) you aren't obligated to play in the sandbox with us, though you are more than welcome too if you don't try to come in and boss us around. If you just don't like mockery, attitude, jokes, rudeness or basic human snideness then perhaps you really have no business being connected to the Internet though.
Operator:911, what is the nature of your emergency?
Caller: My thing hurts!
Operator: Your...thing?
Caller: Yeah, I put it in the place and the guy stepped on it.
Operator: Where are you calling from sir?
Caller: I... Don't know.
Operator: Are you in traffic?
Caller: No, I'm in my car.
Operator: Okay, what can you see when you look out the window?
Caller: I see the sky. Please, help me! My thing really hurts!
Operator: Now when you say your "thing..."
Caller: You know, that body part...
and so on... Okay, now that we've had a little laugh: If you really want help, think ahead to what kinds of information people will need to help you. In your case, photos and a wiring diagram would be a good starting point. Without knowing how the hardware is set up the programmer is helpless to help you. Just knowing what he hardware is is useless-the program doesn't care how big of a motor you're using.

Maxhires, why do you feel the need for rudeness?

Please don't be chased away by comments like this, jlhoffa.

As for information, we have plenty. With a simple google search I got the information on the motor driver he's using. He gave use the encoder to degrees translation. If he was using a RasPi or a BBB I might have had a program written for him last night. I'm not familiar enough with the Arduino to do any coding that fast.

The information we don't have, I would have suggested.

Heck, I have to write similar code, so I might as well show it here. I just got my batteries for Groucho and Zeppo today so when I have time, I'm going to write motor code. Unfortunately I promised Lee I'd get a few things done first, so I can't work on robots until Monday or so. However, I see nothing wrong with giving a newbie some hints on how to get started.

Actually Max's response was more polite than your question.

If you want help then you should be considerate enough to post links to the product, instruction manual etc. Don't expect someone else to waste their time doing a Google search if you cannot be bothered to do it yourself.

This is downright polite compared to what we normally treat this kind of post with. But what are you going to code for him not knowing what his inputs and outputs are or assigned to what motors? Yes, I mocked the lack of information and effort he was willing to put into his post but pointed out the flaws in the post using humor rather than rudeness, and even overlooked his violations of our community rules to do it. (Using the word "help" in a post title usually gets you spanked by one of the elders.) I agree that there is no problem giving newbies hints on getting things started (look at my contribution history if you doubt it) and that's just what I was trying to do-but we all expect a little more out of our members than "hey, do my work for me (even if this is a unique situation where he offered to pay) without my putting the effort into the project to even give you a basic starting point." Anybody who's been here more than 3 months knows that!

I can probably help you a bit, but some others here have more experience with the Arduino.

You also might want to check on your choice of controllers. I don't know if the MegaMoto Plus can have more than three shields. I might be wrong, but it sounded like the store I saw them in didn't know. Each can control 1 motor.

I'm using a RoboClaw 30 amps for my bot. It controls 2 motors at up to over 24 volts and 30 amps each, and it reads the quadrature encoders for me. It also communicates four ways: r/c pulses, analog, serial, and USB. This way the Arduino can just handle the interfacing. These are a available at orionrobotics.com, or at Amazon.

As for you arm, I'm curious about the total weight it's expected to be, because that's how much your first motor has to lift in addition to any payload. You might want to experiment with putting the additional weight at the end of your first joint just to see if the motor has the torque. I'm not good at mechanics, but I've built a few robots and arms.

As for coding, there is a lot of documentation at Arduino.cc, as well as a lot of other forums. I'm surprised if you can handle PLCs that you'd have any problem with the Arduino. Not meant as a put down, just surprised is all.

One opinion in the encoder vs pot question: with a five DOF arm, the early motors are going to be important to keep their positioning know. If you're off a degree or two on motor one, and then another two degrees on motor two, by the end of the chain you're talking about having the hand be somewhere in Cincinnati. :)

And maybe you can help me with some problems with a rather large robot arm I'm going to be building at some future point once I get Groucho built up a bit.