Core Electronics Forum

Tower Crane; the next step

My name is Geoffrey Benton, aka Doonie. I am a maker and for several years I‘ve been designing and building a tower crane. The purpose of this project is to extend my knowledge and learning. To this point, the crane has been built using Cut2D Laser Desktop 8 as a drawing program, a Darkly Labs Core laser cutter, Fusion 360 as a 3D design platform and a MakerBot 3D printer. I taught myself to use this equipment but have had assistance from some amazing friends.

In order to make the crane function my learning has now entered a new phase. I am currently studying Arduino basics with Peter Dalmaris and have searched the internet for information to help me.

I’ve made a short movie and uploaded it to youTube.

The first part shows the initial module I designed, which was used for the weight trolley boom and the crane trolley boom. I increased the size of the module, using it for the tower stack. Next in the video is a picture of the final design of the tower crane and some video footage of the crane as it is now. Finally, the Nema stepper motor position and a visual of how the swivel mechanism functions are shown.

In order to move the crane to the next level, I need to learn how to control a Nema 17 stepper motor with Arduino. The motor I have is a Motech MT-170HS120A 1.8 dg step 170725. I also have an Arduino Uno board and a CNC shield.

In the future, I plan to power everything above the swivel mechanism with batteries, probably lipo 7.4 volt, and hopefully to bluetooth the information to it.

My first challenge is the swivel stepper motor which will be powered from below, probably with a test bench power source.

From this forum I hope to learn:

  • What is a good, reasonably priced test bench variable power source for below 15 volts?
  • What equipment do I need to get the swivel working on my crane, other than what I have? I want to swivel the boom a bit more than 360 degrees. I’d also like to make it turn either left or right and stop at a given number of degrees, and easily change the parameters.
  • Finally, I need some advice on sketches to make this whole thing happen.

Thank you for taking the time to read this.

Doonie

5 Likes

A good-looking project.

To drive the tower rotation there are simple example Arduino sketches available. The CNC shield drives the motor with step and direction commands. For the Protoneer shield (which I think the others would likely follow) the Arduino pins are:
X Step = 2 X Direction = 5
Y Step = 3 Y Direction = 6
Z Step = 4 Z Direction = 7

Depending on the axis you want to use for rotation, the sketch here can be modified to match those pins by replacing 3 and 4 with the pins for the axis you choose. For supply you can use any plugpack at about 12v to 24v that has sufficient capacity. An old PC power supply is also very useful and convenient. (Your bench power supply choice is going to depend on what additional features would be useful in the project development).

If you download any of the Arduino libraries for steppers you will also get examples which use those libraries with step and direction. That simplifies your code at the expense of some additional overhead in the library.

To expand the example to implement user control, you will need to decide on the user interface. A rotary encoder is readily available but I have found it unreliable for precise positioning. A simple forward and reverse switch would be easy to do. You could combine it with a step counter and a small display t give the position indicator. A potentiometer and analog input could be used as a speed control, or you can do automatic speed control based on how long the direction switch is held down for. Note that if the rotation information is going to be absolute then you will need some way for the stepper driver to detect zero position: a limit switch could be used to do this.

3 Likes

That sketch is very useful. I think with a bit of help I could use that to swivel the top of the tower. My driven gear has 34 teeth and the driver gear has 12 so 2.83333 revolutions of the motor = 360 degrees rotation of the tower head.
The stepper motor has 200 steps per revolution.
1 rev (200 steps) of the motor = 127.0589 degrees tower rotation.
Therefore 0.635294865 steps = 1 degree tower head rotation.
The sketch also shows how to change direction.

Is my thinking solid?
How many decimal places can a number have in an Arduino sketch?

3 Likes

Enough for that calculation because you won’t use a number with that precision.

A stepper steps a fixed amount for each pulse. So the question is how much does it rotate for one step. That’s not a simple question, because the drivers in that shield can do microstepping - a fraction of a step such as 1/2, 1/4, 1/8 etc. But the torque available for a microstep is much less than that available for a full step, and varies for the size of the microstep. It could be less than 20% of the quoted torque at 1/8 microstepping. So for starters it would be best to work in full steps only.

The calculation you will need to do is to calculate steps to get to the nearest position in degrees. In other words, you want degrees per step. And you only need enough precision to determine which number of steps is closest to the required angle. That calculation is well within the capabilities of the Arduino floating point library.

3 Likes

Thank you, correct. But, in fact I got my sums wrong up there. 12:34 is 2.833 revs of the motor for 360 tower head degrees. I got that right. 200 steps by 2.833 is near enough to 567 steps for 360 tower head degrees therefore 1 step = 0.635 Tower head degrees. I can live with that so there is no need for micro steps. I think that means there are opportunities for incremental increases and decreases depending on which way the boom swings, which would be minor over just a few swings.
I think that means the sketch has to contain a line that will return the boom to zero degrees at the end of the loop then stop. I also think there has to be a variable which is loaded with a number referring to where it stopped at the end of each move so it knows where it is. I think if it knows where it is and it knows where Home or zero is, it can work out how many steps it needs to move and in which direction to get to the next point.
I don’t actually know how to do that yet but I expect it should be fairly simple in the end.
Hope this makes sense and so much gratitude for being able to express my thoughts here.

1 Like

