









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Project; Class: Senior Design Project Lab; Subject: Electrical and Computer Engr; University: University of Illinois - Urbana-Champaign; Term: Summer 2006;
Typology: Study Guides, Projects, Research
1 / 16
This page cannot be seen from the preview
Don't miss anything!










By Alexander Demaris Mansi Naik ECE 445, SENIOR DESIGN PROJECT SUMMER 2006 TA: Dwayne Hagerman Date July 29, 2006 Project No. 5
We designed an auto that travels in the user defined direction (North, South, East, West) and distance ( feet to 10 foot). This paper explains the details of the engineering decisions that were taken to implement the design of an auto. The rotary encoder switch was used to get the distance from the user and the 2 single-pole, double throw switch was used to select the desired path in four directions. The signals of these switches were sent to the PIC microcontroller. The microcontroller will control three separate motors; two motors connected to the back wheels will control the distance and one motor connected to the front wheel will control the direction of the auto. Two encoders were connected to the distance and direction motor each, and the encoder feedback data was sent to the microcontroller. All the signals were interpreted by the microcontroller and when the auto reaches its final destination, it will stop and wait for further assistance. ii
1.1 Purpose The goal of our project is to design an auto capable of traveling in the user defined direction and the distance. This project involves many engineering disciplines including sensors, microprocessors, motors, encoders and control systems. It gave us the experience in the design process from conception to implementation. This auto can be used in the part of self-navigation with user providing the path. The scope of this project is wide in robotics applications. With additional modifications, this project can be expanded in different applications such as data gathering, surveys, transportation of materials, which could reduce the needs for human workers and it could save the operator from unnecessary danger during hazards situations. 1.2 Specifications The project was split up into different modules and the individual module specifications are detailed in section 1.3. Encoders All the encoders are to output a signal similar to a square wave with amplitude of 5V. The most important feature is that the signal will be near to zero for at least 20ms and near 5V for at least 20ms. PIC microcontroller The PIC microcontroller works well with a 5V power input and sees inputs less than 0.8V input as a low and inputs more than 2.3V as high. Since the distance rotary encoder switch doesn’t have any clicking, the user has to be very careful when selecting the desired distance. The direction and distance controlling motors should respond to the input signals from the microcontroller within milliseconds. The auto is designed to travel within the 6 inches of desired distance and it will turn within the turning angle of 5 degrees. 1.3 Subprojects This project was divided into the different modules and each module was tested independently from each other. In this section, the functions and the specifications of the modules are described. Please look at the appendix – A for the block diagram. 1.3.1 PIC 16F877A Microcontroller The PIC is programmed in C and it controls all communications and compute the require functions. Signals from the magnetic module and user input are interpreted by this unit, and appropriate control signals are sent out to the motors. The control logic of this unit calculates the remaining distance the auto needs to travel based on the encoder signals and outputs digital signal to the motor controller. 1.3.2 User Interface This unit includes 2 switches to get the inputs from the user. The 10 position gray-code rotary encoder is used to set the desired distance (1 foot to 10 foot) and the 2 single-pole, double throw was used to get the direction (N/S/E/W). This unit gets the input from the user and outputs the data into the
microcontroller. 1.3.3 Electronic Compass This unit contains a 2-axis magnetic field sensing module, which tells the direction the auto facing at. It outputs the signals to the microcontroller. It uses SPI interface with the microcontroller which allows measuring the resulting magnetic field data. 1.3.4 Motor Controller This module contains MOSFET circuit and H-bridge motor driver to control the signals to the motors. The MOSFET circuit receives the signal from the PIC and converts the signals to the levels needed to drive the MOSFET gates. The H-bridge controls the transfer of the current from the source to the motors. The motor controller unit turn-on and turn-off the currents and reduce the voltage spike hazards and noise. 1.3.5 DC Motors This module consists of four dc motors that is connected to the wheels and control the lateral movement of the wheels. One motor will control the front wheel orientation; one motor will control two rear wheels and one motor will control the hinging. A fourth motor controls the up and down motion of the direction wheel. It is controlled by two encoders that sense when the wheel has been raised or lowered in place. The motors are rated at 12V, and 24 RPM. 1.3.6 Encoder The encoder is made of a light source which can point at a photocell, when it’s pointed the resistance of the photocell is lowered. This photocell is used in a Wheatstone bridge to enable a rise in the output voltage at point D in the bridge as shown in the equations and diagram in Appendix -. When this light is not on, the resistance of the photocell raises and is matched to the other resistance values in the bridge. So we designed encoders based on a wheel that when it moves allows and stops light from reaching the photocell. 1.3.7 Power Supply We used several power supplies in our design. A 6V battery was used to power the LED’s. A 9V battery was used to power the distance and raise/lower motors. Another 9V is used to power the Wheatstone bridges of the distance up and down encoders. The direction motor and Wheatstone bridge are powered by a separate 9V battery as well. Finally a 5V supply voltage is supplied to the PIC microcontroller.
Function Generator: The square wave pulses were sent to the PIC using this device. The output of the encoder is supposed to be the square wave and to debug the software of the encoder counter, this device was used. PSPICE We used PSPICE to simulate the transistor circuits.
This section explains the details of each component involve in this project. 3.1 Components 3.1.1 PIC 16F877A Microcontroller We used a 16F877A microcontroller PIC in this project. This PIC was programmed in C language using MPLAB IDE program. The PIC gets the outputs signals from the user interface and controls the movements of the motors. Please see appendix-C for the code. It was also easier to control the direction of the motor and to interpret the number of pulses the PIC receives from the distance and direction encoders by using this PIC. The Port B on the microcontroller was setup to get the user distance and direction inputs. The 10 position rotary encoder switch outputs 4 bit gray code, so 4 pins were set on port B. Also the direction switch outputs 2 bit binary code, so 2 pins were set on port B. Other pins on port C were set up to get the outputs of the magnetic module, which tells the microcontroller the direction the auto facing at. Based on these signals, the user inputs were mapped out and the microcontroller would count the required pulses needed to drive the motor circuit. We set up 2 pins on port D that each would control the motor controller circuits. The encoder attached to the direction motor is set to 10 pulses per quarter turn. As soon as, the microcontroller gets the user input distance and direction, it sends out digital clock high, which turns on the direction motor. The code runs through the correct number of pulses to run the motor. The direction wheel keeps turning until this signals goes low, which will be after counting the encoder pulses from the direction motor. The encoder attached to the distance motor is set to 30 pulses per feet, so the digital signal controlling the distance motor circuit goes high as soon as the auto stops turning and it goes low as soon as the microcontroller receives the desired pulses from the encoder, which turns the motor off. There are 4 pins controlling the lifting and lowering of the front wheel, which is responsible for turning in the desired direction. For more details on these pins, look at the appendix-C for coding. The microcontroller starts running the code when we set up one pin as a push button that starts the auto moving on the desired path. 3.1.2 User Interface The user interface includes the rotary encoder switch and direction switch, so a user can put in any desire direction and distance they want for the auto to travel. The rotary encoder is a 10 position gray- code switch. The user would choose the distance from 1 foot to 10 foot by turning the rotary encoder switch. This switch would generate a 4-bit output and the microcontroller gets this input and takes further actions. The user also has an option of choosing one of the four directions- North, South, East, and West. This direction switch is a 2 single pole, double throw switch. This switch generates 2-bit outputs and the microcontroller gets this input and takes actions. 3.1.3 Electronic Compass An electronic compass was necessary in order to provide the heading information of the auto before the auto starts turning in the desired direction. We used a MicroMag2 electronic compass which is a 2-axis magnetic field sensing module. This module is used to find the direction the auto facing at. It measures the magnetic field in the desired direction. It communicates to the microcontroller using SPI interface. During this interface, a command byte is sent to the MIcroMag2 through the SPI port specifying the sensor axis to be measured. The MircoMag2 returns the data in a 16-bit 2’s complement format. The microcontroller takes this data in and converts it into the specific direction.
Figure 3.5.1.1 Wheatstone Bridge Output 3.1.6 Power Supply Most of the power supply’s didn’t need to be limited we did limit the supply to the PIC microcontroller at 5V. We used several power supplies in our design. A 6V battery was used to power the LED’s. A 9V battery was used to power the distance and raise/lower motors. Another 9V is used to power the Wheatstone bridges of the distance up and down encoders. The direction motor and Wheatstone bridge are powered by a separate 9V battery as well. Finally a 5V supply voltage is supplied to the PIC microcontroller.
4.1 Testing Before putting all the modules together, we wanted to make sure that all of our modules were working independently to our satisfaction. The testing of each module is described below. 4.1.1 PIC 16F877A Microcontroller The software for the project was written gradually to ensure the efficiency of the code. Most of the PIC programming was done independent from the rest of the design. After adding each function to the code, the outputs of the pin were tested when the code was running on the PIC. The HP 54616C Oscilloscope and RS-232 were used to debug the code. The microcontroller expects the square wave feedback from the encoder, so the function generator was used to send the TTL level square wave pulses at 3-5 Hz frequency and the corresponding pins were tested to see if they correspond to the correct values that were expected. This confirmed that the code for the encoder-counters for both distance and direction motors worked. From this, we can say that the microcontroller was transmitting the correct data to the motor controller circuits. We also fed different input combinations to the pins that connect to the user interface to see if the functions getting the user inputs work. To test if the magnetic module and PIC can interface with each other, the serial communication with the PC was made. Several test codes were run to ensure the connection between the PC and PIC. RS- communication was made at baud rate of 9600 bits/sec. When the data is ready to send back to the PIC, the DRDT signal on the MicroMag2 gets high. But during this testing, this signal never went high, so the communication between the PIC and MicroMag2 didn’t work in given amount of time. 4.1.2 User Interface We tested all possible values of the user inputs on the distance switch and the direction switch to ensure that the user interface operated correctly. The rotary encoder distance switch and the direction switch were tested separately and we made sure that the PIC gets the expected inputs from these switches. The 2 single-pole, double throw switch was outputting the correct 2-bit data to the PIC. However, the 4 bit gray-code rotary encoder didn’t output the expected values to the PIC. It turned out that this switch needed to be amplified in order to get the correct output values to the microprocessor. We verified all the possible output of the switches by reading their output on the Oscilloscope. 4.1.3 Motor Controller We did PSpice simulations to determine a proper resistance to use in a PNP BJT transistor circuit. This design included a 12 source and allowed the 12V to be applied to the motor. As our design involved it was decided that slower movement in the encoders would give the PIC a better chance of reading the high’s and low’s by giving them more time to soak in. So 9V’s was used and a simple on/off motor control was adopted. Testing was simple and just made sure it could move the motor. 4.1.4 Encoders Each encoder was tested to insure that it had a low very near 0, the goal was to keep it under 0.9v for at least 20ms. It was to have as close a value to 5V a possible, but a value over 3.0V was considered acceptable. The distance motors gave low’s of 0.5 and high of 2.4V-2.6V with some variation in pulse based on the physical dimensions, angles, and reflective ness of the surfaces involved in darkening and lightning of the photocells. Below is the table, which verifies the actual and theoretic output voltages of
5.1 Parts The component costs can be found in Tables 5.1.1. With the final cost of $13,714.60, this product is very affordable. Table 5.1.1 Cost of Parts Part Quantity Price Total 6460k11 Ball bearing rollers 2 $5.80 $11. 6460K41 part of coupling 1/8” 2 $6.50 $13. 59985K11 middle part of coupling 2 $1.23 $2. 59985K13 part of coupling ¼” 2 $6.50 $13. 36-1-141 24 RPM geared motor 4 $19.95 $79. 11594 MicroMag2 magnetic 2-axis sensor module 1 $49.95 $49. PIC 16F877A microcontroller 2 $2.00 $4. PH-383B 8AA Battery Holder 1 $1.45 $1. 2471K22 1 5/8’ wheel 2 $12.42 $24. GJ-8D Encoder Coupling 8MM 1 $6.50 $6. AA Batteries 8 $1.00 $8. Parts Total $214. 5.2 Labor We expect to receive $30 an hour for our work and we estimate to work around 15 hours per week from our lab notebooks, so the labor turns out to be 15 hours x 2.5 x 6 weeks x $30 x 2 persons = $13, Grand total: $13500 + $214.60 = $13,714.
This project was fun, challenging, and a huge pain. To design and build a physical framework while designing and building an electrical circuit that can utilize that framework is a major challenge. And early design problems (with the physical design) involved the planned use of solenoids to lift the turn wheel. These delays were compounded by the wait that followed as the replacement parts came in. Our group had little hands on experience in completing design, order, redesign, and reorder issues and 6 weeks was simply not enough time for our project. A lot was gained by the open choice design and self- applied pressure. Good habits in design, testing, and understanding the results that emerged during our work. There are some improvements that could be made to our project and use in the future projects. By combining more power supplies, the auto could be smaller and lighter. The auto could be operated wirelessly and expanded to a nearly infinite set of commands.