Accelerometer as dual axis controller
Duane Degn
Posts: 10,588
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
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
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
You would need a tri winged screwdriver or a hand drill... and maybe a little bit of hot glue.
Have fun.
Massimo