Friday, September 14, 2012

Overview

"Carve" is the Bot Thoughts entry for The AFRON "10 Dollar Robot" Design Challenge, Traditional Category, an educational robot system with flexibility to provide students and hobbyists around the world with an extremely affordable, capable, expandable, flexible, reliable learning tool.

The name "Carve" comes from a skateboarding term and is a nod to a rather distinctive component on the rear of the robot, as well as a description of its turning radius...

Mass produced cost is estimated at $12.73 for 1000 units, not including per-classroom accessories (approximately $27). Prototype cost is estimated at just over $28 including battery, and around $55 including required accessories (one each per classroom).

The base model provides a fully autonomous robot line follower to the student. The robot can be expanded with small, low-cost shields that provide extra capability.

Features

Expandable with 'shields' making additional, a la carte capabilities affordable

Two working prototypes have been constructed. The first was built to prove out physical assembly, motor control, and steering. The second prototype, pictured here, verifies circuit designs including motor driver selection, and provides a platform for fine tuning performance.

Programmable

The robot is autonomous, and programmable using a widely supported, very available ATmega328P that can be programmed either using the Arduino IDE or, at a future date, the MiniBloq graphical programming environment.

Despite the extra cost of the mainstream microcontroller, its ubiquity in the hobbyist community pays dividends such as:

excellent usability with Arduino, MiniBloq, and AVR IDEs,

support from a very large worldwide Arduino an community,

easy adaptation of Arduino shields onto smaller, cheaper form factor,

wide array of drivers for sensors,

an extremely large collection of libraries, and

a plethora of code examples across the internet.

Robot Kit

The robot is primarily intended to be mass produced in the form of a kit with soldering and assembly to be completed by the teacher or students. The robot is comprised of

a single motor with dual axle stubs,

two drive wheels and axles,

servo-based steering,

steering wheels,

all necessary brackets,

and a circuit board with an ATmega328P processor and motor driver ICs

The kit provides an unpopulated circuit board with through hole components. Two SOIC-8 motor driver chips can be hand-soldered or alternatively, pre-assembled at additional cost. The estimated mass produced price assumes pre-populated motor ICs.

Easy to Reproduce

The robot is designed to be extremely easy to reproduce by beginning electronics hobbyists using commonly available components and tools. The end result would be similar to the prototype at similar cost, provided hobbyists had access to a professionally fabricated boards through batch PCB fabrication, like OSHPark.com, or through sales of bare boards produced at high enough volume to reduce costs.

Physical assembly is accomplished with nothing more sophisticated than hot melt glue, a cheap and readily available adhesive. Fabrication of the single hardware bracket involves cutting and bending a brass strip with pliers or using an alternative.

Intermediate hobbyists can etch and drill the single-side board design at home as was done for the prototype.

Design

The robot is designed with cost as a priority, while carefully balancing capability, expandability, flexibility, reliability, and ease of assembly. To control cost, simplify assembly, and sustain reasonable reliability, the robot is designed to use popular, easily available, inexpensive, mass-produced parts and tools that are easily assembled into a functional robot. There's no need for 3d printers, laser cutters, advanced tools, or anything of the kind.

Locomotion and Steering

The design is based on a single drive motor with two drive wheels and rear steering. Traditional wheeled, motor driven robots are believed to be the most flexible and useful in educational settings.

The single motor, rear servo steering design cannot execute tight radius turns or spins as with differential steering; however, turning radius is minimized by using weight transfer to allow the inner drive wheel to slip during turns.

Weight transfer is accomplished by placing the turning wheels at the end of the servo horn, and by slightly tilting the servo from vertical. As the turning angle increases, the center of gravity of the robot shifts and more weight is transferred off the inner drive wheel (see the experiments section for data). The design was proven by an early Bot Thoughts robot, Sparky several years ago.

Students can clearly observe the rotational speed and slip of each of the drive wheels, and the design offers material for interesting discussions about physics, geometry, and automotive axle differentials.

The Single Motor vs. Differential Steering Designs

Fewer driver components, simpler, lower cost

Smaller chassis, lower PCB fabrication cost

Addition of a servo, subtraction of motor, low cost at higher volume

