Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Angle sensing

Not open for further replies.


New Member
Hey Gang - I'm very novice so bear with me. I have purchased a Javelin stamp and I'm attempting to automate my remote control sailboat (just to see if I can). I need two sensors a wind direction and heal (Boat tipping) angle. For the wind direction I got a 360 degree potentiometer and will convert the resistance into an angular measure this seams to be working ok for me. I'm aware that I could use a similar technique to measure the heal angle but a little plum bob inside the boat seams lame. So I'm on a second attempt. My first try was an accelerometer which if I learned the right lesson can measure motion but not an absolute position which is what I'm looking for. So on to my current issue I have a "Photointerrupter for Detecting Tilt Direction"
Sounds like just what I need. Unfortunately I'm not clear how to wire it and what type of measurement to take for the output.

Any help would be appreciated
You take your outputs out of Pins 3-4
PIN3 - when it is 90 degrees tilted will conduct
PIN4 - when it is -90 degrees tilted will conduct

Use Pin 5 to 5V to get a 5v when is either in -90 or 90 degrees.

Good Luck

If I am not mistaken, even the most basic aircraft have a gage that indicates whether or not the wings are level. You might beg or borrow ideas from this kind of instrument.
The output may be little to crude for good control feedback, a boat heeling at 90' aint going anywhere.
Seems to me that you could use another 360 degree pot for sensing the angle if you were to mount it with the shaft parallel with the keel. Mount a weight on a short arm, then mount the arm to the shaft of the pot. Mount the arm/weight assembly in such a way that when the boat is sitting fully upright, you get half the resistance of the pot. This way you'll get more precise info on heal angle. Sort of a "lame plumb bob" takeoff, but it just might work!
you could use ADXL202 from Analog Devices. Pls see the datasheet and appnote no 715 from microchip for interfacing it with a PIC


happy_99 has it right there- ADXL202

**broken link removed**

They will give you free samples. You will either need to etch a board for the LCC pkg, or use the eval board, or find one of the obsolete Cerpak DIPS.

Any "plumb bob" is inherently prone to oscillation. Most cheap pots don't work well in continuous use, and would be hard to seal against moisture. The ADXL202 has no moving parts and you can just spray the whole deal with silicone or some other board sealant.
I am not suggesting that this is way to go, it's just an idea in case
you already have accelerometer you want to try out:
I don't expect the heal angle accuracy has to match any laboratory standards. If all you need to see is rocking of the boat, you can use accelerometer and check for peaks (both high and low) and use center
as reference. To prevent haunting, you can average it...
There are two basic types of gyros. Rotational gyros do just as the name implies, it measures rotation but cannot give you an orientation. This type is not appropriate for your job.

The other type senses G-force. Now how does that help? Well, if you've a sensor which senses G-force in two perpendicular axis, like the AXDL202, that tells you the absolute angle in relation to gravity:
Ch A faces up, B faces left/right:
Ch A= 1g, Ch B=0g: straight up
Ch A= 0g, Ch B=1g: lying on its side, right side up
Ch A= 0.707g, Ch B= -0.707g: heeling 45 deg, left side is up

It's solid state, tiny, can be waterproofed easily, no wiper noise, will never wear out, and has no lag or "swinging" action. You can get samples for free from Analog Devices. I think you can get an eval board free too so you don't have to etch one. If not, I know I've seen eval boards for that part on eBay.

They also have a PWM duty cycle output in addition to an analog output, which gives you two ways to interface with a PIC.

IMHO Stamps are junk. They took an older PIC, used its own onboard nonvolatile memory meant for the user assembly program to make a BASIC interpreter and threw the program on an external chip. Made it 10x-100x slower and then raised the price 10x-20x. Very pointless, the PIC is meant to store the program in its own memory. Use the chip with 2 external components and you're done. There are C compilers so you don't have to write assembly. You need to buy a programmer, about $100, but look at what you save not buying a single STAMP. Or you can make a programmer pretty cheap too.
How much cash have you got? Try and find the CXTA series of tilt sensors from crossbow. They're not cheap, but they have 2-axis tilt sensing, and they give you the output analog-ly (ie. 2.5v = 0 deg, 3v = 30 deg, etc).

Not open for further replies.

Latest threads

New Articles From Microcontroller Tips