Yes. When the switch (or whatever sensor you use) is triggered then that becomes the zero point. So the initialisation code needs to move the tower around until the sensor is triggered. That’s the same as your 3D printer lowering the z-axis rail until the limit switch is triggered. After that, every step in either direction is counted, so the code knows where the tower is rotated at any time, and the direction and number of steps needed to get to any new position can be calculated. I presume that it can’t rotate more than a certain amount in one direction, so moving to a new position will require a calculation of whether or not the most efficient move would over-rotate it, and instead it needs to go the long way around. Interesting code, but not difficult.

With that gearing and that motor you will be able to get 1 degree resolution with a maximum error of about 0.4 degrees. Precision will pretty much depend on the mechanics.

2 Likes

Awesome, thank you. The thing can rotate in either direction endlessly as all the wiring is under the tower head so a limit switch will be, pardon the pun, limiting. Is there some kind of sensor that will ping each time a mark on the tower head passes it to tell the script where it is?

2 Likes

Several different types are possible.

1 Like

Wow thanks. I’ve learned a lot in the last day or so, movie here

explains where I am at. I believe that my next step in this learning process will be with a CNC shield and a DVR8825 board which I hope will smooth the pulses and decrease the noise. I have the shield but not the board. Can I get one of those boards from Core? I would also like to know how to return the Boom Head to a known, or Home position but haven’t been able to find that out yet.

2 Likes

Hi Geoffrey
If you smooth the pulses driving a stepper motor it aint going to work.
Cheers Bob

1 Like

Hey Geoffrey,

Awesome crane, and I love your workshops name ahaha.
One way to lower the noise out of a stepper might be to use a different driver board such as the TMC2209 or similar board(I couldn’t find one on the core website in my quick search, heres a link to E14

In regards to finding a ‘zero point’ I would take a look at Jeff’s suggestion’s for a couple sensors using either a roller switch or hall effect sensor

You could also use an IR reflectance sensor and a piece of electrical tape to mark a spot on the rotating boom arm for the sensor to pick up.

Liam

2 Likes

If the noise is coming from the stepper then the shield will make it simple to implement microstepping, which will definately help. The shield comes with a header and jumpers that makes it really easy to adjust and experiment. It complicates things a little, but now that you have got it working then adding a feature like this becomes much easier, as you can always take things back to how they were and start again.

You can wire up microstepping for yourself using the breadboard, but the shield makes it really easy. It also breaks out the GPIO pin you will use for the zero position switch. When you get that far I would recommend using one of the Arduino stepper libraries that implements ramping. Combined, that will make the steppers as smooth as you could want, and the only jitter remaining will be in the gears and bearing.

3 Likes

Fantastic. Thanks, I would not be this far without this help.

2 Likes

Thanks Jeff for your continued help.

2 Likes

Can you suggest something that will work?

2 Likes

Hi Geoffrey.
The noise will be predominately mechanical and is due to the stop start nature of the beast. Hence the name Stepper. It is how they work.

This would help. A half step would halve the platform speed and allow you to use double the motor speed and so on. This will allow double and so on motor speed which will smooth out the operation. There is a trade off (there always is) by way of reduced torque as you decrease step size and apparently (I don’t know for sure) possible re-positioning repeatability inaccuracies.

A half step and double the speed may be acceptable. Keep in mind these types of motors have a maximum speed which is not very fast compared to a brushed motor but they have other distinct advantages.

3 Likes

Only if you drive it in start/stop mode. A driver such as the 8255 will use PWM current control to drive the motor with a semi-sinusoidal waveform, which combined with a mixed decay mode virtually eliminates stop/start vibrations. Newer drivers such as the TMC2209 will drive a stepper with almost no detectable vibration.

1 Like

Hi Jeff
The 8255 comes up as a programmable peripheral interface which I don’t think is a stepper driver. I think you may have meant 8825.

I thought that is what steppers did. Started and stopped very rapidly or slowly dependent on pulse repetition rate.
Cheers Bob

1 Like

The pulse repetition rate does not determine how rapidly it starts or stops. That is determined by the shape of the pulse. Advanced controllers such as the DRV 8825 and TMC2209 shape the pulse using PWM current control to ensure that there is no starting and stopping.

1 Like

Hey Doonie,

Welcome to the forums! This is an awesome project :smiley:

One way to significantly reduce the vibration (but also the torque) produced by a stepper motor is to reduce the supply voltage. Less voltage = less torque = less harshness in movement. With a simple square wave stepper control like you demonstrated in your video you’re accelerating and decelerating the motor every step with the maximum torque it can muster from the supply voltage.

It’s also important to check the backlash in your gears - basically, you want them as tight as possible without them binding - which means you always need some clearance/slop. I couldn’t see any method of adjusting the position of your stepper motor to adjust the centre distance of your gears. If they’re overtight you’ll definitely get a lot more vibration, and I’d be willing to bet this is a major contributing factor to your noise at the moment.

Here’s a very brief run down on backlash (in this case they had too much):

An eccentric mount is a common way of adjusting gears (and belt tensioners, and pretty much anything that needs minor, fine centre location adjustment):

It looks like you’re just relying on gravity to keep the crane on the tower - it might be worth implementing some kind of retaining system in case you ever imbalance it to help stop it from coming crashing down. It might be worth redoing that last bit of tower too to expand out around the stepper - those cut outs to let you fit the stepper will drastically reduce the strength of the crane to less than half what it could be. Maybe that’s fine, but just something to keep in mind when you get to testing.

If you’re just planning on driving it manually with a little joystick as an RC crane you can probably get away without as many smarts in the control department. If you need it to operate autonomously you’ll definitely need some kind of limit/home indicator.

Jeff is on the money with using a fancier stepper driver for a lot more silence though - check this demo video out:

2 Likes