Robotics Assignment 5

Nick Pennella and Frank Fernandes



Description

For this assignment, we chose to implement a sort of sonar robot that takes input from a devantech sonar device hosted on a logochip. To implement this design, we used a cricket to send a signal to the logchip which cues the logochip to get the distance from the sonar device, it then sends the distance (in inches) to the cricket. Once the cricket receives the distance it then moves itself using the robot motors until it is approx. 7 inches from what ever object is directly in front of it.

Schematic

LogoChip Code

In the following code we implemented the code for the sonar ranger. For this particular example we use a cricket to send a signal on the bus to this logochip to start the sonar sequence. Once the logochip receives a hexadecimal 180 it then goes off and starts the ranger. The way the ranger works, is that it needs a 5v pulse to start the sonar and it will return on its output pin the edge of the sonar pulse. The pulse represents the time it takes to send out a sonar signal and receive a response. To measure that time, the logochip timer gets started when we reach the edge of the pulse, and it gets stoped when we reach the oposite edge. The problem with this is that the resolution of the logochip timer is 1millisecond making the sonar computation a little off. We then use the knowledge that the speed of sound travels at approximatly 1inch every 74 microseconds to compute our result. The result then gets send on the bus to the cricket on the other end.

View The Code

Handy Cricket Code

In the following code we implemented the bus/motor code for the Handy Cricket. This works by sending the command (hexidecimal 180) to the logochip on the cricket bus, and waiting for a response from the logochip. The logochip sends a 1 byte response to the cricket which represents the distance to the object imeadiatly in front of the sonar in inches. The cricket then takes that answer, and if the distance is greater than 7 inches it moves the motors forward for 1 millisecond then tries again. If the distance is less than 7 inches, the motors get turned to reverse for 1 millisecond. When the distance equals 7 inches, the motor is stopped.

View The Code

Files Submitted for this Assignment:

File Name Description
bus_comm.txt Logo Chip Code
cricket_sonar.txt Cricket Code

Menu

Description
Schematic
LogoChip Code
Cricket Code