New to Electronics-Stepper Motor, Drives, Microcontroller, Rotary Encoders

drc_567

Joined Dec 29, 2008
1,156
A possible answer to the stepper motor 'slack upon power off' condition is to use a worm gear mechanism. That is, the stepper motor rotates a worm screw, which drives a right angle shaft that turns the brake adjustment valve. A mechanical advantage is built into the worm drive, producing more torque. In addition, once the stepper motor loses power, the output gear is locked in place. Reverse rotation of the output gear is caused by reversing the stepper motor rotation.
Here is one possible worm drive source.:
Worm Drive
gearbox_cutaway_300.jpg
 
Last edited:

geekoftheweek

Joined Oct 6, 2013
1,219
Out of curiosity I checked out your DC - DC converter. I noticed it lists a minimum voltage of 9 and max of 36. You may be alright with it going below, but I'm sure going over will be disaster. Automotive electrical systems can have pretty nasty spikes that can be well over 36 volts. Luckily everything else is designed to deal with it, but something to consider on your own project. I'm assuming being a race project I doubt you'll be trying to start it in the dead of winter on a weak battery so ideally you shouldn't go below the 9 volt minimum (if it is even powered while cranking).

You'll want to be even more careful with the Arduino. A good quality USB power adapter would be about the easiest to adapt.
 

Thread Starter

IANTVTBB6H22

Joined Sep 28, 2020
18
As far as holding torque and the stepper motor holding torque when powered off...the hydraulic brake proportioning adjustment valve that the motor is going to operate has a fairly high resistance or high amount of torque required to rotate it. I'm not 100% positive as I don't own the valve but i'd imagine somewhere in the neighborhood of 0.5 ft. lbs. Because of this I don't need the mtor to constantly control the position of the valve, just rest where it is on the valve when the stepper motor, driver & microcontroller are all powered off.
 

cmartinez

Joined Jan 17, 2007
8,257
As far as holding torque and the stepper motor holding torque when powered off...the hydraulic brake proportioning adjustment valve that the motor is going to operate has a fairly high resistance or high amount of torque required to rotate it. I'm not 100% positive as I don't own the valve but i'd imagine somewhere in the neighborhood of 0.5 ft. lbs. Because of this I don't need the mtor to constantly control the position of the valve, just rest where it is on the valve when the stepper motor, driver & microcontroller are all powered off.
You could use a high-ratio gearhead for that. The assembly would have an extremely high resistance to outside torque, and would remain frozen in place until powered up.
 

Thread Starter

IANTVTBB6H22

Joined Sep 28, 2020
18
I am looking into stepper motors with integrated planetary gearboxes. I don't really need one for purposes pertaining to the motor holding position when powered off, just to be able to use a smaller motor that would draw less current.
 

Thread Starter

IANTVTBB6H22

Joined Sep 28, 2020
18
Out of curiosity I checked out your DC - DC converter. I noticed it lists a minimum voltage of 9 and max of 36. You may be alright with it going below, but I'm sure going over will be disaster. Automotive electrical systems can have pretty nasty spikes that can be well over 36 volts. Luckily everything else is designed to deal with it, but something to consider on your own project. I'm assuming being a race project I doubt you'll be trying to start it in the dead of winter on a weak battery so ideally you shouldn't go below the 9 volt minimum (if it is even powered while cranking).

You'll want to be even more careful with the Arduino. A good quality USB power adapter would be about the easiest to adapt.
The alternator and voltage regulator should keep the voltage @ or below 14.3V at most times, maybe 15V. It's things like jump starting that would cause for voltage spikes. As far as falling below, I'm not sure what that might do to the power supply, It does have low voltage circuit protection built in but I'm not positive how that works. As you said, a dead of winter dead battery would also be a problem when it comes to the 9V power supply minimum but I do agree, it's a race car and won't see any dead battery situations. The CUI Inc. VHK-150W-Q24-S24 24V 150W Power Supply indicates that it has a 9V-36V Input range so with a 12V automotive electrical system, I think it should work just fine.

This is what I was going to use to power the ARDUINO:
Powerwerx USBbuddy.jpg
 
Last edited:

Thread Starter

IANTVTBB6H22

Joined Sep 28, 2020
18
I have decided to go with a Anaheim Automation NEMA 17 Stepper Motor with a 51.06 Reduction Planetary Gearbox instead of the AutomationDirect SureStep NEMA 23. It is rated @ a 0.85A "Bipolar Current" (I believe this means 0.85A per phase). The AutomationDirect SureStep NEMA 23 had a "Current Rating" of 5.6A and a holding torque of 286 oz. in. or 1.49 ft. lbs. It was a stronger motor for sure but 5.6A is alot of current for most drivers and it was a little too big dimensions wise. The Anaheim Automation NEMA 17 Stepper Motor I have chosen has a "Rated Torque" of 278 oz. in. or 1.45 ft. lbs. & a "Max Torque" of 833 oz. in. or 4.34 ft. lbs. I'm not sure if these ratings are for the motor alone without the gearbox or not, most I have seen online are rated that way, motor only torque without gearbox so I'd assume the gearbox will add alot of torque. Even if it isn't, the rated torque of 1.45 ft. lbs. should be just about enough I'd imagine. Another plus of using a stepper motor with a planetary gearbox is that the motor con operate at a higher rpm and velocity, meaning less stress on the motor and operation that is more within the designed range.
Anaheim Automation - 17YPG - Stepper Motor with Planetary Gearbox.jpg

