DC Motor Home position

Hello everyone!

Could someone help me to set a default or home position of a dc motor?

Just like how servos returns to it's default position once the arduino was reset. You just have to set its angle on zero under void setup.

But in my case, I have a dc motor with a magnetic encoder. I can set the position i want on the motor and stop it. But i need to know how to program it wherein it will go back in a "zero angle position" every time the arduino is power on or reset.

You know how to "set the position i want on the motor and stop it". So can't you just do that for whatever you choose as the home position in setup before the rest of the code starts running?

Steve

To identify the HOME position you will need some sort of detector such as a microswitch or an optical switch that is triggered when the motor gets to the HOME position. Move the motor slowly until it triggers the switch and then set you position counter to ZERO.

Some encoders have the ability to identify one spot that can be used as a HOME position.

...R

slipstick:
You know how to "set the position i want on the motor and stop it". So can't you just do that for whatever you choose as the home position in setup before the rest of the code starts running?

Steve

Hello Steve, thank you for your time. Hmm. The thing is every time the arduino is reset, the number of rotation is zero, so if I move the motor forward i will just have to set a condition that, if the number of rotation is this then motor will stop.

So for example, the power of arduino was accidentally off. The motor will stay at that last position. So the moment the arduino is on, the rotation is back to zero and the motor will count another set of rotation forward.

The output that I want is for the motor to automatically go back to its original zero rotation position when the arduino is reset.

I hope you understand. Thank you.

ettexx:
Hello Steve, thank you for your time. Hmm. The thing is every time the arduino is reset, the number of rotation is zero, so if I move the motor forward i will just have to set a condition that, if the number of rotation is this then motor will stop.

So for example, the power of arduino was accidentally off. The motor will stay at that last position. So the moment the arduino is on, the rotation is back to zero and the motor will count another set of rotation forward.

The output that I want is for the motor to automatically go back to its original zero rotation position when the arduino is reset.

I hope you understand. Thank you.

What does your magnetic encoder do when it detects the home position? Is your Arduino program detecting it? If so, just run the motor to detect the magnetic encoder each time the program starts.

Paul

I have a dc motor with a magnetic encoder.

Post links to the actual product(s), so we have some idea what you are talking about.

ettexx:
So for example, the power of arduino was accidentally off. The motor will stay at that last position. So the moment the arduino is on, the rotation is back to zero and the motor will count another set of rotation forward.

Did you read Reply #2 ?

...R

Hello, I'm sorry I haven't posted my components.

Here are they:

DC MOTOR

Encoder

Driver:

I have read somewhere that hall effect sensors helps on setting a home position? I believe that the encoder I'm using already have that sensor?

I'm just a beginner in programming so I'm not too sure how to start to program to be able to set a home position.

Thank you for your efforts.

Paul_KD7HB:
What does your magnetic encoder do when it detects the home position? Is your Arduino program detecting it? If so, just run the motor to detect the magnetic encoder each time the program starts.

Paul

Hello Paul, I'm not sure if my encoder is detecing a home position. All I know is it counts the rotation of the magnet on its shaft and then I programmed it to stop whenever it reaches the number of counts I want.

Robin2:
To identify the HOME position you will need some sort of detector such as a microswitch or an optical switch that is triggered when the motor gets to the HOME position. Move the motor slowly until it triggers the switch and then set you position counter to ZERO.

Some encoders have the ability to identify one spot that can be used as a HOME position.

...R

Hello sir, I posted here the components I'm using. Could you check if the encoder I am using already have a detector to identify a HOME position? If so, can you help me to have an idea how to program it?

Thank you very much!

jremington:
Post links to the actual product(s), so we have some idea what you are talking about.

Hello, I'm sorry I haven't posted my components.

Here are they:

DC MOTOR

Encoder

Driver:

I have read somewhere that hall effect sensors helps on setting a home position? I believe that the encoder I'm using already have that sensor?

I'm just a beginner in programming so I'm not too sure how to start to program to be able to set a home position.

Thank you for your efforts.

ettexx:
Could you check if the encoder I am using already have a detector to identify a HOME position?

No it does not.

...R

IIRC telescope mounts that use encoders for keeping track of positioning use a µprocessor, such as the PIC16F676A, for each encoder. These µprocessors keep track of an encoder's count.

Periodically, the main processor, say a PIC18F85J10, queries the µprocessors as to their counts, updates its positioning data and the µprocessors' buffers are reset.

