The engineering of the body!

Third & Final Design

The third design of the project was created following new instructions, the main objective was shifted towards creating a pan & tilt devices. Also trying to resolve the issue that was found in prototype two; the M1 from schematics 2-1 of the second design. It will either be set in front of M0, which would required a worm gear set to change the direction of motion, or the M1 will have to be placed in one of the sides, disproportioning the device’s arm, see image below.

Prototype II 180º

Mechanical design III

This design is trying to solve the issues encountered in the last two designs and trying to develop the device that would be used for pan & tilt movement. It could still be used for testing devices if required by implementing the algorithm in the microcontroller. The device will have the same number of actuators as it can be appreciated in schematics 2-2. M1 and M2 have changed their position to reduce the distance of the arm L1 and facilitate the two axes movement. M0 will rotate the base creating 360º of movement (pan) and M1 will rotate the gripper 180º (tilt). For the project, 3mm thick black Perspex will be used and will be cut in the laser cutter.

P&T Devices1P&T Devices2P&T Devices3

P&T Devices CADP&T Devices1 cad2

The prototype from design I and design II were created using thin cardboard and the models required some adjustments since was less than 3mm thick. Image above shows the final prototype. In the top right image, it can be appreciated the attachment added to the gripper to hold a small webcam.


Base of Prototype III

The base of the device will hold the circuit for control and power supply; ideally, it will have a single PCB containing all the necessary components. Two levels containing different parts of the circuit were used instead, as seen in image on the left.

  • Level one; contains the microcontroller PCB for testing.
  • Level two; contains the power supplier and two stepper motor drivers.

PIC18f26j11 Pan/tilt control demonstration.

The Pic18f26j11 works suing the configuration bits shown in earlier post, using the internal oscillator and C18 compiler from MPLAB IDE 8.90, which aloud us to write in C lenguage.
The pic used for this test was given by university lecture Panos Loakin the pin configuration is:

  • PORTA;
  1. Unuse in this test but all set to be outputs
  • PORTB;
  1. All outputs for testing, in this board we only use 3 outputs.
  2. RB7; Green LED.
  3. RB6; Green LED.
  4. RB5; Green LED.
  • PORTC;
  1. RC4 &RC5 not use at this point.
  2. RC7; RX1 Connected to R232 TX
  3. RC6; TX1 Connected to R232 RX
  4. RC3; Green LED.
  5. RC2; Green LED.
  6. RC1; Red LED.
  7. RC0; Green LED.

The board is power it with a 9v battery  and programmed with a PICkit two also provided by university.

Provided by UEL

PIC18F26J11 Provided by UEL


In this image you can see the pic18f26j11 in a PCB board and with the connector for the PIckit2 this board was provided by my tutor.

There is also the 9v battery connector ground connection coming from the VSS pin 8 of the pic18f26j11. The image below show the pic18f26j11 connected to the R232 and using a 9v battery.


Pic18f26j11 to USB TTL-232R-3

The board in the image above show the pic18 working with different combination of LED’s. Each combination for a command key from the keyboard. The interface in use either 4 arrow keys from a keyboard or the numpad using up to 8 keys. It should also work with mousepad or a normal mouse but at this point this has not been implemented in the program.

The video demosntrate the funcionality of the chip uisng the control interface.

PIC18F26J11 Configuration bits

The configuration bits are important part to set the project efficiently and not have problems when uploading it to the microcontroller. MPLAB help menu contain a topic for this specifications which contain each pic from all their families will each individual configurations settings and commands.

The Pic18 contain all this introductions to set its configurations bits. The configuration is done by using the pragma command. Which microchip defines as:

Pragma; A directive that has meaning to a specific compiler…The ANSI C standard provides each C implementation a method for defining unique constructs, as required by the architecture of the target processor. This is done using the #pragma directive. (2005, Microchip)

Below you have an example of all the configuration bits from the pic18f26j11.

/** C O N F I G U R A T I O N B I T S ******************************/#pragma config WDTEN = OFF //Watchdor timer OFF

