You are on page 1of 14

DESIGN AND IMPLEMENTATION OF ROBOT USING FPGA

D.Chenna kesava, Pavan kumar Reddi, R.Mohamed Niyas, K. Sivasankaran. School of Electronics Engineering, VIT University, Vellore, Tamil Nadu, India. rpk.pavankumar@gmail.com ph:9597369709

Abstract: This paper presents a design and implementation of computational hardware and software of FPGA robot. In this paper, a prototype of robot for obstacle detection using IR proximity sensor has been designed using FPGA. The design includes the adaptation of the FPGA for the implementation of detection of obstacles with IR proximity sensor and the motor driven circuit with L293D to drive the motors of robot. Using Verilog HDL coding the design is implemented on an ALTERA DE1 board (Cyclone II EP2C20F48427 , FPGA) . Co-design of software-hardware tasks which are used to design robotic systems that have improved reliability. We have successfully implemented the design and verified the hardware for different test circumstance. Keywords DC motor, IR proximity sensor, FPGA, ALTERA,GPIO's 1. INTRODUCTION The FPGA-bot is a low-cost moving robotics platform designed using DE1or DE2 board. The FPGA-bot is designed to be a small self-directed vehicle that is programmed to move in reaction to sensory input. A wide variety of sensors can be easily attached to the FPGA bot. Here we are using IR proximity sensors for the detection of the obstacle. Then 9V rechargeable battery pack is used to supply power. Two DC drive motors are used to move the robot. The robot can move forward, left, right and stop based on the detection of the obstacle. The FPGA is automated to act as the controller. The DC motors are controlled by timing pulses produced by the FPGA board. The appearance of reconfigurable Field Programmable Gate Arrays (FPGA) has given increased to a new platform of complete robot control system. With FPGA devices, we can design to fit the requirement of control system tasks for a robot. A FPGA-based control system is designed to solve the problem of parallel tasks attaining control which occurs on single processor machine. FPGA is as flexible as software and reliable as hardware. Timing analysis can be done easily and also the programs can be converted into hardware blocks which do not require any operating systems[6].

Robots carry out many various tasks. During these tasks therobot moves and orients. While navigating, it uses signals from the environment and the contents of its own memory to Make the correct decisions. This form of navigation may be many depending on the given task and problem. 2. SYSTEM ARCHITECTURE POWER SUPPLY

POWER SUPPLY

IR PROXIMITY SENSOR ALTERA DE1 BOARD IR1

DC MOTOR

IR1

IR2

MOTOR1
Fig 2.1: System Architecture of robot

MOTOR2

The system architecture is shown in Fig.2.1. It consists of different blocks includes IR proximity sensors(IR1 and IR2), DC motors with the driver circuit and these are interfaced using GPIO's to ALTERA DE1 board using Verilog HDL code in Quartus II .Where DE1board is a "brain" of the bot which will drive the motors in reaction to the sensor readings.

3.MODULES USED IN DESIGN In the design and implementation of the FPGA based robot we used the three modular approach, those are 1.IR proximity sensor module. 2.Dc motor driven circuit module. 3.Top level module using DE1 board and above two modules.

1. IR proximity sensor module:


Operation: An IR proximity sensor operates by relating a voltage to a pair of IR light emitting diodes (LEDs) which in turn, emit infrared light. This light propagates through the free space and once it hits an obstacle it is reflected back towards the sensor. If the obstacle is nearby , the reflected light will be stronger than if the object is further away. The sensing unit (for this paper is a Sharp LM358D will be used), in the form of an integrated circuit (IC), detects the reflected infrared light, and if its intensity is strong enough, the circuit becomes active[7]. When the sensing unit becomes active, it sends a corresponding signal to the output terminal which can then be used to activate any device connected. For the reason , a small green and red LED's for two will turn on when the sensor becomes active. Here we used LM358D comparator IC to drive the high currents.

Fig:3.1 IR sensor module circuit

Fig:3.2 PCB based IR sensor module

2.Dc motor driven circuit module:


The processing unit programmable input and drives the wheels control circuits with four groups of outputs (GPIOs), controlling whether the auto goes

forward/backward or turns left or right. Where H- Bridge (L293D) motor driver circuit is used to realise the above controls. An H bridge is built with four switches (solid-state or mechanical).