Increase in turning radius; cannot spin in place

Line follower sensors must be located further forward, slightly added cost

Overall the cost is estimated to be lower with a single motor design.

Sensors

The base model includes infrared sensors in the form of very low cost IR LED and phototransistor pairs. These devices excel at close range obstacle detection (within ~10cm) or line-follower applications and provide a basis for lessons in physics and electronics. For example, the effect of natural sunlight can be explored giving rise to problem solving opportunities. Students can find ways to adapt the robot to different ambient lighting.

The base model includes a line sensor board. Taking a cue from the design of the Microrobot Cruiser, this board is (semi) modular and could be swapped for an obstacle detection board (yet to be designed) with some soldering (or the design could be altered with a small cost impact to permit swapping without additional solder work)

Motor Driver

The motor driver circuit design was inspired by that of the Pololu Orangutan LV-168 which featured a low voltage motor driver, capable of running from as few as three 1.5V AA cells.

Motor driver section of the main board schematic

This design featured two Fairchild FDS9934C dual complimentary MOSFET arrays arranged as an H-Bridge. These ICs, in 8-SOIC packages, were used in the prototype design. The preferred prototype ICs were Diodes, Inc., DMC2020-USD but were swapped after a mistake that may have damaged them.

Unlike the Pololu circuit, PTC resettable fuses were omitted in the design to keep costs to a bare minimum, relying on software and overrated MOSFETs to avoid failure.

Also unlike the Pololu circuit, this design provides MCU access to all four MOSFET gates. The MCU can precisely control MOSFET on and off timing, to eliminate shoot through.

The MCU can also command all possible operational modes: brake, coast, forward, and reverse.

Pull up and pull down resistors are in place to ensure default-off operation of the H-Bridge.

The mass produced version is intended to use the Vishay Si1563 ICs. These come in a SOT-363 package. Time did not permit testing these chips, but they appear to meet the requirements well, and cost less than the Fairchild and Diodes ICs.

Main Board

The main board also serves as the robot's chassis, with cost reduction in mind. It features all through-hole components making it easier for beginning hobbyists, students, and teachers to assemble the robots.

The design is single-sided and can be etched at home as proven by the prototype board.

The design incorporates headers that permit shields to be stacked, much like the Arduino board. However, the form factor is smaller (boards are cheaper to produce), and aligned to 0.1" spacing. The pins break out all the digital and analog microcontroller pins as well as supply pins and the reset pin.

Main board, Eagle rendering

Main board, top, SketchUp/EagleUp

Main board, bottom
, SketchUp/EagleUp

Line Sensor Board

The line sensor board connects to the main board so the robot can act as a line follower. It features 4 pairs of IR LED and Phototransistor in 3mm form factor. Again, through hole parts are used for easy beginner soldering. The line sensor board is attached to the main board by soldered pin headers and two sets of optional screw, nut, and standoff hardware.

Line sensor board, Eagle rendering

Line sensor board, top, SketchUp/EagleUp

Line sensor board, bottom, SketchUp/EagleUp

Chassis

As stated, the main board is the chassis of the robot. The main board and motor are affixed together with hot glue. A rubber band, electrical tape, or any number of materials could be used instead.

Additionally, a single bracket mounts the servo to the main board. The prototype version uses a small strip of brass sheet metal, affixed with hot glue. The mass produced version would repurpose a mass produced bracket that will reduce cost considerably.

SketchUp rendering of robot without line sensor board

SketcUp rendering of robot with line sensor board

Power Supply

A 3.7V, 1S 500mAH LiPo battery is the source of power for the robot. These batteries are relatively low cost, long-lived, small, light, and relatively common, used in micro RC helicopters.

Any larger 1S LiPo will reliably power the robot as well. Time did not permit analysis of typical current draw to evaluate use of smaller batteries. Field testing of the robot with the 500mAH battery showed reasonable battery life and reliable operation.The batteries can be charged using a Sparkfun USB charger ($9.95) using a 2-pin header adapter or connection adapter. The production version could use:

the Sparkfun charger,

a purpose-built shield for charging,

a purpose-built shield for charging and programming,

a custom-designed charger board,