#pragma config STVREN =OFF //Stack overflow/Underflow Rest
#pragma config XINST = OFF //Extended Instruction Set OFF
#pragma config DEBUG = OFF //Background DEbug OFF
#pragma config CP0 = OFF //Progam memory is not code-protected
#pragma config OSC = INTOSC //Internal Oscilator
#pragma config T1DIG = OFF //Secondary Oscillator clock source may not be selected
#pragma config LPT1OSC = OFF //High power operation
#pragma config FCMEN = OFF //Fail-Safe clock monitor Off
#pragma config IESO = OFF //Internal External Oscillator Switch Over mode
#pragma config WDTPS = 1 //Watchdog Postcaler = 1.1 in this case
#pragma config DSWDTOSC = INTOSCREF //RTCC clock select, RTCC uses INTRC
#pragma config DSBOREN = OFF //Deep Sleep BOR; Dissable
#pragma config DSWDTEN = OFF //Deep Sleep Watchdog Timer; Disable
#pragma config DSWDTPS = 2 //Deep Sleep Watchdog Postcaler; 1:2(2.1ms) 
#pragma config IOL1WAY = OFF //The IOLOCK bit (PPSCON<0>) 
#pragma config MSSP7B_EN = MSK7 //5 or in this case 7 bit address masking mode
#pragma config WPFP = PAGE_0 //Write protect program flash page 0 
#pragma config WPEND = PAGE_0 //Page 0 throught WPFP<0:5>erase/write protected                    
#pragma config WPCFG = OFF //Configutation words page not erase/write protected
#pragma config WPDIS = OFF //WPFP<5:0>/WPEND region ignored*/

The following code was used for the arm-robot configuration as it was assumed that the rest will be set as default.

#pragma config OSC = INTOSC
#pragma config WDTEN = OFF, XINST = OFF
#pragma config IOL1WAY = ON


PIC18F26j11 ASM to C18

The Pic18f26j11 was chosen by a lecture as a model for micro-controllers programming using assemble language.  The Pic18f26j11 was used for the past year and a half in various small projects; semaphore and password door control.

It was decided to begin the Robot-arm by using the door control project as a beginning structure point. The problem this project had a few faults the project was finish in a week time since the pic18 was given really late, students had to share resources for this project.

Table for codec to control motors………………… to be added

The main problem was that the project was never really finished, when approaching the deadline it had to be completed to a working solution. The result product did work within his minimum requirements.

  • It was not one hundred percent stable; it will stop working it user press the code panel many times to fast.
  • The PIC18 did not really interpreted the code received for OPEN/CLOSE gate; One of the options was using indirect addressing and a possible further development into this project. The way to read OPEN instruction was created by sending two line of code save into an indirect addresses, the CLOSE gate will only send one line of code. The project used a counter to count how many indirect addresses where save and then OPEN/CLOSE the gate, in this case and LED green for open and red for close/wrong code will demonstrated that the PIC18 worked.

Since the arm-robot project required to understand the different instructions received from the computer, the issue refer in the gate system  project needed to be resolve. The assembly programming has demonstrated its advantages since you get to understand how the micro-controller works, having this knowledge and a base of C programming the best solution was to use C18 compiler and its libraries.

A library is a collection of functions grouped for reference and ease of linking…The processor-specific library files contain definitions that may vary across individual members of the PIC18 family. This includes all of the peripheral routines and the Special Function Register (SFR) definitions. (Microchip, 2005)

C18 is a Microchip compiler to program in C language for MPLAB IDE software. The advantage of C18 is that you can find a vast number of examples in their website but further understanding in the use of its libraries is required.

The disadvantages of the Pic18f26j11 is that there are not examples which particular use this micro-controller and some mistakes can be easily made when using other pic18 examples as reference.

Second Design

The device has been designed using cad software, Solidworks. The different parts, which will be cut in the laser cutter, are restricted to be two-dimensional.

Below, it is the first sketch of the robot-arm. This first sketch was designed to use two motors, one to control the vertical movement 180º and another of 360º to create a circular rotation for the gripper and had the possibility to have another motor in the base of 360º. The main objective was only to test two of the three axes of the accelerometer. This was the reason for deciding to use only two DOF.




The second design was created for trying to solve some previous issues. This design is taking in consideration the proximity of the gripper L1 and L2 and also its weight W1 and W2. The second design had the gripper closer to the base; this has multiple connections to attach equipment to it,  like small PCB or the accelerometer see below.

