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

Thread Starter

IANTVTBB6H22

Joined Sep 28, 2020
18
Hi,

My name is Ian. I am 30 years old and this is my first post. I have a somewhat "decent" experience level with electronics but nothing too crazy. I am new to any type of microcontrollers, their code or wiring together motion control systems. I took a few electronics courses when I was @ PCT for automotive training and I have been doing car audio since age 12. So anyways, to my point:

I am trying to design an electronic control system for an automotive project. I want to be able to control the front-to-rear, hydraulic braking force bias from inside the car using an aftermarket hydraulic brake bias adjuster and a stepper motor system. I would like to use an absolute rotary encoder mounted in the car to make the adjustments and have a 24X4 LCD display that would display the current brake bias percentage.

Here are some concerns:
-Memory of Position: It would be important for the microcontroller to be able to keep the stepper motor in its current position with the vehicle being powered on or off and by my understanding the "Absolute" Rotary Encoder would be what I need. I would assume that with the use of an absolute rotary encoder and the fairly advanced ARDUINO MEGA 2560 REV 3 Microcontroller, I'd be able to code that in.

-Multiple-Complete Revolutions: Do most stepper motor drives, stepper motors and microcontrollers support, multiple, complete revolutions of the shaft? I know they can break down one complete revolution into a ton of steps but my hydraulic valve needs to be rotated completely, multiple times, is this something that I can do? I don't have the valve yet so I don't know how many turns it's adjustment knob takes from fully inward to fully outward but I would imagine in the neighborhood of 4-6.

-Stepper Motor Strength: The stepper motor I have chosen is a AUTOMATION DIRECT SureStep STP-MTRH-23079, its one of the larger on the market being a NEMA 23 frame but I can't get specs for output torque on any motors, only holding torque. I'd imagine the actual turning torque of the motor would be more or at least equal to the "holding torque". This motor is listed as 286 OZ. In. which converts to about 1.46 Ft. Lbs. I'm assuming this should be enough to turn the WILWOOD valve, but again, I don't have it on hand.

-ARDUINO MEGA 2560 REV 3, 5V Power Pin: The ARDUINO MEGA 2560 REV 3 has only (1) "5V" output pin. Is ok to wire this pin to multiple other pins like say the rotary encoder, stepper driver as well as the SunFounder Display?

-Absolute Rotary Encoder Selection & Wiring: I chose a BOURNS EMS22A50-D28-LT6 Absolute Rotary Encoder. It has 6 Pins, most rotary encoders I have seen online are either a 4 for 5 pin. In my wiring diagram I only made 4 of the 6 connections, is this ok? It is my understanding that his particular rotary encoder does not have a center shaft "press in" button option but maybe I'm wrong, either way I don't need it. Here are the Pins I connected, followed by a pinout of all the pins on the encoder. So I didn't connect Pin 1 (Digital Input) or Pin 6 (CS). I'm unsure if thats ok. Do I need to connect either of those two?
BOURNS EMS22A50-D28-LT6 ABSOLUTE ROTARY ENCODER - PINOUT 2.jpg
BOURNS EMS22A50-D28-LT6 ABSOLUTE ROTARY ENCODER - PINOUT.jpg


Here are the components I have chosen:
-Brake Proportioning Adjustment Valve: WILWOOD 26011179 Adjustable Brake Proportioning Valve (Rotary Thumb Screw Type)
-Microcontroller: ARDUINO MEGA 2560 REV 3
-Stepper Motor Driver: AUTOMATION DIRECT SureStep STP-DRV-4845
-Stepper Motor: AUTOMATION DIRECT SureStep STP-MTRH-23079 NEMA 23 Frame, Single Shaft, 5.6A, 286 Oz-In Holding Torque, 1.8-Degree Step Angle, 200 Steps Per Revolution, Bipolar
-Microcontroller Power Supply: Powerwerx USBbuddy 12V DC -to- 5V DC USB Power Supply
-Stepper Motor Driver Power Supply: CUI Inc. VHK-150W-Q24-S24 150W DC-to-DC Converter (9-36V Input/24V Output/6.5A Max Current)
-LCD Display: SunFounder IIC I2C TWI Serial 2004 20x4 LCD Module
-Rotary Encoder: BOURNS EMS22A50-D28-LT6 Absolute Rotary Encoder

Here is a wiring diagram and component layout I made, looking for input on if I made the right connections.
Layout & Wiring of All Components.jpg
Thanks for any help guys,

-Ian
 

Attachments

MaxHeadRoom

