Motor Controller Project

Have questions about the equipment used for macro- or micro- photography? Post those questions in this forum.

Moderators: Pau, rjlittlefield, ChrisR, Chris S.

mawyatt
Posts: 2479
Joined: Thu Aug 22, 2013 6:54 pm
Location: Clearwater

Post by mawyatt »

kaleun96 wrote:
mawyatt wrote:The properly configured (not optimized though, so maybe more room) TMC5130 can run so fast I won't even post it, as you wouldn't believe me :shock: And it's quite and accurate....not a bad combination IMO
How fast are we talking? Just curious as I've had to order in some new pulley wheels to change the gear reduction from 1:2 to 1:1 on my rail as the Arduino + TMC2130 couldn't quite manage the speeds I needed, even with acceleration profiles. Though I only want the fast speeds for homing the rail, I don't need nearly as much speed for other functions.

Some caveats to that are the Arduino's 16MHz clock speed, slowness inherent to the accelstepper library, and slowness inherent to the digitalWrite() function compared to the much faster Port Register manipulation.

My Pololu 1200 stepper seems to be capable of faster theoretical speeds than your more powerful motor (http://techref.massmind.org/techref/io/ ... timate.htm) but in addition to the limitations above I also have the 1:2 gear reduction (effectively making it a 400 step/revolution motor) and a small screw lead of 1mm. I think the fastest I could achieve without stalls was 7mm/s but including start/stop time over a length of 100mm you would need to add a few seconds for accel/deceleration.

I wonder if my upper limit is mainly determined by the Arduino clock and function speed or the inability of my motor to run faster under load.
Well let's just say a stand alone 400 step motor transitioning 1000mm, yep 1 meter, in less than 50 seconds including a very long and precise velocity profile for start and stop allowing the same precision and vibration reduction as shown in the 800X video :D

Probably 1/3~1/4 the time taken up with profiled velocity for precision, not exciting resonances at start and stop, and low noise, so north of 20mm/s peak velocity :shock:

And it's very quite throughout the entire range!!

Since the effective "load" on the motor is very small with the THK rails I'm using (1mm pitch), I don't expect this to be much slower on the rail. Of course the rails aren't 1m long!! Now that I have the motor current waveform measurement capability I can optimize/tune the waveforms for the THK rails.


BTW I'm using a 15MHz effective clock from the RPi.

Best,
Last edited by mawyatt on Fri May 10, 2019 6:14 pm, edited 2 times in total.
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike

mawyatt
Posts: 2479
Joined: Thu Aug 22, 2013 6:54 pm
Location: Clearwater

Post by mawyatt »

Lou Jost wrote:
This current edge can cause a sudden "jerk" in the start (and stop) of the rail.


Mike, I paid special attention to this yesterday in my stacking of a cave amphipod in liquid. The vibration was continuous during the motion, not especially great at the beginning or end.
Lou,

The controllers I'm developing (like the one you'll get :D ) are much smoother throughout the range, so expect much less induced vibration with your Micromate. There is no discernible "jerk" at startup velocity and end velocity, and during transition this is extremely smooth and almost noiseless/vibrationless (especially at low speeds) with the Wemacro motor I've tested with. I don't have a Micromate so can't optimize for this, but expect it should be fine once the "right" parameters are established.


Best,
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike

mawyatt
Posts: 2479
Joined: Thu Aug 22, 2013 6:54 pm
Location: Clearwater

Post by mawyatt »

One thing to remember about these stepper motors we use is they are almost equally good generators, meaning they can accept and deliver power by means of coil current (not voltage), although actual power is the product of voltage and current (real part).

If this concept is used the motor can exchange between a motor and generator "on the fly" at very high rates to achieve specific motion parameters, so with the proper motor controller/driver and parameters you can "make" a motor behave in a way where conventional control is restricted. Think of this as making a cheap motor behave like an expensive motor by means of electronic control.

Best,
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike

kaleun96
Posts: 195
Joined: Sat Oct 20, 2018 3:47 pm
Location: Stockholm, Sweden

Post by kaleun96 »

mawyatt wrote: Well let's just say a stand alone 400 step motor transitioning 1000mm, yep 1 meter, in less than 50 seconds including a very long and precise velocity profile for start and stop allowing the same precision and vibration reduction as shown in the 800X video :D

Probably 1/3~1/4 the time taken up with profiled velocity for precision, not exciting resonances at start and stop, and low noise, so north of 20mm/s peak velocity :shock:

And it's very quite throughout the entire range!!

Since the effective "load" on the motor is very small with the THK rails I'm using (1mm pitch), I don't expect this to be much slower on the rail. Of course the rails aren't 1m long!! Now that I have the motor current waveform measurement capability I can optimize/tune the waveforms for the THK rails.


BTW I'm using a 15MHz effective clock from the RPi.

Best,
Wow, that's quite impressive and a little scary :shock:

mawyatt
Posts: 2479
Joined: Thu Aug 22, 2013 6:54 pm
Location: Clearwater

Post by mawyatt »

