For my Computer Logic Design Lab my partner and I wanted to present a final project that was interesting, tactile, and that challenged our skills. After a few rounds of ideas we settled on using the DE2 board we were supplied and the Altera FPGA on it to remotely control a small car. The technology that the lab had focused on up to this point was using Quartus to program the FPGA using schematic diagrams. There certainly are other, probably better, ways to achieve the same end product, but we used schematic diagrams to keep things related to the class material.
The first thing we needed to figure out was how we were going to use the relatively low current (8mA max) GPIO pins on our board to drive the motors that could pull up to 1A per coil. Luckily the Electrical Engineering department had some stand alone H-bridge driver boards based on Toshiba’s TB6612FNG motor driver chip (link). A pair of these with a standalone power supply gave us more than enough driving power. 2 H-bridges for 4 wheels meant that we would be steering tank style where both wheels on a given side always spin at the same speed, but this eliminated the need for articulating front wheels or any other steering trickery.
In order to make a stepper motor rotate in a useful way the various coils must be energized in a very specific pattern. Using half steps this pattern has 8 distinct states - coil A, A&B, B, B&C, etc... . Because of this we chose to use 3 bits of a 4-bit binary counter to keep the sequence in order and have each of the counter's 8 distinct values represent one of the 8 pattern states. We could have used a counter with the ability to count up and down, but the inverse of all of the B states are the corresponding D states and vice versa so counting normally and inverting the output that controls the B and D state reverses the direction of the motor's rotation while using a simpler chip model.
We bundled that logic into a motor driver module and made two copies of it (one for right wheels and one for left wheels). In the main schematic we used a clock divider to take the DE2 board's internal 50MHz oscillator and turn that into a 2kHz clock. This was fed into a 4-bit counter to act as another clock divider giving us available clock speeds of 2kHz, 1kHz, 500Hz, and 250Hz. We could select any of these as the top speed and in order to turn we would bump the direction we wanted to go down one speed (left at 2kHz and right at 1kHz turns the car to the right). This simulated as expected with a few small changes like inverting one side's rotate input so that motors with opposite orientations propelled the car in the same direction.
The last step was to wire it all together and test it out. A custom cable assembly was made out of some cat5 cable that was light enough to not hinder the movement of the car as it drug behind. The car moved fairly well. The top speed was not particularly exciting, but that was more of a design choice because of the relatively short cable lead than a limitation of the design itself. On slick floors the car began to lose traction. We think that was because of the light weight construction of the car itself. We presented our RC Car project for the UNLV Spring 2016 Junior Design Competition and received an Amazon Echo as a Special Prize for Interfacing.