PDA

View Full Version : Suggestions requested for the construction of compass.



BuzziBi
01-09-2014, 12:05 PM
Almost done with the airspeed indicator and the brain starts to rotate around the next project. :p
I want to try me on a the ADF instrument maby integrated in the compass.
I see that Multi let me bring out the ADF frequency but do I need to think about the direction of the neadle?
If I just leave it pointing straight ahead in the flight path, I will lose the possibility of bearing on frequencies in other directions?
Or how is this supposed to work?
Do I use the AFD frequency in combination with other values​​?

vikingsraven
01-09-2014, 03:14 PM
im working on a magnetic compass at the moment , using a stepper motor, im sort of half way through the code pm me! and we can work on this together, then publish it on here.
have a look at this
http://www.thaitechnics.com/nav/adf.html

BuzziBi
01-10-2014, 06:10 AM
I took a look at the page, have studied something similar. I then started to test Multi with ADF ticked. The way I see it, one only gets feedback on ADF frequency from Multi, no data say in which direction (relative to the plane) where the transmitter is located. Is there anything I overlooks?

vikingsraven
01-10-2014, 07:00 AM
yeah theres no bearing info from adf, maybe we should ask jim nicely as hes about to tweak his code at add it! :)

BuzziBi
01-10-2014, 03:09 PM
vikingsraven (http://www.mycockpit.org/forums/member.php?u=19762)
Have had a little mind game today.
Take a look at the picture.
8531
This I think is doable! 8-)
Found incidentally some nice pages here! (http://stoenworks.com/Tutorials/HSI,%20the%20complete.html)

EDIT_ Have you found a solution to the positioning of the stepper motor to the compass?

Tom_G_2010
01-10-2014, 04:43 PM
I had to put my build on hold in the spring of last year, but I am dusting it off now and getting busy again. When I stopped I was part way through coding my whiskey compass. I purchased a high res stepper motor (0.9 degrees per step) and an optical sensor.

My plan is to use a 10 to 1 worm gear to get the highest possible resolution. To initially position the compass when an aircraft is loaded I am writing code that will activate the stepper and rotate it until the optical sensor triggers through a pinhole in a disc at a predetermined position like 0 degrees It would then advance to whatever heading was being sent from Link2FS.

I'm not sure yet how to handle ongoing calibration. If someone made a stepper with 1 degree or 0.5 degree steps it would be so much simpler. But with 0.9 degree steps, even with a 10 to 1 ratio, there will always be some amount of error introduced with each movement. I was pondering a couple ideas like a calibration check any time the heading happens to cross North. But that might not happen to often in a long distance flight headed south.

The other idea I had was to put optical sensors more frequently around the compass like at 0, 90, 180, 270. However that gets mechanically complicated and I need a way to distinguish each position for the calibration to be functional.

Tom G.

vikingsraven
01-11-2014, 03:57 AM
BuzziBi thanks for the link.
Tom
been looking into the error problem, maybe i have a solution, 0.9 degrees is fine.
You can fix the error in the code.
eg.
using modulo you can work out the difference and add extra pulses to compensate.

addstep = reading % 9; // its 9 as we know 10 steps is going to be 9 degrees and it gives a whole number to play with.
this does the following:
for example original heading - new heading ; 200 - 189 = 11;
11%9 = 2, as 11 x 0.9 = 9.9 if we add 1.8 ( 2 steps) it gives us 11.7.
example 180 -187 = 7
-7%9 = 7 (6.3) 7-6.3 = 0.7

As most of the compass roses are in 5 degree steps this isnt going to show up, but over time this will increase, so if we put the .7 into an accumulator variable, and to it or subtract ( if we head back to the original position) then when it gets to 0.9 we can also step either forward or back to compensate.

now the major problem really is the step form 359-0 and 0 to 350;
this will need an extra bit of code


if (previous >270 && new <90){
previous = 360 - previous;}
else if (previous <90 && new >270){
new= 360 + new}

you can actually get a micro stepper drive as well this can increase the resolution X 8 , you can still use the formula to compensate for that error as well.
Mark

BuzziBi
01-11-2014, 08:11 AM
A thought!
Can you use a cheap OPTICAL MOUSE SENSOR to calculate how far the "compass rose" (it's what I call it :D) has moved?
If you only use one axis to calculate the movement of the compass can we use this information to correct the deviation in degrees stepper motor is running? Or maybe use a standard 5V motor?
In any case, a fun thought for use in any connection with simulator!


http://www.martijnthe.nl/2009/07/interfacing-an-optical-mouse-sensor-to-your-arduino/

vikingsraven
01-11-2014, 09:11 AM
yeah i suppose you could, all i was going to do was just keep track of the counts after a zero point (N) and let the duino do the work, theres a really cheap optical sensor called and LED! they were originally designed to be photodiodes but some one wired it up wrong and they produced light so they became LED!
you can put on facing the other and read the light level.
http://playground.arduino.cc/Learning/LEDSensor
cheap and plentyfull
actually just ripped a hp printer apart and it doesnt have steppers in it( annoyingly ) but does have a motor with i think( im not counting them) 4096 optical disc on it.
the optical mouse is basically a low res camera, 20 x 20 pixels i think so maybe some possibilities in that!

Tom_G_2010
01-11-2014, 10:02 AM
Vikingsraven,


Thanks, I'll experiment with that this weekend.

Here's what I did in my original code to convert the .9 to match the 360 using the "map" function.

When looking at the 4000 value below keep in mind my stepper motor is a 0.9 degree 400 step and I will be using a 10 to 1 worm gear arrangement.



HeadingVal = map(HeadingVal, 0, 359, 1, 4000); //Convert 360 degree heading value to 400 steps

And, for crossing north I did the following.

In the code below StepMaxP = 1000 and StepMaxN = -1000 which was arrived at by experimentation and seemed to work well.



StepVal = HeadingVal - HeadingVal_Last; //Calculate difference between last heading read and current heading

if(StepVal > StepMaxP){ // Adjust for crossing North
StepVal = -1*(4000 - StepVal)-10;
}


if(StepVal < StepMaxN){ // Adjust for crossing North
StepVal = -1*(-4000 - StepVal)+10;
}

SteveL
01-12-2014, 06:01 PM
<!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning/> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--> I have this wet compass, it came out of an old ATC510 simulator. It uses a 1rpm reversible dc motor and a pair of shaft mounted potentiometers without physical stops so they can rotate continuously.
8538

<!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]-->

BuzziBi
01-14-2014, 03:24 PM
Need good advice here!
I'm thinking of trying Hall effect sensor to determine the position of the compass, but what type of sensor should I buy?

vikingsraven
01-14-2014, 03:49 PM
hmm magnetic sensor near a compass? is that wise?
http://www.digikey.com/us/en/techzone/sensors/resources/articles/applications-for-hall-effect-ic-switches.html
this may help you decide which type

Tom_G_2010
01-14-2014, 04:37 PM
Need good advice here!
I'm thinking of trying Hall effect sensor to determine the position of the compass, but what type of sensor should I buy?

Would a hall effect sensor provide sufficient precision?

I hadn't thought of going that route, but if it's accurate enough that would simplify the mechanical build quite a bit.

BuzziBi
01-15-2014, 10:01 AM
The Hall Effect Sensing is all new to me, but I have done som reading and I do beleave this is a possible way to go.
(at least until the opposite is proven) :p
I found this "OH49E versatile linear Hall-effect device" The output voltage is set by the
supply voltage and varies in proportion to the strength of the magnetic field.
I think I will give it a try.
http://p.globalsources.com/IMAGES/PDT/SPEC/364/K1074854364.pdf

I also found a stepper motor which I believe would be perfect for making analog instruments. (And here we go again :p )
With a angle of rotation with internal stop 315 degree it should fit most DIY instruments.
http://jukenswisstech.com/index.php/products/x27/
It is used in instrument panels of cars.
It costs about U.S. $ 24.50 / lot of 10 pieces.
http://www.aliexpress.com/item/10pcs-lot-x27-168-Stepper-Motor-Instrument-Cluster-For-GM-GMC-Cars-And-Trucks-2003-2006/1456148988.html
There are already Arduino librarys made ​​for this motor!

Jim NZ
01-28-2014, 04:06 AM
This "Hall effect" thingy Buzzi ,,, I came across this, purely by accident, and immediately thought of your mission.
www.youtube.com/watch?v=Ws_zwQnHQFE (http://www.youtube.com/watch?v=Ws_zwQnHQFE)
Their site (for the PCB) ,,
http://www.madscientisthut.com/Shopping/agora.cgi?cart_id=7635928.22789&product=CNC%20/%20Robotic%20Sensors&user4=Rotary%20Encoder&xm=on
(Look under rotary encoder)
but if your handy with surface mount stuff ,, then just the IC (AS5040) could be got from anywhere.
10 bit resolution !!! That's about a third of a degree for the sensor.

Another idea would be to get a 360 degree pot like they have on a lot of weather station wind direction gauges. ???

Happy pondering ,,, Jim

BuzziBi
02-02-2014, 07:58 AM
Update on the OH49E linear Hall-effect sensor.
I have done som testing with this sensor, but the result is discouraging!
Maby somthing wrong with my code?

/*This sketch turns ON/OFF the led om pin 13, when the Hall Effect sensor
is sensing the magnet.
It also Serial.println the value red from analog pin 0.
I thought that I could treat it cind of like a potmeter, because the output voltage
from the Hall is set by the supply voltage (5V) and varies in proportion to the
strength of the magnetic field.
The problem is that the values is jumping from about 43 to 141 (0, 255) and therfore
not usable for mutch!
*/


// These constants won't change:
int HallPin = A0; // pin that the Hall effect sensor is attached to


// variables:
int HallValue = 0; // the Hall effect sensor value


int led = 13;
void setup() {
pinMode (led, OUTPUT);


Serial.begin(9600);
}


void loop() {
// read the sensor:
HallValue = analogRead(HallPin);


// map the sensor reading
HallValue = map(HallValue, 0, 1023, 0, 255);


Serial.println(HallValue);

{if (HallValue < 100)
digitalWrite(led, HIGH);
else
digitalWrite(led, LOW);
}
}

vikingsraven
02-02-2014, 11:46 AM
BuzziBi what readings you getting on the serial monitor.
loose the mapping first and try if HallValue < 512 stick a delay (500) after as well just incase



{if (HallValue < 100) digitalWrite(led, HIGH);
else
digitalWrite(led, LOW);

move the { to after 100) its in the wrong place! Also ther should be a { after else and } at the end.

BuzziBi
02-07-2014, 07:51 PM
After a few days of serious thinking, I had a revelation.
Instead of this line:

// map the sensor reading
HallValue = map(HallValue, 0, 1023, 0, 255);
Something that gave me a pretty inaccurate and unstable value between 43 and 141.
This new line gave me completely different values​​.

// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = HallValue * (5.0 / 1023.0);
Who gave me a stable value scale of about 1000 for a 360 degrees rotation of the magnet.
Now it remains to see if I can use the values ​​to something useful!

vikingsraven
02-07-2014, 08:23 PM
Thats interesting. Ive been using map on something as well and thats pretty unstable too.
So how you mounting the magnet and hall Effect?

BuzziBi
02-08-2014, 05:24 AM
So how you mounting the magnet and hall Effect?
Just that I'm not sure of yet!
I will try to integrate Hall sensor in stepper motor code first.
I did a little experiment last evening, but could not come up with something reasonable.
The code must run like this: At startup stepper motor go, say clockwise, untill the Hall sensor = 0
Afterwards, receive Heading from Link2fs. Then stepper motor move steps which corresponds with the heading.<j) from="" link2fs,="" and="" lign="" up="" wit="" steps="" which="" corresponds="" with="" that="" degree.

I did an experiment with: (I have a suspicion that this part of the code should be in the setup part)

if (HallValue = 0)
myStepper.step(0);But the motor did not stop!
I do not yet know how to stop the motor :roll:


If anyone has an idea, I am happy to hear about it :p
</j)>