Sped up the acceleration and deceleration profiles with some other parameters/setups I'm working on and move 1 meter in ~25 seconds. The motor is quite throughout the entire range and it's sitting on a cardboard sounding box. :shock:

Here's a video showing the performance, the camera was 300~400mm from the motor. Note the sound (lack of noise) and motor speed.

https://drive.google.com/file/d/1P-95Ic ... sp=sharing

Best,
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike

mawyatt
Posts: 2479
Joined: Thu Aug 22, 2013 6:54 pm
Location: Clearwater

Post by mawyatt »

ray_parkhurst wrote:
mawyatt wrote:Lou,

If you look at the start current, you can see it has a sharp "edge". This current edge can cause a sudden "jerk" in the start (and stop) of the rail. Probably the cause of the vibration you mentioned.

Best,
In your sims, did you check if it might be possible to filter the motor currents to improve things? Your method of waveshaping is of course best, but for folks using other controllers, an analog filter solution might be feasible.
Ray,

Sorry for late reply, I didn't see this until now.

You would need to add significant inductance in series with each coil to "slow down" the current rise and/or edge. If you are willing to add some loses, a small resistor in series might help, be careful of power though, it's Irms^2*R....so 1.5 amps and 1 ohm is 2.25W per coil. You can't use a conventional capacitive filter with shunt elements since the coil terminal voltage switches from ground to the motor supply rail at a high rate, this is the motor "chopping" to control the average motor current. If you Google this you'll find using back to back diodes, but I'm not sure this is any different than just a series resistor.

So the best way IMO is to use a controller like these to help with the current waveforms.

Best,
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike

Lou Jost
Posts: 4644
Joined: Fri Sep 04, 2015 7:03 am
Location: Ecuador
Contact:

Post by Lou Jost »

That's a nice video, you can see the smooth acceleration and deceleration.

kaleun96
Posts: 195
Joined: Sat Oct 20, 2018 3:47 pm
Location: Stockholm, Sweden

Post by kaleun96 »

mawyatt wrote:Sped up the acceleration and deceleration profiles with some other parameters/setups I'm working on and move 1 meter in ~25 seconds. The motor is quite throughout the entire range and it's sitting on a cardboard sounding box. :shock:

Here's a video showing the performance, the camera was 300~400mm from the motor. Note the sound (lack of noise) and motor speed.

https://drive.google.com/file/d/1P-95Ic ... sp=sharing

Best,
Certainly is quick! I had a quick look at the video while at work so apologies if you mentioned this but have you tried running speeds like this with a load close to what the linear rails would impart on the stepper?

mawyatt
Posts: 2479
Joined: Thu Aug 22, 2013 6:54 pm
Location: Clearwater

Post by mawyatt »

kaleun96 wrote:
mawyatt wrote:Sped up the acceleration and deceleration profiles with some other parameters/setups I'm working on and move 1 meter in ~25 seconds. The motor is quite throughout the entire range and it's sitting on a cardboard sounding box. :shock:

Here's a video showing the performance, the camera was 300~400mm from the motor. Note the sound (lack of noise) and motor speed.

https://drive.google.com/file/d/1P-95Ic ... sp=sharing

Best,
Certainly is quick! I had a quick look at the video while at work so apologies if you mentioned this but have you tried running speeds like this with a load close to what the linear rails would impart on the stepper?
The experimental setup I'm working on now has no problem running the Weamcro focus rail beyond 20mm/sec (with a Nikon D800E attached) from end to end (95mm).

Best,
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike

mawyatt
Posts: 2479
Joined: Thu Aug 22, 2013 6:54 pm
Location: Clearwater

Post by mawyatt »

Just received the latest parts shipment for some components I needed for the high speed, high motor current & high voltage controller I'm working on.

Things get interesting when you run at very high speeds with high current for long times, the switch-mode motor driver which uses the motor current with coil inductance to efficiently regulate the coil/motor current can heat up a conventional power supply decoupling capacitor with high internal resistance (ESR) due to I^2 R heating. Special low ESR, high current caps are required, these were the parts I was waiting for.

I still have a few of the custom PCBs based upon the Triniamic TMC5130 controller available, but all my built-up boards with TMC5130s have been shipped to folks, so I've reordered more TMC5130s. PM me if you are interested in these last few PCBs (they don't require any cuts, jumpers nor component mods and mount directly to the RPi by the 40 pin header connector.

Best,
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike

apt403
Posts: 37
Joined: Mon May 06, 2019 5:29 pm
Location: Yelm, WA

Post by apt403 »

Nice work! I'm putting some time right now into designing an automatic stacking rig for use in the field based on the RaspPi. Just out of curiosity, what made you go with the TMC5130A versus some of the more commonly used drivers, like the DRV8825 or A4988?

Looks like you've got the PCB layout covered at this point, but in the future I'd be happy to help - Just sent out a few prototype designs out to OSH Park for fabrication today. Also have the setup to do small volume (sub-100) SMD reflow, if you'd ever like to offer completed boards (the overseas options for assembly are admittedly pretty cheap for moderately high volumes).

