Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Driving Stepper Motor Gauges

Status
Not open for further replies.
#4 is key to simplicity. The ST method looks at the current profile (integrates current) for the energized coil. In the stalled condition, the period of EMF is less. It seems to me that just looking at the non-energized coil is simpler.

As a first approximation, though, I am just going to drive 600+ steps to ensure I am past the FS stop and then back off 300 full steps. The exact number will be determined by experiment. As Pommie noted, this is not for a run of >100,000 devices. And, as for Nigel's comment, these devices are considerably quieter than the old disk drives. I think driving to FS stop rather than to zero stop has more panache.

I took the day off for other things. Tomorrow will be a "go to Cleveland" day with mowing afterwards, if it doesn't rain. When I get back to it, I will look at how to implement the bridge arrangement using just the PIC. A smart chip with dual bridge and drivers combined for that level of current may still be the easiest way to go.

John
 
John:

I would think, you would just have to drive 4 full steps of 90 degrees each. I don't think you need to even back off.

Then you drive with micro-steps. At least that's how I see it. So, you need two channels of PWM and an H bridge.
 
This https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=17&ved=0CGUQFjAGOAo&url=https://application-notes.digchip.com/074/74-42627.pdf&ei=4SllVc_NJIHpsAW1qoOIBA&usg=AFQjCNEwUaCvqxHwbY_3EQb0k9NFVV4M2A&sig2=gvMWykzRsrD6i1CtuFW-nQ&bvm=bv.93990622,d.b2w app note has a lot of holes, but it somehow fills in a fair number of details too.

Here's https://www.google.co.ls/patents/US7816883 a patent that attempts to say driving the stepper to a fixed stop has issues and the patent tries to correct them.
 
Last edited:
Maybe I'm not following very well.

The stepper motors jp was talking about from the data I assume are x27.168 types, these have built in gearbox's, and have1/3 degree per step, microstepping these wouldnt give any benefit, backlash in the gears is probably in the order of 1/2 a step.

I have a dash cluster from a french car, it uses stepper motors directly on the needle pointers, no gearbox, and the motors are only about 15 steps per rev, so obviously they are employing microstep to get the resolution.
The cluster has 4 pointers/motors, there is no electronic indexing, so they must beusing the stalling method, its cheaper.
 
UPDATE:

Well, I finally feel well enough to get some outside work done. The sun feels good.

As for the stepper, I have a full step program working. It clocks to TMR0 (8-bit) and runs well with a pre-scale of 1:16 (PIC MCU at 8 MHz), but not 1:8. In other words, it keeps pace with a 2 mS signal in full-step mode.

Edit: In half-step mode, it also works well at 1:16 pre-scale, but not at 1:8. Of course, it is considerably slower than full step at the same timing.

John
 
Last edited:
I have run mine at 600 steps/sec which is the maximum instantaneous step rate, 600s/s = 1.6mS, I run the motor direct of the pic, a decoupling cap and a 10uF across the pic's supply speeds things up a little, also if your pointer is balanced it will go quicker.
The motor can step even quicker but you need to program an acceleration curve for the step sequence, I cant be bothered.

I got around to making a case for one of my aircraft guage clocks, the case is limewood, and the legs are turned from a piece of laburnum, the hours is a nimrod fuel guage 0-12,000 lb, and the minutes is from a uk wessex helicopter fuel guage and is 0-6,000 lb.
 
Hi dr pepper:

This time of year 20 acres can revert to wilderness pretty quickly. One of my daughters and her family ( six additional people) are arriving this Saturday for a few days. Needless to say, I have been very busy with other things. After getting the half-step program running directly from the PIC, I have done nothing else. My schematic is here:

upload_2015-6-22_19-5-37.png


I hope I won't be shunned for having four-point connections.

It is really fun and works well in both MPLAB SIM as well as MPLAB ICD3 SIM. It's kind of fun to watch it step to command. Just for giggles, I want to try quarter stepping, but don't see any practical use for it with the gauges I am using.

I like your box. FWIW, I have many hours in GA aircraft and like what you do with those archaic instruments. Apparently, limewood = basswoood in the US. which is a nice wood to work with, but it doesn't have a particularly distinctive grain or color.

John

BTW: How you insert a thumbnail of a PDF file?
 

Attachments

  • Motor Diodes.pdf
    8.2 KB · Views: 310
No shun from me, in fact your design is more professional, I didnt bother with the diodes, my system relies on the built in diodes in the pic, and its worked fine for this long, The built in protection diodes seem to be pretty hardy.
The backlash in the gears is more than a sigle step, half and quarter step just makes a slightly smoother rotation.

I like aircraft instruments I have a few of them, another clock uses 2 landing gear guages from a shackleton, and for seconds theres a zero reader, the reader passes through zero on seconds 0.