Fig:3.3 H-bride (L239D) motor driven IC, which is driving one motor. The moment of the DC motors is done by L239D driven circuit by using the Hbridge four switches. When the switches S1 and S4 are closed and S2 and S3 are open a positive voltage will be applied across the motor then moves . By opening S1 and S4 switches and closing S2 and S3 switches, then it moves to left for change of voltages results in allowing reverse operation of the motor i.e. it moves right .These switch operation were done based on the detection of the IR proximity sensors (IR1,IR2)as shown in the tabular column (table:3.1)
IR1 1 0 1 0 IR2 1 0 0 1 S1(mlp) 0 1 1 0 S2(mrp) 0 1 0 1 S3(mln) 0 0 0 1 S4(mrn) 0 0 1 0 STATEs STOP FORWARD RIGHT LEFT

table:3.1 Showing states based on inputs operation of the sensors

4. IMPLEMENTATION In the implementation part we had both the software and the hardware portions of each and every module. As we come to them, 1.MOTOR MODULE: a. SOFTWARE: The functionality of the module is as follows, If the enable is high and based on the inputs of the sensors IR1 and IR2 i.e. as per the states given table:1 the motor operation takes place i.e. when en=high and both IR and IR2 are low then motor moves forward when these are high it will stop due to detection of the obstacles on both sides, when one is high and other is low based on IR it will moves to right or left. We used the Quartus II software version 10.0 to design the motor module using the verilog code. Then as a starting stage we Verified the functionality of the verilog code by stimulating in the tool and verified the stimulation result by using waveforms (which is basic advantage for using this tool ). RTL schematic for code :

Fig4.1: RTL schematic for the motor code

After analysis of functional stimulation report we interfaced the module to ALTERA DE1 board and checked the functionality by assigning the pins so that LED's should glow for the inputs given. We successfully verified the operation by varying the switch inputs to all the four cases. Then we implemented the module by using the hardware.
b. HARDWARE:

In the hardware implementation of the motor module we used the motor driven circuit which consists of motor driven IC(L239D), bread board to make the interconnections and interface between the DE1 board and bread board and power supply. Here we dumped the code in to DE1 using QUARTUS II then after using GPIO's interface in board[2] we mapped all to the motor driven IC as per the circuit shown in fig:3.3, The snapshot of the successful implementation DC motor module.

Fig:4.2 Showing the hardware of motor module with rotating right wheel. 2. IR SENSOR MODULE: a. SOFTWARE: The functionality of the module is as follows, based on the clk and inputs of the sensors IR1 and IR2 i.e. as per the states given table:3.1 the operation takes place. The operation of the IR sensor module is when the IR1 and IR2 are high the output should be high-high-low which is given by two bit , when low output should be low and when any one of sensor is low and other is high the output must high-low or vice versa.

We used the Quartus II software version 10.0 to design the IR module using the verilog code. We Verified the functionality of the verilog code by stimulating in the tool and verified the stimulation result by using waveforms (which is basic advantage for using this tool ). RTL schematic for IR sensor code :

Fig:4.3 RTL schematic for the IR sensor code. After analysis of functional stimulation report we interfaced the module to ALTERA DE1 board and checked the functionality by assigning the pins so that LED's should glow for the IR inputs given. We successfully verified the operation by varying the switch inputs to all the four cases. Then we implemented the module by using the hardware.
b. HARDWARE:

In the hardware implementation of the IR module we used the PCB designed IR module and make the interface between the DE1 board and IR module PCB. Here we dumped the code in to DE1 using QUARTUS II, then after using GPIO's interface in board[2] we mapped all to the PCB IR module. Then snapshot of the successful implementation IR module .We can observe the glowing of LED in fig4.4 this says the working of PCB IR module and the glowing LED's in the DE1 board indicate the detection of the object by the IR module.

Fig:4.4 Shows the successful implementation of the IR module

3.Top level module:


Top level module is nothing but the implementation of the entire architecture by assembling the individual modules i.e. motor module and the IR proximity sensor module is assembled and written as one module. a. SOFTWARE: In the software implementation of the top level module the inputs of this module is IR1 and IR2 these will detect the presence of the obstacle based on this detection the outputs of the IR module is given as the input to the motor driven module. Were the output of the IR module is the two bit were these two bit were concatenated and given to the motor drive circuit (L293D) which will given as the input to the motor module as the four bit input .As the result the output of the module has driven the two motors for the different combinations of inputs in forward, left and right directions. The whole block must be enable when en=1 otherwise it should be disabled. RTL SCHEMATIC:

Decoder0 ir1[1..0] ir2[1..0] motrp~0


IN[3..0] OUT[15..0]

0 1

motrp

motrp~1
DECODER

0 1

motrn

motrn motlp~0
0 0 1

motlp

en

motlp~1
0 0 1

motln

motln

Fig:4.5 RTL schematic for top module.

b. HARDWARE :