Expected lifetime of these type of batteries is difficult to ascertain. Many online forum posts indicate 100-200 cycles.

To maximize flexibility, the robot is designed to run from 3, readily available, 1.5V alkaline or NiMH cells such as AAA. Any set of three 1.5V cells with enough current capacity could run the robot with no other changes required. The robot was tested at various voltages and found to operate well from approximately 2.2V and up, well within the range of 3 cells.

Two-cell operation is possible with caveats. The servo stops operating properly at around 2V and the CPU requires a lower frequency crystal below 2.4V (2-cell would require 5MHz), in turn requiring IDE configuration. The robot prototype was tested with a 4MHz resonator and the Arduino IDE was successfully configured to support 4MHz operation. MiniBloq does not yet support 4MHz, ATmega328P boards.

Educational Applications

This robot design provides a number of educational applications. The robot offers the flexibility to be used as a simple line follower using a line follower board, or a micro mouse, using a object detection board. It can be further expanded with shields to offer myriad additional capabilities.

A list of some of the potential learning topics follows; these topics would have to be tailored to the level of education: primary, secondary, college.

Basic Electronics: Circuit Diagrams, Components

Batteries

Resistors

Capacitors

LEDs

Soldering (optional)

Demo: blink LED

Physics: Light, Forces

Motors and gears

Torque: Force and distance

Gear reduction, speed reduction, torque multiplication

Demo: run motor out of gearbox, inside gearbox

Electromagnetic spectrum, visible light, Infrared light

IR LED and Phototransistors

Demo: blink LED when reflected IR detected

Turning geometry

Vehicle axle differentials

Center of gravity and balance

Servo turning system design

Computer Science: Programming C or MiniBloq

Arduino/MiniBloq introduction, blink LED

Arduino/MiniBloq: control servo, motors

Arduino/MiniBloq: read phototransistor voltages

Arduino/MiniBloq: create line follower

Problem Solving, Logic

Breaking down problems

Computer algorithms (line following, etc.)

Troubleshooting robot misbehavior

Bill of Materials (Prototype/Single)

The prototype Bill of Materials is found on the following Google Docs spreadsheet, under the Prototype tab.

Total cost of the prototype robot is estimated at just over $28; and around $55 with accessories (one each per classroom).

Method of Estimation

Some components were drawn from my parts stash. Lacking records of their original price or source, current prices from one of the parts distributors was used. The ATmega328P, 0.1uF capacitors, LED, battery, and brass bracket were estimated in this way. Only part of the brass strip was used so only a partial price of the full strip was used yet.

For some components, the origin is known but the original price paid isn't, and so current prices from the known origin are used. This applies to pin headers.

The 1/8W resistors came from my parts stash and these were originally obtained in a $10, 500-piece value pack from Radio Shack, so the cost is estimated at $0.02 which is comparable to online prices. Likewise the ceramic resonator came as part of a pack of 5 so the total cost was divided by 5.

Several parts were purchased specifically for the project. The actual costs were recorded for the servo, motor, MOSFET motor drivers, blank PCB, the total cost of a toy car and a toy miniature skateboard from which parts were salvaged, and the IR LEDs and phototransistors. Approximately 1/4 (probably less) of the blank PCB was used to fabricate the prototype board, and so the original cost was divided by 4.

Several parts in my junk box are salvaged from consumer electronics given to me. I've harvested capacitors and tactile pushbuttons in droves. The 100uF capacitor, reset button, and battery connector/adapter fall into this category.

Shipping prices are not included in parts prices unless otherwise indicated.

Bill of Materials (Mass Produced, Cost Scaling)

The mass produced robot kit parts are estimated to cost $12.73 per unit for a 1000 unit run. Parts shipping is not included in the price estimate unless otherwise indicated.

Finding parts in quantities supporting 100 unit builds proved difficult and so cost scaling analysis was performed only for 1000 units.

Consumables

As mentioned above, batteries are the consumable component for the robot. Low cost (under $3) 3.7V, 1S 500mAH LiPo batteries were selected. The lifetime of these batteries is difficult to determine but most online posts suggest around 150 cycles.
If the robot is fully cycled once a day, every day, the battery would need replacement approximately every 22 weeks.

