Go Down

Topic: Control DC motor on/off with Hall Effect Sensor counts (Read 12172 times) previous topic - next topic

SolarPanels



A little off topic but ....


I have experimented a bit with slew drives, I think stepper motors would be a better (simpler) solution than the dc motor/sensor route


gknapp19

This is the power being provided to the Hall Sensors. The bench PS is set at 12V and the trace seems to show 10V. In any case, the signal coming from the Hall seems to reach 5.4V max.
Since, in this test setup, I am only using the arduino to run a program and receive a signal from the Hall Sensors, I have connected nothing to the arduino gnd. The motor is provided 24V with a switching power supply and the sensors are powered by the bench PS.
Being paranoid, based on what I've read, I have been loathe to use the probe ground clip. I did connect it briefly to the 24V PS ground and saw no difference in the signal and therefore saw no need to use it. I have since done the same with the bench PS - no change in the signal.

gknapp19

Stepper motors - That bridge was crossed many weeks ago when the motorized slew bearing was purchased. I'm trying to work with what I have. Also - we are swinging nearly a ton of mass.
The linear actuators have not yet been purchased as we are concentrating on rotation at the moment. When that is working, we will want to tilt the array as well. We have calculated the need for appx 48" of travel as we will want to be able to flatten the array in high wind. An open question now is electric or hydraulic - and of course electric would allow a choice of hall effect or stepper motors. I have also considered a MEMS accelerometer from which elevation can be calculated.

gknapp19

Tom -

A note on my earlier success in cleaning up signal noise by removing the coil of wire on my desk. I uncoiled this cable and laid it out on the floor to confirm that the signal would still be okay. The noise returned. The coil was not he problem - it is the power lines jacketed with the signal lines.

I then strung out 36 feet of CAT3 telephone UTP and used one pair for the two signals. The signal was improved again although not as clean as my 2 foot wire harness. I suppose CAT5 would be better but I am now considering using two coax lines for signal - haven't tried it yet; multiple priorities with holidays beginning to interfere.
- Gil

TomGeorge

Hi, Gil,  okay on  the noise, must be coming from the motor current in the associated wiring.
Have you tried a .01uF capacitor across each of the two signal wires to gnd to possibly filter out the noise without causing any distortion to the waveform.
The gnd on  the lab supply you don't need to worry about, however have you got the negative of the lab supply connected to the negative or gnd as marked on the arduino.


Tom..... :)

by the way Merry Christmas..
Everything runs on smoke, let the smoke out, it stops running....

gknapp19

Merry Christmas Tom,

I added a 30 foot piece of coax for one of the sensor lines - no improvement and no degradation of the signal. Went looking for a better waveform. Found it by removing the arduino from the circuit per the attached diagram and scope trace. It's a thing of beauty.
I reattached the sensor lines to the arduino as before with a 10K resistor to +5V. The result was a stepped waveform - not noise.
I had one 0.01uf capacitor so attached it between the A sensor line and ground per your suggestion. This added a 200ns 2.5V. spike to the B sensor waveform. Step waveform with voltage spike attached.
There must be some logic to this step waveform. I'm now too tired to think what it might be.
Thanks for looking at this.
-- Gil


TomGeorge

Hi, no worries, well leave the caps out, the waveform now looks good.


Tom.... :)
Everything runs on smoke, let the smoke out, it stops running....

gknapp19

Hi Tom,
The waveform looks good when not connected to the arduino. I get this step function as soon as I connect the sensor lines to the arduino. Unfortunately I didn't get a chance to work with it today.
-- Gil

TomGeorge

Hi, just to double check, the negative of the supply for the sensors is connected to the gnd of the arduino?

Tom...... :)
Everything runs on smoke, let the smoke out, it stops running....

gknapp19

Hi Tom,

You're brilliant and I'm dense. Two days ago you underlined "negative of the lab supply connected to the negative or gnd as marked on the arduino".  So I connected ground on the power supply to the arduino gnd.

My results are for revolutions of the out put shaft - counts - expected counts - phantom counts% - phantom counts #.

output revs   counts   expected   phantom counts   
10   4727   4720   0.15%   7
20   9456   9440   0.17%   16
30   14170   14160   0.07%   10
40   18956   18880   0.40%   76
50   23683   23600   0.35%   83


Not sure how this table looks on the forum. I can stop the motor certainly within 1/12 revolution of the output shaft. Error can be as much as 40 counts. The results are exceptional up to 30 revolutions. Not sure why performance slipped after that but I am very pleased with these results. I will do more testing. I also expect to provide an indicator of home position on the array at azimuth 180 deg ( South - ah yes - for you this would have to be 0 deg North). That way a correction can be made twice a day - both while tracking during the day and again at night when returning the array to the East.

Thanks for all the help.

Merry Christmas to you and yours.
Gil Knapp

TomGeorge

Hi, good to see some improvement, now you have connected arduino gnd to the lab supply grn, have you got the neg term of the lab supply connected to gnd as well?

Tom... Merry Christmas.....  Christmas morning here..... :)  8), going to be 30DegC.
Everything runs on smoke, let the smoke out, it stops running....

gknapp19

The results I forwarded yesterday were with the lab supply neg connected to arduino gnd.  I had also disconnected lab supply gnd from arduino gnd.  Should I have left this connected?

Spent the day visiting family. 19F ( -7C) this morning; roads slippery.

Returned tonight and did a confirming run. Results attached. Will diagram current setup in the morning.

Merry Christmas 
- Gil

TomGeorge

Hi, I think you have no errors, how accurate is your counting of output revs, to the fraction of a degree?
The proof is as you increase the total of each rev sample your perceived error is less and less.
In fact no matter how many turns you count I would say you will always be 8 to 15 turns out, this is due to how accurate you measure the stopping point of the output shaft.
1 rev is 472 counts, are you stopping the output shaft to exactly 1 in 472 of a rev?
I doubt it mate.
So your output count is accurate, its the stopping point that isn't.

Tom.... 8) (sunglasses cos its 30DegC)
Everything runs on smoke, let the smoke out, it stops running....

gknapp19

Agreed.  I have been very pleased with results the last couple of days. Since I have dialed back the lab supply to 5V to power the Hall sensors, I have now removed this power supply and am powering the sensors from the 5V on the Arduino.  This works fine.  The attached results are not 10, 20, 30 because I ran another revolution of the output shaft if I was unhappy with how close I had stopped it.  The results speak for themselves.

I am curious about the effect of the filter caps. They smooth the signal except for the brief blips - and results are worse. It's all in the attached. It includes a wiring diagram.

Gil ..... (jealous about your sunglasses - no need here lately)

gknapp19

After adding circuitry to my breadboard setup phantom counts have returned big time.  Added circuitry includes two transistors and relays to control motor polarity and on/off, a real time clock and appropriate connections to the arduino.

After stripping the added circuits back to where I was reading counts form the hall sensor reliably - I still have phantom counts (20% - 120% too many). The scope shows interference spikes both in the waveform and in the base power.

Go Up