Cool but would it work on a Corexy?

Dear all,

My first post. I’m interested in the odrive because it is really cool (!!) and I like the idea of the control and silent operation.

I have a couple of questions though, while researching this forum and the documentation.

  1. Am I correct to understand I could use a pi with Klipper to drive an SKR1.4 (for example) and instead on mounting drivers, I route a couple of wires to the Odrive to use the step / dit functionality? In that way I can use gcode and all other stuff for heaters sensors etc yet have access to a couple of Servos through the odrive? I could even (?) use 2 Servos for XY while I use steppers for the Z and E(xtrusion) on the SKR1.4?

  2. How to connect a battery instead of the resistor for breaking? Simply connect a battery instead and that’s it? The battery should then have a voltage of (for example) 24V, so for example a Lipo s6 which would give 4V on each cell and this headroom upwards?

  3. I’m looking at motors on HK in the range of 400 - 800 Kv, as they give a kind of size I feel sufficient for my application. But then if I use those to directly drive a pulley / belt I recon I only need like 1 to 3V? If I would drive them with 12V I would need to be very careful with the amount of Current? This is perhaps really basic question, but the funny thing is I just don’t know ;-).

  4. I was reading the nice explanation on how to choose the servo motor. It relates to 3. Above. Is states that one computes the electric power using Imax. But how do you know Imax? From a data sheet? I would imagine that relating to 3. The current is not an issue as I’d only need 3V while using 12V?

  5. Which control applies to the Odrive when used in Step/dir mode?

Thanks!

Q

? what’s a Klipper? What’s a SKR1.4?

Don’t use step/dir, use USB and the Python interface, or CAN.

Don’t worry about current - the ODrive is a closed-loop current controller - it measures and regulates current for you. I recommend using the lowest kV motors and the highest voltage you have available. 48V for a motor normally rated as 12V is fine, so long as you set the max speed and max current appropriately.

If you are using a battery then you can disconnect the brake resistor and set its resistance to 0 in the config. The ODrive will then send regen current to the power supply (the battery) instead.

I think the Imax that you are referring to refers to the maximum current you can send through the motor with the available voltage, given the resistance of the motor. You still need additional voltage to change the current (and therefore torque, and therefore acceleration) in the motor quickly. Look up the concept of Inductance.

Step/dir is a stupid, lowest-common-denominator interface. Can you program your software to send a position setpoint instead?

Also I’d note that ODrive might not be the best idea for 3D printing, it’s more intended for robotics.

Thanks for the replies already. Klipper, SKR and Steppers is the name of the game for 3D printing. If you slice a model it generates a lot of gcode with lots of stuff and not just G0 or G1 commands. So I’d think having the odrive as a relative “stupid” device to interface between a classic 3D printing “controller” board and a servo would work most practical?

So perhaps that then brings us more to the point of it can be done that way or not? Hmm…

But then good to know the current and voltage is not an issue. That makes me want to keep in investigating! And the battery is thus on the power supply side. So when breaking the current wants to naturally go to the battery as it has the lowest resistance?

When braking the ODrive will generate a higher voltage than the battery, so current will flow towards the battery.

If you can translate your G commands into position setpoints (Move axis 0 to X, axis 1 to Y) instead of using single-steps, then it will work most effectively. Step/dir will also work, but it will probably sound like a stepper motor and have the same performance (if not worse) than a stepper motor! And you will not get any diagnostics, motion profiling, etc. Like I said, it works, but it’s a lowest-common-denominator interface, a bit like the PWM that R/C hobbyists are obsessed with. :stuck_out_tongue:
It’s somewhat analogous to using Morse code to type on your keyboard.

I’ve been working through a pretty similar project, using an ODrive to control a CoreXY laser cutter. It’s not nearly complete but I’ve started a write-up here: http://jacksonsmith.name/Laser/. Here’s another build someone else did that sounds more similar to what you are trying to achieve: https://www.youtube.com/watch?v=F3HQpAGiybM.
I would be very concerned with trying to directly charge a LiPo using the regenerative braking function of the ODrive. The regenerative braking function is very simple. When the VBus voltage rises above some threshold, the brake resistor opens to keep the voltage from rising. To use the regenerative braking function you need to design your own circuitry that can eat sudden spikes of power. Trying to do this with a bare LiPo battery is likely to cause it to explode or at least shorten its lifespan.
I’m using two 1400KV motors in my laser cutter. I’m only driving them at 12v, yet they still are massively overkill for my application. As towen said, the ODrive will intelligently regulate the current through the motors to minimize power consumption and motor heating. No need to worry about current/voltage into the motor beyond the limits of the ODrive itself.
Using the full UART interface will be necessary to take advantage of the full array of ODrive capabilities, but it will be necessary to modify the source code of Klipper itself (if the words compiler or IDE sound scary, this path is not for you).

