commaster WROTE:How far exactly should I place the compass from the motor?
I am now testing the compass on table. It doesn't seem likely that the compass value is affected by those magnetic flux. No idea what goes wrong, please help.
There is no exact answer for this. It's really depends on how strong the magnetic flux from your motor. And bear in mind that the magnetic flux from the motor varies when the motor is running at different speed.
Maybe you can try to make your robot higher and place the compass at the highest position away from the motor. Alternatively, you can try to get the magnetic shield material which is used in computer speaker to cover up your motor. But I've got no idea where to get those thing...
With the power of dream, nothing is impossible...