When the user asks the main processor to go to a new object, it uses the current position data, the time, date and location to calculate the number of encoder counts on each axis necessary to center the object, directs the µprocessors to execute the counts and monitors their action. Easy-peesy.

Meade Instruments attempted to patent the use of a computer network for telescope control in the early '90s. Prior art used open loop control relying on step motors (Celestron and Vixen). When its competitors made use of similar networks Meade wasn't able to defend its patent.

GeoAC:
IIRC telescope mounts that use encoders for keeping track of positioning use a µprocessor, such as the PIC16F676A, for each encoder.

This is not a PIC Forum. You can do the same sorts of thing with Atmega MCUs.

...R

Sure you can, but the commercial products currently use PICMicros and Torshiba processors. I don't pretend to know what AVR design would/could work in this application. I happened to have the Celestron Nexstar GT parts at hand. For over twenty years the processor that was used as the server in these networks was the Motorola 68000 design. Same as powered the first Apple Mac.

What is an Arduino, any way? As I understand it, it is a development environment. Yes, it is built around some Atmel processors, but it has been adopted by other manufacturers producing AVR designs. And there some pretty creative work arounds to use the IDE, even with PICMicro devices. Arduino as a Pic Programmer! - Exhibition / Gallery - Arduino Forum

Additionally, you seem to have missed my point that the OP wanted a simple solution to a pretty complex programming problem. Now that Microchip owns Atmel not sure what the difference is all that important. What Arduino represents is free open source development tools, not a brand of processor.

The only Arduino/AVR solution I'm aware of is the OnStep solution (onstep@groups.io) which is based on step counts not encoder counts. Celestron solved that problem in the mid '80s with the Intel 8051, that was a development of the Intel 8048 introduced in 1976. These were Harvard architecture processors, as are most of the processors used Arduino development boards. There is a way to use a UNO V3 to program the 8051. Atmel still makes a few processors based on the 8051...

Atmel, now Microchip, (8051 Family)

80C32E, AT48801, AT8032X2, AT80C31X2, AT80C51RD2, AT83/87C5103, AT83/87C5111, AT83/87C5112, AT83C5134, AT83C5135, AT83C5136, AT83EB5114, AT85C51SND3, AT87F51, AT87F51RC, AT87F52, AT87F55WD, AT89C1051, AT89C1051U, AT89C2051, AT89C4051, AT89C51, AT89C5115, AT89C5130, AT89C5130A, AT89C5131, AT89C5131A, AT89C5132, AT89C51AC3, AT89C51CC03, AT89C51ED2, AT89C51IC2, AT89C51ID2, AT89C51IE2, AT89C51RB2, AT89C51RC, AT89C51RC2, AT89C51RD2, AT89C51RE2, AT89C51SND1, AT89C51SND2, AT89C52, AT89C55, AT89C55WD, AT89F51, AT89F52, AT89LP2052, AT89LP213, AT89LP214, AT89LP216, AT89LP3240, AT89LP4052, AT89LP414, AT89LP428, AT89LP51, AT89LP51ED2, AT89LP51IC2, AT89LP51ID2, AT89LP51RB2, AT89LP51RC2, AT89LP51RD2, AT89LP52, AT89LP6440, AT89LP828, AT89LS51, AT89LS52, AT89LS53, AT89LS8252, AT89LV51, AT89LV52, AT89LV55, AT89S2051, AT89S4051, AT89S4D12, AT89S51, AT89S52, AT89S53, AT89S8252, AT89S8253, AT8xC5122, T80C31, T80C31X2, T80C32, T80C51, T80C51FP1, T80C51I2, T80C51RA2, T80C51RD2, T80C51U2, T83/87C51RB2, T83/87C51RC2, T83/87C51RD2, T83/87C51U2, T83/87C52X2, T83C5101, T83C5102, T87C51, T87C5101, T89C51AC2, T89C51CC01, T89C51CC02, T89C51RB2, T89C51RC2, T89C51RD2, T8xC5121, TS80C52X2, TS80C54X2, TS80C58X2

GeoAC:
Sure you can, but the commercial products currently use PICMicros and Torshiba processors. I don't pretend to know what AVR design would/could work in this application.

Then I'm not sure I see the point of your Post on this Forum :slight_smile:

I could see the point if you were recommending some convenient off-the-shelf product that the OP could use to save himself the time required to build something, bur I don't think you are.

...R

1 Like