Thanks both for the reply! I’ll dig into the website and get back with more questions ;-))) tomorrow.

At least I got right that small motors are enough for sure. That keeps me interested ;-).

Converting gcode. Well I think that slices can’t do arcs at the moment so they are a lot of position commands. I can imagine klipper to think about it a bit different that the odrive decides to move and might get out of sync with the extruder.

Food for thought, but I agree now already that it’ll have to be done in klipper

Not really. The ODrive is behaving as a current source, not a voltage source. It’s also possible afaik to define a maximum regen curreent and voltage, to avoid overcharging a battery.

This is fine. Send as many position commands as you can.

This. ^
If you’re not prepared to learn a bit of Python programming & a bit of control systems theory (or at least, best practice), you will fail.

Yes, you can use Klipper, SKR 1.4 and step/dir. It’ll work fine - you can also try the new input_filter if you’d like, it should make step/dir smoother.

Everyone uses ODrive for robotics but it’s definitely intended for CNC applications too. Anywhere you need high power at low voltage (not typically a 3D printing problem, but for a CoreXY you can justify it solely due to the accelerations)

1 Like

Ok I’ve checked out your website Robo and thanks for the comments Town and Wetmelon!

So the youtube system would be a bit too much for me. Indeed I fancy a quite fast XY acceleration as reason for a servo over stepper (apart from cool ;-))

So may I conclude that using 3D standard stuff it can work quite straight forward with the step/dir way of input to the Odrive. The Odrive would in this way only be able to control for the steps with its feedback, e.g. Would prevent / note that steps are being lost. Otherwise nothing fancy in position, velocity current control etc, so won’t get the most out of the Odrive. I could check out the input filter function (where can I find the documentation on that?) as perhaps some additional improvement over a normal stepper.

Further integration would be possible. In that case the Pi would send commands to an SKR for, for example, Z and E steppers and stuff like fans heaters etc. It would also send commands to the Odrive directly which then plans it’s own trajectory routing from the G0 commands. In that case I do wonder about the syncing of the systems. Any ideas on that? But for sure it would enable all the goodies the odrive has to offer and would have me learn a lot on Python. I know Matlab and Control Theory, but I would really consider this as a next step as it’s a study on its own :thinking:.

I don’t see an 3D printer driven all from the Odrive as it lacks stuff for heaters etc, so the second step above would be perfect. Perhaps if sync is an issue one would add another odrive for the extruder. BTW I think the extruder could really benefit from the servo when measuring / controlling the current / torque while extruding…!

Thank you guys for the help: I hope it will also help out others thinking about adding an Odrive to their 3D printer.

May I keep on asking here on the topic?

I wonder about the voltage now as Robo things 12V where Town thinks 48V would work too. I would like 24V actually as that would drive the steppers for Z and E and allows me to use one 24V power supply. And the put the Lipo S6 on between (I imagine a max of 6A to be given to the battery which isn’t so much for a decent size battery: a 5000mA battery with 10C charging capability would allow even 50A charging). I am right thinking that a Meanwell power supply is “high Ohm” and the batt “low Ohm” so the current doesn’t interfere with the powersupply right?

