Sunday, August 28, 2011

3 PIC Microcontroller & Wireless Transfer


3.6    Wireless Data Transfer

We transfer the control signals in our project using wires from PC to the PIC microcontroller.

To advance the project we use the radio frequency transmitter and receiver module for a wireless control transfer signals as another options.

The Compact FM Hybrid  transmitter and receiver Modules are used in this project to receiving a signal data at up to 9.67kbps of the state of the transmitter with rang up to 250 m with CMOS/TTL Compatible Output, offers low current consumption , which uses no adjustable components ,and requires No radio license to operate . The transmitter is attached to the serial port on the PC to send data on the 433.92 MHz carrier to the motion control subsystem.

Figure 3.8 Radio frequency (RF) – Receiver and Transmitter


3.6.1 Receiver (RX)

Figure 3.9 Receiver IC (RX)


Table 3.2 Pin description for Receiver


Table 3.3 Operation mode for Receiver

Technical Specifications

Table 3.4 Technical Specifications for Receiver

3 PIC Microcontroller & Wireless Transfer


3.5 Circuit Layout

Figure 3.6 PIC16F876 hardware interface connections



Figure 3.7 PIC16F876 hardware interface board


The previous figure shows the connection between the PIC microcontroller and the hardware components such as the stepper motors, D.C motors, light and so on. A crystal of 10MHz is connected to the CLKIN pin to generate the clock of the PIC. The data from the RF is received through the RA3 pin (pin5). Every one of the three D.C motors need three lines for direction and speed control(Enable,IN1,IN2) and the stepper motor needs two lines for direction control(Enable,(CW/CCW)). The output control lines of the microcontroller in this table shown below:

RB0
ENABLE (PWM)

RB1
IN 1
D.C motor 1
RB2
IN2

RB3
ENABLE (PWM)

RB4
IN1
D.C motor 2
RB5
IN2

RB6
ENABLE

RB7
IN1
D.C motor 3
RC0
IN2

RC1
ENABLE
Stepper
RC2
CW\CCW
motor
Table 3.1 Output control lines of the microcontroller

Saturday, August 27, 2011

3 PIC Microcontroller & Wireless Transfer



3.3    PC software

We used the visual basic 6 language to transmit the control signal to the serial port.
The visual basic program gives ability to control the robot by the user orders.


3.4    PIC programmer

PIC microcontroller is able to run programs written in assembly, PicC and PicBasic. You can purchase the programmer, but it is too expensive. In our project we design a new circuit as shown in figure 3.2 that is programming PIC 16F876 chip. The programmer don’t require a separate power supply, put takes the power from the serial port of a PC.

Connection with the PC is made by a cable 1-1, 9 pin connectors, male-female.

Figure 3.4 Programmers for PIC microcontroller

Programming the PIC microcontroller family can be done by changing the wires of this programmer to the same name pins of the other PIC new chip.

Figure 3.5 The programmer for PIC16f876

3 PIC Microcontroller & Wireless Transfer


3.2    Serial port interface

The transmitting signal from PC ranges from 12 Volts to –12 Volts (RS level) which is not compatible with the PIC microcontroller or with the RF transmitter which required a voltage setting of +5 Volts to 0 Volts (TTL level), so we must put max232  as a level shifter between RS level and TTL level .
Figure 3.2 MAX232 IC connections


Figure 3.3 Connection between serial port in PC and MAX232 IC


3 PIC Microcontroller & Wireless Transfer


3.1 PIC16F876 Microcontroller

The PIC16F876 is the “brains” of the Drive Subsystem. Using built-in RS232 interface, we were able to use two pins for transmitting (from user). We were able to check what inputs were coming in from the user and then decided which signals to send out to move the motors. By using the built-in Pulse width Modulating channels, we were able to control the speed of the two D.C motors at the same time. The remaining pins were general input and output pins and were used for outputs to control the stepper motor and D.C motors direction.

Figure 3.1 Pin Diagrams of PIC16F876

2.3 Power Supply


In our project, 5 Volts was required for all the integrated circuits, 12 Volts was required For the D.C motors and 8Volts for stepper.

 We use 5 Volts Regulator (LM 7805) to feed the integrated circuits, and 8 Volts regulator (LM7808) for the stepper motor.


2.3.1  LM78XX Regulator

The most common way of generating afixed voltage is to use the 78xx voltage regulator which has atypical tolerance of 5%.




Figure 2.12 LM78XX circuit diagram

2.2 Robot Drives

2.2.4 Stepper Motor Drives

The stepper motors used in our design contain four input wires, one to each coil, plus a common voltage input. The stepping sequence of the motor can be controlled differently by assigning the input pulse on different combinations to the inputs A, B, C, and D indicated on figure 2.8 below.

Figure 2.8   stepper motor terminals

The possible stepping sequences are wave-drive, two-phase, and half-step. The wave-drive format activates one coil at a time in an A-B-C-D (or D-C-B-A, if reversing rotation direction sequence). The wave-drive mode consumes the least amount of power and has high positional accuracy.

Two-phase drive activates two adjacent coils during each sequence (AB-BC-CD-DA). This sequence mode offers an improved torque while decreases the rotation speed of the stepper motor.

 Half-step activation alternates between the one-coil and two-coil modes (A-AB-B-BC-C-CD-D-DA), providing an eight-step sequence for smoother rotation.



2.2.4.1 UCN5804 Stepper Motor Driver

