Tuesday, December 21, 2010

Zigbee + solar + robot

The aim of this project was to design and build a 4WD differential drive rover with integrated robotic arm capable of autonomousoperation with obstacle avoidance and object detection. Also designed to have a manual override teleoperated mode for wireless remote manipulation using a graphical user interface on a PC for both rover as well as arm control.

Below are the 3D CAD models of various components of the robot designed in Solidworks.

The graphical user interface for remote operation was created inVisual Basic 6. Initial concept for software control of rover and arm required knowledge of inverse kinematics for precision real-time control of the arm. Below are sketches of initial conceptualization.

These concepts were incorporated into software and tested on servos that would later be part of the robotic arm. I decided on the Pololu Micro Serial Servo Controller that accepts serial data using RS232 protocol and can drive up to 8 servos. After some mathematical calculation involving arm lengths, weights and torque requirements, I selected Hitec HS-805BB and HS-755HB servos.

Images below shows servo data calibration and inverse kinematic equations that I derived:
The rover component of the robot consisted of four 6V DC gearhead motors fromTamiya powered by aSabertooth 2x10motor controller from Dimension Engineering. The Sabertooth was set to operate in serial mode, where speed and direction data are sent as serial data packets. It provides a continuous current of 10A per channel which is sufficient to drive two motors per channel. Thus, the two left motors and two right motors are paralleled and driven by each channel of the motor controller.

Below is the Sabertooth 2x10 motor controller.

Both the motor controller and servo controller slave devices are driven by a master PIC16F877A microcontroller. In manual control override mode, the PIC communicates with the software on a PC via a bidirectional wireless UART link and receives instructions that drives both controllers as well as other devices like LEDs & sensors as well as transmits data from sensors back to the software.


developed the software in VB6 with the purpose of implementing real-time control of the rover and arm without the need for writing down scripts for pre-planning the robot's movements. The graphical user interface is divided into 4 quadrants. The top-left quadrant shows the graphical position of the robotic arm. The arm itself is made of 4 segments including wrist & gripper. The user can drag the end-effector to any location (Xp, Yp) in cartesian space with base of the arm at (0,0) and the software calculates the angles of A, B and C using inverse kinematic equations. The user can also move each arm segment independently without moving the other segments. Alternatively, each angle can be changed by directly editing the angle in the appropriate text box and using forward kinematics, the end-effector position (X, Y) is computed.

The top right quadrant has controls for the rover. Basic controls for the differential drive are forwards, backwards, turn right, turn left and rotate either side. The navigation frame in the sidebar shows the speed of the rover as a percentage of full speed. Other controls on the rover like, wrist rotation, gripper controls and various LED lights can also be controlled from here.

The bottom left quadrant displays options for the infrared sensor.Scan180 option sweeps the sensor 180 degrees and displays the result graphically like a radar. The Follow Target option locks the rover onto a moving object in front of it and follows it while maintaining its distance.
The robot can also be operated by a Playstation 2 style USB game controller using DirectX routines. One advantage of this game controller is that it has lot of digital switching options for activating various controls on the robot. The two analog sticks worked very well for the robotic arm as well rover manipulation. When the keyboard control option is enabled, all of the features mentioned above for the rover and the arm can be controlled directly from the keyboard by various keyboard shortcuts.

Other software features include, graphical enhancements like grid (Polar and Cartesian), arm segment loci, inside and outside borders for the arm, ability to create macros, scripts, real-time battery power and wireless signal strength indicators.

When the wireless link is enabled from the application, any changes in rover or arm positions are transmitted to the robot in real-time. If sensor is enabled, the software requests the robot to send current sensor data. The progress bars for the signal strength and battery voltage indicator are also periodically updated.

Figuure below shows the block diagram of the electronics involved:

At the heart of the electronics is the PIC16F877A microcontroller, which has sufficient GPIO pins and all the peripherals to interface with the rest of the electronics. The system derives its power from a 6V SLA battery which conveniently sits in the rover's belly, which was designed to accomodate the SLA. The electronics is divided into 5V and 3.3V electronic sub systems, each is powered by its own regulator and filtering circuits. The Sabertooth 2x10 motor controller provides the regulated 5V at 100mA, which powers the 5V system and I built an onboard 3.3v regulator for the 3.3V systems, which includes the wireless XBee Pro module from Maxstream.

The PIC communicates serially with the XBee Pro module using the PICs onboard hardware USART. Since, the XBee Pro and PICmicro constitute a mixed 5V/3.3V system, they cannot be interfaced directly with each other. Instead, an intermediate transceiver or buffer is required for interfacing in such situations to prevent damaging the XBee due to overvoltage. The circuit below was designed to do just this.

Data transfer between the microcontroller and servo and motor controllers is also done serially. However, since the hardware USART pins were already used for PIC-XBee communication, I had to implement UART (Universal Asynchronous Receiver Transmitter) function in software. Since, implementing software UART requires very precise timing functions to accomplish a predetermined baud rate, the selection of the system clock becomes very crucial. Using a 4.00MHz or 8.00MHz crystal, for example, will result in timing which is not divisible by standard baud rates:
4.000 MHz / 9600baud = 416.6666... (not an integer)

For serial communications, selecting a crystal frequency which is exactly divisible by standard baud rates, is very important. Using the wrong crystal results in loss of data which results in unsatisfactory performance in teleoperated mode. In my case, I decided to use18.432 MHz.
18.432 MHz / 9600 = 1920 (an integer)

The microcontroller communicates with the radio transceiver (XBee) using the PIC's built in hardware USART peripheral at 38.4 kbps. The other XBee at the user's end is programmed to operate at thesame baud rate and communicates with the computer through a serial port. For computers without a RS232 serial port, as in my case, a USB port can be made to emulate one using theFT232R - USB UART IC from FTDI Ltd. To make interfacing the XBee through the USB port on the computer, Sparkfun Electronics has abreakout board for FT232R IC, with internal oscillator, EEPROM as well as 3.3V regulator on board.

Slideshow of ongoing autonomous rover prototype with integrated robotic arm.My robotic arm being controlled manually from a graphical user interface (GUI) application that I developed in VB6.Earlier 3D model and simulation of the robot arm (Concept stage).

Click photo to go to a Robotics Project

Original Teleoperated Robot With 5 DOF Arm

Current Robotics Project: Snow (work in progress)

No comments:

Post a Comment