Which sensor to use?

I’m working on a project that control a small toy car. The car has to turn an right angle at some location. The distance is too close for GPS. If the speed of the car is around 2 meter per second (or six feet per second) which sensor is more useful to tell how much have been turned? It will take one second to turn a right angle, gyros seems to have ranges that are too large? But will a magnetic sensor not reliable near a DC motor?

Which product would you suggest to test? The car is moving in level ground, so three axis is not necessary.

Hello,

The ranges specified for gyros are the maximum rate of rotation that they can measure. They can still be used to measure much smaller angular rates, in the same way that a thermometer that has a range of 100 degrees can still be useful for measuring temperature changes of just a few degrees. For your application, a gyro should work fine for measuring relative rotation; you should get plenty of resolution with, for example, an L3G4200D configured with a range of ±250°/s.

Since gyros tend to drift over time, you should consider using an IMU (inertial measurement unit) or AHRS (attitude and heading reference system), which combine a gyro with an accelerometer and magentometer, if you need to keep track of your car’s absolute heading. You are correct that DC motors can affect magnetic sensors, but you can try to minimize that effect by locating the sensor far away from the motors.

- Kevin

How about #1256? Is there any example code for it’s use with a 3.3V 8 MHz Arduino using 328?

Unfortunately, we do not have any example code for using a CHR-UM6 with an Arduino. However, you should be able to find the necessary information about its serial protocol in its datasheet, which can be found on the Resources tab of its product page.

You could also try searching or posting on the CH Robotics forum to see if anyone there can offer any code or advice to help you.

- Kevin