#Optical auto homing for steppers

1 messages · Page 1 of 1 (latest)

mint moth
#

I will built gauges and I'm not satisfied by the manual homing of the steppers. All it takes is a crash or put the PC to sleep for MF to loose all the steppers postion and having to home them manually all over again. so I want to instal auto homing, in gauges I want something stealth, I think the easiest is to opticaly detect the pointer position.

#

But the problem is MF requires a LOW input at home point but phototransistor have high output when detection occurres. I'm open to solutions for this!

grizzled cobalt
#

@supple oriole do you think building the firmware with reversed button logic would help here?

#

also, there are both kinds of optointerruptors

#

but this is something that would be good to have configurable eventually

mint moth
#

Yes I tink reverse the button logic would help a lot. And it shouldn’t be a problem with mechanical microswitch either which can be wired as NC or NO.
The pinnacle would be to be able to choose high or low for each stepper zeroing button input.

#

Even better would be for MF to auto home X27 stepper based on torque sensing against end stop. Like when you start your car, gauges swipe up and down and auto calibrate.

grizzled cobalt
#

you can try building the firmware yourself with the flag (set in the platformio. ini) if you are familiar with Arduino programming a bit

#

it uses vscode and platformio as the build framework, not the default Arduino IDE

mint moth
#

I’ve always used arduino with ready tu use projects like MF but will try to get my hands dirty on this!

dapper cairn
#

Wasn't this already discussed a few months ago? I think a transistor acting as switch can invert the logic of the optical sensor.

supple oriole
dapper cairn
supple oriole
grizzled cobalt
#

oh, it was outputs only, good to know

mint moth
#

I’d love a software solution rather than more components for simple gauge but if there is no other choice I’ll manage!

dapper cairn
#

Well, one transistor is not a whole lot IMO.

delicate moat
#

Just to add to whats been said, there is a very simple solution I've been using successfully with mobiflight for a few years now. I use the small optical endstops you can get on ebay for CNC/3d printers. The boards already has the resistors and connector on them. You just need to connect power and a single wire to whatever switch input you assigned. The key to reliable behaviour is to use an interrupt disc, not a pointer. I know it's an extra piece of hardware, but it does work reliably as the switch is only active when a hole or slit
in the disc comes round.

dapper cairn
mint moth
#

Still not decided on anything with this, I have to experiment electronic and mechanic solutions.

grizzled cobalt
#

that is another thing: those do have a mechanical stop that is intended as a way to set zero

#

@supple oriole I wonder if we can do that as an alternative thing, or whether it would be possible to do in a MF config even now, basically drive the motor "left" long enough to be sure it hits the mechanical stop, then it is at zero

#

it would require resetting the zero point I guess

#

if you want just a single pointer regular gauge that moves in an arc, like a fuel gauge

#

a simple ammeter will also work

#

it works with a led pwm output

#

its not stepper, but makes a great fuel gauge

#

seems 50mA is fine but maybe 100mA might be even better for the range, as I am hitting 50mA with pwm value of 128

#

I set it to engine RPM, it is very very smooth

#

this mechanism probably can use a very lightweight pointer cut from paper or very thin plastic and superglued on the real pointer

#

but it is a very good option for a simple pointer gauge with just one pin

supple oriole
mint moth
grizzled cobalt
grizzled cobalt
#

I have a x27 here that I can run backwards until it hits hits the end stop and skips - but I would ideally do that a bit slower, I guess, to avoid breaking it, and at that point I would want to reset the zero point

#

I think we could prototype this with a separate switch, that you push manually once all your steppers have hit the zero limiter

#

and wire that to all of your zero-set pins

mint moth
mint moth
grizzled cobalt
#

well, it wouldnt make sense to have two steppers use the same zero pin

#

the "drive against limiter" use case is not currently supported

#

and you wouldnt want to have a zero switch on two steppers on the same pin because it would zero all steppers when the first one triggers the switch

#

so I am just speculating that if you had a bunch of x27 steppers with mechanical stop, you could test things by waiting for it to hit the end stop and then trigger the limit switch pin manually

#

as a proof of concept it does work

#

I am testing with X27 stepper, and I set a momentary switch as the zero pin

#
  • when the arduino boots up, it drives left expecting the switch to trigger
  • when I see it hit the end stop, I will press the momentary switch
  • stepper stops trying to move, and zero point is set

this works well, and I agree with you, if you do this, it would be possible to use a single pin for all of these, but in reality you would not need a pin at all. because you can just drive the stepper slowly towards zero, if you have gone the "full revolution" amount of steps, you can expect to be at zero.

delicate moat
#

