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.

Does anyone have a solution to motor positioning?

Status
Not open for further replies.

bigal_scorpio

Active Member
Hi to all,

Well Eric, here it is!

What I want to do is make my car seats which are electric, have some kind of memory positioners like they have in many of the new cars today.

The seats have 3 motors in them 1 for height, 1 for backrest angle and 1 for seat position (nearer or further from steering wheel), they also have a motor for a lumbar support but this never gets used and is in one position whoever drives it, so I will ignore that one!

My intention is to have a PIC monitoring the positions and remembering them so I could press a single button when entering and have the seat adjust for either me or the missus.

If the wife has been driving the car when I get in my nose is touching the windscreen, mainly because she has the backrest tilted forwards at an angle of about 20%, I don't even know how she can get out without walking like quasimodo! ;) But if thats how she's happy driving then who am I to complain, besides moaning at the missus is a dangerous thing!

My problem is how to get the position of the motor and then remember it in a couple of different positions. I have googled for weeks to find how the new cars do it and found nothing!

I have thought about using rotary (shaft) encoders, but they seem fairly expensive and are pretty complicated with their grey coding etc.

Has anyone got a simpler method of finding the position of a standard dc motor? It does not need to be precisely accurate but if it is then all the better? I was thinking of maybe using pots connected to the seat somehow, but the mechanical part would be quite complex so if anyone has a better method then feel free to jump in.

Al
 
You could just count the number of turns the motor moves from one position to the next using an IR LED source and IR sensor. You could paint a small white mark on the motor shaft to sense rotation. If you need more resolution, you could paint more than one mark on the shaft. Accuracy of the mark spacing wouldn't be critical.

Another way would be to put a small magnet on the shaft (one or more) and use a magnetic detector. Since it operates at a low duty cycle, you could even use a bare reed relay (no actuation coil, the type used in window position alarm detectors) for rotation detection, which is very simple.

You also need to sense the direction of rotation of the motor during the learning process when programming the PIC to the seat positions. Assuming the motor is reversed by reversing the motor polarity, you could sense the motor polarity by monitoring both motor terminals with the PIC (through an appropriate resistor attenuator).
 
Hi bigal scorpio,

rotary encoders are not expensive at all. Here is one example: "ALPS STEC12E05". It has 24 detents with 24 positions. Cost at Reichelt.de: €2.10 including sales tax. To the UK it's sales tax exempted. (Minimum order value at Reichelt for foreign countries €50.00)

For the mechanical part I suggest to use a threaded shaft (available at home markets in lengths of 1m with M3 to M12 threading) connected to a stepping motor on one side and to the rotary encoder on the opposite side. Let the adjustable part of the seat move using a nut fixed to the seat and have the axle mounted in an angular suspension construction underneath the seat.

Here's a small sketch of the construction principle.

Hans
 

Attachments

  • SEAT.jpg
    SEAT.jpg
    28.3 KB · Views: 160
Grab a couple of old computer mice, the ones with balls.
Inside each you will find all the parts for two rotary encoders, comprising of a slotted disc and an optical sensor package. You should have no difficulty interfacing these to a PIC.

Of course you could go 'old school' and use an analog position sensor in the form of a linear or rotary potentiometer.

just had a thought.. the motors themselves can provide the position information.
http://www.discovercircuits.com/DJ-Circuits/motor-controller.htm
The circuit uses the current pulses from the motor brushes, counting these gives you a good idea of where the chair is.
 
Last edited:
Hi to all,

Firstly I need to explain that the seats are already electric, as Hans may think I am trying to convert them to electric.

The Idea of DIY encoders seems to work for me for two of the three motors which have a long worm drive shaft which I could fix a slotted ring to or mark with paint or such.

The third motor that controls the reclining part of the seat is totally enclosed and with no available shaft I would need a different method for this one. I had considered fixing an encoder type device to the seat frame and having the seats angle monitored by it with some kind of lever or cam etc. Maybe even a bar going to a linear pot.

The idea of counting the actual pulses from the motors as suggested by the mad professor would solve all my problems but I wonder if there would be discrepancies between the actual and expected positions long term, especially when you consider that other people besides my missus and me would be adjusting the seat to suit themselves, would there be a small error that could cumulatively become a large one?

I don't know the accuracy of the pulse counting method but I wonder if it could be supplemented maybe by a fixed central point in the seats movement range, like a microswitch that only closed when the seat was in one particular position (maybe one of the two memory positions) that could be incorporated into the program somehow, or am I making things harder?

