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.
#Optical auto homing for steppers
1 messages · Page 1 of 1 (latest)
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!
@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
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.
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
I’ve always used arduino with ready tu use projects like MF but will try to get my hands dirty on this!
Wasn't this already discussed a few months ago? I think a transistor acting as switch can invert the logic of the optical sensor.
We have a compile flag for reversing the outputs, but not for inputs.
Like @dapper cairn said, I would reverse the logic level with a transistor or if multiple signals must be reversed by an IC, something from the 74xyz line, an OP as Schmid trigger,...
This flag is global, that is all outputs are inverted, correct?
No, OutputShifter can be set separately.
oh, it was outputs only, good to know
I’d love a software solution rather than more components for simple gauge but if there is no other choice I’ll manage!
Well, one transistor is not a whole lot IMO.
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.
For the sake of discussion, I think your method is clever and works by inverting the logic mechanically, using the hole in the disc, instead of a pointer to obstruct the light sensor.
Yes this method seems very simple and efficient But I'd like to us X27 stepper with pointer direclty on the output shaft to built simple gauges. But maybe X27 can be modified to have a second shafton the rear. Or add a hall sensor? I'm also thinking of hacking the inside and use the mechanical stop as contact some way.
Still not decided on anything with this, I have to experiment electronic and mechanic solutions.
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 know this is not a stepper but it is similar thing
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
I don't think it's possible for now. Depends also on the number of steps per how many steps you have to do in the worse case to teach the end stop.
I like this! I would totaly use that as fuel gauge, prop amp, instrument air on my Bonanza. The 100mA one I foundhave a non linear scale. They are cheap, I'll buy a few and make some tests.
yea it is likely not linear, but the interpolate modifier exists for exactly this purpose
yea I mean you would need to run backwards for the full circle I guess, if there is no current sensing. Some stepper drivers can support limit-switch-less homing by detecting the current I guess
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
I was thinking about that exactly!
You mean the zero set pin can’t be set to the same one for all the steppers? That would be a waste of inputs
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.
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.
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
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.
though I think like mentioned, these are designed to be driven against the end stop for finding zero
We need MF to support this way of zeroing steppers!
Nice idea! I’ll keep that in mind.
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?
I think the stepper homing function is a firmware start up function happening long before simvar values are available to MF Connector.
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
Yeah ok, nevermind my thoughts, then🙈
I haven't played around with steppers and mobiflight, so wasn't sure of the funtionality.
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
Mega, Uno, Nano (not ProMicro) gets reset on connecting via USB due to setting the DTR line. The Pico gets not resetted on connect.
Before uploading a new config the existing one gets deleted. Next the one is uploaded and afterwards it gets executed. The boards are not resetted.
Next step is to build additional hardware to sense the rising current against mechanical stop and trigger the zero pin. (I have no idea how to do that!)
Difficult on steppers, as you'd have to sense current across each coil set in both directions. The current would increase in one direction and decrease in the other in one coil set while remaining more or less the same in the other coil as the stepper motor skips steps... I'm not sure this would be practical
I can understand that. Then how is it done in car dashboard?
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
I think they just drive it against the mechanical stop. Or they have a controller chip with current sensing
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?
Sorry, I didn't understood what you meant.
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
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.
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.
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.
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!
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.)