My wife is a woodworker and turner and has a selection of wood, I have heard of basswood but didnt know it was lime.
Lime is very good to work, the wife uses it to carve with as it peels and shapes/sands easily, beech is very similar but it clogs up cutting tools with gunk.
She likes a couple of special woods from the us, we get them sent now and again, I think they are cocabola and black sassafrass, might have spelled that wrong, its very expensive.

I've never linked to a pdf, can you do that, anyone?
 
My home is very near a large Amish area and a wood kiln that gets its wood largely from the Amish. Sassafras has nice grain and color, but the kiln owner has most of his sassafras ordered quartersawn. Here is an example from the web:

upload_2015-6-23_6-15-15.png


At the kiln, the cost is only about 50% more than oak. It is often used as a contrasting or highlight wood here, but you won't find it at the "big box" stores.

John
 
That looks like the stuff we've had, grain wise, only it was nearly black, I odnt know if it grows like that or if it was treated to make it black.
A piece 6" x 4" x 3/4" thick here in the uk would be around 10 quid, about 16 usd, enough for a breakfast bowl would be triple that.
Oak turns well but is hard to carve, it also makes good hammers, gears and bearings, maple is the best for that, I've maintained industrial machines for a while now, the odd time I've seen very old ex steam powered ones with maple bearings.
 
Background:
One such device is to show when pallet forks attached to the front-end loader are level. I used an accelerometer to measure level and a GLCD for display. The prototype "worked" but had two major deficiencies: 1) The display was hard to read in all lighting conditions; and 2) "Bounce" made the reading too variable for its intended purpose.
Although I have a lot of experience in stepper servo's used in floppy and hard disk drives, when I think of the overall requirements for readability , reliability and averaging, bounce, I think an analog display would be best for all conditions using the most accurate tilt sensor you have.

Voltmeters with large kOhm /Volt have poor mechanical vibration, whereas Current meters with low shunt R have good back EMF dampening characteristics. So choose a meter with the lowest uA scale and divide down your output and drive with low impedance for good dampening.This has to do with needle mass and coil torque current and Rs series resistance in circuit.

I would choose a short needle Ammeter for cars and modify the shunt to more reasonable currents ( trading off dampening) then mount at right angles.

Electrolytic Tilt sensors have direct reading, good viscosity with mineral oil.
**broken link removed**
 
Heres the pic of the completed aircraft clock, the picture is totally naff, it looks more yellow and much nicer than that:
 

Attachments

  • Photo0341.jpg
    Photo0341.jpg
    514.5 KB · Views: 431
Why did your wife miter the top and lap the bottom joints? Not criticizing -- just wondering. BTW, if you can find quartersawn sycamore, it is also quite attractive:
upload_2015-6-23_18-36-16.png



Tony Stewart
Thank you for the suggestion. I was not aware of that name for an inclinometer method based on liquid level. Right now, I am assuming that any gravity-based device will show too much jiggle or be too damped to be useful. That is why I am looking at the two critical angles in the mechanical linkage. They are relatively fixed. As for the indicator itself, I will probably include a digital output as well as the analog indicator. The problem with a digital output, presumably and LCD, is readability in all lighting conditions. If I go with LED's, they hog the battery current. The stepper gauges I have had experience with in my automobiles do not bounce much, even when going over rough roads.

John
 
You can make the dampening factor critical with no overshoot and adjust slew rate by same methods used in electronics. NPL/Hitachi early stepper HDD's had a rotary plastic disk attached to stepper motor to prevent overshoot in microstepping at 600 tpi. It had some fluid, probably mineral oil and a small brass disc enclosed with gaps about the same as the disc.

Can you define is your slew rate of angular change and frequency of vibration? Analog ammeters are very sturdy from low ESR and high readability under any conditions ( except in the dark without lights)

Inclinometers must be defined like Op Amps in terms of offset, Slew rate and Bandwidth to decide which technology is best suited. Can you ? 10 deg/sec 5Hz resonance? 5 deg max error?
 
Last edited:
Er well, the mrs didnt make the enclosure I did, I couldnt be bothered to mitre all the corners, you cant see the joins at the bottom so its just butted, I think its looks 'modern' too.
We have a fair bit of sycamore, theres no interest for it in woodturning circles here, allthough it looks nice with its light finish, and its real good to turn, in the uk sycamore causes all kinds of trouble with its sticky residue and pesky rooks like to roost in them, that might have something to do with it.

Stepper motors are used in many vehicles that still use pointers, if they werent effective that certainly wouldnt be the case.
Bounce just doesnt happen with a stepper, the only drawback is if for some reason a step is missed then inaccuracy is introduced untill the next reset.
Another movement I've fiddled with is aircore, these were common in automotive apps before steppers, however you have to control them like microstepping a stepper motor, which is tricky and requires more hardware, allthough you can build a aircore movement fairly easily.
 
This may be a good choice for low power Analog Inclinometer with two BW choices in sensors 7Hz or 60Hz 1mA 3~6V

+/-10 deg range full scale perhaps best accuracy for true level. Gravity sensed and critically damped by gas medium.

