2

I'm working on a kinetic sculpture that involves a large pendulum swinging perpetually left to right.

I'm using a raspberry pi 3 B+ / arduino uno with a DM860AC to control a nema 34 stepper. I was using the pi to directly control the driver with pigpio wavechains (thank you joan!) until I realised the driver needed a 5V signal which is why I got the uno. At this point I'm not sure whether it makes the most sense to either:

1- Use the pi to control the uno which can then handle the 5V PWM

2- Use the uno by itself and some implementation of the stepper.h/accelstepper.h libraries

3- Use the pi by itself but get a logic converter to bump the 3.3 up to 5v

This it the approach I've used so far: In a spreadsheet I've calculated the speed and acceleration of the pendulum very precisely (ie. at every 0.5 degrees, or any other integer step increment). Using this I planned to calculate step/freq pairs to feed into a wavechain.

I've had luck driving the motor back and forth with acceleration/deceleration using wavechains but when I try to add all of my many step/frequency pairs to a wavechain I get an error related to having too many counters.

Through trial and error I've been able to determine that this number of counters is 20. Is this a set number or can I redefine it?

After I hit the wave counter issue and 3.3/5v issue I tried using the arduino with the accelstepper library but the acceleration control seems a little coarse for what I'm trying to do which is accelerate and decelerate the stepper perfectly in time with the natural motion of the pendulum. Are there any other arduino based PWM libraries I'm not aware of that might work better for me?

I've also been curious about only driving the stepper at the bottom of the swing to give the pendulum just that little bit extra energy but haven't spent much time on that idea yet, just wanted to mention it.

I need to say that while I know enough to have gotten this far, I am by no means a fluent coder, I'm more mechanically inclined, so please forgive me for any large knowledge gaps. I'm bouncing back and forth between methodologies and I'm hoping someone could point me in the right direction or at least A direction.

Many thanks in advance.

  • it is unclear why you have to calculate acceleration and deceleration of the pendulum ..... all you have to do is to give it a small nudge as it passes the lowest point – jsotola Oct 21 '18 at 18:23
  • Just outa' curiosity: Could you explain what you mean when you said, "... pendulum swinging perpetually left to right..."? I've gotten used to pendulums that swing in two (or more) directions, so I may not appreciate the problem you're trying to solve for a pendulum that swings only left to right. – Seamus Oct 22 '18 at 17:12
  • jsotola - I'd like to but with the detent torque of the stepper motor it will not spin freely when not driven! – David N Oct 23 '18 at 17:27
  • Seamus - I just mean that it will swing like a simple pendulum on a grandfather clock and the stepper is just there to provide the energy to keep it swinging. I'm trying to match the acceleration and deceleration to what would happen naturally due to gravity so that the stepper isn't fighting the motion the whole time. – David N Oct 23 '18 at 17:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.