Tuesday 25 December 2012

Receiving Info From the Servo Motors

      Since we successfully sent commands to the controller using the sliders, our next endeavour was to get feedback on the actual position of the servos as they move, using the commands Q & QP. The format of the Q command is "#(servo) Q", and it will send back an ASCII '+' or '.'. The plus means that the servo is currently in motion, while the period means the servo is stopped. The QP command takes the form of "QP(servo)", and will return the pulse width that the servo has been delivered. Using these 2 commands, we can track the servo as it moves.


      We added a text box to the right of slider 4 in our control window and modified our code to have the program show the current pulse width as the slider and the servo both move.
     Our first attempt at coding this was to add a subroutine called “getPulseWidth” that sent the SCC-32 the QP command for servo 4, then read the response and put it in the text box. This operated on roughly the same lines as how we sent sent the move commands to the arm, and then it used the 'read' command to get the signal that was sent back. Because the SSC-32 can sometimes take a few milliseconds to respond, we included a timer that pauses the program for 6 milliseconds to account for that. The program then converts the response to to an integer, and places it in the text box.


      This worked, but we wanted something that would constantly display the pulse width as it changed, not just once when the slider was moved. To do this, we used a loop to call “getPulseWidth” multiple times, constantly updating the text box. It kept getting the value but introduced a few other problems. Since that the loop was constantly running, it became somewhat of a power-hog, and was using processing power when we didn't need it to. This caused large amounts of lag, slowing down our program.

          To fix this,we used a special timer that would trigger every 5th of a second and check the pulse width. This worked perfectly but the timer was still running. We fixed this with the “Q” command, so that the timer when the servo stopped moving. It works by sending the Q command to the arm, reading the response, and if it's a period, meaning that the arm has stopped, it kills the timer.


      We also did one last check of the pulse when the arm had stopped to make sure we got a final position value. This ensured that the position in the text box was correct. We also had to add a couple of lines to kill the timer before we started it just to make sure that the timer was completely reset.




Here's a video showing the final program with the pulse value being updated as the servo moves:




Friday 21 December 2012

Robot Arm: Writing The Controller

     Since my understanding of programming isn't overly advanced yet, the best approach to building a program for the arm would be to find a program that has a similar function, and modifying it for my needs. After browsing the apple forums, we found a program that someone had developed that could output signals from the serial port. 


       Using a programming environment called XCode, we opened up the program and examined it to figure out how it worked. We then stripped out all of the code we didn't need, leaving us with a solid foundation that we could build upon.



     


       From there, we built a simple interface consisting of six sliders that controlled each of the six servos. The program had to be written in a language called Objective C, which has some similarities to the Java programming language we used in my Grade 11 Programming course, so it wasn't that hard for me to understand.





       Here is a look at a portion of the code that handles the interface. The very first line basically waits for any of the sliders to be changed, and when one is, it activates the code within the curly brackets. The next line creates the format for the signal that will be sent to the robot(the red text). Normally, the signal that is sent to the robot is "#(servo) P(desired servo position) S(speed)". For instance, if you wanted to send the shoulder to position 1700 at a low speed, you'd type "#1 P1700 S100" and then hit enter. So in our program, you'll notice the same format, except the servo number and servo position have been replaced by a "%d", which is used in Xcode as a substitution, so you can get the program to replace that "%d" with any set of symbols, letters, or numbers. 

        The next few lines get somewhat complicated, but all they really do is take the decimal data received from the slider and convert it to ASCII, so the arm understands it. Finally, the last line outputs the ASCII command through the serial port.

Tuesday 4 December 2012

Robot Arm: Testing the Computer


     To run the robot arm with a computer, we first needed to make sure the computer could send and receive signals. Since the Macintosh does not have a physical serial port, we used a USB to serial cable that we connected to the physical serial port on an older PC. Then, using terminal emulation programs, which allow you to send and receive signals out the serial port. We set both of the programs to accept ASCII characters, as that is what the robot arm uses, then successfully transmitted a signal to the PC using the Mac, with the same speed and conditions required by the robot arm(115.2kb/s, 8 bits no parity).


