<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=639&d=1133445289">
<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=639&d=1133445289">
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
I looked just like that guy! LOL
Well I just hooked up my old parallel LCD and got it working! The program with interupts is better but still loses count. I wonder if it is because the encoders do not have detents and can change direction in between?
A little more background on what I want to do with these in case someone has an alternative or any other input.
I have the two encoders set up so they are perpendicular to each other. Each has a small weight on one side so they stay oriented to gravity. One is for pitch and one is for roll. The numbers returned will be converted into degrees and then sent to a BOB-4 video module. For those who do not know, the bob-4 is a video overlay module and it supports vector graphics! I am setting it up to display a HUD for my RC plane. This HUD will have Altitude, heading, air speed, artificial horizon, temperature, miliamp hour meter, and some other nifty stuff. All viewed on the ground via a monitor or my video glasses.
Smitty
Oh yea, these encoders obviously will be in constant motion and I plan on using a dedicated pic to keep track of them.
Smitty
I found something that looks easier to use and more accurate. What do you guys think about these little puppies?
http://www.usdigital.com/products/ma2/
The PWM type with ball bearings look like they will fit the bill. The best thing is, a simple pulsein command will read the absolute position. Also they are cheaper than going to mem's 360 degree inclinometers.
The ball bearing type are free spinning so a very small amount of weight will needed to keep them parallel with the gound. I have two ordered and should be able to have them working by this weekend. Then on to the code to do the vector graphics on the bob4.
Smitty
I've been watching this thread for quite some time now. Waiting for Steve's great example to provide the final, Yeah! it works.
But now to find out what the intended purpose was, I've assumed the position of hanging my head while shaking it back and forth. While this idea might have worked for a robot moving at a few inches per second, it doesn't have a chance in an R/C plane.
There are 2 parts to the gravity equation. There's the gravitational force (A force that pulls things together based on their mass and how close they are together). And, there's Inertia (The tendency of an object at rest to remain at rest, and of an object in motion to remain in motion.)
Gravity is the Weak force, and can be easily overcome by Inertia. So as the plane is making any kind of movement, the inertia stored in the weight on the sensor will want to continue moving in the direction it was going before the change in direction. It's not going to stay pointing straight down at the earth to relate to an artificial horizon. And the heavier it is, the more inertia it stores. Depending on the G forces applied, you can make a full loop and never have the weight move at all.
In order to track the changes in direction of a moving object that has no other reference point, you'll need a Gyroscope and an 3-axis Accelerometer. The accelerometer allows it to find out which way is down during straight and level flight, and the gyro tells it the orientation relative to the original accelerometer reading.
Now if all that sounds complicated, it's because it is. Just be glad you're not flying in space. Then you'd need to fix the location by star sightings. But you'd still need the gyro.
<br>
DT
Hi Darrel,
Thanks for your input! Please forgive me for not explaining everything. I understand inertia and centripetal force and I totally agree with you. However, the plane this unit is going into is slow and very stable. Yes it can do loops and rolls but I do not plan on doing any (or at least I don’t expect the reading to mean anything if I do). I plan on just slow gentle flying and gliding. For this, I believe my setup should work just fine. Please correct me if I am wrong.
Smitty
I still think you'll have problems with the weight swinging back and forth, and wild readings in general just do to the different G forces.
If you're just looking for a way of finding which way is down during level flight. Perhaps as an aid to setting the trim. I think it'll be a lot easier to use an accelerometer. It's not going to give an artificial horizon, but it can find which way is Up. It can also give other interesting info like the G force of a turn or the amount of turbulence.
There's a nice one at Parallax for pretty cheap. And it works with PULSIN, so no interrupts or quadrature encoders to deal with.
Memsic 2125 Dual-axis Accelerometer
http://www.parallax.com/detail.asp?product_id=28017
Understanding the Basics of an Accelerometer
http://www.parallax.com/html_pages/r...s/cat_acce.asp
HTH,
DT
Having a little experiance with this from the operator end, Darrel is right, at any flight speed. It is inconcievable that you will only be flying in straight, unaccelerated flight, and this is the only time your concept would be accurate. Even at slight bank angles and accelerations, your "gravity" based system would not give you useful or accurate infomation.
Doing a little searching, found an adequate explaination of why this the the case.
Steve
Last edited by SteveB; - 3rd October 2006 at 15:34.
Bookmarks