Shop OBEX P1 Docs P2 Docs Learn Events
Accelerometer as dual axis controller — Parallax Forums

Accelerometer as dual axis controller

Duane DegnDuane Degn Posts: 10,588
edited 2010-12-30 13:49 in Accessories
I'm trying to use a Wii Nunchuck as a controller for a RC helicopter.

My thought was to use the joystick on the Nunchuck as one of the two sticks on a normal RC controller and to use the Nunchuck's accelerometer as the other stick. The user will be able to select which stick the accelerometer emulates.

For sake of discussion let's have the accelerometer take the place of the throttle/rudder stick.

As I tilt the Nunchuck forward or back (rotate around x axis), I want the throttle to increase or decrease. Tilting the nunchuck side to side (rotation around y axis) should control the rudder.

The y and z accelerometer values both change with rotation around the x axis (throttle control). My plan was to make the throttle a function of the y accelerometer value and the rudder a function of the x accelerometer value. My problem arises when I rotate the nunchuck a full 90 degrees from horizontal with respect to the x axis, the rotation in of the y axis is no longer sensed by the x component of acceleration. A similar thing happens if I rotate the nunchuck along its y axis by 90 degrees. I can no longer sense rotation around the x axis.

Is there a way around this? Do I need to limit rotations to around 45 degrees? I've wondered if using the z component of acceleration will help me (I doubt it).

As I've thought more about this (while writing the above), I come to the conclusion this is just one of the limitations of using Earth's gravity as an input device. I'm pretty sure I'll need to limit rotation to less than 90 degrees.

If any of you have used accelerometers as input devices, I'd like to hear any advice.

Duane

Comments

  • max72max72 Posts: 1,155
    edited 2010-12-27 07:10
    You could combine it with a gyro. The WII object can interface to the wii motion plus (3 gyro).
    Massimo
  • Duane DegnDuane Degn Posts: 10,588
    edited 2010-12-29 10:12
    Massimo,

    I want to experiment with a Wii motion plus some time. I presently do not own one.

    One of my goals in using the Nunchuck is to control the helicopter with one hand. I believe the motion plus connects to far end of Nunchuck's cord. It would take some extra hacking to merge the two controllers into an one handed device.

    I limited the input range of the Nunchuck to within about 45 degrees of level. It's working really well right now. I'm still trying to get used to controlling the throttle and yaw with the accelerometer. I'm using the joystick for roll and pitch control. It's a lot of fun.

    Duane
  • max72max72 Posts: 1,155
    edited 2010-12-30 13:49
    you are right, the motion plus connects to the wii remote, not to the nunchuck. Nonetheless the board inside is so small that you could probably stick them together.
    You would need a tri winged screwdriver or a hand drill... and maybe a little bit of hot glue.
    Have fun.
    Massimo
Sign In or Register to comment.