Joined Jul 18, 2013
28,684
I am 30 years old and this is my first post. I have a somewhat "decent" experience level with electronics but nothing too crazy. I am new to any type of microcontrollers, their code or wiring together motion control systems.
I have to question such an ambitious project for some one who on ones own admission is new to this type a technology.
I have been in the servo/robotics/motion control industry for many years and would be a little hesitant to attempt this.
Also, stepper motors are always considered the bottom of the pile where complicated motion/position control is considered.
Max.
 

Thread Starter

IANTVTBB6H22

Joined Sep 28, 2020
18
I have to question such an ambitious project for some one who on ones own admission is new to this type a technology.
I have been in the servo/robotics/motion control industry for many years and would be a little hesitant to attempt this.
Also, stepper motors are always considered the bottom of the pile where complicated motion/position control is considered.
Max.
I'll be honest, it's a bit of a hypothetical, I think thats what your reading into. This is for a hydraulic valve I don't own and for a car that doesn't have the valve installed yet. It's a hypothetical for a dream build on my daily driver. I have searched long and hard to find either an OEM or aftermarket ELECTRONIC brake proportioning valve, there are none, only manual valves. I have read that there are some cars out there (including Hondas) that have factory fitted, electronic braking force adjustment systems that use an electronic control system to adjust the hydraulic brake proportioning but I can't find one of these anywhere, new or used. Some of these systems incorporate this feature into the ABS system, making it hard to develop your own system utilizing their components. It is a bit above my head but not really. As long as I can solidify what exact components I need (EX. Correct Driver & Correct Microcontroller), learn the right code for the microcontroller from the internet (I understand the basic principles behind coding EX. web design and MS DOS codes/commands) and get the right help online with concern as to what wiring connections need to be made...I can do it!

You said stepper motors are considered bottom of the pile, would there be a better option? A servo? A brushless DC motor? I'm trying to build something robust that will turn the valve and will hold of to being under the hood of a car for years. Honestly the system probably wouldn't even be utilized very often.
 
Last edited:

MaxHeadRoom

Joined Jul 18, 2013
28,684
Typically used in modern CNC/robotic systems is the BLDC or AC servo which comes with the appropriate encoder/commutation installed.
I believe you will find PWM BLDC/AC motor's in a few current Automotive applications.
Max.
 

djsfantasi

Joined Apr 11, 2010
9,163
Hi,

My name is Ian. I am 30 years old and this is my first post. I have a somewhat "decent" experience level with electronics but nothing too crazy. I am new to any type of microcontrollers, their code or wiring together motion control systems.
Hi Ian. Quite the complicated project for someone unfamiliar with microcontrollers. But, I have some comments that might be helpful. First...

-Memory of Position: It would be important for the microcontroller to be able to keep the stepper motor in its current position with the vehicle being powered on or off.
You’ll need to keep the stepper powered to maintain position and likely the stepper driver. But, the microcontroller can remember that last position when powered off. An MCU has different types of memory, and one will retain the values stored there when powered off

-Multiple-Complete Revolutions: Do most stepper motor drives, stepper motors and microcontrollers support, multiple, complete revolutions of the shaft?
Yes. Once the steps for a complete revolution have occurred, you simply start over again at the first step.

-ARDUINO MEGA 2560 REV 3, 5V Power Pin: The ARDUINO MEGA 2560 REV 3 has only (1) "5V" output pin. Is ok to wire this pin to multiple other pins like say the rotary encoder, stepper driver as well as the SunFounder Display?
The Arduino 5V pin can only supply 200mA of current. It is intended for shields; not motors or devices. And the GPIO pins only can supply 20mA. Usually an Arduino switches an external supply to devices with a MOSFET or BJT. Or a shield (Arduino add-on) made for driving motors or steppers.

Thanks for any help guys,
You’re welcome
 

Thread Starter

IANTVTBB6H22

Joined Sep 28, 2020
18
I'm beginning to do a little research on BLDC Motors and their controls.
It appears that BLDC Motors are motors that are the inner rotor type, with the motor’s permanent magnet attached to its rotor, and the coils placed outside.
They typically have 6 or more coils and they are operated by controlling the direction and timing of the current going into the coils, with some control systems such as the sinusoidal, outputting varying currents in patterns to the coils.
They also seems to have incorporated positional sensor systems to accurately indicate motor rotor or magnet position.

I'm looking more into this, the motors I have seen have fairly low torque rating however and are very expensive, but I am looking at Brushless Motors with Integrated Speed Controllers. I am going to look more into peicing together a system with a seperate, modular driver and microcontroller.
 
Last edited:

