USB Robot
From Ece
Team USB_ROBOT
Our goal is to control a robot's movements with a USB joystick using the FPGA as an interface between the joystick and the robot.
Contents |
Team Members
James Sakalaukus – Checker
Jimmy Rapier – Coordinator
Yuko Shimomoto - Recorder
Jeffrey Lorens – Recorder
Phase 1
Introduction
The FPGA can be used to allow humans to control devices by receiving input from a human interface device and converting the signals from the human interface device to signals used by the device being controlled. Converting data between devices requires the conversion of the interface itself and doing some processing on the data. In our project, the interface will be converted from USB to serial and the data will be converted from joystick position values to servo adjustment values.
Concept
In order for a joystick to control a robot, the signals from the joystick need to be converted into signals that the robot understands. A microcontroller with a built in USB controller will be used to connect to the USB joystick. The USB controller will handle the USB interface and receive the USB packets sent from the joystick. The microcontroller will take the data received by the on board USB controller and send that data to the FPGA. The FPGA will take the raw joystick position data and convert it to servo position adjustments for the robot. The FPGA will make adjustments to the current servo positions and send the new servo positions to the robot over the serial bus. The FPGA will then display the current joystick and servo positions on the VGA monitor.
Proposed Work
- The microcontroller will run a program that will handle the USB interface with the joystick and convert the packets received over the USB interface to an interface that is receivable by the FPGA on the Spartan III development board.
- The FPGA will run a module that receives the joystick position data from the microcontroller.
- The FPGA will run a module that converts the joystick position data to the appropriate servo position adjustments for the robot.
- The FPGA will run a module that outputs the servo positions to the robot over the serial port.
- The FPGA will run a module that displays the current joystick and servo positions on a VGA monitor.
Required Parts
- Spartan III development board
- PIC18F4455 microcontroller
- USB joystick
- USB port to connect the joystick to the micrcontroller
- External power supply for microcontroller and joystick
- Robot
Expected Deliverables
With the parts listed, the Spartan III board will control the movements of the robot and output the current joystick and servo positions to a VGA monitor.
Phase 2
Introduction
The FPGA can be used to allow humans to control devices by receiving input from a human interface device and converting the signals from the human interface device to signals used by the device being controlled. Converting data between devices requires the conversion of the interface itself and doing some processing on the data. In our project, the interface will be converted from USB to serial and the data will be converted from joystick position values to servo adjustment values.
Concept
In order for a joystick to control a robot, the signals from the joystick need to be converted into signals that the robot understands. A microcontroller with a built in USB controller will be used to connect to the USB joystick. The USB controller will handle the USB interface and receive the USB packets sent from the joystick. The microcontroller will take the data received by the on board USB controller and send that data to the FPGA. The FPGA will take the raw joystick position data and convert it to servo position adjustments for the robot. The FPGA will make adjustments to the current servo positions and send the new servo positions to the robot over the serial bus. The FPGA will then display the current joystick and servo positions on the VGA monitor.
Proposed Work
- A module will be developed to translate data received from the keyboard. This module will be phased out by the usb joystick. To be developed by:
- A module will be developed to send data over the serial port to the robot. To be developed by:
- A module will be developed to mantain current position of the robot, and it will determine what the next position will be. To be developed by:
- A module will be developed to receive information from a usb joystick. The pic18 is an intermediate step in this module. It will translate the usb joystick data into movements and send it to the fpga. To be developed by:
Modules
- Keyboard Interface
- The keyboard will initially contol movement of the robot. Two rows of keys, A-J and Z-M, will control the 7 different servos on the robot. A key is needed for each direction of movement for each servo.
| Key | Function | Opcode |
| ‘a/z’ | Left Wheel movement | 0000 - 0001 |
| ‘s/x’ | Right Wheel movement | 0010 - 0011 |
| ‘d/c’ | Base rotation | 0100 - 0101 |
| ‘f/v’ | Shoulder movement | 0110 - 0111 |
| ‘g/b’ | Elbow movement | 1000 - 1001 |
| ‘h/n’ | Wrist movement | 1010 - 1011 |
| ‘j/m’ | Gripper movement | 1100 - 1101 |
- Serial Interface
- This module will output the decoded servo position to the robot.
- Input(s): Servo Number, new Servo postition
- Output(s): Serialized transmission of Servo Data
- Position Module
- This module will take the input from the keyboard module and convert it into servo positions. It will output the postions to the serial module.
- Input(s): Opcode
- Output(s): Servo Number, new Servo position
- USB Module
Required Parts
- Spartan III development board
- Datasheet: [1]
- PIC18F4455 microcontroller
- Part Number: PIC18F4455
- Datasheet: [2]
- Price: Free Sample
- USB joystick
- Price: existing hardware
- USB port to connect the joystick to the micrcontroller
- Part Number: yet to be determined
- Price: yet to be determined
- External power supply for microcontroller and joystick
- Part Number: unknown
- Price: exisiting hardware
- Robot
- Price: exisiting hardware
Expected Deliverables
Using the parts listed, we will first interface the robot via the keyboard, and add usb joystick functionality as time permits.
Phase 3
Review of Proposed Work
- A module will be developed to translate data received from the keyboard. This module will be phased out by the usb joystick. To be developed by: Jimmy Rapier
- A module will be developed to send data over the serial port to the robot. To be developed by: Jeffrey Lorens
- A module will be developed to mantain current position of the robot, and it will determine what the next position will be. To be developed by: Jimmy Rapier
- A module will be developed to receive information from a usb joystick. The pic18 is an intermediate step in this module. It will translate the usb joystick data into movements and send it to the fpga. To be developed by: Yuko Shimomoto and James Sakalaukus
Module Descriptions
- Keyboard Module (decodeop.v)
- This module utilizes the ps2core.v and decodeop.v from the Calculator lab.
- This module has two inputs: ps2_data, ps2_clock and two outputs: upDown, servo
- (See Table I from Phase II for opcode definitions)
- Position Module (position.v)
- This module takes the opcode from the Keyboard, and eventually the Joystick, and converts it into the position for the robot
- This module has three inputs: clk, upDown, servoNum and three outputs: load, sPosition, servo
- SerialToRobot Module (SerialToRobot.sch, debounce.sch, ClkUnit.vhd, TxUnit.vhd, datareg.v)
- The SerialToRobot module converts the individule servo positions from the position module into a serial stream to the robot. The serialToRobot module has a eight bit input for the servo's number, a eight bit input for the servo's position, and a one bit load enable input. The modules's only output is a serial transmition line. When the load enable line is pulled high by the position module, the SerialToRobot module loads the values on the servo number and position buses and places the values into a buffer. The values are then sent to the serial transmitter. The serial transmitter is sent three bytes of data that it will send to the robot across the serial line. The first byte sent to the robot is hex FF. This byte tells the servo controler on the robot to get ready to receive the next two bytes of data. the second byte is the number of the servo to be moved and the thrid byte is the location to move the servo to.
- USB Module
- The pic18 will output an opcode over a 5-bit parallel bus to the fpga. The usb module on the fpga translates this opcode and sends two outputs to the servo position module: direction (up or down), and servo number.
Expected Deliverables
The expected deliverables are similar to phase 2. The pic18 used for usb interpretation may be phased out, in which case a usb to ps/2 converter will be used to interface the joystick to the fpga.
Phase 4
Review of Proposed Work
- A module will be developed to translate data received from the keyboard. This module will be phased out by the usb joystick. To be developed by: Jimmy Rapier and James Sakalaukus
- A module will be developed to send data over the serial port to the robot. To be developed by: Jeffrey Lorens and Yuko Shimomoto
- A module will be developed to mantain current position of the robot, and it will determine what the next position will be. To be developed by: James Sakalaukus and Jeffrey Lorens
- A module will be now receiving information directly from keyboard instead of using USB, which was proposed in Phase 3.
Module Descriptions
- Top Module (newtop.sch)
- This module contains all of the submodules.
- Keyboard Module (decodeop.v and ps2core.v)
- This module utilizes the ps2core.v and decodeop.v from the Calculator lab.
- This module has three inputs: ps2_data, ps2_clock, valid and two outputs: upDown, servo
- (See Table I from Phase II for opcode definitions)
- Position Module (position.v)
- This module takes the opcode from the Keyboard module and converts it into a servo number and a increment or decrement for that servo's position. This module also holds the current position for each servo and outputs a servo's number and position whenever the position of a servo changes.
- This module has three inputs: clk, upDown, servoNum and three outputs: load, sPosition, servo
- SerialToRobot Module (SerialToRobot.sch)
- The SerialToRobot module contains the following submodules: datareg.v and rs232_uart.vhd. The RS232 Modules is a serial uart that consists of the submodules rs232tx.vhd, ram16*8.vhd, and rss232rx.vhd. The serial uart was found online at http://www.hunteng.co.uk/support/ipbyfunction.htm[1]
- The SerialToRobot module converts the servo positions from the position module into a serial stream to the robot. The serialToRobot module has a eight bit input for the servo's number, a eight bit input for the servo's position, and a one bit load enable input and clock. The modules's only output is a serial transmition line. When the load enable line is pulled high by the position module, the SerialToRobot module loads the values on the servo number and position buses and places the values into a 32 byte buffer contained in the datareg module. The values are then sent to the serial transmitter by the datareg module. The serial transmitter is sent three bytes of data that it will send to the robot across the serial line. The first byte sent to the robot is hex FF. This byte tells the servo controler on the robot to get ready to receive the next two bytes of data. the second byte is the number of the servo to be moved and the thrid byte is the location to move the servo to.
Expected Deliverables
The expected deliverables are similar to phase 3. The difference is instead of using the pic18 and the USB joystick as the human interface device, a PS2 keyboard is used.
- Here is the Robot waiting for commands.
- Here is a link to downLoad the source code package.[3]




