Gyro-controlled revolving headlamp project

This morning I got the idea of using a 3-axis gyro module lsuch as the 10-DOF IMU along with a Raspberry Pi to control a continuous rotation microservo mounted the bottom of the quad. Attached to the servo would be a small LED headlamp flashlight. That way if the quad is moving right it would turn to 90 degrees, back 180, forward 0 etc. 

Adafruit's tutorial on using this chip is here. The hardware part I can handle but I have no idea where to start with the software. Any ideas?

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Actually, there are code examples already for a similar project using the compass. Sample accel code is here. Compass X-Y calculations to servo position here.  I would assume I could just change 

    Adafruit_LSM303_Mag_Unified mag = Adafruit_LSM303_Mag_Unified(12345);

    to

    Adafruit_LSM303_Accel_Unified accel = Adafruit_LSM303_Accel_Unified(12345);

    Then find and replace "mag" to "accel".

    I don't have any of my hardware yet so I can't this out. However, am I on the right track?

This reply was deleted.

Activity