I have decided to add an Anaheim Automation Single Ended w/ Index - Incremental Rotary Encoder Addder. I'm not 100% sure on what this does but I'd imagine having the hardware to have the ability to give the ARDUINO motor position and speed info would be a plus.
Anaheim Automation - Single Ended With Index - Incremental Rotary Encoder Adder.jpg
Also, I have finally found an ARDUINO compatible shield that I'd like to use. It's a DFRobot DFR0105 ARDUINO Compatible "Power Shield". Since I need a microcontroller controlled, 5V power source that can handle the current required to power the stepper motors incremental rotary encoder add on for feedback, the absolute rotary encoder input/adjustment switch, the LCD display & the AutomationDirect SureStep STP-DRV-4845 Microsteping Driver, this "Power Shield" will allow the ARDUINO Mega 2560 REV 3 board to switch and manage power at much higher voltages and currents than the ARDUINO board can do alone. The ARDUINO Mega 2560 REV 3 board's only 5V power output pin is limited to 5V & 200mA but with this shield I can use the board and control voltage outputs from 1.25V-12V & currents up to 2A (3A Peak). Since I am driving a NEMA 17 stepper motor and will be using a separate stepper motor driver to manage the power to the two phases of the motor, I don't need a ARDUNIO shield designed specifically for driving motors, I just need something that can manage power and deal with the voltages and current of running all the things I need to.
DFRobot - Power Shield (Arduino Compatible) - Angle View.jpg
 
Last edited:

Thread Starter

IANTVTBB6H22

Joined Sep 28, 2020
18
Here is the actual hydraulic, manual, brake bias adjustment valve i plan to use. It's a thumb screw adjustment type and has up to a 57% pressure reduction meaning I can easily achieve front/rear brake bias percentages between 50% Front/50% Rear or 70% Front/30% Rear (The most I'd likely set the bias to). I don't own the valve yet or have it in hand so I am uncertain of the resistance or torque required to turn the valve. I hope that the stepper motor's "Rated Torque" of 278 oz. in. or 1.45 ft. lbs. & a "Max Torque" of 833 oz. in. or 4.34 ft. lbs. will be enough. My guess is the valve takes somewhere between 0.25-1 ft. lbs.
Wilwood Brake Proportioning Valve.jpg
 
Last edited:

geekoftheweek

Joined Oct 6, 2013
1,219
The alternator and voltage regulator should keep the voltage @ or below 14.3V at most times, maybe 15V. It's things like jump starting that would cause for voltage spikes.
Jump starting is pretty much the worst case, but it might only take one time forgetting to turn something off or disconnect it to kill it. I found out I kind of misinterpreted some other things I've read before on the subject, but at the same time there are other possibilities under the right conditions. It's better to build in your protections from the beginning rather than after replacing something that failed. A couple extra hours, a couple extra dollars, and a little extra protection can save hundreds in the long run.
 
Last edited:

ounavcon

Joined Jun 19, 2017
1
I applaud your enthusiasm. Learning is always valuable.

I’d like to encourage you to take a risk based approach. Identity the failure modes, then ensure that your approach maintains the safety of the system.
What happens when the mcu has a hard fault? Perhaps because a sensor reading causes a calculation to output an error. If the electronics fail, do they fail safe? What happens when the output fails closed(on) , or fails open(off)? What happens then the high supply rail is shorted, possibly because a wire has rubbed through?
Highway speeds on a slick road isn’t a good time for all the breaking to be shifted to the rear.
This is why we have guidelines like IEC 61508, ISO26262 to help maintain a level of a safety.
You’ll want to test the complete system. I’ve seen enough runtime code issues that you can’t find through static analysis or code inspection. You’ll want test real world failure like broken wires or shorts and stuck mechanics.

The system should be able to boot and know exactly where it’s at. It needs to be in stable control of the system immediately.
An electric power assisted steering module will use a PMSM with an absolute encoder permanently mounted to the shaft. The devise knows at power up exactly where it is.
What your making is a classically known as a “Servo Mechanism”. That may show up when you’re reading.

Good luck and have fun.
 

Sensacell

Joined Jun 19, 2012
3,453
Get the valve in your hands.
It's impossible to design anything meaningful without fully understanding the mechanical nuances of this part.

A valve designed for occasional human hand twidling is difficult to automate, don't underestimate the sophistication of the human touch.
Valves get designed differently when they need to be automated.

