Tower Crane; the next phase

@doonie

I love this! It's seeing stuff like this that keeps me helping out on the forum :slight_smile:

If you were close to me I'd also come round and help, but the UK is a little bit far from you.

All the best with your crane!

Goodonya Perry. It does my head in every now and then. Right now the nema 17 has failed to proceed even though I am using the same sketch and same wiring as yesterday when it worked. So now I am trying to find a diagram and a sketch for a nema 17, a cnc shield and an A4988 to prove that things do work or is the motor stuffed. With everything the same as yesterday, I think, the motor just locks up when I turn the power on. Any suggestions.

Here is a very simple code to test a stepper connected tothe X axis A4988 driver in a CNC shield V3 on an Uno. Tested, successfully, just now on my setup.

#define CW 0
#define CCW 1

const byte stepPin = 2;
const byte dirPin = 5;
const byte enablePin = 8;

unsigned long stepTime = 2400;  // change this to change speed.  lower is faster

void setup()
{
   Serial.begin(115200);
   pinMode(stepPin, OUTPUT);
   pinMode(dirPin, OUTPUT);
   pinMode(enablePin, OUTPUT);
   digitalWrite(enablePin, LOW);
   digitalWrite(dirPin, CW);
}

void loop()
{
  oneStep();
}

void oneStep()
{
   static unsigned long timer = 0;
   unsigned long interval = stepTime;
   if (micros() - timer >= interval)
   {
      timer = micros();
      digitalWrite(stepPin, HIGH);
      delayMicroseconds(10);
      digitalWrite(stepPin, LOW);
   }
}

That sounds like the motor is enabled, but is not getting step pulses.

OK, fixed that little drama and everything works again. Time to move on.

Fixed that problem, all is well now. Is there a wiring diagram somewhere to go with that sketch?

The code is for a stepper connected to a CNC shield V3. The shield plugs onto an Uno. The stepper connects to the stepper connector next to the X axis stepper driver.

Here is the Uno to CNC shield V3 pin mapping.cnc shield Uno pins

Thank you. I've done some more work on the slew mechanism. This little vid should explain.

1 Like

I don’t want to be discouraging, but I can’t help feeling an h-bridge, DC motor and gearbox would address most issues with the mechanism.
The only thing you’d need to consider would be some method of indexing the position.

Not a huge deal, but this might address speed, vibration, and controllability of the action.

Also applicable to the other mechanical systems you’re looking at.

Three or four years ago I bought an early release Darkly Labs "Emblaser" laser cutter and worked it to death. I went way outside the boundaries of laser cutting at that time and kept Damian, Darkly Labs Founder, up to date with what I was discovering. When it finally wore out I asked him to go over it and give it a birthday. Short story is that he replaced it with his latest release "Core" laser cutter and threw in a MakerBot 3d printer. Thus began my introduction to stepper motors. I have three Nema 17s because somebody gave them to me. I thought they would be the bees knees to drive my crane. I kow nothing about almost everything to do with electronics but am willing to go down any path that looks better than stepper motors. I have 2 L2989N boards because I was going to try to learn how to drive dc motors with Arduino. I muck around with scratchbuilt rc boats so I know that dc motors with gearboxes are cheap as buggery and am certainly willing to have a go at that if you reckon it would be better.

I love steppers, but feel the variable speed, torque and smoothness of the motors would have advantages over the step-by-step of a ‘stepper’

The only thing to be aware of (you have to do it with most drive systems). is the indexing of motor & actuator position… whether it’s opto, hall-effect, or micro-switches.

I just did a quick search and found things called dc motors with gearbox and encoder. Is that the sort of thing we need?

If you guarantee the drive wont slip against the driven part, that’s fine.

It should be able to give very fine angular accuracy, possibly greater than you need !

Check the motor power, torque, speed specs.
A simple h-bridge with PWM will allow good speed control - forward and reverse.

If you think there’s any chance of the motor getting out of sync with (e.g. the turntable), then it’s desirable to monitor the turntable position rather than the motor.

If your drive is with a toothed belt, that motor/encoder combo would be suitable.
A flat belt has the potential to slip much more easily.

Depending on repeatability required, there can still be a case for a ‘home’ sensor on the driven surface - which could allow slippage to be corrected.

Certainly heading in the right direction.

How are you going to control the crane?

Initially, I assumed that you would have the Arduino do it, which meant steppers would be useful, but now I'm wondering if you're going to do manual control (joysticks?) instead and have them command the Arduino to run the appropriate motor(s).

Currently I am exploring the use of joysticks to control dc motors as a part of the learning process. Soon I have to decide between steppers and dc motors to run the trolleys that run out along the booms. Ultimately, everything will be controlled by computer, sketches and Arduino. One day I hope to be able to enter destinations (numbers) and press a button to make it all happen. A bit ambitious, perhaps but hopefully not impossible.

Yeah, I think joysticks or buttons are a great launching point, then later, you could ‘learn’ specific points, or enter numeric targets.
That’s almost a separate project, your initial goal is simple control - typically with a joystick* or buttons.

*An (analog) joystick can give you proportional control of motor direction and (PWM) speed, but the point-to-point numeric control should have some intelligence for acceleration and deceleration (not too hard).

Certainly a project you can grow with as the crane grows. A great learning curve, I love real-world control projects!

The TMC 2209 V2.1 has arrived. I would like to test it with the nema 17 driving the slew mechanism but at the moment cannot find a simple wiring diagram and sketch. Do I use A4988 as well? Any help greatly appreciated.

That's a more fancy stepper driver that the ones I'm used to - it appears that you can opt to control it (or perhaps configure it) over a serial port.

However, it looks as though it will act as a simple driver too.

A1 and A2 go to one set of stepper coils, B1 and B2 go to the other. You need a power supply for the stepper, I assume that's VM and the ground next to it.

Then you need to connect step and direction to Arduino pins. The other ground pin goes to Arduino ground. VIO to Arduino 5V.

Enable can usually be ignored - it's really disable and defaults to enabled. If necessary you can pull it to 5V or ground whichever the manual asks for. Microstep pins you can probably ignore too for an initial test.

For code you just need the blink code from the IDE and attach the step pin to the one that's flashing the LED.

Remember that I haven't used one of these - the above is deduced from what I know about Pololu drivers and assumptions based on the pin names. I suggest you pull the manufacturer's manual and check before applying any power!

G'day everybody. Much progress has been made with the stepper and particularly the code. Lastchancename has worked furiously on making and improving the code. He has dragged me kicking and screaming through the mire that is PuTTY and has been there mentoring as I struggled to get the damn thing to move. But it does move and it is magnificent. So many simple functions, simple because he made them simple to operate. Thank you. I am still learning how to drive it but what fun that is. Here is a little vid of progress. I'll leave it to him to explain the code.

2 Likes

Hi, mate.
Looking great... :+1: :+1: :+1: :+1: :+1: :+1:
Lastchancename has well and truly got you on the way to completing this project.

Keep us posted.

Tom... :smiley: :+1: :coffee: :australia:

1 Like

Yes, I'm very grateful. Still a lot to do and he has some great ideas.