mawyatt
Posts: 2479
Joined: Thu Aug 22, 2013 6:54 pm
Location: Clearwater

Post by mawyatt »

apt403 wrote:Nice work! I'm putting some time right now into designing an automatic stacking rig for use in the field based on the RaspPi. Just out of curiosity, what made you go with the TMC5130A versus some of the more commonly used drivers, like the DRV8825 or A4988?

Looks like you've got the PCB layout covered at this point, but in the future I'd be happy to help - Just sent out a few prototype designs out to OSH Park for fabrication today. Also have the setup to do small volume (sub-100) SMD reflow, if you'd ever like to offer completed boards (the overseas options for assembly are admittedly pretty cheap for moderately high volumes).
Awhile back I did some testing and evaluation of the A4988 and DRV8825 and quite a few other drivers and wasn't happy with the performance. For example, the 8825 has really bad non-linear behavior during micro-stepping, and some of the Toshiba devices have a mico-step current offset around zero.

Long (very) story short is I selected the Pololu Tic-500 based upon the MP6500 chip. These are USB and work nicely with the RPi, however I wanted to reduce the movement induced vibration to achieve 1~2 second image captures for large stack & stitch sessions at high magnifications (think 10,000 ~ 30,000 total images). This set me on a path that eventually ended up with the Trinamic devices. These are very complex devices that have nearly 250 parameters for controlling things, but when setup and working properly they really behave and are quick, quite and precise with THK KR20 or 26 rails.

Now I have various versions working for a fully automated (hands off completely) S&S system with the TMC5130 on Z and Tic-500 on X and Y. Also working on high current, speed and voltage versions (2), as well as Sine and Cosine motor current monitoring to assist in setup motor/rail/controller evals, plus a couple other controller configurations.

Thanks for the offer to help with the PCBs, initially no one stepped up to help, so I ended up doing it all myself. Also wrote my own code (Python) mostly from scratch, because I didn't want to use the stuff for 3D printing or CNC, as I wanted it be fully automated and work the way I wanted rather than adapted.

As you can see from the video the S&S System is working and the 800X video confirms it's very stable, quite and precise.

Best,
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike

cws1745
Posts: 15
Joined: Tue Apr 23, 2019 9:04 am
Location: U.K.

Trinimac

Post by cws1745 »

Just an update on my experience with the Trinimac / Raspberry Pi configuration as produced by Mike.

Stunned! .... and very annoyed that I spent sooo long designing my microcontroller based on the Arduino and BigEasyDriver (AD4988 chip).

Totally silent operation on my WeMacro rail, just beginning to get to grips with the literally hundreds of configuration commands but the prospect of 256 microsteps, silent operation, load sensing, auto torque etc etc etc make this a no-brainer for me. Cheap and cheerful Chinese drivers a thing of the past!

As for the Raspberry Pi - I'm reluctant to throw away all of my development effort on a stand-alone controller / TFT screen, Arduino and C# so I'm going to see if I can redesign my code to replace the BigEasyDriver with the Trinimac 5130. If there is anyone interested in this platform I'd welcome any collaboration.

Charles

kaleun96
Posts: 195
Joined: Sat Oct 20, 2018 3:47 pm
Location: Stockholm, Sweden

Re: Trinimac

Post by kaleun96 »

cws1745 wrote: As for the Raspberry Pi - I'm reluctant to throw away all of my development effort on a stand-alone controller / TFT screen, Arduino and C# so I'm going to see if I can redesign my code to replace the BigEasyDriver with the Trinimac 5130. If there is anyone interested in this platform I'd welcome any collaboration.

Charles
I've just finished moving from a DRV8255 to a Trinamic TMC2130 on Arduino. Will post my code in the coming days. It took a lot of work in the end as most libraries were intended to be used with the Matrin 3D printing software. It also took a lot of time to get the right settings dialled in, there are so many confounding factors that can influence performance.

In the end I've got totally silent operation for both StallGuard (when finding my X axis limits) and SilentStep. Speed is perhaps not as fast as I'd like at this stage, I can traverse a 70mm on a screw with 1mm pitch at 4microsteps and a 200 step motor in about 10 seconds. But the acceleration profiles are great and there's almost zero movement jerk when the motors start accelerating from zero.

One limitation is the AccelStepper library I think. Writing to digital pins using the normal methods is quite slow compared to port manipulation.

cws1745
Posts: 15
Joined: Tue Apr 23, 2019 9:04 am
Location: U.K.

Arduino / Trinamic

Post by cws1745 »

Hi kaleun96,

Very interested in your work - I spent many months writing my C# code. For me speed is of little interest given the distances are tiny - but acceleration / deceleration, silent stepping etc a must.

I was under the impression that Trinimac configuration removed the need for most libraries and was catered for by the chip itself?

I haven't worked out how to post my code yet - it is many tabbed in the IDE.

I am only interested in single axis control but I can see why you looked at Marlin.

Hopefully we can both benefit from each others efforts!

Look forward to your code posting.

Best

Charles

Post Reply Previous topicNext topic