algorithm Arduino hardware software

Basic SmartCar Bot – Hardware

Many years ago I purchased a Rug Warrior kit to go with the book Mobile Robots: Inspiration to Implementation. It was an expensive kit – in the hundreds of dollars in Australia – for what was an advanced entry level robot of the early 1990’s.

The technology to make such a bot vehicle has become considerably more accessible, so I thought it was time to build a roving bot from the ground up. The challenge for this version is to make it as cheaply as possible for functionality similar to Rug Warrior.

The Original Rug Warrior

The Rug Warrior

The original Rug Warrior had two independent wheels, each with shaft encoder, 2 forward facing IR obstacle detectors, a plastic shell with bump sensors, two forward facing light sensors, a microphone and a speaker.

The robot was originally developed at the Massachusetts Institute of Technology (MIT) for use in robotics courses. The author of the book received so many enquiries about the robot that they decided to offer it as a kit to accompany the book of the course.

The robot controller was a custom PCB mounted on the robot chassis, with a Motorola MC68HC11 microcontroller and all sensor sockets, amplifiers, speakers, LCD display, etc, built-into the board.

Rug Warrior was programmed from either Mac or IBM PC compatible computers. Programs for were written in ‘Interactive C’ and the compiled code downloaded to the robot via the serial port. A simple time sharing operating system allowed execution of parallel processes. Software libraries for controlling all the robot motors and accessories were provided on 3.5″ diskette (remember them?).

Breaking it down

I decided to break the project down in the following major subprojects/components which roughly correspond to the parts in this series of articles:

  1. SmartCar Core Hardware – vehicle chassis, motors, motor encoders
  2. Power Supply
  3. Additional Sensors – Bumpers, Sonar, Light, Bluetooth
  4. Microprocessor and Control Strategy
  5. Software Implementation – configuration, tuning, autonomous rover

The core library, configuration, setup and application sketches referenced in this series of articles are available in my code repository as the MD_SmartCar library.

SmartCar final configuration

SmartCar Core Hardware

Robot Chassis

The base chassis for the robot is a 2 wheel drive plus idler castor wheel vehicle platform found on most online marketplaces for not much money. Most of them look like a variation of the photo below.

SmartCar Chassis

These chassis are designed to accommodate the small, but highly geared, TT type motors (yellow plastic housing) with dual output shafts. All the kits seem to come with standard 65mm diameter wheels and many include slotted encoder discs that fit the motor shaft.

Motors Type and Motor Control

There are two practical low-cost choices for SmartCar motors – brushed DC motors (like the TT style motors supplied) and stepper types. In both cases the motors need to be geared to reduce the motor output speed and increase the torque available.

As TT motors are provided with the chassis, the choice is simple. However, it is worth considering geared stepper motors as they do not need an encoder for motor feedback and can be more precisely controlled.

No matter which choice is made, the motors need to have some form of hardware speed controller between the Arduino processor and the actual motor.

The practical choices for the TT brushed DC motors supplied are outlined in this previous article. In keeping with the ‘cheap’ objective, the motor controllers used in this implementation are MX1508 PWM type, with one controller able to handle both motors.

There are some limitations to how accurately the robot can be positioned using DC brushed motors. For the purposes of creating a ‘random rover bot’ these limitations are not really an issue, but I can foresee that a version using low-cost stepper motors will probably become a future project.

I also found the yellow TT motors, with their all-plastic gearbox, unreliable. Two motors broke gear teeth during bench testing and the output characteristics were highly unmatched (ie, the rotation speed was quite different at the same PWM setting), making them difficult to tune. I eventually purchase metal gearbox TT motors (blue plastic bodies), which proved to be more consistent and provided more output torque, although they are a little noisier.

Motor Encoder

For stepper motors the encoder is not required, as control of the motor is by counting the number of steps.

For DC brushed motors, the motor encoder can be any sensor that provides a reliable number of pulses per wheel revolution. Some of the more expensive DC motors have these built-in to the motor housing. However most, like the TT types, will need an external sensor.

The two most common sensors are photo interrupter and photo reflector types. The first uses an infrared LED beam passing through slots in a disc to detect the wheel’s rotation; the other a beam reflected off black and white segments.

The simplest encoder for this application is a photo interrupter as many of the SmartCar chassis come with a slotted wheel that made to fit the second motor shaft. The encoder sensor is always attached to the vehicle body. A ready-made module with this type of sensor is shown below.

I salvage my encoders from a variety of broken electronic equipment (printers are a good source) and the circuit above can be used to build a near-zero cost DIY version (photo below). Note that the output of this circuit is pulled-up by the 10k resistor when there is no signal from the detector.

Home built dual encoder

A photo reflector circuit works in a similar way, as it packages a LED and a receiver, but the sensor is usually much smaller (like this Hamamatsu P5587 sensor to detect paper in printers and photocopiers, as used in the original Rug Warrior). They also need to detect off printed or reflective segments (similar to a barcode scanner) rather than slots. These sensors need to be installed very closer to the rotating segments to work reliably, making installation slightly more difficult.

To detect wheel movement the SmartCar counts the number of pulses returned by the sensor. The pulse train is created by the intermittent blocking of the IR beam by the slotted wheel or the change in reflectance by the light/dark boundary of the segmented circle. Each change (light to dark or vice versa) is a count, so a wheel with 20 slots has a resolution of 40 counts per revolution, or 9° (360/4) of wheel rotation.

The output of the circuit is connected to an pin supporting external interrupts – pins 2 or 3 on the Arduino Nano – to ensure counts are captured accurately.

Dual encoder installed – bottom view

In the next part we’ll look at the setup for the power supply, controller selection and sensors for the SmartCar.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s