Finding and driving small stepper motors - Page 1
Forum section: electronics / projects

author: Simon
author_rank: Unknown
timestamp: November 12, 2013, 08:29:25 am
content: My boss has a motorbike and has changed the wheels. This means that the old speedo system will no longer work as the wheels are potentially different diameter and the width means that the sensing wheel no longer touches.So he has this idea, what is he puts magnets on the spokes and uses a hall effect sensor to pike up the pulses and uses those to tell a driver board what speed to turn a stepper/brushless motor that will drive the original speedo mechanism.Now main concerns are:1) motor need to be small2) motor needs to be able to go at low speed - although he needs to recheck that as he thought it was 0-250 rpm for 0-100 mph but I think big wheel driving small wheel will give a much greater speed (not much torque is required)Is there fairly generic parts out there that can be used ? I've never actually driven a stepper so any suggestions on that would be good (or where to go get the information)

author: Kremmen
author_rank: Super Contributor
timestamp: November 12, 2013, 08:55:42 am
content: Phew. The main challenge will not be the electronics, but the mechanical part. To make this thing half reliable, the mechanics must be built to reasonable tolerance esp. regarding the fittings, and weatherproof. But OK, assuming that can be handled:1. Why try to replicate the original mechanical setup at all? The reason for this rotational gauge contraption is the lack of "intelligence" in the system, so you must convert angular speed to angular displacement. Why not just discard all of that and use the stepper directly? In the latter case the stepper if perfectly suited to turn the speedo needle this way and that under simple program control.On the other hand, if you find a stepper with suitable specs (torque!) and can fit it on the existing input coupling, then why not replicate the original too...2. You need to implement a stepper driver in every case. While there are many ways of doing this, i am still going to recommed the combo L297 / L298. The dual full bridge chip is probably overkill as far as power levels are concerned, but this is a simple surefire way of getting the stepper part to work. The L297 is the step logic generator and the L298 is the full bridge and those 2 interface directly. The 297 takes simple step/dir input commands making control of the stepper real easy.3. You could use (gasp) an Arduino to do the conversion between the hall input and the stepper control output. Although if it was me, i would just grab a Mega328 and implement the board directly. No big deal.4. The software is real easy: time the input pulses and generate a pulse interval modulated output based on the multiplication factor programmed into permanent memory. You could even implement a signal conditioning curve if the input (or rather the gauge transfer function) is nonlinear.

author: Kremmen
author_rank: Super Contributor
timestamp: November 12, 2013, 09:03:24 am
content: To expand point 1 a bit: it is a tradeoff between choices:-Replicating the original where you need to rotate the input coupling proportional to the wheel speed is easy in that you only need to do what the original did. The challenge may be in fabricating a reliable coupling between the stepper and the original cable input ferrule or whatever you call it properly. Also you must think of the required input torque. The original gauge may not be the lightest to turn because the cable coming from the actual wheel has all teh torque you could ever need. So in the worst case you might actually need a gear ratio between the motor and gauge. For this option you will need a motor with some torque but how much - you need to find out from the original speedometer.-Driving the needle directly from the stepper shaft eliminates all of those issues but introduces some of its own. Now you must connect the gauge needle to the motor shaft which may or may not be a piece of cake. Also, the needle will not return automatically to zero when the bike stops, but must be driven there. So the controller must be aware of the needle position at all times. If the stepper never misses pulses then it is no big deal but has to be accounted for in the control software. And of course the conversion algorithm is totally different from the previous case. This option can be implemented with just about any kind of stepper, even a very small one. The won't be any appreciable torque at all, the motor just needs to wave the speedo needle around.