The operating cost is approximately $0.02 per cycle or $0.14 per week if cycled once every single day.

Required Accessories

In addition to the parts to build the robot proper, some accessories are required. These can be found on the BOM spreadsheet under the Accessories tab.

Tools and Equipment

The following tools and equipment are required to assemble the robot. Prices based on cursory online searches for these items. The items, prices, and further notes are provided in the BOM spreadsheet under the Tools, Equipment tab.

Software

Experiments Conducted

Some experiments were deliberate in their execution and purpose. Others, rather accidental. But helpful nonetheless.

Rear Steer Weight Distribution

Purpose: verify that a single motor will work given the steering design

Description: measure the change in weight on each drive axle when the rear wheels are turned left and right

Expectation: the inboard drive wheel will have less weight than the outer during turns

Equipment: American Weigh Scales 100g hanging scale

Result: weight transfer is inconsistent from left to right, but I did not carefully control the steering angle, nor did I make multiple measurements. The data follows and demonstrates a significant weight difference between the two drive wheels. Testing the robot on a line following course, the inner wheels never failed to slip around turns.

Result: stalling the motor for several seconds caused no excess heat or other issues.

Line following

Purpose: verify robot operation

Description: write my first line following code, see if robot can follow a line of electrical tape on foam core.

Expectation: more or less capable of following a line

Equipment: programmer, robot, dollar store foam core, electrical tape

Result: Required heat shrink tubing on phototransistors and LEDs. Robot follows line with moderate reliability, sometimes missing turns. This is fixable with a bit more testing and calculation. The prototype design is non-optimal for this particular robot, requiring some redesign. Only two LED/Phototransitor pairs were used. Four might work better. These sensors are not located far enough in front of the robot, only about 60mm in front of the axles, approximately the same distance between rear steer pivot and axles. Some calculations can be done to estimate the optimal location. The design submitted is a guess at an improved distance. Faster servo response can be programmed in, but will result in more instability on straight lines.

Shoot through Current

Purpose: accidentally test what happens if shoot through current occurs for a few seconds

Description: a mistake on the schematic caused shoot through on all MOSFET pairs in the motor drivers

Equipment: eyes and nose to observe smoke, fingers to detect heat, and dumb brain to goof up the schematic.

Result: A tremendous amount of heat was generated very quickly. It's safe to say that avoiding shoot through is a good idea, and providing a library for motor control that avoids it is the cheapest solution. It's not clear whether the particular motor ICs were destroyed or not; they were rated for more amps than the connected battery could theoretically deliver so it is possible they survived but both were replaced with different ICs.

Friday, September 7, 2012

Here's an example of curve fitting a function to calibrate a Sharp infrared ranger for distance measurement using OpenOffice Calc.

I tried to do this with Gnuplot but found that using Excel or Calc is infinitely easier.

The voltage measurement versus distance for these sensors is non-linear. Here's a plot of the values I experimentally collected from a GP2Y0A710K0F 100-550cm sensor.

This line can be fit using a power function of the form:

Simply edit the plot, right click on one of the data points and select Insert Trend Line...

Then select Power under the Regression Type section then click the Show Equation checkbox.

You now get a trendline with the equation on your plot.

The equation works out to be:

In c code you'd do the following (this assumes that your MCU or compiler supports floating point, and that using it won't use up all your memory and processing cycles):

To avoid the cpu- and memory-intensive math on an integer-only MCU, a faster option is to use a lookup table and interpolate between adjacent entries. This could be done with floating point or integer math. Store the range values multiplied by 100 for greater precision in the interpolation.

Also of note, the IR rangers have a usable range. If an object is too far away, the range will be unreliable. Modify the adc function so that it returns a large value like 999 if the adc value is below the usable limit (around 300 in this case).

If the object is too close, the ranger reports distance incorrectly. The best solution is to place the ranger so that objects cannot be closer than the minimum distance.

I also like to set a lower range in software. In our case, an adc value of 500 or higher should report back the minimum distance of 100cm.

One final note, every sensor is a little different, so it might be a good idea to calibrate each one if precision is an issue.