Thread Starter

IANTVTBB6H22

Joined Sep 28, 2020
18
So "djsfantasi", your saying the 5V pin is only capable of 200mA of current and is designed for a "Shield" and that I need a Shield designed for running motors? I made a wiring diagram that showed the 5V pin being wired to the stepper motor driver's "EN+" pin, that connection would be okay then as far as current is concerned? Does adding the LCD Display and wiring the Rotary Encoder onto that same pin exceed 200mA or would I be ok? Where would I connect the LCD's "VCC" Pin and the rotary encoder's "VCC" Pin then?
What is a GPIO Pin?
 

Thread Starter

IANTVTBB6H22

Joined Sep 28, 2020
18
I guess I'm just a little overwhelmed when it comes to what product is what and what ones I need and getting them to work together. Is a shield a replacement for a stepper motor driver?
 

Thread Starter

IANTVTBB6H22

Joined Sep 28, 2020
18
So I'd need a ARDUINO board, a shield that is designed for motor control AND a stepper driver?
I need to figure out how to supply the LCD Display with 5V as well as my Rotary Encoder, would a shield enable me to do that?
 

Thread Starter

IANTVTBB6H22

Joined Sep 28, 2020
18
So the microcontroller processes code and does the "switching" sort of like a programmable transistor?
The shield, enables the microcontroller to deal with higher levels of power and "switching"?
The driver is what interprets the microcontroller's signals and converts it to higher level power and actual motor supply current?
 

Thread Starter

IANTVTBB6H22

Joined Sep 28, 2020
18
If the ARDUINO board can easily remember position then I should be set, the stepper motor driver will not necessarily keep the position of the motor stored in memory but it's also not going to change the position of the motor just due to a power loss. The motor itself stays in one position when powered off as well so it shouldn't reset everytime I start the car. I'm just going to count on the microcontroller to display the current brake bias percentage and recall the rotary encoder's position so that when the car is turned on and off, we don't have the hydraulic valve and stepper motor turning unneccessarily, untouched when power is diconnected and then reconnected and operating only when the encoder is turned.
 

Thread Starter

IANTVTBB6H22

Joined Sep 28, 2020
18
Here is some photoshop work of a racing switch panel I made, note the brake bias percentage on the lcd display and the rotary encoder.
Switch Panel.jpg
 

zazas321

Joined Nov 29, 2015
936
Im not an expert of motor control in any way, but just a quick thought.

Does it matter for you whether the motor will loose its position either due to the powerloss or when the you switch the car ignition off ( I assume that will also disconnect power from your motor control circuitry?)

In order to maintain the motor in position, motor needs a holding current. That is perhaps handled by your stepper driver, but once you disconnect power, the motor will probably collapse
 

MaxHeadRoom

Joined Jul 18, 2013
28,684
In order to maintain the motor in position, motor needs a holding current. That is perhaps handled by your stepper driver, but once you disconnect power, the motor will probably collapse
Steppers should always be ran at the rated plate current, but when non-powered they have a certain amount of holding torque. Due to the rotor and stator both possessing magnetic attraction.
Max.
 

djsfantasi

Joined Apr 11, 2010
9,163
To remember values, you will need the EEPROM library. This tutorial shows you how to save and retrieve values if the Arduino powers down.
https://www.arduino.cc/en/Tutorial/LibraryExamples/EEPROMWrite

Also, depending on the number of devices, you may not need a Mega. The Uno can support up to 20 GPIO pins (analog pins can be used as digital pins).
https://components101.com/microcontrollers/arduino-uno

Also, if you use the servo shield, you won’t need pins from the Arduino to control your stepper motors.
https://store.arduino.cc/usa/arduino-motor-shield-rev3
 

mcardoso

Joined May 19, 2020
226
Consider a high end "hobby" servo. There are continuous rotation types with integral feedback. I bet you can get these in 12V flavors and they have a ton of torque. I normally preach AC servos with fitted precision gearboxes, but they might not be the right choice for a thumb screw application. You'll need something environmentally sealed as well.

Here is a monster sized one with integral seals and digital position feedback. It may or may not support continuous rotation.
https://hobbyking.com/en_us/hobbyki...695&indexName=hbk_live_magento_en_us_products

https://hobbyking.com/en_us/turnigy...811&indexName=hbk_live_magento_en_us_products

I'm assuming this valve won't move on its own if the motor is powered off? How much torque is required to move it? I do not think a stepper motor is the correct fit for this application.

Don't be intimidated in trying this. If you're not selling these commercially then you have some flexibility to learn as you go.
 
Top