author: Psi
author_rank: Super Contributor
timestamp: November 12, 2013, 09:21:36 am
content: Some motorbikes may already use an electronic VSS.You could try get hold of the sensor part and mount it yourself.That way it's designed to work on a motorbike and you shouldn't have any issues.You may even be able to use the speedometer from that same bike and slap a ATtiny inbetween if needed to scale the pulses per second up or down. (It wouldn't surprise me if there was a pot inside the speedo to do this without needing the mcu)

author: Simon
author_rank: Unknown
timestamp: November 12, 2013, 09:51:52 am
content: Well I've not seen the actual bike so only have what he tells me to go on. The mechanical side of things is not a problem as that is what we do so coupling a motor to the speedo is not a huge concern to him it's the choice of motor and electronics that he is unfamiliar with.And yes - gasp - I would bang something together with an arduino, even if just on a Tiny85, why make life complicated.I think he wants to keep the original speedo as that saves messing with and messing up the original dash. The L297/8 combo sounds good to me I'll look them up. Any ideas on where to get motors ? what sorts will the L297/8 drive ? I'm not that well up on the realistic availability of steppers, never used one before.

author: Psi
author_rank: Super Contributor
timestamp: November 12, 2013, 09:58:36 am
content: How small is small?No idea how suitable it is but hobbyking have some tiny 3phase motorshttp://www.hobbyking.com/hobbyking/store/__6744__AD_100L_Micro_Brushless_Outrunner_1850Kv.html

author: Simon
author_rank: Unknown
timestamp: November 12, 2013, 10:06:49 am
content: Can that be driven by a L297/8 ? if I'm seeing it right I need to time the pulses on the hall sensor and then generate a new pulse sequence to clock the L297 with at the correct speed

author: amyk
author_rank: Super Contributor
timestamp: November 12, 2013, 11:40:16 am
content: Quote from: Psi on November 12, 2013, 09:58:36 amThat might be a bit too fast...You could probably find the needed stepper motors in the gauge clusters of scrapped cars.

author: Psi
author_rank: Super Contributor
timestamp: November 12, 2013, 11:55:00 am
content: I wonder if you could use a continuous rotation servo.They accept typical RC servo input pulses but instead of controlling their position you control the rotation speed and direction.Probably be a bit slow.

author: Terabyte2007
author_rank: Frequent Contributor
timestamp: November 12, 2013, 11:59:58 am
content: I assume you are thinking of driving analog gauges. What about replacing with a digital gauge? The pulses can then be handled with simple logic and a bit of calibration.

author: Psi
author_rank: Super Contributor
timestamp: November 12, 2013, 12:02:57 pm
content: Some mechanical cable speedometers are actually electronic inside and have a small generator built in.If its one of those you maybe able to hack it up to take the electronic signal directly.

author: Simon
author_rank: Unknown
timestamp: November 12, 2013, 12:34:19 pm
content: Quote from: Terabyte2007 on November 12, 2013, 11:59:58 amI guess he wants to keep it original and does not want the hassle of working on the dash.

author: Simon
author_rank: Unknown
timestamp: November 12, 2013, 12:35:36 pm
content: Quote from: Psi on November 12, 2013, 12:02:57 pmso the cable generates pulses and you think we could bypass that bit and pulse directly ?

author: Kremmen
author_rank: Super Contributor
timestamp: November 12, 2013, 01:41:28 pm
content: Before planning a replacement too far, first find out what the actual system in place is. Then design how to replace it. That will show you the gap to close.

author: Kremmen
author_rank: Super Contributor
timestamp: November 12, 2013, 05:07:56 pm
content: Quote from: Simon on November 12, 2013, 09:51:52 amThe L298 will easily drive anything relevant size-wise. The motors should be with bipolar coils to make things easy. Something like these:http://www.ebay.com/sch/i.html?_trksid=p2050601.m570.l1311.R7.TR11.TRC1.A0.Xstepper+motor&_nkw=stepper+motor+nema+17&_sacat=0&_from=R40You can supply the bridge (298) directly from the bike battery voltage (it does have a battery?) and the chip will easily handle both the voltage and the current. Be aware though that you need to take action to limit the max coil current of the motors in order not to burn them. Fortunately the L297 handles this part. The data sheets and app notes show you how, but briefly what you do is place a curent sense resistor into the return path of each coil H-bridge. The sense voltage is connected to the 297 and it will interrupt the PWM cycle when the coil reaches the set current. This prevents running the coils with overcurrent.You are free (i.e. you must) to set whatever reference voltage you want for the current sense voltage and this makes it easy to fit all the pieces together. A few hundred millivolts is easy to generate using some clever diode circuits, and is not so high as to cause significant power dissipation in the sense resistors - yet high enough to have reasonable noise tolerance. I have done this so if you need help, just let me know.Considering the alternative of using an Arduino or rolling your own, You only benefit from the Arduino if a matching shield is available. There seem to several 298 based shields but i didn't see a single one where also the 297 controller was used. This means that many of the shields will blithely bypass the question of current limit and let you worry about that. Many of them seem to be more geared towards controlling small DC motors where this is not an issue (and where a 297 controller makes no sense). So be aware that not every 298 shield is up to the task really.Then if you decide to roll you own there is no similar limitation of course, but you have to go to the trouble of designing the board and having it made. Not a big deal but extra effort anyway. Although i have to say that the thought of an Arduino inside a motorcycle speedometer, subjected to the moisture and temp variations of outdoors, may not be the longest life piece of kit.

author: SeanB
author_rank: Super Contributor
timestamp: November 12, 2013, 07:17:14 pm
content: 2 questions.If it is all mechanical then there is a reduction gear and drive inside the hub. You will find there are replacement gears that suit assorted wheel and tyre sizing. Simple to just change a single pair of gears and the speedo will be recalibrated for the new wheel size while still looking original. Easy enough to cut new gears if needed by almost any engineering shop once you have the right ratio of teeth.If it is electronic then the speedo unit will have a calibration system to change the wheel size to suit built into the microcontroller there. That is even easier to do provided you can get a factory programmer or an aftermarket unit.

author: iceisfun
author_rank: Regular Contributor
timestamp: November 12, 2013, 07:58:50 pm
content: I have been using these on robots, they give 1600 edges per rev, work at low and high speed, great build quality, etc.http://www.ebay.com/itm/251328650694And this to read the sensorhttp://www.robogaia.com/two-axis-encoder-counter-mega-shield-version-2.htmlFYI : If you do use one of these sensors make sure to ground the sensor instead of leaving it floating, there is a ground strap in the cable. If you don't this encoder reader chip is really sensitive and will get reset with small static shocks.

author: Reboot
author_rank: Contributor
timestamp: November 13, 2013, 04:16:20 am
content: ST recently came out with an integrated stepper controller/driver in a TSSOP package. This thing is really a wonder when you consider all that it does. It has ramp generation/step sequencing/current control/power stage/protection built in. 3A current output from this little guy too.Sparkfun has an evaluation board.https://www.sparkfun.com/products/11611Also Allegro makes several chips which are great for driving steppers as well with integrated pwm current control and the power stage.

author: Simon
author_rank: Unknown
timestamp: November 13, 2013, 12:21:03 pm
content: The speedo is fully mechanical (1995 year) so easiest work around seems to be a motor to drive it. The problem with the wheel change is also that the new wheels are wider so the sensor assembly is impossible.

author: Kremmen
author_rank: Super Contributor
timestamp: November 13, 2013, 04:15:33 pm
content: Quote from: Reboot on November 13, 2013, 04:16:20 amThis chip actually looks real interesting. It has a lot of nice features so i for one am going to take a closer look.For this particular application i would say it is a bit overkill because you cannot really use the advanced features, or at least not in a way that would be easier than the simple step/dir method of controlling the 297.

author: Simon
author_rank: Unknown
timestamp: November 13, 2013, 04:23:28 pm
content: Yea that is quite a complicated chip by the looks of it. Way over the top for what I want but useful for advanced applications.

author: Reboot
author_rank: Contributor
timestamp: November 13, 2013, 04:31:59 pm
content: This is a less complicated chip which I have used before for a couple of applications. It takes step and direction inputs and has current control via an analog input (pot or resistor to set current). It also has microstepping which increases the resolution of the stepper motor (not so necessary I think for your application).http://www.allegromicro.com/en/Products/Motor-Driver-And-Interface-ICs/Bipolar-Stepper-Motor-Drivers/A3967.aspx