The stepper motors use a 9-12 Volts to support the movement of the camera. We use the integrated circuit stepper motor driver UCN5804B which can drive up to 50 volt 1.5 an output, and the inputs are compatible with TTL circuits. This driver provides four Darlington transistors at the output connecting to the stepper motor.

The following is the circuitry for each stepper motor with the UCN 5804 Integrated Circuit stepper motor driver.
Figure 2.9   UCN 5804 stepper motor driver

From the figure above, pin 9 and 10 determines the stepping sequence of the stepper motor. Since we decided to use two phase stepping sequence, and according to the truth table below, both pin 9 and 10 are at logic 0.
Table 2.2 Logic control for the stepper sequence


2.2.4.2 Circuit Connections

Figure 2.10 UCN5804 circuit connections

Figure 2.11 UCN5804 circuit and 555 IC board

As displayed in the figure 2.10 above, pin 9 and 10 are also used for ON/OFF switch of the stepper motor. This is because when both pin 9 and 10 are high, the step inhibit function is performed by the UCN5804 chip to stop the motor from running. Since our project only requires both pins to be low (half-step) or both high (step inhibit) at the same time, only one ON/OFF switch needs to be connected to both pins. The a, b, c, d pins in the figure are connections to the input pins of the stepper motor. Each input signals will control motor in the way described by the stepper motor section previously discussed. The diodes, LEDS, are put in so one can visually observe the stepping sequence and for debugging purposes. The direction (pin 14) is used to rotate the stepper motor clockwise or counterclockwise.



2.2 Robot Drives

2.2.3 L6203 D.C motor driver

The IC is a full bridge driver for motor control applications realized in Multi power-BCD technology which combines isolated DMOS power transistors with CMOS and Bipolar circuits on the same chip.

By using mixed technology it has been possible to optimize the logic circuitry and the power stage to achieve the best possible performance. The DMOS output transistors can operate at supply voltages up to 42V and efficiently at high switching speeds. All the logic inputs are TTL, CMOS compatible. Each channel (half-bridge) of the device is controlled by a separate logic input, while a common enable controls both channels.

The integrated circuit L6203 is a full bridge driver for D.C motors; it can drive up to 48 volt with total RMS current up to 4 A outputs and has an operating frequency up to 100 KHz with high efficiency.

It is compatible with TTL logic circuit and has internal logic supply. This IC can optimize the logic circuitry and the power stage to achieve the best possible performance.

Figure 2.4     L6203 H-bridge

2.2.3.1 Pin connections for L6203

Figure 2.5   PIN connections for L6203

The logic drive shown in table:
Table 2.1 Logic control for l6203 IC

2.2.3.2 Circuit connections

Figure 2.6 L6203 circuit diagram


Figure 2.7 Driver board for L6203 and stepper motor

The transistors have an intrinsic diode between their source and drain that can operate as a fast freewheeling diode in switched mode applications.


Friday, August 26, 2011

2.2 Robot drives

Figure 2.1: motors driver board


2.2.1 Introduction
To control the direction of D.C motor we need the H-bridge driver circuit using relays or transistors act like switches or integrated circuits like L298 or L6203.

In our project we use two D.C motors to provide the vehicle with four movement directions: forward and backward, rotate left and rotate right. The speed of the motors controlled by pulse width modulation (PWM). Also, One D.C motor used to move the main arm backward and forward.

For the stepper motor used to rotate the camera, we can use software from PC or microcontroller to produce the required sequence and an integrated circuit like UCN5804.

2.2.2 SPEED CONTROL
2.2.2.1 PWM
Pulse width modulation is a technique for reducing the amount of power delivered to a DC motor. This is typically used in mechanical systems that will not need to be operated at full power all of the time.
Instead of reducing the voltage operating the motor (which would reduce its power), the motor's power supply is rapidly switched on and off. The percentage of time that the power is on determines the percentage of full operating power that is accomplished and so reducing the speed.

Figure below illustrates this concept, showing pulse width modulation signals to operate a motor at 75%, 50%, and 25% of the full power potential.

Figure 2.2 Pulse width Modulation (PWM)

We produced the PWM signal in our project from the PIC microcontroller to control the speed of the vehicle.

2.2.2.2 Pulse Rate of stepper
The speed of the stepper motor is controlled by the width of the pulses that supplied to the integrated circuit (UCN5804B).
In our project we produced these pulses by (555) integrated circuit like shown in figure 2.2 below:
Figure 2.3 (555) pulser
Where:
R1 = R2 = 2 KΩ , C = 10 μF
 Substituting these values to find period, duty cycle, ton, and toff we obtain:
Period  = C [( R1 + 2 R2) ln(2)]
            = 10 [(2 + ( 2*2)) ln(2)] =  0.04159 sec
duty cycle =  ton / period = (R1 + R2 ) / ( R1+ 2R2)
                = (2 + 2) / (2 + 4) = 0.6667 sec
 ton = C ( R1 + R2) ln(2)
       = 10 (4) * ln(2) = 0.02773 sec
toff  = C R2 ln(2)
      = 10 * 2 * ln(2) = 0.01386 sec

Obviously, the smaller the step angle is, the more accurate the motor. But the number of pulses stepper motors can accept per second has an upper limit. Heavy duty steppers usually have a maximum pulse rate of 200 or 300 steps per second. Some smaller steppers can accept a thousand or more pulses per second, but they don't usually provide very much torque.