I also restrict the movement of X27 steppers depending on the gauge I'm replicating. I install a hard stop in the channel the pin rides in so the max rotation is restricted to slightly beyond the max printed scale. This has been useful in very small gauges were a collision could snap a pointer. See the 1 1/4" Load Gauge pictured and the Fuel Qty gauge.

grizzled cobalt
#

yeah

#

and you can likewise snap the pin on the rotating part to get rid of the end stop altogether

#

if you want a fully rotating gauge

#

but then doing the zero calibration automatically would need a optointerruptor in the shaft

delicate moat
#

I did extend one of the shafts through its case on a dual needle BKA30 to add an interupt disc. It worked fine. The X27 shafts are approc .96mm, so I'm sure you could drill out the case and add a longer shaft to the output gear to add a sensor.

grizzled cobalt
#

though I think like mentioned, these are designed to be driven against the end stop for finding zero

mint moth
mint moth
grizzled cobalt
#

datasheet for the x.27-168 stepper

#

@supple oriole

hoary girder
#

I don't currently have access to a laptop or pc so can't check this myself, hence my question:

Does the stepper homing function only work with hardware inputs (button connected to arduino pins) or is it possible to feed in a mobiflight variable. In that case maybe you could invert the signal in the gui by writing the inverted end stop input to an output variable?

dapper cairn
grizzled cobalt
#

yea homing happens when the arduino boots up, and also if you for example create a stepper device and upload config (I dont know if the board actually reboots at this point, but stepper gets calibrated at this point if the zero pin is defined, if I remember correctly)

#

if we would experiment with mechanical stop calibration, one would

  • move rather slow (to avoid damage) to the motor gears
  • would have a parameter for the number of steps to move backwards for mechanical stop calibration.
  • once the number of steps has been moved, the stepper would move one or two steps forward, to get away from the mechanical stop, so any stress is relieved from the gears
hoary girder
grizzled cobalt
#

I experimented with the mechanical stop by connecting a led output to a button input and setting it ON with a Transform, so it triggered the stepper zero pin 🙂 but the stepper calibration starts when mobiflight probes the arduiono I think, and its quite a long time for it to grind the gears waiting for autostart to run

#

the manual push button works fine though

#

it would just be good to consider the mechanical stop "-1" and step one step back to zero

supple oriole
mint moth
hoary girder
mint moth
hoary girder
#

Interesting question. I don't know tbh. Since they're designed to last many many cycles, I'd assume they don't rely on mechanical overload but rather on hall effect feedback for reliability reasons

grizzled cobalt
#

I think they just drive it against the mechanical stop. Or they have a controller chip with current sensing

grizzled cobalt
#

seems the AX1201728SG is a clone of M-S X12.017

#

the driver is simple step+direction mode

#

there is a reset pin on the chip, @supple oriole I wonder if one could use this as "auto zero pin" but instead of expecing a switch, have a "X27 mechanical stop" stepper type that would SEND a pulse on the zero pin instead, one could then connect it to the RESET pin of the driver chip?

supple oriole
grizzled cobalt
#

the chip has STEP and DIR pins, and also "RESET"

#

that can be used to set zero

#

but I guess the zero point is something Connector keeps track of?

#

and it doesnt matter what the driver thinks, it just sends step and dir when the pointer needs to move?

#

I need to play some more with the chip

supple oriole
#

I don't think the driver sets to a "real" zero position. The driver does not now where the absolute position of the motor is.
For me it looks like the microstepping is resetted to a full step when the driver gets resetted.

grizzled cobalt
#

yeah

#

oh true

#

which is probably a good idea though

mint moth
#

After much research it seems the commonly accepted method to home small x27 steppers is to just drive them to the endstop, torque being so small no dammage can be done.

#

I'm waiting for mine to be delivered and will try to add a routine in MF doing exactly that upon simulator startup.

supple oriole
#

With the existing FW and a defined end switch in the config the stepper rotates counter clockwise until the end switch is activated when booting up the board.

mint moth
#

I do understand that. The problem is to add said endswitch to a simple gauge with X27 stepper would add unneccassary mechanical complication.

#

Thats why I was initially asking about optical sensor, a simple slit in the back plate to detect the pointer is acceptable I think. But the simplier the better!

hoary girder
# mint moth Thats why I was initially asking about optical sensor, a simple slit in the back...

After looking again at the circuit you posted originally I think it will do exactly what you would like...

When the needle is in front of the sense point, it reflects light emitted by the diode back to the phototransistor. The phototransistor then becomes conductive, pulling the arduino pin to ground.

I may be mistaken, but I don't think any additional circuitry is required, as the phototransistor does all the hysteresis stuff. The main difficulty will be avoiding false signals caused by reflections from the faceplate and by IR transmitters in the vicinity perhaps (remote controls etc.)

grizzled cobalt
#

I think there are two kinds of those interruptors too

#

normally open and normally closed