11.07.2015 Views

Builders guide robot pacman.pdf

Builders guide robot pacman.pdf

Builders guide robot pacman.pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Table 2. RF signal format for Pac-Man movementRF Interrupt RF Bit 1 RF Bit 0No signal 0 0 0North 1 0 0East 1 0 1West 1 1 0South 1 1 1RF ReceiverPIC16F877MicrocontrollerFigure 34. Model of interface between PIC and RF receiver6.1.4 Stepper MotorsThe PIC controls each stepper motor through two pins to the stepper motordriver chip. One pin controls the stepping pulse to the motor, hencecontrolling the speed, and the other controls the direction of the rotation,used in making stationary turns.The pulsing code is done through a timer interrupt routine, whose 16-bittimer counts at a rate of 1 MHz (one-quarter of our clock speed). Whenthe interrupt is called, we toggle the stepping pulse pin value from high tolow or from low to high to simulate a square wave output.An interrupt is triggered when this 16-bit timer overflows from 0xFFFF to0x0000. Hence, an interrupt is by default called at a rate of6 counts 16 counts interrupts1× 10 / 2 = 15.26 . However, we can increasesecond interrupt secondthe interrupt rate by setting the timer value to some number greater than0x0000 at every interrupt so that it counts from that number up to 0xFFFFinstead of 0x0000 every time.Our target speed for Pac-Man is 20 cm/s. To determine the rate ofinterrupts, we required some information about the physical <strong>robot</strong>dimensions. They are summarized in the table below.Table 3. List of parameters needed to control motor speedSeparation distance of wheels 11.5 cmDiameter of wheels6 cmDegrees per step of stepper motor 7.527

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!