[SOLVED] Trouble reading motor feedback

Hello all, this is my first post here!

I cracked open an old Oyster Satellite Tracker, something like a much older version of the Oyster 65/85. Inside I found a two heavily down-geared motors each with 4 wires coming out. I can't seem to find any information about these motors, have even tried contacting ITT with no luck.

We touched the thick black and blue wires to a 12V car battery and the motor seems to rotate smoothly and uniformly in a single direction. Connecting the wires the other way turns the motor in the opposite direction. Connected directly to the battery the motor seems to draw about 0.8A.

There are two thinner red and white wires which I assume give some sort of feedback on the rotation of the motor. I have no idea how. Measuring the resistance across the white and red wires with a multimeter just shows a disconnect. Measuring the voltage with the motor connected to the battery shows 0V.

The Motor:

I made a potential divider with a 100 ohm resistor and measured the voltage across the white and red wires.

  • If the red wire is connected to positive and the white wire grounded we see nothing, just a constant potential when the motor is connected to the battery.
  • If the red wire is grounded and the white wire is connected to positive we see a (slight) oscillation in the potential as the motor spins. It appears like a step function - on/off/on/off. The motor can land on either high or low resistance when disconnected from the battery.

Diagram:

Photograph:

Code:

void setup() {
  Serial.begin(9600);
}

void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  Serial.println(sensorValue);
  // delay in between reads for stability (not accurate due to println in loop)
  delayMicroseconds(5); 
}

Output:

958
958
958
957
958
957
.
.
.
958
736
958
736
736
958
737
958
736
958
737
736
958
737
958
737
958
737
737
958
737
.
.
.
957
957
957
957
958

In Arduino language 1024 means it is reading 5V across the potential divider and 0 means it is reading 0V. Above I show a few 958,957 which is with the motor disconnected from the battery. This is followed by oscillation between 958 and 737 which happens when the motor is conneted directly to a car battery. Finally I show 957 with the motor disconnected from the car battery. Sometimes (if you time it right) this can land on 737 and it will stay like that until connected to the battery again.

What is going on in the motor? Some sort of diode? A hall effect sensor? How do I get a more stable feedback on the rotation of the motor?

I have tried 200 ohm, 1000 ohm, 10000 ohm resistors in the potential divider, they are all worse and whatever is in the motor doesn't appear to be an Ohmic resistor. Is 5V the right voltage to apply? I have tried 3.3V and it is worse, higher than 5V could blow the Arduino.

Am I even approaching this the right way?

Ideally I would like to have the values ocillate about a digital HIGH/LOW in a very pronounced way so I can use an interrupt to count them.

Please help :D!

For the interested:
I'm using these motors in an attempt to build a homebrew solar tracker, for mounting on an RV. Details of how the project is going are available here, more information on the motors is available here and here

So it looks like the sensor is an active component and not a mechanical switch. It's only 2 wires so probably not an optical interrupter. It acts differently in different directions so it's probably has a semiconductor (diode or transistor). It seems to work without the battery connected.

So far it's nothing that I know. My next guess would be a Current Loop sensor that draws different currents in the Sensed and Un-sensed states. This would allow the controller to detect a wiring failure (no current) as well as the two sense states.

Measure the resistance across the sensor in both directions, both with the sensor inactive and the sensor active. Have the motor wires disconnected when you take the sensor measurements.

Do the same but with current measurements instead of resistance. Typically a current-loop sensor would draw 20 mA in the 'HIGH' state.

Thanks!

I will do what you suggest this as soon as I figure out a nice way to measure the resistance and current... not sure my multimeter is up to the job.

StewieG of the Arduino IRC points out the following: http://www.netmotion.com/htm_files/mc_valeomotors2.htm

It has a motor code number that looks suspiciously like the one printed on the unit and gives the following information:
Satellite Dish GMPG 404.335** contact us for more information
DC Motor with Worm Gear
210:1
Selflocking system, Hall-IC for positioning

That gearing looks about right.

Could this motor have a Hall-IC? Would this explain the semiconductor nature of the resistance?

I'm not too sure how to read a Hall-IC or how this is wired up internally on the motor. They all seem to have 3 legs but I only have 2 wires.

Measure the resistance between all the pairs of wires to see if the motor connection are also used for the hall sensor?