I wonder about the precision of the movements. Robo noticed some problem in the position and solved it by adding some more inertia to the system. I know / read about balancing the inertia of the system and the motor('s). Best being about the same or a bit less for the load. Do you now have a really (position) accurate system Robo? How accurate compared to your encoder (which has how many pulses per rev?).

Thanks for the help and discussion!

Q

You can use the 56V version on a 24V supply - gives you the option of increasing the voltage for more performance later on.

Err, what?
You’re intending to use a battery and power supply at the same time? Apart from being a recipe to burn down your shed, why would you even do this?
“high Ohm” / “low Ohm”?? No, both have a low impedance, if that’s what you mean… Honestly, I don’t mean to be insulting, but it sounds like you are inexperienced and should not be playing with 50A power supplies never mind 6s 5Ah Lithium batteries. You could get yourself or someone else killed, no joke.

I’d advise that you start off with a standard 30V 3A bench power supply - it’s likely to be more than capable of delivering what you need, and it won’t burn your house down and it will give you a better idea of how much power you actually need for best performance. Even if you are sending 20A to a motor, if the speed is low, it won’t draw anywhere near 20A from the power supply. I.e. you don’t need a lot of input power to accelerate from a dead stop, or to hold a lot of torque at standstill. The brushless motors driven with ODrive are MUCH more efficient than steppers, so you don’t need a huge power supply for a 3D printing application.

Leave the brake resistor in place when running from a power supply of course.

I don’t see how adding inertia could ever help precision. It will do nothing but waste power and potentially cause oscillation.
It’s true that for high performance robotics applications, an inertia match between motor and load is useful for performance (i.e. positioning speed, NOT precision), but it’s not essential. Normally it’s done by adding a gearbox, which multiplies the motor’s effective inertia by the square of the gear ratio. For direct-drive applications (i.e. no gearbox) it’s quite common to have an inertia mismatch. If you’re using a belt, then you could use the sizing of the pulleys to match the inertia as it’s effectively a gearbox.

1 Like

Not offended at all (!): really glad you are helping me to understand as I’m indeed not good at electricity stuff :blush:. So highly appreciated!:

I thought to understand from above that the power supply, battery and Odrive would all be connected I. Parallel. The power supply and battery would act as the power source and if the voltage of the battery drops below the power supply, the power supply would charge the battery and give power to the Odrive. If breaking it would charge the battery and thereafter use the battery with a bit higher voltage compared to the power supply first un till etc etc.

So I’ve completely misunderstood? You would do either one but not both at the same time?

In that case I’d like to plug it into my 24V power supply with 20A capacity. More than enough as I think indeed the odrive would only pull like 5A max max for both Servos combined. That would be OK right and I’d just connect the resistor and that’ll work just fine?

====

I also don’t know why the added inertia helps other than perhaps pulling the system out of a resonance when it was (accidentally) put there with the tuning of the PID control. But Robo mentioned so and I see it on the youtube movie above too with a couple of CD. So I’m really interested in his ideas too.

I’ve been calculation the dynamics of my printer design and the inertia of the belt / gantry matches about with a nema17 48mm length. So I think the brushless motor will be similar (yet to find a right one though). Note that this is when moving the whole gantry (Y motion), if it’s just the printerhead (X motion) it’ll be less.

I would therefore like to use the servo as a direct drive. Have pulleys with diameter of 12mm, so one turn gives about 36mm of belt movement. So I do need quite some angular precision of the servo. Hence my question what I might expect here? An encoder could have “100k increments a revolution” but that doesn’t say the system will position itself with that accuracy right? So I wonder what can be achieved. In reference to my understanding of steppers:

Steppers usually do 200 (or 400) real steps per rev and then with interpolation (microstepping) they increase the resolution typically with a factor of 16. So like 3200 steps per rev. But if you look at stepper data sheets it typically mentions 5% inaccuracy on the angle? I’ve till now not really understood this but would think that a 0,9deg stepper (400 steps per rev) would have an inaccuracy of 5% on that 0,9deg so about 0,005deg. Not sure though as it seems way too precise to me…?!

=====

So I think to understand that lower Kv would be good for the motor but in the range around 500 till 1500 would be fine? Is it correct to assume lower Kv gives more torque at low rev?

Is it best to have a motor with as many pole as possible for position accuracy? Intuitively I would imagine so?

Sorry to keep firing questions at you🥴.

1 Like

No, if you plug a battery directly into a power supply you will most likely start a fire, and a ferocious one at that, because the power supply could easily overcharge the battery if it’s not designed to be a battery charger.
A battery is almost an ideal voltage source (it has a more-or-less fixed voltage and almost unlimited current) and a cheap 24V high current power supply like a mean-well is also a voltage source. You should never, in general, connect two voltage sources in parallel together because they will fight eachother to find an equilibrium, with almost unlimited current flow between them!
There is an exception for identical batteries/cells connected in parallel, but you need to be extremely careful that the state of charge is identical when you connect them, so they can find an equilibrium quickly and easily.
The ODrive, as I mentioned, behaves more like a current source, because it has current feedback sensors that drive a regulator. You can safely connect a current source in parallel with a voltage source.

Yes. I don’t know what you’d achieve by attaching a battery in parallel to a high-current, constant-voltage power supply, apart from fiery death. :joy:
The power supply already has circuitry to regulate its output to a fixed 24V, whatever load you put on it (until it reaches its 20A limit)
If you wanted to boost the power supply’s ability to handle bursts of extremely high current, then what you want is a capacitor, not a battery. But your power supply is already over-rated for the job, and will contain quite a hefty output capacitor already.

Yep :slight_smile:

Normally, you’d expect about 10 counts of error on a well tuned system. However some things like motor cogging or dynamic loading could increase that error, but I think even with 100kcpr encoder (which is unususual and expensive in itself) there’s no reason why you couldn’t achieve 10 counts following error at the motor. However, things like belt stretch, mechanical deformation of the rig, would have a far greater effect at that kind of precision.
I normally use AS5047p sensors which are absolute encoders with 16384cpr. They normally have about 10 counts of noise, so you can expect (at least) 10 counts of error. But they are nice because I can use cogging compensation and I don’t need to home them before they can work.

Yes, up to a point. kV is mathematically congruent to the torque constant of the motor, i.e. Nm/A. With a lower kV you will get more torque for the same current (or rather, you need less current for the same torque). This makes them more efficient in general, but you also need a higher voltage to achieve maximum speed.
Beware though that lower kV motors usually have a higher resistance (because there are more windings) so usually you can’t run them at the same current without overheating them.

Yes, I’d agree. Mainly because the cogging has less effect at high pole counts, and also because high pole count reduces the kV (increases torque constant) in general.
But beware that inertia also goes with the square of motor diameter. A high torque motor is not necessarily the best for acceleration.
Also beware that you can never get better positioning accuracy than your encoder allows, unless you use a gearbox (and suffer the backlash that implies)

Very very clear answers, thank you so much! It might be good for other novice that visit the Odrive website that it’s either a power supply or battery? Obviously I didn’t get that when reading at first :stuck_out_tongue_closed_eyes:.

The 100k counts per rev was as a matter of speaking btw; but happy I got that part right. So with your sensor suggestion I may expect ±5 count error so like 5/16384 * 360 deg sensing error which is a position inaccuracy of about ±0,01mm in my application. That would be min / max and if the sensor noise is distributed it might on average be smaller?

I computed the belt stretch to be a little bit less (like ±0,005mm with about 5g accel (at which state I’m sure to break the printer in 100 pieces ;-)). So I think that your suggested encoder makes sense or perhaps just a little bit better?

May I ask then about the clogging? This is inherent to the brushless motor but if all tuned and done well is this something that gives an additional uncertainty or can the Odrive feedback prevent any rotation error thereof?

Anyways, I’ll now try and do some more Google search on the accuracy of steppers to compare!

1 Like

Not clogging, but cogging. It’s a force produced because of the permanent magnets being attracted to the iron cores of the motor. You can feel it when you turn the motor by hand (especially high torque types) - it feels as if there are some positions that the motor prefers, and others that it refuses to stay in. For control, it can be difficult to force it accurately into one of these positions.

The ODrive has the capability to measure and calibrate out this cogging, but it’s an advanced feature that I’ve not been able to get to work well yet.

1 Like

Yeah neither have we lol. It’s an advanced feature, but also an alpha feature. Very rough around the edges

Well, I suppose it’s because because in general, you either use a power supply OR a battery as a power source, not both! Nothing special about ODrive here, just power electronics in general. I’d never even considered that someone might think to simply plug them in parallel. That’s what the Darwin awards are for! :stuck_out_tongue:
In hindsight I can see that some people may be confused because things like laptops and mobile phones have both a power supply and a battery - but in reality these devices have quite complicated charging circuits, known as Battery Management Systems (BMS) to charge and discharge the battery safely. They are basically constant-current power supplies. (i.e. current sources) They certainly don’t connect the battery across the rails of a constant-voltage power supply.

In older battery technologies such as Ni-Cad, it was sometimes true that batteries were connected across a (current limited) power supply. This is because Ni-Cad and Ni-MH are tolerant of over-voltage - once they are fully charged, they will start to pass current and slowly get hot, dissipating the excess energy.
Lithium batteries do NOT do this. If they are overcharged, they will suddenly and violently erupt into flames, spewing noxious gases such as Hydrogen Fluoride, which will cause permanent eye damage.
It’s normally illegal to sell a Lithium battery without some kind of over-voltage or over-current protection (i.e. a fuse), but there seems to be an exception for hobby LiPo batteries, because it’s assumed that hobbyists will take responsibility for their own ignorance (a la Darwin awards).

I think the main problem is that it calibrates in one direction only. It should do it in both directions (ideally multiple times) and take the average of the results.

Hmm spelling check made it clogging ;-(.

Found more on the accuracy of steppers in open loop as usual on 3D printers. It’s rather striking:

The changing external loads while moving the printhead can give up to 2 full steps or error, eg on a 0,9 deg stepper like 2degree. Soooo, that gives me a complete different take on your suggested encoder with 10 counts noise ;-))).

I guess the question for me is still a bit on the cogging error but the AS5047p to control actual step / dir will be an improvement compared to a stepper already I believe now. Cool.

Would the anti cogging firmware also work on step / dir mode? I’d guess so for it’s a positioning thing?

1 Like

As far as RC goes: I have that as a hobby with Lipo driven stuff… Soooo :hugs::stuck_out_tongue_winking_eye:.