Robot-Art II           |mechanical design II










The M0 motor is attached to the side of the base and it creates the 360º movement. The base needs a metal platform to support all the weight of the arm and M1 motor. This motor will have 180º of movement.


Fourth Meeting

Dr. L#### suggested to use DC motors because of their low cost and it may required at easier circuit and manipulation from the pic18f26j11. The reality after researching in this matter seems to be that we will reduce accuracy to gain in price and time.

In the link below you can find a definition in the types the motors you can use and their characteristics. Until now I still think the steeper motors are the most accurate.

All On Robots Website

After researching prices for motors  and baring in mind that micro-motors will be better for the project since we thinking to go for the smaller and more precise adding a gearbox to the motor but their cost is too high for our project.

In his book Robot Builder’s Bonanza, Gordon McComb mentioned how you can create robot from recycling parts, what he calls “Building Bots from found parts”. There are lots of other people which recycle material from people waist, normally hobbies. The decision was to trying to minimize the cost of the motors and get the more efficient, in this case talking about accuracy. This could be archived by using unwanted printer motors. We have dismantle and old Epson printer and taking the two motors. Printers are really accurate and for this prototype will be perfect to use them.

Printer motors are accurate the only negative site is difficult to find the specifications of the motors since there is not model number the only description found is; EM462 for one of the stepper motors and EM463 for the other stepper motors.

(There will be required some testing to get the values of the motors.)

Solidworks first design.

This is the first finished design created in Solidworks, which is a cad software provided by university.


First Robot Design using Solidworks


I decided to use the Planetary Gearbox Stepper: 42BYGH40(M)-160-4A NEMA 17 Bipolar 99.55:1. After looking in libraries for a design of those for cad software solidworks and since I am still developing my skills in Solidworks  the decision was created my own, it will be required a cad software to view or manipulate this file (Solidworks eDrawings free for viewing this file).

The dimensions of the motors were taken from the mechanical drawing from Active robots websiteThe motor was intended for demonstration purposes, after realizing their price with our budget been £50; it was required to find another solution.

Third meeting

Group meeting where Dr. L#### told us a general approach of the projects and he also mention that we all have similar parts in our projects. We all using same microprocessor the pic18f26j11.

He mention that some people will be using wireless communication RF650 (433Mhz)  , other will use an ADXL325 accelerometer with 3 axes, the rs232 will be use for serial communication for those that we don’t have to use necessarily wireless communication

I will be testing a ADXL325 for my project I will need to check the values of X and Y and identify the most accurate value. The ADXL325 will be provided by Dr. ####, I have asked him be he will provided me with a pcb to connect to the pic and read the values that will be send to the computer throughout a usb using rs232.

I need to decided the types of motors I will be using for the project. I think this is essential for my project. The motors could be:

  • DC motors;
  • Stepper motors; unipolar or bipolar
  • Serve motors;

Dr. L#### will help me given a session on Solidworks.

Second meeting

The second meeting was to approach Dr. L#### to discuses about the details of the project and my concerns about the difficulty of it, I am not that comfortable with the electronic side of the project.

Dr. L#### has been really positive about this project and seems that I will not have any problem with it at all. He will send me a brief description for the project to be able to write my project proposal.

During the meeting its been decided that I will have to use the pic18f26j11, this is the one we currently using in class for this term project in Integrated systems design, which I think is in my advantage since we been programming similar functions in the pic for a completely different project.

I been told the interface will be created with vb (visual basic), the design of the robot I been told to use Solidworks even I am comfortable with Autocad seems that solidworks will be much easier and quicker.

The idea is to created a 3d arm robot which will be cut in a laser cutter. Dr. L#### has mention that he can provided the parts if I give him the files in solidworks.

Mark which is a technician from the department has provided me with some good books in Solidworks, he was the one who told me autocad in the first year.

The lab at the moment has not licenses for this software and Mark will add those to a few computers in the library at the same time I have asked Solidwork if they could provided me with a student trial licenses for 60 days.

Working in the lab is not always easy.

From today I will be meeting Panos L#### every Wednesday at 14:00 in the lab.