Looks like it COULD be something like the Allegro A1357 "Two-Wire High Precision Linear Hall-Effect Sensor IC". You connect it in series with a resistor (like you were doing) and the current through the resistor (voltage across the resistor) is determined by the magnetic field. The chip needs a minimum of 4.5V to work so if you only give it 5V that leave a maximum of 0.5V to drop across the resistor. Looks like they intend it to be powered by 12V (18V Max). At 12V supply the shunt resistor should be less than 454 Ohms. They give formulas for calculating the resistor size for other supply voltages.

http://www.allegromicro.com/Products/Magnetic-Linear-And-Angular-Position-Sensor-ICs/Linear-Position-Sensor-ICs/~/media/Files/Datasheets/A1357-Datasheet.ashx

Amazing, john it looks like you are exactly right!

In desperation I took the unit carefully apart and inside there is a board with an Allegro A3321 connected to two wires only (red and white). It also has some sort of circuitry that looks to me like an SMT capacitor.

Now I just need to find the Allegro A3321 datasheet to be exactly sure of the spec. I also need to construct some kind of circuitry that maps 4.5V -> 0V and ~12V -> ~5V so I can read it with my Arduino without worrying about blowing it. I guess a reasonably high frequency MOSFET to keep it completely isolated is the way to go, agree?

Pictures:

Perfect.

I don't know how you did it but you've figured this right out! Thanks a lot John.

I just connected up to a 12.7V car battery in series with a 440 ohm resistor. The white lead is connected to the positive terminal and the red lead to the negative via the resistor. Measuring the voltage across the resistor with my multimeter I see 1.5V in the HIGH hall state and 7.9V in the LOW hall state.

Back of the envelope:
12.7V - 7.9V = 4.8V this I assume is the 4.5V minimum you spoke about!

All that remains is to figure out how to step this down to between 0V and 5V. MOSFET or as darkther4py of the Arduino IRC suggests a voltage divider and clamping diode should probably do it.

RE: Datasheet
Can't find anything online. Phoned MSM (Allegro's UK distributor) they said they'd e-mail me if they found it but they only have access to what is online.

Still no datasheet for the A3321.

I have thought about 12V to 5V conversion a bit more and (thanks to the guys on Arduino IRC) have arrived at the idea of an optocoupler. I think I can use a 4N25 optocoupler to let a 2-Wire Hall Sensor@12-14V drive an Arduino digital pin@5V.

As I said above, with a 440 ohm resistor in series with the hall sensor I see either 1.5V (off) or 7.9V (on) and I want to translate this to 0V (off) or 5V (on) at the Arduino end. I don't care if the logic is reversed.

Here is what I have in mind:

D1 is just there for paranoia, don't want an accident connecting to the battery blowing my optocoupler. R3 is set to 440 ohms on the advice of johnwasser above (seems to give a good voltage swing from the hall sensor).

Does this circuit look sensible?

My main questions are:

  1. What should the values of R1 and R2 be?
  2. Should the transistor base (PIN 6) be left floating? (See point 3 HERE)

The datasheet for the 4N25 optocoupler is available HERE.

I understand from the datasheet that the diode forward voltage ~1.5V and the diode forward current ~60mA, since I want a fully on diode at about 8V I think R2 should be 120 ohm, is that sensible? Will this diode be operating within spec if the battery voltage should hit 14V and the Hall Sensor is shorted?

I am less sure about R1 (I guess this is more about protecting the Arduino from shorting).

I have no idea about the transistor base

REVISED: on closer inspection... it looks like your sensor is designed for a Current Loop... so this won't work as planned.

Cobbled up design from a discussion between myself, Sanelss and bob on Arduino IRC channel: (redrawn for clarity)

Have just built this test circuit without the opto enabler and with the main opto replaced by an LED for easy monitoring and this works absolutely flawlessly as far as I can tell.

Next I will install the optos and test with the Arduino but I fully expect this to work. Then it's time to get the soldering iron out!

I just want to say thank you very much to sanelss, PWillard & StewieG of the Arduino IRC for their immense help. It took us quite some time to "reverse engineer" this circuit and build a unit capable of consistently reading it. I absolutely could not have done it without you guys! Thank you!