Here, you can see that the message that was written on the mac was successfully delivered to the PC using the terminal programs.

     We later used the same method to test if our simple program to control the arm was working. It was better to use the PC to test the program, rather than the arm itself, because we can actually see the signals our program is sending. We used RealTerm on the PC ( download at http://realterm.sourceforge.net ) and CoolTerm on the Mac ( download at http://freeware.the-meiers.org/#CoolTerm ). Both are free and work really well.

Monday 19 November 2012

Welding cast iron brackets

     Today, 2 brackets that hold up a side shelf on our wood stove broke off, so i took them into welding class to see if I could fix them. I was worried they wouldn't weld well, as they are made of cast iron, and neither me, nor my welding teacher knew if it would work. To my surprise, I easily joined them with a MIG welder, and grinded the weld so it was flush with the rest of the piece, then polished it off. Here's a picture I took after I did the first one. It was much easier then I thought it would be, and I am quite pleased with the final product.

Sunday 18 November 2012

Offroad Truck Bumper Part 1


     I've decided to build my own bumper for my truck that will increase it's capabilities, allowing it to be more agile over rough terrain. I've looked into buying a bumper, but there aren't too many available for the 97-03 generation of F-150s, and all the one's I've found are highly expensive. The style of bumper that I've chosen is prerunner/baja. These bumpers are widely used in desert racing and offroading in areas such as Mexico and Southern California.
         




The main point of these bumpers is to improve the clearance of the front end. Normally, if you were trying to drive your truck from flat ground onto a steep incline, the bumper would hit, and you'd get stuck. These bumpers expose much more of the wheel, thereby allowing the truck to handle drastic changes in incline.  




      
     
     To build my bumper, I would first need to find a way to mount it to my frame. The old bumper was bolted onto 2 large brackets that were welded to the end of the frame. To mount my bumper, I would need to chop the ends of the frame off to allow the skid plate to have shallower angle, which will keep air resistance to a minimum.




    

    First, I drew up some designs for the mounting brackets of my bumper. I then cut out the pieces I would need with a plasma cutter. I used 1/4 inch iron, as it would give my bumper a good strong base to sit on.
         





    


   
    I used a mig welder to join the pieces together, and once I had both brackets built, I arc welded a piece of tube in between them to get the width right.




     

Friday 16 November 2012

Robot Arm: Controlling the servos







Each servo connects to the SSC-32 board using 3 wires. The VC(Red) and Ground(black) wires provide the 5 V DC voltage to power the servo.




The third “Pulse” wire supplies a 5 volt control pulse signal that is repeated 50 times a second (every 20ms). The width of this pulse determines what point the servo rotates to, and can be from 0.9ms to 2.1ms long. For example,an ASCII command from the computer to the SSC-32 control port such as “#2 P1500” would tell the controller to send Servo #2 a signal consisting of 1.5ms pulses which would move the servo to move to it centered position.

The Oscilloscope lets us actually see the pulse by freezing the screen, allowing us to measure it. This is how the Oscilloscope shows the 50ms 5 Volt pulses to the servo.

The black permanent grid squares on the Oscilloscope screen are called “Graticules”, and the numbers at the bottom show the units. In this setting, each graticule is 10 ms wide and 5 Volts high. The two dotted lines are part of the Oscilloscope's measurement tools. The Oscilloscope allows these to be moved to allow vertical or horizontal measurements, and the number at the top op the screen represents the distance between them(20.0ms). The time scale of the scope can be adjusted to look at one pulse and make more accurate measurements.

Below is what the .75ms, 1 ms and 1.5 ms pulses look like for the commands “#1 P750”, “#1 P1000” and “#1 P1500” are sent. 




Using the basic commands the Servos moved very quickly but there is a longer command that allows you to control the speed that they rotate into position. By adding a “S” parameter, the movement speed of the servo can be adjusted. The SSC-32 manual does not explain how this works, but using the Oscilliscope we were able to see how the SSC-32 slowly adjusted the pulse width when the command “#1 P700 S100” was sent (note that the the previous servo position was “#1 P2300”). The “S” value sets the movement speed in us/sec.

Here is a video displaying the changing pulse width.


Friday 2 November 2012

Robot Arm: The SSC-32 Servo Controller


       The servos on the robot arm are controlled by a controller board called a SSC-32. 

       Here's a diagram from the manual detailing each of its components. 

       As you can see, those pins along the bottom are the connection points for a servo motor. One pin is ground, one pin delivers power, and the remaining pin delivers the pulse that moves the servo. The area of the card that says "Baud" is where the speed that data is passed is selected using 2 jumpers. As you can see in the photo, both jumpers are in, which means that the card will operate at the maximum speed of 115.2 Kilo Bytes per second.

Wednesday 31 October 2012

Loader Bucket Completed!

      I finally completed the loader bucket today, the welding took a while because I was welding outside, and the weather has been rather dodgy lately. I used a Lincoln arc welder running at about 130 volts, with 7014 AC rods I believe. As you may be able to tell, I completely welded the patch to the bucket, covering every edge, gap, nook, and cranny. Generally it would have been easier(and maybe a bit structurally stronger) to just use a bunch of short welds spaced along the seams, however, it is a bucket that is used to haul manure and other liquids, so I needed to make sure that it wouldn't leak. Overall, I'm fairly proud of the job, especially since I've only been welding for a few months.
Before
After

Tuesday 16 October 2012

Robot Arm Components: Part II: The Control Systems

     Today, I'd like to go over the part of the robot that controls it: the computer. the computer's job is to take in signals from the computer, then interpret those signals and send commands to the various parts of the arm. These signals are in the form of a widely used code: ASCII(American Standard Code for Information Interchange). The purpose of ASCII is simple, in that computers only understand numbers, so ASCII is a way to use numbers to represent actions or characters that aren't numbers. For example, every single button on a keyboard has an ASCII number applied to it.

Ascii Table
An ASCII table
So, when you type in a command on a computer, the computer converts it from ASCII to a binary value, which the computer in the robot then accepts, and sends it in the form of electric pulses to the necessary part of the arm.  

Monday 15 October 2012

The Loader Bucket


 This is a loader bucket we use around the farm for odd jobs. As you can see, it's rusted out around the bottom. I'd thought I'd put my newly acquired welding skills to use at school, and build an inner plate to patch the rusted spots. (it's currently incomplete, pics will be posted of the final product).



    

