Friday, April 25, 2014

Controlling Both Wheels on the Board

We can control both motors! Here there are two control loops running, one to increase the PWM duty cycle of both motors in response to vertical tilt of the IMU. The other control loop handles turning correction so if the IMU is tilted horizontally, the PWM duty cycle of one motor will be decreased to keep the pivot board on a straight path.

The video below shows basic control of both wheels based on the tilt angle of the IMU. As shown in the video, when the breadboard, which the IMU is on, is flat, the wheels stay relatively still. When the board is tilted in one direction, both wheels turn rapidly in the same directions. The board can also be quickly shifted in either direction and the wheels respond accordingly. When the breadboard is turned, one wheel slows down and the other speeds up which demonstrates correct to turning correction functionality.