Anyway thanks for the ideas so far guys, keep em coming, maybe someone on the forum has even done this already, I'm sure its not an original idea!

PS I have an Alcatel alarm that has an 8 channel RF keyfob and my intention is to press a different set of buttons for each driving position as so far only 5 channels of the alarm are being used and the alarms output is easy to utilise as I have already made it central lock and close windows and sunroof so far.

BTW the car isn't a posh ferrari or porche, its a 14 year old Granada 2 litre Scorpio,(hence the nick) my boy racer days are long gone and I just appreciate comfort and nice toys now! ;)

Thanks............Al
 
Hi bigal scorpio,

for the backrest you could use a tilt sensor which gives precise information about the angle of it.

I had a Scorpio Cosworth a while ago, also 2l, but a little stronger than the standard version. (179hp)

It had no electically driven seats, thus saving weight. The max. speed was nothing in comparison to a Ferrari Testerosa (350km/h), but it took off like a scared rabbit. :D

Hans
 
Hi bigal scorpio,

for the backrest you could use a tilt sensor which gives precise information about the angle of it.

I had a Scorpio Cosworth a while ago, also 2l, but a little stronger than the standard version. (179hp)

It had no electically driven seats, thus saving weight. The max. speed was nothing in comparison to a Ferrari Testerosa (350km/h), but it took off like a scared rabbit. :D

Hans

Hi Hans,

As far as I know all the UK Scorpio Cosworths are V6 2.9l. My mate had a 1997 frogeye model and boy did it move! ;) But it seemed to have a different sensor fail every week, Maf, Lambda etc, it spent more time in the repair shop than on the road. :)

As to the tilt sensor, wouldn't it be different every time I parked on a different slope? EG uphill or downhill? Unless I had a tilt sensor to tell the position of the tilt sensor? :eek:

Keep the ideas coming mate.

Al
 
Last edited:
Hi bigal scorpio,

Cosworth also tuned the 2l engines of the Sierra. Maybe there were just the V6 engines tuned for the domestic market.

My cardealer once showed me a Sierra tuned by Cosworth. There was even room under the hood for a match box.

My Scorpio didn't have the frogeyes. It was the older model. Ford saved a lot on the newer models and they were not as reliable as the older ones. There was neither ice warning in the model, nor a digital stop watch. The anti-skid was a piece of junk with rotten connectors every once in a while. 12 DIN-hp were sacrificed to fulfill EU exhaust gas standard III with never ending problems of the lambda probe.

On the new model the motor hood lifted all by itself at a speed of 220km/h. Ford's reply: "That might happen from time to time."

You are right about parking at slopes I guess. Those sensors always maesure the angle between the natural horizon and their tilt angle relative to it.

I'll think about another way to measure that angle regardless of the slope.

Hans
 
hi Al,
If you are not already commited to a solution you could consider this.

As I understand it, you not interested in the 'intermediate' position of the seat back rest while its being moved by the motor.

All you need for the seat back rest are a couple of end stop micro switches.

One end stop uSw operated when the backrest gets to your wifes required position and another uSw in the opposite direction when the backrest gets to your position.

A twopole two way switch. Marked 'His and Hers'.:rolleyes:

Select 'His' the motor drives towards his position till its stopped by the uSW.
Throw the switch to 'Hers' and it drives the other way until its stopped by the hers uSw.

No encoders, MCU's etc...:)

Do you follow that OK.?
 
Last edited:
Hi Eric,

How is the painting going?

Did you see my ESR sine wave, its near as dammit 5v and lovely to see!

As to the uSW idea, I suppose it could work on the seat back but don't forget there are another two motors that need to be positioned too, the distance one and the height one, distance maybe could be done too with uSW but the height would be really tricky as there is very little up/down motion and even less room under the seat for any extra parts.

Thats why I thought of using a uC to do the whole job. I was trying to find out the accuracy of using the pulse count method as suggested earlier in the thread, my concern being that the motors have vastly varying loads ie empty seat, my weight or the wifes weight, I'd better mention that the wife is just a slip of a thing and I'm 20 stone. So there is sometimes going to be very different loads on the motors.

If the pulse count method worked it would be much easier to implement and would even mean maybe I could take the feeds from the switches at the side of the seat rather than going under them to fit parts and wiring.

So if you or anyone else has used this method successfully please let me know, bear in mind they are just standard brushed DC motors and not steppers.