Tuesday 9 October 2012

The Oscilliscope

     We purchased an oscilloscope at an auction about a month ago, thinking it would be cool to play around with. Basically what it does is measure the voltage over time. The picture on the right shows 2 different voltage over time readings. The bottom one is very much like what my robotic arm would be sending to the servos, each pulse is electricity traveling to the servo, and the width of each pulse is what tells the servo what position it should be in. The dials at the side of the screen allow you to change different variables, so that you can line up the wave with the graticule, and measure it better.
I have to say that I'm rather fond of the way the Oscilloscope looks, it gives a work area a little bit of the 'mad scientist' look. 

Tuesday 11 September 2012

Robot Arm Components: Part I: The Servos

     Hello, I'd like to take a few posts to explain how my robot arm works before going into detail about using it. First, I'll explain the servo motors.

What Do They Do?
The servo motors handle all functions of the robot involving motion, bending the joints, closing the gripper, and rotating the base, all of these things use the servo motors.


What makes them different from normal motors?
Normal motors are very simple, electricity goes in, the motor turns. Servo motors are much more advanced. First, a signal comes in to the motor. This signal is composed of many quick electric charges traveling at a certain speed this speed tells the motor which position it should be in. The motor then rotates to that position, and continues to keep it's position if it some external force tries to change it.


So what does it do for the robot?
Using these servo motors, the arm can be controlled with a high degree of precision, and gives it the ability to keep it's position whilst under stress, such as when it's lifting an object.

Tuesday 28 August 2012

Meet The Arm

Meet The Arm.
     For a very long time I've had a robotic arm sitting around that I never really did anything with. So the other day I decided to pull it out and try to get it running. I couldn't get it running with the software it came with(which defeats the purpose of including software with it), so my dad helped me connect to it using his computer, and a terminal program. After a bit of research, we finally got to the point where we could send it individual commands to control it. My plan now is to try and make a program that will have a user friendly interface.


Tuesday 31 July 2012

Meet The Truck

 





Allow me to introduce my truck, it's a 1997 Ford F-150.










  

  As you may see, it's not in mint  condition, but that's the reason I bought it. I'm fixing it up and adding a few modifications to make it my own unique vehicle..
 


  
...Residing under the hood is a 4.6L V8 engine. It may not be the most economical, or environmental choice, but there are few things in this world better than a good V8 engine.








    And good it is. The engine is of the 'Triton' series: Which has a  reputation for being extremely reliable. So far, this reputation has rang true, as the only part that has broken in it's lifetime is an exhaust manifold (which I still need to get around to replacing).

Monday 16 July 2012

-BLOG OVERVIEW-

-Brian Sturgess-

-July 16th, 2012-


-BLOG OVERVIEW- 

    If you're reading this, then you're most likely wondering what this blog's about. Well, to put it in simple terms: this blog is here so I can talk about myself. Quite simply, I've been doing a lot of fun projects, and I thought it would be neat to show off these projects to see what the public thinks of them.

     I will be using this blog to showcase the projects I've completed, the projects I'm working on, the projects I'm involved in, and even some projects of mine that have not yet come to fruition. These Projects will all follow the general theme of Mechanics and Computers, as I'm very interested in those fields, and I'm planning on a career involving them.


    So please make yourself at home here, give me feedback if you want, all in all, take what you want from reading this blog.