The entry from last week had the class completing a transition. We had to remove the servo motors from the maze project and install brush motors. Upon completion of that, we then were assigned to program the platform to drive the pattern of our initials on the floor.
This was a simple program to write. Initially a diagram of the letters was needed. Seeing as two of my initials are the same (JJM), all I needed was two diagrams listing all the steps. These diagrams are shown below.
The programming was very similar to the maze assignment. Most of the program was written in subroutines. The difference was in how these subroutines were written. The following is an example of the forward full speed subroutine: fwdfll: pwmout mol, 99, 400
pwmout mor, 99, 400
return
In the last assignment the motors were identified using "servopos." This time, that command was replaced by "pwmout." The 400 at the end is full power to the motor in this program. After each subroutine a pause command was added with a time ("pause 2000"). This was how the program was written. Each step was either a straight command or a turn command. Each was written as a subroutine, then placed in the program in the proper order, and assigned a time limit to accomplish the goal.
I had the program completed and was ready to test it out, but I had a major problem. On Sunday afternoon, while I was putting the robot away, I forgot to unplug the battery pack. It caught fire and comlpletely melted. The pictures below show the results of this fire. The first is the remains of the battery pack and the second is the damage the fire did to the wiring.
Thankfully, the fire did not damage anything on the board itself. Only the wires pictured above incurred damage. The wires were easily fixed by cutting and resoldering them together with new pieces. The results are visible below. The blue sleeves are where the wires were rejoined.
If you look closely at the picture below, there is a blue housing where the black and red power cable attaches to the platform. This is why the battery pack overheated and melted down. Where the wires are attached the ends there were very short, but loose wires hanging free. These crossed over and touched. This shorted the battery pack out. The reason for the frays is because of how the cable was created. It was a thick bundle of wire that did not fit into the housing correctly. We had to trim away excess strands until the core of the strands would fit in. What remained were these very short frays. They would not have been a problem except if the cable were jostled around. As the cable moved around, the wires would pull out slightly. After so long, the wires would pull out to far and the strands could touch. This problem was fixed by the professor. He had smaller cables that he gave out to the class. These smaller cables slid directly into the housing and attached snuggly. Important rule of thumb: ALWAYS UNPLUG THE BATTERY PACK WHEN DONE USING!
As a final note, when all repairs were completed. The program was finally reloaded into the platform, and the robot was successful in writing my initials.
Tuesday, February 28, 2012
Monday, February 20, 2012
The last assignment had us using servo motors to drive our platforms. Today we transferred over to brushed DC motors in class. The first step in today's process was soldering foot long wires to the tabs on the motors. Also, we had to attach a capacitor between the tabs. This was accomplished simultaneously by slipping the wires through the tab holes, wrapping them around themselves and the tabs, laying the capacitor between the tab/wire combination, then soldering everything together at once. The final results are visible below.
The next step was attaching the motor to the platform. The following picture shows a side view of the motor with the wheel removed.
At this point, only one small piece remained. To the ends of the wires tips had to be crimped on. These tips were then placed in a plastic sleeve that acts like a plug for adding the motors to the bread board. This picture shows the final results of both plugs.
This final picture shows a side view of the platform with the motor and wheel in place.
The next step was attaching the motor to the platform. The following picture shows a side view of the motor with the wheel removed.
At this point, only one small piece remained. To the ends of the wires tips had to be crimped on. These tips were then placed in a plastic sleeve that acts like a plug for adding the motors to the bread board. This picture shows the final results of both plugs.
This final picture shows a side view of the platform with the motor and wheel in place.
Saturday, February 18, 2012
This entry will be about the first full assignment with the built robot platform.
On Monday, during class, we began a project. This project was to program our robot to make its way through a maze. The layout of the maze is below.
This was a task where it was primarily programming. The following is the program that was written.
init: servo B.6, 150 ;right motor starts from zero
servo B.7, 150 ;left motor starts from zero
symbol mor = B.6 ;change servo in B.6 to right motor
symbol mol = B.7 ;change servo in B.7 to left motor
main: gosub fwd ;1 move forward
pause 3500
gosub stp
gosub rgt ;2 turn right
pause 1300
gosub stp
gosub fwd ;3 move forward
pause 3500
gosub stp
gosub lft ;4 turn left
pause 1450
gosub stp
gosub fwd ;5 move forward
pause 1600
gosub stp
gosub lft ;6 turn left
pause 1450
gosub stp
gosub fwd ;7 move forward
pause 4000
gosub stp
gosub rgt ;8 turn right
pause 1400
gosub stp
gosub fwd ;9 move forward
pause 1600
gosub stp
gosub rgt ;10 turn right
pause 1350
gosub stp
gosub fwd ;11 move forward
pause 1300
gosub stp
gosub lft ;12 turn left
pause 1500
gosub stp
gosub fwd ;13 move forward
pause 4250
gosub stp
sound A.1,(100,150) ;piezzo buzzer
stop ;stop at end
fwd: servopos mor, 75 ;right motor forward (rev) full
servopos mol, 225 ;left motor forward full
return
lft: servopos mor, 75 ;right motor full forward
servopos mol, 150 ;left motor stop
return
rgt: servopos mor, 150 ;right motor stop
servopos mol, 225 ;left motor full forward
return
stp: servopos mor, 150 ;right motor stop
servopos mol, 150 ;left motor stop
pause 1000 ;wait 1 second
return
The right hand side, in green, is where the programming comments are. These allow me to keep track of what the program should be doing at that point. The blue words are the commands for the program. If you read the program, you will notice a command: "gosub." This command sends the program down to a subroutine. These are the four segments at the very end. They each have a designated job. These jobs are to move forward, turn left, turn right, and stop respectively. These subroutines are very nice in that you do not have to repeatedly type the same commands over and over. Instead, all you need to do is send the program to that portion over and over. If you contiue to inspect the program, you should notice the command "pause." This tells the program to continue the previous action for that length of time. For example: gosub lft ;12 turn left pause 1500
gosub stp
This tells the robot to turn left for 1.5 seconds. 1000 is equal to 1 second. One final addition that was made to the program was the second to last line. sound A.1,(100,150) ;piezzo buzzer
This line was added to make the piezzo buzzer sound when the robot completed the maze. This time, the numbers indicated two things. The 100 indicates the tone the buzzer is to sound, and the 150 indicates the duration. This means that if you wanted to, you could have your buzzer play an entire song.
The program was to be written on Monday and it was to be tested on Wednesday. My personal side to this was one of major upset. I had the entire program written on Monday, but my laptop died before I saved it. This meant that I had to rewrite the program from scratch. Happily, it did make the run on Wednesday after I rewrote it.
Another item we worked on on Wednesday was adding LED lights to our bread board. This exercise was designed to show us how we can control multiple components at the same time. Below is the program that I wrote for this assignment.
dirsD=000111
main: pinsD=000001
pause 100
pinsD=000011
pause 100
pinsD=000111
pause 100
pinsD=000110
pause 100
pinsD=000100
pause 100
pinsD=000000
pause 100
goto main
With this program, I was able to make the LEDs come on and turn off in sequence. The first line of the program designates which pins attached to the chip will be turned on. The final three (where the ones are) designate pins 2, 1, and 0 respectively. Each LED was plugged into one of those pins (see picture below). In the program as a 1 appears it means that that pin is turned on. When a 0 appears it is turned off.
The following is a movie of the LEDs in operation.
On Monday, during class, we began a project. This project was to program our robot to make its way through a maze. The layout of the maze is below.
This was a task where it was primarily programming. The following is the program that was written.
init: servo B.6, 150 ;right motor starts from zero
servo B.7, 150 ;left motor starts from zero
symbol mor = B.6 ;change servo in B.6 to right motor
symbol mol = B.7 ;change servo in B.7 to left motor
main: gosub fwd ;1 move forward
pause 3500
gosub stp
gosub rgt ;2 turn right
pause 1300
gosub stp
gosub fwd ;3 move forward
pause 3500
gosub stp
gosub lft ;4 turn left
pause 1450
gosub stp
gosub fwd ;5 move forward
pause 1600
gosub stp
gosub lft ;6 turn left
pause 1450
gosub stp
gosub fwd ;7 move forward
pause 4000
gosub stp
gosub rgt ;8 turn right
pause 1400
gosub stp
gosub fwd ;9 move forward
pause 1600
gosub stp
gosub rgt ;10 turn right
pause 1350
gosub stp
gosub fwd ;11 move forward
pause 1300
gosub stp
gosub lft ;12 turn left
pause 1500
gosub stp
gosub fwd ;13 move forward
pause 4250
gosub stp
sound A.1,(100,150) ;piezzo buzzer
stop ;stop at end
fwd: servopos mor, 75 ;right motor forward (rev) full
servopos mol, 225 ;left motor forward full
return
lft: servopos mor, 75 ;right motor full forward
servopos mol, 150 ;left motor stop
return
rgt: servopos mor, 150 ;right motor stop
servopos mol, 225 ;left motor full forward
return
stp: servopos mor, 150 ;right motor stop
servopos mol, 150 ;left motor stop
pause 1000 ;wait 1 second
return
The right hand side, in green, is where the programming comments are. These allow me to keep track of what the program should be doing at that point. The blue words are the commands for the program. If you read the program, you will notice a command: "gosub." This command sends the program down to a subroutine. These are the four segments at the very end. They each have a designated job. These jobs are to move forward, turn left, turn right, and stop respectively. These subroutines are very nice in that you do not have to repeatedly type the same commands over and over. Instead, all you need to do is send the program to that portion over and over. If you contiue to inspect the program, you should notice the command "pause." This tells the program to continue the previous action for that length of time. For example: gosub lft ;12 turn left pause 1500
gosub stp
This tells the robot to turn left for 1.5 seconds. 1000 is equal to 1 second. One final addition that was made to the program was the second to last line. sound A.1,(100,150) ;piezzo buzzer
This line was added to make the piezzo buzzer sound when the robot completed the maze. This time, the numbers indicated two things. The 100 indicates the tone the buzzer is to sound, and the 150 indicates the duration. This means that if you wanted to, you could have your buzzer play an entire song.
The program was to be written on Monday and it was to be tested on Wednesday. My personal side to this was one of major upset. I had the entire program written on Monday, but my laptop died before I saved it. This meant that I had to rewrite the program from scratch. Happily, it did make the run on Wednesday after I rewrote it.
Another item we worked on on Wednesday was adding LED lights to our bread board. This exercise was designed to show us how we can control multiple components at the same time. Below is the program that I wrote for this assignment.
dirsD=000111
main: pinsD=000001
pause 100
pinsD=000011
pause 100
pinsD=000111
pause 100
pinsD=000110
pause 100
pinsD=000100
pause 100
pinsD=000000
pause 100
goto main
With this program, I was able to make the LEDs come on and turn off in sequence. The first line of the program designates which pins attached to the chip will be turned on. The final three (where the ones are) designate pins 2, 1, and 0 respectively. Each LED was plugged into one of those pins (see picture below). In the program as a 1 appears it means that that pin is turned on. When a 0 appears it is turned off.
The following is a movie of the LEDs in operation.
Wednesday, February 8, 2012
The next steps in the construction of the robot, are a combination of work done Monday and today during class.
On Monday, we began work that would allow us to add external components to the robot via a breadboard, and create programs to control these components. The first addition to the robot was the breadboard. From there we had to wire the breadboard to the microcontroller and the power source on the circuit board. The first set up was to attach an LED to the breadboard and make it flash. the circuit on the breadboard was simple, but then we had to write the Picaxe program to turn on the LED, then make it flash. The following is the program as it was written:
do
high B.0 B.0 is the pin on the microcontroller the LED is attached to
pause 2000 this is a 2 second delay (light is on for 2 seconds)
low B.0 the high above is on full, the low here is off
pause 2000 the LED is off for 2 seconds
loop this loop sends the program back to the do command
This work was successfully completed during class time. I did not have my camera, so there are no pictures of the full set up.
Today's work had to do with the connection and programming of servo motors. The first step was to attach the servos to the robots. The following pictures show two views of the servos mounted to the frame with wheels attached.
Upon attching the servo motors, we next had to set up a way to attach the plugs to the breadboard. In order to accomplish this, I cut short wire bridges and plugged them into the servo plug. The picture below shows the results.
The circuit had to attach to the voltage source, the ground, and two B pins on the circuit board. I used pins B.6 and B.7. The next picture shows the circuit board where these connections were made. The votage source is the red wire in the middle on the left of the microcontroller, and the black on that side is the ground. The two blue wires located at the top right of the microcontroller are the two pins.
The next two pictures are how the remainder of the circuit on the breadboard was laid out. I began by making a hand drawn layout, then plugged the components in to match.
It is a little difficult to see, but the connections between the two pictures are the same. Now that the circuit on the breadboard was complete, it was time to run a test program to see if it worked. The following was the test program that was used:
init: servo B.6,75 these two lines allow the program to identify which components
servo B.7,75 are attached to which pins
main: servopos B.6,225 the servo in B.6 is on full in one direction
pause 2000 B.6 is on for 2 seconds
servopos B.7,75 the servo in B.7 is on full in the opposite direction
pause 2000 B.7 is on for 2 seconds
goto main this returns the program to the top (it ran the same as a loop)
Thankfully, once the programming was completed, the servos turned on and ran as expected. Interestingly, the goto main command returned the program to the top at main and the wheels continuously ran. This was the same effect as running a do loop in the same program.
On Monday, we began work that would allow us to add external components to the robot via a breadboard, and create programs to control these components. The first addition to the robot was the breadboard. From there we had to wire the breadboard to the microcontroller and the power source on the circuit board. The first set up was to attach an LED to the breadboard and make it flash. the circuit on the breadboard was simple, but then we had to write the Picaxe program to turn on the LED, then make it flash. The following is the program as it was written:
do
high B.0 B.0 is the pin on the microcontroller the LED is attached to
pause 2000 this is a 2 second delay (light is on for 2 seconds)
low B.0 the high above is on full, the low here is off
pause 2000 the LED is off for 2 seconds
loop this loop sends the program back to the do command
This work was successfully completed during class time. I did not have my camera, so there are no pictures of the full set up.
Today's work had to do with the connection and programming of servo motors. The first step was to attach the servos to the robots. The following pictures show two views of the servos mounted to the frame with wheels attached.
Upon attching the servo motors, we next had to set up a way to attach the plugs to the breadboard. In order to accomplish this, I cut short wire bridges and plugged them into the servo plug. The picture below shows the results.
The circuit had to attach to the voltage source, the ground, and two B pins on the circuit board. I used pins B.6 and B.7. The next picture shows the circuit board where these connections were made. The votage source is the red wire in the middle on the left of the microcontroller, and the black on that side is the ground. The two blue wires located at the top right of the microcontroller are the two pins.
The next two pictures are how the remainder of the circuit on the breadboard was laid out. I began by making a hand drawn layout, then plugged the components in to match.
It is a little difficult to see, but the connections between the two pictures are the same. Now that the circuit on the breadboard was complete, it was time to run a test program to see if it worked. The following was the test program that was used:
init: servo B.6,75 these two lines allow the program to identify which components
servo B.7,75 are attached to which pins
main: servopos B.6,225 the servo in B.6 is on full in one direction
pause 2000 B.6 is on for 2 seconds
servopos B.7,75 the servo in B.7 is on full in the opposite direction
pause 2000 B.7 is on for 2 seconds
goto main this returns the program to the top (it ran the same as a loop)
Thankfully, once the programming was completed, the servos turned on and ran as expected. Interestingly, the goto main command returned the program to the top at main and the wheels continuously ran. This was the same effect as running a do loop in the same program.
Wednesday, February 1, 2012
Construction of my robot continued today in class. At this point, I was a little bit ahead of my classmates, so I began construction of the body. As you can see in the following pictures, it consists of two levels of blue plastic with the board mounted on a separate level on the top. Provided are four pictures to allow for an overall look at its current state.
The pictures above and below show views of the front and rear of the robot. You should notice that there are some parts missing. These views allow you to see that the battery and bread board have not been attached yet.
The picture above shows the bottom, and the picture below gives a side view. The side view gives a good glance at the absence of wheels, motor mounts, and motors. All of these parts will be added as the project moves forward.
Once the majority of the body was constructed, there was a job to complete held over from the last class period. The wiring of the computer cord needed to be completed. During the last class period, it was established that the yellow, orange, and brown wires were needed. This was incorrect because I counted the ports from the wrong end of the plug. The orange was correct as number three (basically because the third hole is the same from both sides). Instead of yellow and brown being two and five respectively, it turned out red was two and green was five. In order to discover this miswiring, the Picaxe program was used to check our work. We ran a diagnostic program to check the flow of data. The program showed that no data was flowing. That was when it was discovered that the plug was read in reverse. Once that error was remedied, the diagnostic check turned out fine. The final step for today was to put a plastic plug cover over the wire ends. This is visible in the following picture.
Now the board is ready to be programmed. That will be next class.
Subscribe to:
Posts (Atom)