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.
No comments:
Post a Comment