In the hardware implementation of the top module we used the bread board designed motor driven IC circuit module and PCB designed IR module and make the interface and interconnections between the DE1 board and PCB IR module and the motor driven IC circuit. Here we dumped the code in to DE1 using QUARTUS II, then after using GPIO's interface in board we mapped all to the modules. Then snapshot of the successful implementation top level module is taken and the test results of the top module were shown in the test scenarios.

Fig:4.6 Shows the Hardware module by assembling all the modules.

5. TEST SCENARIOS AND RESULTS

The different test Scenarios used in the design and implementation of the FPGA based robot are as follows, 1.TEST FOR DC motor driven circuit: To test the working of the dc motor driven IC circuit we prepared the circuit using the bread board ,IC L293D to drive motor having inputs and outputs ,voltage regulator to have 5V dc supply, interconnecting wires,12V dc power supply to drive motors. These are connected as per the circuit shown in the fig: 3.1

Fig:5.1 DC motor driven circuit circuit

Fig:5.2 Successful driving of motor

Thus as the test result in driving of the motor wheels one in clockwise and other in anti clock wise , we can see in the fig:5.2 that rotating of motor connected wheels as compared to behind wheels. 2.TEST FOR IR proximity sensor:

To test the working of the IR proximity sensor circuit ,we prepared the circuit using the bread board ,IC LM358, transmitter and receiver LED's , resistors each across transmitter and receiver, LED to check working, voltage regulator to have 5V dc supply and interconnecting wires. These are connected as per the circuit shown in the fig3.3

Fig:5.3 Circuit for IR proximity sensor sensor

Fig:5.4 Successful test Circuit for IR proximity

Thus as the test results in the detection of the object by the sensor .Were the glowing LED indicate the passing of supply to the circuit and the LED at the pin 3 indicate the detection of obstacle by the sensor. 3.TEST FOR FPGA -BOT for different states:

Finally, all the modules were assembled as the single module and the test was done for the different states of the robot. a. FORWARD: For the robot to move forward IR1 and IR2 must be low that means there should not be any obstacle before. Then the two motor will rotate clock wise and moves forward. For this to test we dumped the software into the DE1 board and interfaced the GPIO's with the IR proximity sensor circuit and with motor driven circuit, then given the power supply as the result the FPGA robot had moved forward. b. RIGHT: For the robot to move right IR1 and IR2 must be low and high that means if there is an obstacle in left the robot will moves right. Then the one motor will rotate clock wise and other will stop moving then it moves right. For this to test we dumped the software into the DE1 board and interfaced the GPIO's with the IR proximity sensor circuit and with motor driven circuit, then given the power supply as the result the FPGA robot had moved right.

Fig:5.5 Showing the successful implementation of the FPGA-bot moving left c. LEFT: For the robot to move right IR1 and IR2 must be high and low that means if there is an obstacle in right the robot will moves left. Then the one motor will rotate clock wise and other will stop moving then it moves left. For this to test we dumped the software into the DE1 board and interfaced the GPIO's with the IR proximity sensor circuit and with motor driven circuit, then given the power supply as the result the FPGA robot had moved left.

Fig:5.6 Showing the successful implementation of the FPGA-bot moving left

CONCLUSION:
We implemented the complete system of FPGA-bot using QUARTUS II 10.0 and we successfully generated the necessary architecture required for the of the detection of obstacle using the IR proximity sensors. Using the verilog coding with QUARTUS II tool helped us in the knowing the outputs of design by functional stimulation waveforms and on dumping the code to FPGA ,DE1 board the outcomes of system are verified before going to the hardware. We performed the hardware of the system for each and every module and successfully designed the FPGA based robot for the detection of the obstacle using the IR proximity sensor. By working on this project we came to know how to implement the software designed code to real time applications and get familiarised with FPGA based DE1 board. We faced a lot of problems with regard to drive the FPGA-bot to all conditions but our continued efforts paid result of working drive the robot to all conditions.

REFERENCES:
[1] Autonomous Object Seeking Robot Based on FPGA and a Single Chip Microcontroller Alauddin Al-Omary [2] DE1 User Manual from Altera [3] Fuzzy Based Obstacle Avoidance System for Autonomous Mobile Robot ,C. G. Rusu1, I. T. Birou1, E. Szke1. [4] FPGA-based Control System for Miniature Robots ,Narashiman Chakravarthy, Jizhong Xiao. [5] Hamblen Hall Furman-Rapid Prototyping of Digital Systems. [6] Neuro-Fuzzy Algorithm implemented in Alteras FPGA for Mobile Robots Obstacle Avoidance Mission Muhammad Nasiruddin Mahyuddin, Chan Zhi Wei and Mohd Rizal Arshad. [7] Recognising and locating objects with local sensors ,Jan De Geeterl, H. Van Brusse1, J. De Schutter, M. DecrCton.