Skip navigation
TechXchange
Digi-Key TechXchange Communities > Projects and Designs > Discussions
6518 Views 2 Replies Latest reply: Jan 11, 2013 11:15 AM by MetMan RSS
Currently Being Moderated

Jan 8, 2013 10:32 AM

I need to gradually change the hue of a 3 colour LED depending on it's position or angle...

The LEDs will be mounted on top of a rod which may be vertical or tilted. I want it to be one colour when vertical and gradually change as the rod tilts. The height of the LED will decrease, as the angle of tilt increases, from around 2 metres/6 feet to 0.5 metres/2.5 feet. It needs to be a cheap solution as I have to make many of them. I'm guessing that a tilt sensor might be the best way to go but they seem to be simple on/off devices in the price range I'm checking. Is there a better approach?

 

Thanks.

  • MikeWeed Novice 62 posts since
    Oct 21, 2011

    Consider an accelerometer. Some are very inexpensive, but unfortunately the cheapest only come in very small packages that are not feasible for manual assembly. The best I could find for manual assembly is the MXR6500MP ($4.91US from Digikey). This is a 2-axis accelerometer analog output with adequate sensitivity (with an op amp, such as LMC6482). With any accelerometer you will need a microprocessor. I favor Microchip's PIC16F886 ($2US in quantity). The '886 has an A/D converter that can convert the accelerometer signal to digital, and plenty of processing ability to make the LED drive signals. To dim the LEDs, you can use a pulse width modulation (PWM) method. The

    '886 has 2 PWM modules, and you can synthesize the third from the timers in the '886. The '886 outputs have a 25ma sink/source capability, so can drive the LEDs directly. This could be a fun project!

  • MetMan Apprentice 93 posts since
    Oct 24, 2011

    This does sound like an interesting project!

     

    Mike's suggestion of a multi-axis accelerometer is a good one.  You could also use a multi-axis magnetometer (compass), or if your rod is rotating on a shaft or axle you could detect the shaft rotation by coupling it to a simple potentiometer or a shaft encoder.  Have fun!

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 4 points
  • Helpful Answers - 3 points