Project Name Here CSEE 4840 Project Design Document Thomas Chau [email protected] Ben Sack [email protected] Peter Tsonev [email protected] 2 of 11 Table of contents: Introduction Page 3 Block Diagram Page 4 Hardware: Proximity sensor Page 6 Car hardware Page 8 Mouse Page 10 Control Milestones Page 11Page 3 of 11 1) Introduction Our project seeks to achieve the following goal: create a hardware and software co-design that leverages the computational power and interface capabilities of the DE2 board to an autonomously control a stock RC car on a preprogrammed course while avoiding obstacles that might pose a threat for the car.Page 4 of 11 2) Block Diagram: 1. NIOS II processor module 1.1 Avalon Bus interface 1.1.1 UART 1.1.1.1 Proximity Sensor 1.1.2 SDRAM Controller 1.1.2.1 8MB SDRAM 1.1.3 Custom Car Control Hardware ( PWM?) 1.1.3.1 Car Hardware: Motor and Steering Control 1.1.4 PS/2 Controller 1.1.4.1 PS/2 Mouse The figure above describes the basic functionality. The NIOS processor will run a C program residing in the SDRAM. The C code will output left/right and forward/backward commands to two memory-mapped registers in a VHDL component. The latter will constantly read the registers and generate the proper signal for the car hardware (more onPage 5 of 11 that later). The C program will also constantly poll registers in another VHDL component that uses the RS232 interface to read the proximity sensors. Based on the values of those registers, the C code will be able to recognize upcoming obstacles and take corrective action. The car might also need to be aware of its direction of motion relative to previous directions so that if it turns left/right to avoid an obstacle, it can then make the opposite turn and tell if it is going again in the original direction. To achieve that we use a mouse which will interface through PS/2 and write to registers through a VHDL component. The registers will be then polled by NIOS to get their values into the C code.Page 6 of 11 3) Proximity sensor : Maxbotix LV-MaxSonar-EZ0 Our project will rely on an ultrasonic proximity sensor to gain awareness of obstacles in its path. Ultrasonic sensors emit sound pulses at a 42khz and wait to detect an echo up to a predefined timeout. Based on the time difference between the emitted pulse and the echo detection, the distance to an obstacle can be calculated. To avoid irrelevant results, most sensors are tuned to operate best for specific tasks. The tuning normally includes adjustment of the width of the sound pulses the sensors emits. For our application, the Communication is done via RS232 protocol, PWM or analog. For the project purpose, we will use the RS232 format which the DE2 board natively supports. Figure 1 - LV-MaxSonar-EZ01 Figure 1 contains front and back views of the sensors in addition to a graph which show the detection pattern for a large object. Each square on the grid represents 1 foot. To use the sensor, we would need to connect only three pins: power, gnd and rx. To communicate over the serial line, the onboard MAX232 chip would bridge between the UART module and the external sensor. The synthesized UART module would have to be set to communicate at 9600 baud, 8 bits, no parity and with one stop bit. The DE2 board supports all three pins and communication rates without any modifications. To obtain readings from the sensor, all you need to do is connect it to the board. Once the sensor is powered up, it auto calibrates for 100ms. Once done, the sensor will produce measurements once every 49ms. Each measurement is outputted as a string consisting of the letter ‘R’ followed by the distance to the nearest obstacle in inches. Serial communication is made possible by the NIOS II processor’s UART module. The software controls the UART through the use of five memory mapped 16 bit registers. 1 Image Taken from http://www.trossenrobotics.com/maxbotix-lv-maxsonar-ez0.aspxPage 7 of 11 Tx and Rx registers are used to read and transmit data, while the Control and Status registers are used to set and get the information related to the operation of the device. In addition, a dedicated devisor register is used to determine the baud rate of the module. In addition the above registers, the module supports interrupts in the event polling is not proffered. figure 2 below describes the timing diagram for one word transmitted over the UART line. This information is not needed for the current project as the exact behavior of the UART is abstracted thanks to Altera’s built in support for serial communications. Figure 2 – RSR232 timing diagram2 2 Image taken from UCSB’s ECE153b lecture notes, by Professor Butner. http://vader.ece.ucsb.edu/ece153b/handouts/L15-Serial1.pdfPage 8 of 11 4) The Car: The diagram below illustrates the hardware modules of the car and their interconnections. The percentages designate the duty cycle of the controlling signals for different commands (left/right and forward/backward). All of these will be now explained. The DE2 needs to interface with the car hardware in order to control it. As it is, the car has an RF transceiver, steering module, and speed control unit. There is one connection from the transceiver to the steering module and a second connection from the transceiver to the engine module. Each connection uses three wires. Two of the wires are power (0.5V) and ground and the third one carries the control signal to the corresponding modules. Thus, in our case, we can leave all power connections intact and just drive the two control wires that leave the transceiver and go to the steering and speed control modules. Both control signals use the same waveforms, but are independent of each other. Each signal is a square wave of a constant frequency of 50Hz. Information is transmitted by changing the duty cycle of the wave (e.g. pulse width modulation). In the neutral state (when the car is doing nothing), the waveform is square with duty cycle of 8.1%. If there is a left/right or forward/backward command, the
View Full Document