**broken link removed**
 
UPDATE:

After a wonderful month of having my children and their families visit, I have had a few days to review what I had done. These comments apply to the typical GM instrument cluster stepper motor described initially.

Every description I could find of driving such motors directly from a PIC use either a full-step or half-step sequence. Reference is made to quarter stepping, but an actual programmable sequence is not given. The discussion simply shifts to microstepping. While it is clear from the previous discussion that quarter stepping such motors is probably worthless, as a challenge I wanted to see whether I could do it. Moreover, I wanted to do it without using PWM to modulate the power to the coils. I relied heavily on AN907 and AN906 for the attached demonstration program.

The first problem was developing the sequence for energizing the coils. This MikroElektronika users' maunal, Figures 4 thru 7 (**broken link removed** ) offers clear examples. Comparing its half-step chart with Microchip's make clear the approximations that must be made. I drew the desired patterns using EAGLE and have attached the resultant BRD file as a zipped folder. You may want to go to Options, User Interface and change the background to white, if it appears as black. Also, showing the grid helps. For those who refuse to open zip files, I have also attached a pdf, but it lacks the grid.

Finally, I have attached my code as a pdf. I used the internal oscillator at 8 MHz. The code does nothing except demonstrate the three modes of stepping. Each push of the switch changes direction and/or mode as shown in the ModeSelectTable. Of interest, a 1:8 TMR0 prescaler did not work with full steps, but did with quarter steps. Using a 1:32 prescale gave very jerky quarter steps, which is probably a result of the approximations I made compared to the "perfect" sine/cosine curve.

John

Edit: There is a small error in the code. For the 16-bit counter, the preferred (PicList) first instruction is "movf CountL,f," not " movf CountL,w" as shown.
Edit#2: A 1:4 prescale works well with quarter stepping. I am not particularly surprised. Didn't try 1:2. Needle is quite "alive" at 1:4.
 

Attachments

  • Stepper Drive Patterns.zip
    5.7 KB · Views: 257
  • Stepper Drive Patterns.pdf
    22.3 KB · Views: 342
  • Stepper Gauge_16F1829_v.1.6.pdf
    49.3 KB · Views: 392
Last edited:
Interesting.

Microstepping will make the motor quiet, the clock I made with these motors on by desk is noticeable at the start of a new hour when it returns to minute zero with the noise it makes.

I messed with code to microstep, then I came across the easdriver, sure makes things easy, it microsteps and all you need to do is apply step pulses and a direction i/p, and its cheaper than just a l298 module which you'd need for anything larger than this, pololou do a version that steps to 1/32, I have tested one of these on a big fat stepper at nearly 300,000 steps/sec, with the motor running at 3000 rpm, works perfectly.

Generating the sine/cosine and implementing it on a higher impedance motor like this has its complications, firstly because the motor is comparitively high impedance you'll need a higher voltage supply to get current limit quickly, an inverter might be required.

Another thing I toyed with is a dc motor driving a pointer direct, with a cheap 1024 encoder on the back you can use one as a servo, I prototyped something like this, I pinched roman blacks code for a precision dc motor speed control and turned it into a servo, at high speed you get oscillation, but at moderate speeds (still quick) its very accurate, I went down this route as my interest in aircraft instruments demands a motor that can rotate many times to reach its target position, carefull application of liquid paper to blank off one of the optical encoder slots gives a z or once per rev signal.
 
UPDATE
Since the last episode, I got the stepper working quite nicely. However, if you screwed enough with it, you needed to re-zero the pointer. That could be an annoyance in its intended application. So, I tried using a servo (See: Pommie, post #6 ).

I used the CCP module in compare mode (PIC 16F1829 at 8 MHz). That gave me a 16-bit register, which worked nicely with the 13 bit data I am capturing. I set a repeat pace of about 20 ms using a TMR2 interrupt (1:64 prescale, 1:3 post-scale, PR=208). Dividing the 13-bit data by 2 gave me a count that produced a pulse within the acceptable range of a conventional servo. A Hitec HS5125MG digital servo ( **broken link removed**) was used for my output. I could feel movement of the servo with a change in pulse width of 6 us. Back calculating, that is approximately the change expected for a rotation of the sensor by 0.5° and was about the smallest change I could reproducibly resolve with my scope due to s little jitter in the end-pulse time.

John
 
Since this thread started I messed around with another couple of these motors:
The code runs on a pic, but seeing as I'm now into arduino I think I'll put a bare bones 'duino on a bit of proto board and control things from it, maybe with a precision time clock module, th elittle red light on the right flashes, the guages are from a shackleton bomber, something to do with the landing gear.
Servo's do the job, I've used them in instrumentation before, you hav eto use good ones though, which is pricy, as the cheapo ones just sit there and buzz, which no doubt would wear out the gearbox in no time.
 

Attachments

  • Photo0370.jpg
    Photo0370.jpg
    588.5 KB · Views: 358
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top