BTW Eric, what do you program in? Basic, C, Assembler etc? I ask as I am trying to learn Mikro Basic (I tried assembler and it was like learning Chinese to me) and have got stuck already by changing from a standard Pic as used in the tutorial to a 12F629 and its something that should be really simple that's stopping me. ;)

Regards...........Al
 
Last edited:
Hi Eric,

How is the painting going?

Did you see my ESR sine wave, its near as dammit 5v and lovely to see!

BTW Eric, what do you program in? Basic, C, Assembler etc? I ask as I am trying to learn Mikro Basic (I tried assembler and it was like learning Chinese to me) and have got stuck already by changing from a standard Pic as used in the tutorial to a 12F629 and its something that should be really simple that's stopping me. ;)

Regards...........Al

hi Al,
External house painting is done, keep trying get the garage and outbuildings finished but it keeps raining.!

I program in most languages, but not 'C'.
If you have problems with Assembler I wouldnt recommend 'C' as a first language.
Many years ago when 'C' came out it was easy to understand but as it got more complex it ran out of available symbols.
So now, IMHO we have a language that is almost gibberish.

I know my peers will give me flak, but thats what I feel about 'C'.:p

Some of the Basic's are quite easy to use.
How much is your budget for a Basic compiler.?
 
As to the uSW idea, I suppose it could work on the seat back but don't forget there are another two motors that need to be positioned too, the distance one and the height one, distance maybe could be done too with uSW but the height would be really tricky as there is very little up/down motion and even less room under the seat for any extra parts.

Thats why I thought of using a uC to do the whole job. I was trying to find out the accuracy of using the pulse count method as suggested earlier in the thread, my concern being that the motors have vastly varying loads ie empty seat, my weight or the wifes weight, I'd better mention that the wife is just a slip of a thing and I'm 20 stone. So there is sometimes going to be very different loads on the motors.

If the pulse count method worked it would be much easier to implement and would even mean maybe I could take the feeds from the switches at the side of the seat rather than going under them to fit parts and wiring.

So if you or anyone else has used this method successfully please let me know, bear in mind they are just standard brushed DC motors and not steppers.

Give the pulse count method a try, if you find it to be unreliable (or not working at all) you will have to use some type of encoder.

But even with a rotary encoder you will need a reference point - it may be mechanical (a µswitch), optical or magnetic but the µcontroller needs to "know" where is the seat when it powers up - and even if you leave it "allways on", there is the posibility of "crrep" caused by missing pulses.

The best aproach is to make the seat go in one direction until it reaches the reference (end) point and then back up to the desired position.

And beware of optical sensors under a car's seat. They may be "blinded" by debris, lint, etc

Some years ago, a local company replaced the mechanical "position switches" in some lifts (elevators) with optical ones. Of course, they atracted every kind of greased dirt and had to be cleaned periodicaly. Eventually they had to use magnetic sensors.
 
hi Al,
External house painting is done, keep trying get the garage and outbuildings finished but it keeps raining.!

I program in most languages, but not 'C'.
If you have problems with Assembler I wouldnt recommend 'C' as a first language.
Many years ago when 'C' came out it was easy to understand but as it got more complex it ran out of available symbols.
So now, IMHO we have a language that is almost gibberish.

I know my peers will give me flak, but thats what I feel about 'C'.:p

I would totally agree - I don't do C either :D
 
Hi Eric and ecerfoglio and Nigel,

There must be a fairly simple solution to my needs, the newer models of my car have the same motors and wiring but also have a module for the memory function, so it must be possible. There may be some secret switches somewhere in the mix but they don't show them on the diagrams!

I will live in hope that someone has a tried and tested solution to this as I don't have a definate schedule to do it, I'm in no hurry. :)

Eric, In have Mikro Basic already, it came with my developement board"EasyPic 5" which is amazing, but it caters for the larger chips mainly in the documentation, the compiler I mean!

What I am doing is trying to use a 12F chip just to do something simple, flash an LED for example but the code is confusing me!

TRISB = 0

This supposedly sets port B as output. All well and good except that the 12F629 has no port B, infact in the datasheet there is no port letter allocation at all and I have tried TRISA, TRIS,0 and all I can think of but the compiler says its wrong!

So what is the discipline when using a chip with a single unnamed port like the 12Fs? Why should it be easier to use a 40 pin 16F877 than an 8 pin 12F?

Al :confused:
 
Last edited:
Hi Nigel and all,

Yep, too true Nigel! I got so used to using the Tris commant that I was thinking you needed it on all the chips. Hehehehehe

Well you live and learn, although with me now it seems to be live and forget! :)

Al
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top