You need to measure the amount of torque required over the full range of adjustment, and the number of turns (degrees) it has to travel.
Check if it binds up near the ends of travel, this could significantly complicate your design.

Determine what position resolution and absolute accuracy you will need.

Your feedback system must be absolute and not depend on "remembering" where it was when the power goes off, this point could easily get corrupted leading to a failure.
You might be able to "home" the valve by running it to the end each time it powers up, but this could significantly increase wear, or create a hazardous condition if the MCU reset while you were driving!
 

Thread Starter

IANTVTBB6H22

Joined Sep 28, 2020
18
Wow I hadn't even considered the safety side of the system. An un-wanted change of position of the motor and valve could cause catastrophe by changing brake bias front or rear without me even being aware of the change. I need fail safes and maybe looking into safety guidelines is the best idea at this point.

I'm starting to become a little wary over the hydraulic valve, "A valve designed for occasional human hand twidling is difficult to automate, don't underestimate the sophistication of the human touch." The stepper motor would be mounted to the valve but it's position would be fixed rather permanently and if there is any faulty alignment it could wear the valve out over time. I know I need to get the valve in hand, learning how it operates and acquiring info about # of turns/turning resistance etc. I don't doubt that the stepper motor I picked out with its 50:1 planetary reduction gearbox and it's "Rated Torque" of 278 oz. in. or 1.45 ft. lbs. & a "Max Torque" of 833 oz. in. or 4.34 ft. lbs. will be enough to operate the valve, I can estimate the turning torque of the valve but if its designed to be easily operated by hand I'm sure its less than 1 ft. lb. I mean imagine a 1 foot bar sticking off the thumb screw and placing a whole pound on it, its probably a pound or less.

TO BE CLEAR ON POWER ON/POWER OFF AND THE STEPPER MOTOR'S POSITION:
I want the system to:
  1. When powered off I need the actual motor to maintain its last position, basically I want all components to get powered off and have it remain static. This will be partially achieved by the fact that the hydraulic valve its connected to will have a fair amount of turning or resting resistance. It's my understanding that stepper motors and drivers tend to just cut power and not change position when power is lost, if not I can program the correct operation.
  2. When powered off I need the arduino board to store the last position it had the motor in, in memory
  3. When powered back on, I need the motor to not operate and remain in its last position
  4. When powered back on I need the LCD display to continue showing the last position (or current position as it has not changed between power cycles). This will be the job of the arduino board's memory

I can count on the driver to remain as a slave to the arduino microcontroller and use the microcontroller to program correct positioning when it comes to power being turned on or off. Basically I want the driver, microcontroller, stepper motor and LCD display to all operate when powered on and for the motor and valve to remain in position when powered off. As far as i can tell the LCD display will display the current position via the arduino so it should display current position with power on and show the same position when powered off and back on.

Once I get the valve in hand and count the turns, I will need to do some math on how to program the arduino so it will operate the valve from fully closed to fully opened and how to program the LCD display to show these operations as a percentage front/rear. Basically the valve has up to a 57% pressure reduction to the rear brakes. So with the valve fully opened (no pressure reduction) The car will have 50% Front & 50% Rear braking bias, with the valve fully closed (57% rear pressure reduction) I will have 71.5% Front & 28.5% Rear. 70% Front & 30% Rear is the bias percentages for the stock non-adjustable proportioning valve so all the valve is really gonna do is let me reduce the front percentage from 70% to 50% and send an extra 20% to the rear to have 50% there as well. You don't typically want anymore than 70% of the braking to be in the front anyways, the front brakes tend to lock early and you don't ever really want anymore than 50% rear bias because the car tends to lift in the rear when moving forward and braking so the back end gets light and too much rear braking will cause the rear wheels to lock very early. Because of this the electronic control system needs to turn the valve from its all the way closed to its all the way open positions and display the correct or actual brake bias percentages on the LCD display. I'd assume taking the valve, fully opening it (no pressure reduction), counting the # of turns until fully seated and closed (57% rear reduction), taking that # of turns, dividing 57% by that # would give me a percentage of rear pressure reduction per turn of the valve. Next its programming the arduino the understand the motors position when the valve is fully open (50%/50%) and coding in for it to stop there and store it as a fully open valve position. Then coding in for the LCD display to display "50% Front/50% Rear" when the motor is in that position, then coding in the correct # of steps/rotations for the fully closed valve position, setting it as a final position for the motor to stop at and coding in the arduino to display "71.5% Front/28.5% Rear" on the LCD display when in that position would work.
 
Last edited:

Thread Starter

IANTVTBB6H22

Joined Sep 28, 2020
18
I have yet to determine the torque required to turn the adjustment knob on the Wilwood Hydraulic Brake Proportioning Valve but I did talk to Wilwood and they said it takes a complete 8 turns from fully closed to fully open. That means there is a 7.125% reduction in rear braking for every turn clockwise from fully open.
 
Top