|
Wednesday, January 16, 2008 |
Software For Robot |
Interactive C:
The development tool for the used for The Handy Board is called Interactive C (IC). IC is basically consist of two parts, a pseudo-code (pcode) machine language module and the interface/compiler portion (IC program). IC compiles into pseudo-code (p-code) which is then executed by a custom stack machine. The p-code is interpreted by a run-time machines language program store in the 6811 MPU. This unique approach was taken because it allows IC to have run-time error check, small object code, source code portability and finally the most useful and powerful feature, multi tasking. The only drawback is at the expense of slower execution speed. However, this should not be a problem with most applications.
IC supports a subset of C, it includes: Control structure; for, while, if, else Local, global variables Arrays, Pointers 16, 32 bits integers 32 bits floating point numbers Here is a block diagram of how IC works.
IC Library functions:
DC Motors : void fd(int m) Turns motor m on in the forward direction. Example: fd(3); void bk(int m) Turns motor m on in the backward direction. Example: bk(1); void off(int m) Turns off motor m. Example: off(1); void alloff(), void ao() Turns off all motors. ao is a short form for alloff. void motor(int m, int p) Turns on motor m at power level p. Power levels range from 100 for full on forward to -100 for full on backward.
Servo Motor : void servo_on() Enables PA7 servo output waveform. void servo_off() Disables PA7 servo output waveform. int servo(int period) Sets length of servo control pulse. Value is the time in half-microseconds of the positive portion of a rectangular wave that is generated on the PA7 pin for use in controlling a servo motor. Minimum allowable value is 1400 (i.e., 700 sec); maximum is 4860. int servo_rad(float angle) Sets servo angle in radians. int servo_deg(float angle) Sets servo angle in degrees.
Sensor Input: int digital(int p) Returns the value of the sensor in sensor port p, as a true/false value (1 for true and 0 for false). int analog(int p) Returns value of sensor port numbered p. Result is integer between 0 and 255.
User Buttons and Knob: int stop_button() Returns value of button labeled Stop: 1 if pressed and 0 if released. int start_button() Returns value of button labeled Start. void stop_press() Waits for Stop button to be pressed, then released. Then issues a short beep and returns. void start_press() Like stop_press, but for the Start button. int knob() Returns the position of a knob as a value from 0 to 255.
Infrared Subsystem: int sony_init(1) Enables the infrared driver. int sony_init(0) Disables the infrared driver. int ir_data(int dummy) Returns the data byte last received by the driver, or zero if no data has been received since the last call.
Time Commands: void reset_system_time() Resets the count of system time to zero milliseconds. long mseconds() Returns the count of system time in milliseconds. float seconds() Returns the count of system time in seconds, as a floating point number. Resolution is one millisecond. void sleep(float sec) Waits for an amount of time equal to or slightly greater than sec seconds. void msleep(long msec) Waits for an amount of time equal to or greater than msec milliseconds. msec is a long integer.
Tone Functions: void beep() Produces a tone of 500 Hertz for a period of 0.3 seconds. void tone(float frequency, float length) Produces a tone at pitch frequency Hertz for length seconds. Both frequency and length are floats. void set_beeper_pitch(float frequency) Sets the beeper tone to be frequency Hz. The subsequent function is then used to turn the beeper on. void beeper_on() Turns on the beeper at last frequency selected by the former function. void beeper_off() Turns off the beeper.
Multi-Tasking: int start_process( function-call( : :):, [TICKS] , [STACK-SIZE] ) start_process returns an integer, which is the process ID assigned to the new process. int kill_process(int pid) kill_all kills all currently running processes. ps prints out a list of the process status. The following information is presented: process ID, status code, program counter, stack pointer, stack pointer origin, number of ticks, and name of function that is currently executing. void hog_processor() Allocates an additional 256 milliseconds of execution to the currently running process. void defer() Makes a process swap out immediately after the function is called.
Floating Point Functions: float sin(float angle) Returns sine of angle. Angle is specified in radians; result is in radians. float cos(float angle) Returns cosine of angle. Angle is specified in radians; result is in radians. float tan(float angle) Returns tangent of angle. Angle is specified in radians; result is in radians. float atan(float angle) Returns arc tangent of angle. Angle is specified in radians; result is in radians. float sqrt(float num) Returns square root of num. float log10(float num) Returns logarithm of num to the base 10. float log(float num) Returns natural logarithm of num. float exp10(float num) Returns 10 to the num power. float exp(float num) Returns e to the num power. (float) a ^ (float) b Returns a to the b power.
Memory Access Functions: int peek(int loc) Returns the byte located at address loc. int peekword(int loc) Returns the 16-bit value located at address loc and loc+1. loc has the most significant byte, as per the 6811 16-bit addressing standard. void poke(int loc, int byte) Stores the 8-bit value byte at memory address loc. void pokeword(int loc, int word) Stores the 16-bit value word at memory addresses loc and loc+1. void bit_set(int loc, int mask) Sets bits that are set in mask at memory address loc. void bit_clear(int loc, int mask) Clears bits that are set in mask at memory address loc. Here is an hierarchical sturcture of the IC library functions in relations to user programs.
Software model The main function of the robot is to gather information from all of its sensors and decide what to do from the information collected. It must constantly poll, 4 infrared(edge), 4 ultrasound, and 4 contact sensors. In addition to checking the sensors, the motors are controlled via an open loop system with no feedbacks. Therefore it must use some timing function to control its maneuvers such as turning. The multi-tasking function and time commands of IC seems ideally suited for this application.
The ellipses are individual tasks. The sensors checking tasks writes the result of its sesnsor test to global variables. The "Main Program" polls these global variables and decides on what to do. It also have to make sure that only one "Move Robot" task can be active at a time. This information is communicated to the "Main Program" via task status global variables. /***************************************************** ***** Dave's Multi-tasking Sumo Robot Program ***** ***** Version .91 May 18, 97 ***** *****************************************************/
/***************************************************** ********** Global Variablies ************** ***************************************************** ********** Common fixed values ************** *****************************************************/ int moving=1, not_moving=0, robot_status, running=1, not_running=0;
/***************************************************** ********** Analog ports ************* ***************************************************** *********** Infared edge sensors *************** ***************************************************** ****** Values for edge ****** ****** 1 = fl_edge ****** ****** 2 = fr_edge ****** ****** 4 = rl_edge ****** ****** 8 = rr_edge ******/
int rr_edge=0, rl_edge=1, fr_edge=2, fl_edge=3, first_edge=0, last_edge=3, suface_value=0, off_edge_value=0, white_value=0, temp_edge=0, edge=0;
/***************************************************** ************** Digital Ports *************** *****************************************************/ int left_ultra=12, front_left_ultra=13, front_right_ultra14, right_ultra=15, first_ultra=12, last_ultra=15, ultra=0, temp_ultra=0;
int left_contact=7, right_contact=8, /*front_contact=xx, rear_contact=xx,*/ first_contact=7, last_contact=8, contact=0, temp_contact=0;
/***************************************************** ******** Direction, Speed, and Duration ********** *****************************************************/ int fast=100, medium=50, slow=11, forward=1, right=2, left=3, fast_pivot=100, slow_pivot=50, reverse=-1;
long forever=255l;
/***************************************************** ********* Process ID's ************** *****************************************************/ int edge_pid,move_pid,contact_pid,ultra_pid, edge_evade_pid,contact_evade_pid,tracking_pid;
/***************************************************** ********* Process Status ************** *****************************************************/ int edge_status,move_status,ultra_status,contact_evade_status, edge_evade_status,tracking_status; int edge_evade_stage1=not_running;
/***************************************************** ******** Sensor Checking Taskes *********** ***************************************************** ******** Edge detection Analog ports 0-3 *********** *****************************************************/ void check_edge() { int x,e; while(1) { e=0; for (x=first_edge; x<=last_edge; x++) { e <<= 1; /* shift e 1 bit to the left */ if (analog(x) <= white_value) /*||analog(x) >= off_edge_value)*/ e |= 1; /* OR e with 0001 */ } /*printf("edge=%d e=%d\n",edge,e);*/ if (e != edge) edge=e; } }
/***************************************************** ****** Contact sensors, Digital ports 7-10 ******* *****************************************************/
void check_contact() { int x,c; while(1) { c=0; for (x=first_contact; x<=last_contact; x++) { c <<= 1; /* shift c 1 bit to the left */ if (digital(x)) c |= 1; /* OR c with 0001 */ } /*printf("contact=%d c=%d\n",contact,c);*/ if (c != contact) contact=c; } } /***************************************************** ****** Obstacle detection Digital ports 12-15 ******* *****************************************************/ void check_ultra() { int u,x,y,z; while (1) { u=0; for(x=first_ultra; x<=last_ultra; x++) /* left to right */ { u <<= 1; /* shift u 1 bit to the left */ if(digital(x)) u |= 1; /* OR u with 0001 */ } printf("ultra=%d u=%d\n",ultra,u); if (u != ultra) ultra=u; } } /***************************************************** ********* Move robot ************** *****************************************************/ void move(int direction, int speed, long duration) { int sp1,sp2; long dur; move_status=running; if(direction==forward||direction==reverse) { sp1=direction*speed; sp2=sp1; } else if(direction==right) { sp1=reverse*speed; sp2=speed; } else if(direction==left) { sp1=speed; sp2=reverse*speed; } robot_status=moving; motor(0,sp1); motor(1,sp2); motor(2,sp2); motor(3,sp1); if (duration!=forever) { dur=mseconds(); while(duration >= mseconds()-dur); ao(); robot_status=not_moving; } move_status=not_running; kill_process(move_pid); }
/***************************************************** ************ Edge Evasive Maneuver *************** *****************************************************/ void edge_evade() { int dir,temp;
edge_evade_status=running; temp=temp_edge;
/********** move away from edge ***********/ /* front edge detectors dir=reverse */ /* rear edge detectors dir=forward */ if (temp==1||temp==2||temp==3) dir=reverse; else if (temp==4||temp==8||temp==12) dir=forward; edge_evade_stage1=running; robot_status=moving; move_pid=start_process(move(dir,fast,forever)); while (robot_status==moving);
edge_evade_stage1=not_running;
/****** turns towards the centre of platform ******/ if (temp==2||temp==8) dir=left; else if(temp==1||temp==4) dir=right; msleep(300l); move_status=running; move_pid=start_process(move(dir,medium,1500l)); while (move_status==running);
/******* move towards centre of platform **********/ move_status=running; move_pid=start_process(move(forward,slow,750l)); while(move_status==running);
edge_evade_status=not_running; kill_process(edge_evade_pid); }
/***************************************************** ********** Contact Evasive Maneuver ************** *****************************************************/ void contact_evade() { int c_dir;
contact_evade_status=running;
/* left contact c_dir=right speed=fast_pivot duration=500l */ /* right contact c_dir=left speed=fast_pivot duration=500l */ /* front contact c_dir=forward speed=fast duration=forever */ /* rear contact c_dir=reverse speed=fast duration=forever */ if (temp_contact==1) /* right contact */ c_dir=left; else if (temp_contact==2) /* left contact */ c_dir=right; robot_status=moving; move_status=running; if (temp_contact <= 2 && temp_contact !=0) move_pid=start_process(move(c_dir,fast,forever)); while(contact==temp_contact); contact_evade_status=not_running; kill_process(contact_evade_pid); } /***************************************************** ************ Obsticle Tracking *************** *****************************************************/ void tracking() { tracking_status=running; if(temp_ultra==1) move_pid=start_process(move(right,slow,forever)); if(temp_ultra==2||temp_ultra==3||temp_ultra==4||temp_ultra==6||temp_ultra==12) move_pid=start_process(move(forward,slow,forever)); if(temp_ultra==8) move_pid=start_process(move(left,slow_pivot,forever)); tracking_status=not_running; kill_process(tracking_pid); } /***************************************************** ***************************************************** ***************************************************** ***************************************************** ***************************************************** ************ Main Program *************** ***************************************************** ***************************************************** ***************************************************** ***************************************************** ***************************************************** *****************************************************/ void main() { int e,m,k,x,y,z; ao(); /* make sure that all motors and relays are off */ k=1; /* Initalize edge sensor values */ for(x=first_edge; x<=last_edge; x++) { z=0; for(y=0; y<=10; y++) z=z+analog(x); z=z/10; suface_value=suface_value+z; k++; } suface_value=suface_value/k; white_value=suface_value-20; if (suface_value+5 > 253) off_edge_value=253; else off_edge_value=suface_value+5; edge_pid=start_process(check_edge()); contact_pid=start_process(check_contact()); ultra_pid=start_process(check_ultra()); /* Main loop */ while (1) { if(edge!=temp_edge) { if(edge!=0) { if(edge_evade_status==running) { kill_process(edge_evade_pid); edge_evade_status=not_running; } if(contact_evade_status==running) { kill_process(contact_evade_pid); contact_evade_status==not_running; } if(tracking_status==running) { kill_process(tracking_pid); tracking_status=not_running; } if(move_status==running) { kill_process(move_pid); move_status=not_running; } ao(); robot_status=not_moving; temp_edge=edge; edge_evade_pid=start_process(edge_evade()); } else { if(edge_evade_stage1==running&&robot_status==moving) { ao(); robot_status=not_moving; if (move_status==running) kill_process(move_pid); } temp_edge=edge; } } else if(contact!=temp_contact&&edge_evade_status==not_running) { if(contact!=0) { if(tracking_status==running) { kill_process(tracking_pid); tracking_status=not_running; } if(move_status==running) { kill_process(move_pid); move_status=not_running; } ao(); robot_status=not_moving; temp_contact=contact; contact_evade_pid=start_process(contact_evade()); } else if(contact_evade_status==running || robot_status==moving) { if (contact_evade_status==running) { kill_process(contact_evade_pid); contact_evade_status=not_running; } ao(); robot_status=not_moving; temp_contact=contact; } } else if(ultra!=temp_ultra && edge_evade_status==not_running && contact_evade_status==not_running) { if(ultra!=0) { if(tracking_status==running) { kill_process(tracking_pid); tracking_status=not_running; } if(move_status==running) { kill_process(move_pid); move_status=not_running; } if(robot_status==moving) { ao(); robot_status=not_moving; } temp_ultra=ultra; tracking_pid=start_process(tracking()); } else { if(tracking_status==running) kill_process(tracking_pid); if(move_status==running) kill_process(move_pid); ao(); robot_status=not_moving; temp_ultra=ultra; } } } }Labels: Software for robot |
posted by Sachin Maurya @ 8:02 AM |
|
|
Share It:
Sunday, January 13, 2008 |
How to convert rotary motion into linear motion |
Introduction If you are thinking about constructing a small robotic platform, maybe control a few motors for some special applications and you want to get off cheap and use dc motors. Then it’s going to cost you. DC motors usually need things like gearboxes and location sensors if you want to get any use out of them. But if all you need is continuous rotational motion or linear motion until a switch gets bumped, this is the motor. Speaking of linear motion, here is a little recipe side dish: Linear Motion Using DC Motors A good linear setup can be easily made with a Radio Shack 3 volt DC motor, a square 1/8 inch styrene tube, and about 5 inches of 256-threaded rod. Cut an inch of the styrene tube and pressing it onto your motor, making sure the shaft still rotates. Now you simply start screwing the threaded rod into the other end of the styrene tube. Isn’t it cool how the threaded rod taps the styrene for you? For a real good hold, use modeling or crazy glue to hold it in place.
Now you can mount the motor into your project, or attach a slide to it. I like to use a 0.3 inch piece of 1/8" styrene as the part that slides up and down the screw. Once again I just use the screw to tap it, and I usually just glue the outside of the piece to whatever it is I’m trying to move. Or I press the small styrene piece into a larger brass tube using a little glue to secure it. Piece of cake.
Now all you need to do is determine where the slide is on the screw and you’ve got it made. True gear heads use optical encoders, I like to use a switch. With a switch it’s easy to determine where the beginning of the slide is, and I can just send a pulse to the motor and get the assembly to move to approximately where I want it. It seems like I’m forgetting to tell you something… OH YEAH, THE SWITCH So now that you have this cool linear slide, you probably think this would be a great app. to use up some of those micro-switches that you’ve had in your junk box since you where seven years old. Sure, you can use those switches to sense when the slide is at the end/beginning of the it’s range, right? Nope. It’s ok I use to think I could use those too, I even convinced myself that those switches where actually made to stop when something bumps into them. The reality is those switches where made to fill space in your toolbox. If micro-switches where meant to stop anything with any kind of momentum, they would have made them so they activate sooner and not bind up the second an object in motion. But fear not! We will simply construct our own. Switches are actually pretty easy to build. A spring, a contact point with a stopper, a little insulation, an outer case, you’re in business. Let’s build one real quickly.
THE SPRING Its pretty easy to make a spring. Using a 6" length of 1/16" square brass tube, insert one end of the steel wire into the tube, and crimp the tube shut, thus securing the wire. you are now free to wind the wire tightly around the tube, leaving no gaps between the coils. After you have wound wire down about an inch of the tube, snip the excess wire off at the top and the bottom of the spring using an old pair of wire cutters since the steel wire tends to nick the edge of the cutters. The wire will recoil slightly, making a pretty cool little spring about 0.1" across with bends in it that form hexagonal coils. Now just pull the two ends of the coil apart and stretch the wound wire until the distance between the coils is a little less than 0.1", and the spring is unable to pull back to it's original shape. Snip off a smaller spring about 0.4" long. INSULATION 0.4 inches of 1/8" Styrene. You’ll learn to love this stuff. CASE AND CONTACT ROD For the case I just used some square brass tube 5/32" actually, about 0.4" of it. The contact is just a thin piece of square brass tube (1/16" about 1.4 inches long) that runs down the center of the styrene. The styrene is glued into the larger piece of brass. For the stoppers I cut two 0.2-inch pieces of styrene, one piece fits flush on the end without the spring, and the other piece is glued on so as to add a little bit of tension to the spring. Solder a wire onto the contact piece and one onto the outside of the case. I use silver solder, it holds well. Now assemble like the picture using glue to hold the styrene stops onto the contact rod, and the styrene insulation in the case. Easy on the glue, if you get it on the contact rod and it glues to the insulation, things won’t slide. Now I glue or solder the case of the switch right below the motor and allow the slide assembly to bump into the contact switch. On my projects the slide assembly is metal and grounded. So now I can just run a 10k-ohm resistor from say, +5 volts to the contact rod. Now when the contact rod hits the slide assembly I get a nice TTL low for my microcontroller. The spring allows the assembly to come to a slow without binding. The assembly is now ready to start moving back out with no problems.
Your going to have to make adjustments in the tension of the spring and the position of the switch to suite your application. You might even want to eliminate the back stopper and replace it with a couple pieces of brass tube so you can make a normally closed switch. As long as you understand the basic concept of what your application requires and what you need to do to get your project to work, you’re cool. After all, that’s what hobby robotics is all about. THE DC MOTOR INTERFACE If you have a small DC motor and you want to hook it up to a processor or a controller easily, I would highly recommend using L293D motor controller chip has good prices and even got me the surface-mount version. For most of my applications I use the Basic Stamp II but I know SRS Rob hackers aren’t like the rest of us- they’re different. Here is a generic schematic with the control lines labeled. Notice that the L293D supports two DC motors. Pin 16 is the +5 voltage for the chip, while pin 8 is the voltage for the motors. The first motor gets hooked directly to pins 3 and 6. The motor is turned on by sending a high signal to both the enable (pin 1) and one of the two direction pins, lets say pin 2, while keeping pin 7 low. To go the other direction keep the enable pin and pin 7 high while pin 2 goes low. To stop enable pin is high while both 2 and 7 are low. The same goes for the other side of the chip. When driving two or more motors I like to hook pins 2 and 15 together and pins 7 and 10. Sorry to say I don’t remember what the specs are for this chip, I usually send about 6 volts through it with a 0.7-volt drop for the L293D internal transistors, and I expect a 200 to 300 milli-amps total for both motors. Labels: How to convert rotary motion in to linear motion, Robotics |
posted by Sachin Maurya @ 9:54 AM |
|
|
Share It:
|
The Techniques of connection |
Introduction While building a robot you need to connect multiple devices together. There are lots of ways to connect them. Some are better than others! I have built lots off things that turn into a real rats nest. I would need one thing connected to my power source so I just solder a wire to the positive side and another wire to the ground side. As Chef Tell would say "Very simple, very easy". Then I needed a second device so I soldered those wires on. It's still not bad, yet... Or you can just twist the wires together, solder them and cover it with tape... As you add more devices it becomes a real problem! The picture on the left shows multiple wires soldered to a common point. It's not obvious from this picture but one of the red wires is soldered to another common point on the back of the board. And it has another 2 or 3 wires soldered to it. Both photos show examples of multiple wires soldered together and covered with tape. Connections will generally fall into one of two categories: - Individual signals
- Bussed or grouped signals
I will present different methods to make these connections. Individual Connections There are various ways to make a single connection. The following techniques come to mind: - Solder
- Banana plugs and jacks
- Jumper wires
- Wire-Wrap
- Screw terminals
- Block pin connectors
- Pin connectors
- Combination pin/screw connectors
- COAX cable connectors
Solder Connections As simple way to attach a wire is to solder it to a pin. This is a good way to permanently attach a wire. For instance, you may want to solder wires directly to a motor. Then use a quick-disconnect on the other end of the wires. These photos show different devices with soldered connections. The first one shows a voltage regulator which is bolted to a heat sink. The second one shows wires and a capacitor soldered to motor terminals. The third one shows wires soldered directly to a PC board. Just keep in mind these are permanent connections. Banana plugs and jacksJumper wires
Wire-Wrap Wire-wrap has been around a long time. Basically you have square pins and wire is wrapped around a pin to make the connection. Wire-wrap sockets are available for standard DIP I.C. packages. If you look around you can also find other types of sockets available. You can connect two boards together with wire-wrap wire. But the standard 30 gauge wire is made from steel (or iron) and is more brittle than copper wire. This leads to the wire breaking if it is flexed much. So it is best to have the boards mounted solidly if using 30 gauge wire-wrap wire to connect them. The actual connection is made using a wire-wrap tool. It looks much like a screwdriver. It has two holes in the business end. One in the center which slides over the pin to be wrapped. The other hole is offset from the center. The wire to be applied is slipped into this second hole. As the tool is turned the wire wraps itself around the pin. You can also find power wire-wrap guns. They are electric or pneumatic. But for occasional use the hand operated wire-wrap tool is adequate. Back when I did a lot of wire-wrapping I was amazed that it usually cost more for the socket than for the I.C. Over the years I have collected wire-wrap sockets when I found them at a cheap price. Screw terminals Screw terminals can be handy. They come in various sizes. You can get PC mount type and also simple terminal blocks you connect multiple wires to. The smaller PC mount types are designed to have a wire inserted and screwed down. The larger type work well with a crimp-on connector. If you use stranded wire with a screw terminal I recommend tinning the wiring with solder before connecting it to the screw terminal. This prevents the individual wire strands from fraying and possibly causing a short. Even though the terminal blocks (as seen in the first photo) are very handy, they seem to take up a lot of valuable space. My robot projects are usually quite large so it isn't a big problem for me. They are available in smaller screw sizes also. Crimp-on terminals Crimp-on terminals provide an easy way to terminate individual wires. This provides a clean connection to a screw terminal. The terminals come in a variety of sizes and types. They are applied using a crimper. You can get "cheap" crimpers at auto supply stores and hardware stores. They work, but not very well. (In my humble opinion) The high quality yellow handle crimpers in the picture are a pair I picked up at a swap meet for 4000 Rs. A pair from AMP or other major brands seems to run around 3200 Rs for some unknown reason... The terminals are available at Radio Shack, auto supply, hardware and lots of other stores. Block pin connectors This type of connector allows an easy way to make a cable removable. You can cut the cable and install this in between the two ends. These are available at Radio Shack and most electronics suppliers. (Maybe even auto parts stores) They come in at least two different pin sizes. Right off hand I know you can get them with pins ranging from 2 to 12, maybe bigger. PCB pin connectors Pin connectors provide a very flexible way to terminate your wires. They come in two basic types. Single wires and multiple wires (like ribbon cable). The multiple connections are presented on the next page. I use two different size of connectors. The smaller, red ones are Molex/Weld There are many, inexpensive ways to lay out the electronic components which interface to your Stamp board. A good layout has the following features: 1. All components are secured to some kind of rigid backing. Nothing is flopping in the breeze. 2. Wires are only as long as they need be. No wire loops rising above the board. 3. Component leads are trimmed so that there is no danger of leads shorting should they be bent. 4. The entire project, including batteries, can be lifted with one hand. Everything is one backing board. 5. The project can survive modest drops and modest shaking without connections coming loose. 6. All motor housings are secured so that the housing doesn't move when the motor is powered. 7. Switches are anchored so that they can be operated with one hand. Here are some pictures of circuits which interface an LED, a small motor and a switch to the Stamp. Use them for ideas. on connectors. The pins are .1" on center so they fit in standard perf board. I get them from Digit Key. You buy the pin blocks, socket blocks and pins separately. They come in lots of sizes so you pick the size you need for the application. (Some times it is good to have all the connectors on a board be different sizes. Then you can't plug the wrong one in by mistake.) You can get a crimper for the socket pins, but I can't find mine at the moment. I usually solder the pin whither I crimp it or attach it by hand. I've had too many come loose if I don't solder them. The other types have the pin permanently mounted in the socket block. You crimp the wire into the socket itself. These come in at least two different sizes. I have .1" and .156" pin spacing sizes. The larger size are rated at around 3 to 5 amps. They are made by AMP and Pundit and others. I managed to find a pistol crimper for the large and small ones and surplus stores. (These are something else that cost too much when they are new. I think they are over $100. :-O ) I also found a hand crimper which you can see in the photo. AMP MT pin connectors
This is another type of pin connector. They come as single in-line or dual in-line. They are end and edge stackable. (Which means you can insert them side-by-side.) So you can mix and match them on a larger block of connector pins. Combination pin/screw connectors
A pin/screw connector offers an interesting alternative. It allows individual wires to be attached at random since each pin has a screw terminal. It also allows the whole connector block to be pulled off the pins when removing the board. (Note: I didn't have the pin block handy for the photo.) COAX cable connectors
There are various ways to terminate COAX cable. COAX stands for Co-Axial. A COAX cable has a central wire surrounded by a concentric shield wire. COAX is usually used for analog or RF signals. You can use RCA phonon connectors, BNC connectors and lots of other types. Grouped Connections There are various ways to make a group of connections. The following techniques come to mind: - Crimp-on ribbon cable pin connectors
- Crimp-on ribbon cable card-edge connectors
- Crimp-on DIP cable connectors
- Solder cup DB type connectors
- AMP MTA pin connectors
- Modular telephone type connectors
-
Crimp-on ribbon cable pin connectors
Crimp-on ribbon cable card-edge connectors
Crimp-on DIP cable connectors
Solder cup DB type connectors
Modular telephone type connectors
CIRCUIT LAYOUTS There are many, inexpensive ways to lay out the electronic components which interface to your Stamp board. A good layout has the following features: 1. All components are secured to some kind of rigid backing. Nothing is flopping in the breeze. 2. Wires are only as long as they need be. No wire loops rising above the board. 3. Component leads are trimmed so that there is no danger of leads shorting should they be bent. 4. The entire project, including batteries, can be lifted with one hand. Everything is one backing board. 5. The project can survive modest drops and modest shaking without connections coming loose. 6. All motor housings are secured so that the housing doesn't move when the motor is powered. 7. Switches are anchored so that they can be operated with one hand. Here are some pictures of circuits which interface an LED, a small motor and a switch to the Stamp. Use them for ideas. Labels: Robot Connections, Types of connection |
posted by Sachin Maurya @ 6:46 AM |
|
|
Share It:
Friday, January 11, 2008 |
How to Build a Microcontroller Based Robotic Arm |
Introduction
The arm control by robotics is very popular in the world of robotics. The essential part of the robotic arm is a programmable micro controller based brick capable of driving basically three stepper motors design to form an anthropomorphic structure. The first design was for experimental use on a human size industrial robot arm called PUMA 560 .This article explains the method of interfacing the robotic arm stepper motors with the programmed 8051-based micro controller Keywords: MCU, PUMA, PIO, LATCH, I/O Objective: Our primary objective is to make the Robotic arm, having three stepper motors, to interface with the In-Development of a Microcontroller Based Robotic Arm tel 8051-based micro-controller. It provides more interfaces to the outside world and has larger Memory to store many programs Approach: We were able to perform a detailed study of the robotic arm and the 8051 micro-controller. We Tested the built robotic arm, and the stepper motors when the robot is loaded. We also learnt and Familiarized with the 8051 micro-controller using assembly language, and converting the assembly language codes to hexadecimal codes using a development board. Mechanical Structure of the Arm: In constructing our arm, we made use of three stepper motors and gears since our structure is a three dimensional structure. A typical prototype that we employed is as shown in Figure.There is a stepper motor at the base, which allows for circular movement of the whole Structure; another at the shoulder which allows for upward and downward movement of the Arm; while the last stepper motor at the wrist allows for the picking of objects by the magnetic hand.
Micro-Controller: The various components of the MCU shown in Figure 2 are explained below: Random Access Memory (RAM): RAM is used for temporary storage of data during runtime. ROM: ROM is the memory which stores the program to be executed. SFR Registers: Special Function Registers are special elements of RAM. Program Counter: This is the "engine" which starts the program and points to the memory address of the instruction to be executed. Immediately upon its execution, value of counter increments by 1. Control Logic: As the name implies, it which supervises and controls every aspect of operations Within MCU, and it cannot be manipulated. It comprises several parts, the most Important ones including: instructions decoder, Arithmetical Logic Unit (ALU) and Accumulator. A/D Converter: A/D stands for analog to digital. They convert analog signals to digital signals. I/O Ports: To be of any practical use, microcontrollers have ports which are connected to the pins on its case. Every pin can be designated as either input or output to suit user’s needs. Oscillator: This is the rhythm section of the MCU. The stable pace provided by this instrument allows harmonious and synchronous functioning of all other parts of MCU. Timers: timers can be used for measuring time between two occurrences and can also behave like a counter. The Watchdog Timer resets the MCU every time it overflows, and the program execution starts anew (much as if the power had just been turned on). Power Supply Circuit: this powers the MCU. Methodology The method employed in designing and constructing the robotic arm are based on the operational Characteristics and features of the microcontrollers, stepper motors, the electronic circuit diagrams and most importantly the programming of the microcontroller and stepper motors. Block Diagram The block diagram of our work is as shown in Figure
Circuit Diagram The electronic circuit diagram of the development board is as shown in Figure 4. The connection of the identified components and devices are as shown. The components shown are: the MCU, the LATCH 74LS373, the EPROM 2732, Intel 8255 PIO, diodes, resistors, capacitors, inductors, transistors, and op-amps. This components work together to achieve the set goal of controlling the anthropomorphic-like arrangement of the stepper motor. The microcontroller is the processing device that coordinates all the activities of all the components for proper functioning.
Power Supply This is used to power the whole system i.e. the Control Unit, Magnetic Sensing Unit, and the Stepper Motors. The transformer is a 220/12V step down transformer. We used a bridge rectifier to convert the 12V alternating current to direct current. The unregulated output from the filtering circuit is fed into a voltage regulator LM7805 andLM7812. These two are chosen for the design because the LM7805 has an output of +5V which’s required to power the Control Unit, and the Magnetic Coil while the LM7812 has an output of +12v which is required to power the Stepper motors. The TIP41 connected to the IC regulators functions as an emitter follower amplifier making sure that at least the required voltage by the Control Unit, the Magnetic Coil and the Stepper Motors produced. MCU 8051 This is the processor. It coordinates the operation of the robotic arm by collecting information from the EPROM, the LATCH, and the PIO; interprets and then execute the instructions. It is the heart of the whole system. LATCH 74LS373 This is a D-type transparent latch. It is an 8 bit register that has 3 state bus driving outputs, full Parallel access for loading, and buffer control inputs. It is transparent because when the enable EN(enable) input is high, the output will look exactly like the D input. This latch particularly Separates the data and address information from the MCU before sending to the instructed destination.The high-impedance state and increased high logic-level drive provide these registers with the capability of being connected directly to and driving the bus lines in a bus-organized system without need for interface or pull-up components. These latches are particularly attractive for implementing buffer registers, I/O ports, bidirectional bus drivers, and working registers.We are using this latch because there is a need to separate our 8 bit data and 8 bit address information from the common line of the MCU, and send them to the appropriate device(s). 8255 PIO This is a programmable input/output device. It interfaces the connection between the 8051, the LATCH 74LS373, and the EPROM 2732 to external devices such as the stepper motors, (as is our own case) thereby allowing for communication. (EPROM) 2732 EPROM stands for Electrically Programmable Read Only Memory. We made use of this external EPROM specifically because it makes the controller cheaper, allows for longer programs, and Because its content can be changed during run time and can also be saved after the power is off The overall diagrammatical layout of the complete circuit diagram of the whole control unit is shown in Figure. Stepper Motor The stepping motor is a motor that is driven and controlled by an electrical pulse train generated by the MCU . Each pulse drives the stepping motor by a fraction of one Revolution, called the step angle. The Magnetic Sensing Unit The magnetic sensing unit consists of a magnetic coil which can be magnetized simply by the action of the port P1.0 of the 8051. The port 1.0 was made use of because when designated as output, each of the pin can be connected up to four TTL inputs. That is why we have connected the pin 1.0 to the magnetic coil through three TTL logic The design is such that on the downward movement of the wrist, the 8051 sends an electrical signal to the Darlington pair connected to the magnetic coil. The magnetic sensing unit is powered on by three BC548 Darlington NPN pair transistor, through a diode each and a 5k resistor. The pair amplifies the current and makes the magnetic coil turn into magnet. Then any magnetic material could be picked (by attraction) and then movement continues. The magnetic material can then be dropped at another point when the wrist is made to come down, this also is an action from the 8051 as it withdraws the electrical signal from the coil. Control Circuit This is the control panel of the system as it oversees the operations of the mechanical arm, and the magnetic sensing unit. The MCU 8051 of the control unit acts as the brain of the control panel as it coordinates all the activities of the other devices. When power (+5V) was supplied to the control unit, the MCU started off by loading the program from the EPROM M2732A, interpreted and executed the instruction codes through the various operational principles which had been described in details in chapter three (session 3.2).The 8051 then sends signal to the stepper motor which moves 9° per step. The stepper motor(M3) at the wrist first moves five times (45°) turning the gears to cause a downward movement of the hand. The stepper motor at the shoulder (M2) moves next stepping five times (45°) and makes the connected gears to cause the movement of the arm 45° forward. Then the stepper motor at the base(M1) moves either ten times (90°) or twenty times (180°), depending on the button pressed, causing the whole structure to turn from right to left( or vice versa) through the connected gears. The magnetic coil resting on the hand becomes magnetized immediately the last gear on the hand stops moving. Then, it magnetizes (picks) any magnetic material it can find and then M3 and M2 moves the arm up while M1 moves (rotates the structure) from left to right (or vice versa) and then the 8051 demagnetizes the magnetic coil thereby making the hand to drop the metallic object. Results This work is able to successfully accomplish the defined functionality. A sample robot which can rotate, magnetize an object, lower and raise its arm, by being controlled by the 8051 microcontroller is built successfully. The 8051-development board is soldered and it used the required procedure for the correct operation of the controller. The 8051 development board has been interfaced to the stepper motors such that the anthropomorphic like structure can be controlled from the buttons at the base of the structure (robotic arm). There are four buttons being controlled by the control unit at the base of the arm: • ON/OFF: the ON button puts on the system while the OFF button puts off the system • START/STOP: the START button starts the movement of the whole arm from its reset point, while the STOP button takes the arm back to its reset button after completion of its movement. • RIGHT-LEFT/LEFT-RIGHT: when this button is switched to the RIGHT-LEFT part it causes movement from right to left, while the LEFT-RIGHT part causes movement from left to right. • 180/90: when the button is on 180, it causes a rotation of 180 degree of the base stepper motor, but when put on 90 degrees, it causes rotation of 90 degrees. Labels: MicroController, Robotic Arm |
posted by Sachin Maurya @ 6:33 AM |
|
|
Share It:
|
About Me |
Name: Sachin Maurya
Home: Lucknow, Uttar Pradesh, India
About Me: born thinker
See my complete profile
|
Previous Post |
|
Archives |
|
Links |
|
Robot Images |
|
|