




















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





















































Senior Design Project Clay Oehlke • Matt Crotts • Kenny McNutt • Jeremy Vernon 05/05/
1.1 Introduction The purpose of the program is to search for light and inform the other bots when the light is found. To this end the main parts of the program are divided up into a search routine, a receiving routine, and a transferring routine. The program spends most of its time in the search and only leaves the search when it or another Boebot is transferring data. Upon successfully finding the light, the Boebot who finds the light sends out a signal to all the other bots. The other bots then do a dance to indicate that they acknowledge that the light has been found.
1.2 Global Variables Because of the lack of variable space in the Basic Stamp 2p’s architecture, the different programs were split into separate program slots. In order to pass data among the various programs, the scratchpad RAM had to be used. Table 1 shows the variable that were treated as global and passed among the program slots.
Table 1: Global variable passed in scratchpad RAM.
1.2.1 Token The Token is what allows a node to transmit. Without it, the node may only listen to transmissions.
Byte Variable (^) token^0 found^1 NextNode^2 RouteTable^3 Invite^4 ID^5
1.2.2 Found The Found variable is responsible for saving the status of the light search. When a node finds the light, a 1 is saved into Found. When it receives the token, the node may then transmit that it has found the light.
1.2.3 NextNode This is no longer used. NextNode is calculated directly from the RouteTable.
1.2.4 Route Table The RouteTable is probably the single most important part of the network. It contains information about the network size, a node’s successor, and the list of used ID’ s. See Table 2.
Table 2: Three nodes are currently in the network: nodes 1,2,4.
1.2.5 Invite This is no longer used. Invite is now calculated locally.
1.2.6 ID The ID variable is calculated just before the node joins the network. This ID stays with the node until there is an error.
RouteTable 0 0 0 0 1 0 1 1
1.3.3 Inviting A node can go to the Inviting State if it is the only node on the network or it begins a Random Invite. When a node is alone in the ring, it will continually invite until it receives any acknowledgment. A positive acknowledgement will result in adding the node to the RouteTable and passing the token to the new node. If the invitation is a random invite, it will send five invitation packets. If no response, the node will continue on by sending the token to the next node in the table.
A node can only invite in two cases:
1.3.4 Idle (Search Algorithm) The Idle State is where the other activites can be performed: in our case, the light searching. Light searching continues for some finite time, and then the node, if it has the token, moves to the Have Token State. If the token has been lost, the lowest ID’ ed node will time out first and start up a new token.
The light searching algorithm takes the values of the two photo resistors, and turns in the direction of the lower value. The higher the value of the resistor, the darker the environment. It steers away from the
darker areas. Infrared is also used to detect solid objects in front of the robot, which makes the robot move back and to the left of the object. If the resulting light values are within a deadband value, then the robot goes forward. This deadband value is set to five times the square root of the average value of the resistors. This was found by experimentation with various values.
1.3.5 Monitoring When a node is in the Monitoring State , it is receiving all transmissions and deciding what to do next. If the packet is for it, the node will update its RouteTable. By design, all changes in the token ring’s RouteTable are propogated throughout the network, one hop at a time. If it is an invitation packet, and it is waiting for an invitation, it will enter the Joining State. If the node times out in the Monitoring State , it will move to the Idle State.
1.3.6 Have Token When a node is in the Have Token State , it has the right to transmit. If it is the only node on the network, it will go to the Invite State. Otherwise, it will transmit to the next node on the ring. If it does not receive an acknowledgment, it will remove that node from the RouteTable and transmit to the next node in the table. When an acknowledgment is received, the node goes to the idle state.
1.4 Code Outline The code is divided into the five following files init.bsp, mainRoutine.bsp, RxRoutine.bsp, TxRoutine.bsp, and dance.bsp. See Appendix 5.1 for source code.
node in the network. If not it will determine the next node to pass the token to. It then calculates the crc value and begins trying to transmit. It then transmits a synchronizer, the next node, the packet number, the found bit, the invite bit, the route table, and the checksum. It will try this a set number of times and if it does not receive a correct ack within those number of trys it will try the node after the node it is trying to send to in the route table. If it is transmitting an invite, then it will change the routing table when it receives an ack. Following all this, TxRoutine will then set the current node to not have the token, save the route table to the scratch pad, and return to mainRoutine.bsp.
1.4.4 RxRoutine.bsp RxRoutine pulls the node ID off of the scratchpad and initializes the other variables in the routine. It then receives a synchronizer, the node being transmitted to, the packet count, the route table, and the checksum. It then checks to see if there was an error in the checksum. If there was an error in the checksum it assumes this is due to the presence of two tokens and sends out a message sending everyone back to mainRoutine. If there is no error in the checksum, it checks the found bit and if it is set to one then program control is transferred to dance.bsp. It then checks to see if it’s Id is zero or is not in the route table and the invite bit has been sent and if so it assigns it the Id being invited. If the message being transmitted to is for this node or this node is being invited into the network, it sends back an acknowledgement and sets the token to one. It then returns to mainRoutine.
1.4.5 dance.bsp This causes the boebot to move in circles continuously.
1.5 Hardware The boebot comes from parallax and consists of several components. There is a chassis to which everything attaches. There is a battery back that is mounted under the chassis. The circuit board is called the board of education and is mounted on top of the chassis. The basic stamp attaches to the board of education. Two servos and wheels are mounted along the chassis as well as a third wheel, which is mounted on the back. The main peripherals we use with the boebot are two infrared LED’s and two infrared sensors used for detecting objects near the boebot, two photo resistors used to detect if light is near the boebot, and a radio frequency transmitter, a radio frequency receiver, and two antennas which are used to communicate with the other boebots.
1.5.1 Servos Pulses are sent from the servos causing them to spin. Here is a schematic of the servos circuit.
Figure 1: Servo Schematic. 1.5.2 Infrared circuit The infrared sensors can detect IR signals in the neighborhood of 38.5 kHz. The IR LED’s can send out IR signals at 38.5 kHz by using the freqout command. When the IR sensors are checked immediately after the IR LED’s have pulsed, they can detect reflections of the IR signals if there is an object in front of them. This can be used for collision avoidance. Here is a schematic of the circuit.
Figure 3: Photoresistor schematic.
1.5.4 Radio Frequency Transmitter, Receiver, and Antennas The radio frequency transmitter and receiver are treated as serial ports. The same commands that are used to transfer data to and from the serial port can also be used to transfer data to and from the radio frequency transmitter and receiver. Here is a schematic.
Figure 4: Transmitter and Receiver schematics. Receiver output is pin 4 and transmitter input is pin 5.
2.1 Introduction The purpose of these Boebots is to locate a light source in a dark room and tell the other Boebots that the light source has been located. All the other Boebots will dance around when the first Boebot finds the light source.
2.2 Activating the Robots First one needs to power up and load the program onto each of the Boebots. The Boebots are powered by the power cord, which comes from the battery pack. Plug this cord into the power receptacle near the adapter for a nine-volt battery on the lower left hand side (as seen from above).
Figure 5: Top view of completed BoeBot.
Next plug the serial cable into the back of the Boebot and into a computer. Proceed to run the stamp editor from parallax. Using the stamp editor, open the file init.bsp by clicking on the file menu and choosing open.
Figure 8: Running a program.
This should load the program into the Boebot and begin executing it. The red LED on the Boebot should light up immediately. Repeat this for each of the Boebots.
2.3 Running the Search Now that the Boebots all have been programmed, take them to a dark room and press and hold the reset button on each Boebot. Turn on a flashlight and point it at the center of the room. Place the Boebots in the darkness on the floor of the room and point them in various directions. You may now release the reset button and move away from the Boebot. The Boebots will now begin searching for the light. They should be able to avoid any objects during this search. Once one of the Boebots finds the light the other Boebots will receive a message and will begin to dance. At this point you may unplug the Boebots by pulling the power card from the receptacle. Congratulations, you are now fully prepared to use Boebots to search for light.
3.1 Group Management There were several problems with our group management style. These led to some inefficiencies in our group project.
One of the major problems our group had was a lack of communication. Some of goals and assignments for various parts of the project were never communicated correctly, and this led to a loss of time and effort for some people. Goals were redone several times, and some not done at all. Clear rules for communicating would have led to increased productivity.
3.2 Safety and Ethical Concerns There appears to be few safety concerns for the robot. The robot is too small, and has too little power to serve as a danger to humans by either electrocution or contact.
The ethical concerns for the robot are few as well. The only conceivable one is that the frequency that the robot transmits on (433 Mhz) could provide interference to some radio devices. This frequency is used for amateur radio experiments, so the affect should be minimal.
3.3 Final Analysis of Solution Our solution to this problem has one flaw, was that the program kept getting false positives for its receive signals. This led us to analyze what was wrong with the receiver, and try to develop a solution.
Figure 9: Vdd during servo pulse.
This shows the voltage level of the power source. As it shows, when the servomotors are initialized, it causes the voltage to take a sharp spike down, and then rise back up. After this, the receiver, which uses this value to determine whether a signal is on the antennae. When the VCC dips, it then thinks it has gotten a signal. When it does drop to the receive subroutine, the dip has passed, and there is not signal.
The behavior caused by this problem was as follows: the network would be established, but when the search routine was initialized, the servos would be engaged. This caused the VCC dip, and the search routine was interrupted. It tried to find a signal, failed, and then went back to the search routine. Thus the process would repeat itself.
3.4.2 Solutions We tried several different solutions for this problem. Each has some limited success in eliminating the problem, but not enough to solve the underlying result of the VCC dip.
3.4.2.1 Grounding Our preliminary thoughts were that this might be caused by the aluminum casing that the robot uses not being grounded. A wire was connected from the casing to ground. This had no discernable affect.
3.4.2.2 Capacitors The first solution was to smooth out the dip, by using capacitors. These would act as a short-term battery, providing voltage through the dip, charging back up as the dip receded. First we tried using a 2200-microfarad capacitor. This provided no discernable difference in the voltage dip. After discussion with the professor, it was decided that a large value capacitor did not provide a fast enough response to the voltage dip.
It was then decided to use a string of multiple capacitors placed in parallel to simulate a larger capacitor, with better response time. 470-microfarad capacitors were used to this. The results are as follows:
Figure 10: Vdd during servo pulse with 470uF capacitor.