Monday, July 12, 2010

tinybot: unauthorized biography


The sole purpose of this page is to document the progress on tinybot mk III, one of my countlessconfuse my cats. The page may be of interest to other people for three reasons: attempts to build a robot that would sufficiently
  • The mechanical engineering aspects of this project are ridiculously low-level: even every single gear is custom designed, machined, and manually cast in my home workshop.
  • The electronics are cheap, easy, power-efficient, and extensible. The total cost of the robot is $30 if you count just the essential parts, and $90 including a pretty LCD and two fancy distance sensors. Most of the comparably featured projects on the web are several times more expensive.
  • I am trying to make it look pretty, so it's purple.
In other words, enjoy your stay.

1. Electronic components

The complete inventory is: The resulting robot is a GCC-supported, libc-enabled compilation target running at up to 20 MHz, with 128 kB of program memory and 16 + 4 kB RAM. It is equipped with stereoscopic distance vision, traction control, has good dead reckoning capabilities, and features very low power consumption, thanks to motors running near their maximum efficiency (approx. 35 mA per motor).

2. Other components

Molds for all plastic parts were initially machined on Roland Modela MDX-540 in Huntsman RenShape 460 medium density modeling board. Negative molds and tires were then cast in ShinEtsu KE-1310ST platinum cure silicone, and all the remaining final parts - including around 15 spur gears - were made out of Innovative Polymers IE-3075 polyurethane resin, manually pigmented with quinacridone pink, titanium white, solvent blue 67, and solvent yellow 146.
The project also called for four VXB ball bearings, 16 steel dowel pins (M1, M2, M3), 30 machine screws (M1.5, M2), and one square steel rod.
The whole machininng and casting process is explained in painstaking detail in my guerrilla CNC manufacturing guide, and also illustrated on this Flickr page (an earlier project of mine).

2. Mechanical design

External dimensions of the robot are 15 x 12 cm; ground clearance is 2.7 cm. With a battery installed, it tips the scales at 275 grams.
Rear wheels of the robot are joined together with a steel rod, mounted in two low-profile ball bearings (8 x 12 x 3.5 mm), and connected to a 130:1 gearbox that delivers about 40 RPM and 3,000 g/cm of torque, allowing the robot to effortlessly mount most obstacles. Closeup of the rear assembly:


Front wheels have integral ball bearings and rotate freely; a reflective optointerrupter, TLP841, is used to provide traction feedback for the motor, detecting a small white target on the inside of the wheel.
A second motor and a 490:1 gearbox can be found in the front; instead of the usual (and crappy) differential drive system, an oversized gear-based transmission is used to synchronize the turning of front wheels, each of them individually mounted on 3 mm dowel pins. Turn range is +/- 30°. A small slot optointerrupter, OPB609, is used to sense 0°, +/- 15°, and +/- 30° positions marked on the gears:


Gear tooth size is about 0.5 mm, pressure angle is about 18° for initial stages, and 25° for the final stage in the steering assembly. Gearwheel thickness is 1 and 1.75 mm, respectively (see the aforementioned CNC machining guide for a good primer on gear geometry).
Rendered image of the entire body, with the main PCB and the battery installed:


Positive molds machined in RenShape 460 based on CAD models:


Early stages of assembly:


Several hours of work later - all sensors installed, electronics on a breadboard, distance sensor readings displayed:


Completed, turned on, and crying "put me down":


Other images of interest: initial prototype two months ago; and the immediate predecessor to this version (note a 
different orientation of the motors). If you count these iterations, the project took about 25 hours of work to get to the current stage.

3. Circuitry

The robot uses a lightweight, two-cell 800 mAh lithium-polymer battery; this choice yields a continuous running time of 8 hours with LCD backlight turned off, or 4-6 hours when the backlight is on (depending on the desired brightness).
The battery has a nominal voltage of 7.4V (the actual range is 5.6 - 8.5V); this needs to be translated to stable 5V for the motors, sensors, and the microcontroller. To do this, I used Murata OKR-T-3-W12-C, a high efficiency 3A switched regulator. The voltage is set with a 270 Ω resistor; the value needs to be set accurately, so a 500 Ω trim pot may be more practical than shopping for a 1% resistor of this exact value.
An extra 10 µF capacitor across terminals is employed to counter motor inrush currents and the crowbarring tendencies of the H-bridge drivers used, so that the risk of resetting the MCU is minimized.
To avoid damaging Li-poly batteries, care must be taken not to discharge them below about 2.8V per cell (5.6V total). To prevent this, I rely on a MAX8212 voltage monitor, coupled with a medium power p-channel MOSFET transistor (STP12PF06 in this case, but any other rated for at least 3A will do). This serves as an input stage for the regulator; the threshold voltage is adjusted with a 250k resistor. This value also needs to be matched accurately, so a 220k resistor and a 50k trim pot may be a simpler choice.
The complete voltage control circuit looks as follows:

The remainder of the circuit consists of ATmega1284P interfaced to several peripherals: 

  • An HD44780-compatible LCD (NHD-0208AZ-FL-YBW) in 8-bit write-only mode (R/W pin pulled low) for displaying status messages and offensive ASCII art. Backlight brightness can be adjusted by adding an extra 500 Ω trim pot on the LED+ pin.
  • Two narrow beam ultrasound distance sensors (MaxSonar-EZ4) used in one-shot mode with pulse width output. The range for these devices is about 15 cm to 6.5 m.
  • Two FAN8082 H-bridge controllers for the motors, with speed control using a trim pot. FAN8082 is being phased out, but Toshiba TA7291P or ROHM BA6956AN are good substitutes.
  • Basic support circuitry for the optointerrupters to limit LED current, and convert phototransistor output to CMOS levels (on the schematic, "MV" stands for traction sensing, "ST" for steering).
  • A single diagnostic LED.
  • An obvious and accessible self-destruct button.
The whole thing looks the following way:
Not shown on the schematic, the AVR ISP connector is also attached to pins 6-11 of the MCU to allow for easy programming.

4. Software

I have just started working on the software part; motor, sensor, and LCD drivers are complete, so is the main event loop. Environmental mapping and a "personality" still in the works.
Click here for a video showing a test program; sensor feedback is used in this demo to execute movements very precisely.

5. Questions? Comments?

You can reach me at lcamtuf@coredump.cx.

Thursday, July 8, 2010

Why Arduino Is a Hit With Hardware Hackers

July 6, 2010  | 3:45 pm 

For electronics hobbyists, the open source chipset BeagleBoard that packs as much punch as a smartphone processor might seem like the key to paradise.

Yet it is the relatively underpowered 8-bit microcontroller Arduino that has captured the attention of DIYers.

Arduino began as a project in Italy in 2005 and since then has turned into an open source hardware movement. There are thousands of Arduino projects today such as electric meters, guitar amplifiers and Arduino-based gadgets that can tell you when your plants need water.

The Arduino community is at least 100,000 users strong.  But it is not alone.

Other open source projects like the BeagleBoard, which is shepherded by Texas Instruments, are trying to win Arduino fans over. 

The Beagleboard is a low-power, single-board computer, whose latest version is based on the same 1-GHz ARM Cortex A8 processor that drives the most sophisticated smartphones today. That gives it far more processing power than the Arduino. Yet the BeagleBoard hasn’t hit the same kind of chord with hardware hackers that the Arduino has.

“The BeagleBoard is not for a novice,” says Phil Torrone, senior editor at Make magazine and creative director at Adafruit, a company that sells DIY electronics and kits. “With an Arduino, you can get an LED light blinking in minutes.”

Fundamentally, BeagleBoard and Arduino are two different systems: The former is a single-board computer, while the Arduino is just an  8-bit microcontroller. The BeagleBoard-xM includes a 1-GHz processor, on-board ethernet, five USB 2.0 ports and 512 MB of memory.

What they do have in common is that both represent possibilities: the potential to use your technical and creative skills to make a concept come alive.

Here are five reasons why the Arduino is more popular than the BeagleBoard: 

Starter Projects
Editing and rewriting is often easier than writing from scratch. It’s the same with electronics. It’s easier to mod an idea than start with a blank slate.

That’s where the BeagleBoard falls short. “It has virtually no example application that you can just copy and hack to learn from,” says Massimo Banzi, one of the co-founders of the Arduino project.

The Arduino has hundreds of projects and ideas that are cooked up and shared by its users. For instance, check out this list of 40 Arduino projects that includes ideas such as a Wiimote-controlled Espresso machine, a biking jacket that flashes a turn signal and a wireless electricity monitor that tweets your power usage.

It’s a chicken-and-egg problem for the BeagleBoard. Unless there are more example codes out there, it is difficult to draw in the audience. And without the audience it is challenging to get enough sample projects into the community. 

Cost and Durability
At $30 a piece, an Arduino is an inexpensive investment for someone who wants to try it out. “It’s the price of a few sandwiches,” says Torrone.

Compare that to the BeagleBoard-xM, which costs $180.

One reason why the Arduino is so cheap is because it is easy to clone. The microcontroller is completely open source so the “components are all commodity,” says Torrone.

With the BeagleBoard, hobbyists don’t have the same amount of freedom. They have to work closely with Texas Instruments or its partners, says Torrone.

Arduino is also very resilient. Drop it, smash it and it still stays alive. Add to that its low-power requirement, and the product becomes a must-have for DIYers. An Arduino can run on a 9V-battery for days.

“The BeagleBoard is fast and powerful but that also means lots of energy is needed, which makes it difficult for simple projects,” says Torrone. 

A Thriving Community
Arduino’s popularity means it’s easy to get started. Companies such as Adafruit, SparkFun and Liquidware not only sell chips, but they also host blogs that suggest ideas on how to use your Arduino while providing extensive project plans to guide you in completing your creations.

Will Chellman, a student who has played with Arduino for years, says he’s now experimenting with the BeagleBoard. But finding documentation and information to work off is not easy, he says.

The lack of well-documented projects done with the BeagleBoard can be intimidating to new users as well, says Banzi.

“There’s lots of of interesting stuff (about the BeagleBoard) but it is very technical,” he wrote in a comment recently on Gadget Lab in response to the launch of BeagleBoard-xM.

Banzi says BeagleBoard documentation is also scattered and fragmented.

“Parts of it have aged and you spend quite a bit of time jumping from wikis to mailing list to track which specific bit of documentation applies to your board, bootloader etc.,” he says. 

Maturity Is the Key
Arduino has had a head start on the BeagleBoard. By October 2008, about 50,000 Arduino boards had already been shipped. That year, the first BeagleBoards started making their way into the hands of hardware enthusiasts.
“The BeagleBoard is just two years old. Since it hasn’t been around long enough, there’s not enough people building apps based on it,” says Chellman.

That’s not to say that BeagleBoard isn’t catching up. Earlier this month, we showed five projects ranging from a videowall to the iPad of ham radios that use the BeagleBoard. There’s also a build-your-own tablet kit that is based off the BeagleBoard.

If DIYers take a shine to it, expect to see more ideas like these. 

Simple Is Attractive
With its single-board computer configuration, 1-GHz processing power and the choice of accessories, the BeagleBoard is a creative engineer’s dream come true.

But the same reasons make it intimidating to those who want to geek out on a DIY project but don’t have the technical know-how.

Arduino users point out that it is simple to connect external sensors to the board, and the example codes out there make it easy to get started quickly.

Arduino is a simple system designed for creative people with little or “no prior knowledge of electronics,” says Banzi. “It’s cheap and open source with lots of documentation written in a not too technical language. Above all, it has a very welcoming attitude towards beginners and tries not to scare them too much.”

Photo: pt/Flickr
See Also:

Wednesday, July 7, 2010

Realtime Tracking With a Pan-Tilt Camera

Friday, July 2, 2010





Introduction

The human eye is amazingly adept at tracking moving objects. The process is so natural to humans that it happens without any conscious effort. While this remarkable ability depends in part on the human brain's immense processing power, the fast response of the extraocular muscles and the eyeball's light weight are also vital. Even a small point and shoot camera mounted on a servo is typically too heavy and slow to move with the agility of the human eye. How, then, can we give a computer the ability to track movement quickly and responsively?

Thanks to recent progress in camera miniaturization, small, easily manipulable cameras are now readily available. In this project, we use a first person view (FPV) camera intended for use on model airplanes. The camera is mounted on servo motors which can aim the camera with two degrees of freedom. The entire assembly weighs only 32 grams, only slightly more than a typical human eyeball. Coupled with a GPU-based tracking algorithm, the FPV camera allows the computer to robustly track a wide array of patterns and objects with excellent speed and stability.

The above video clip shows a short demonstration. We built a simple camera tracking system using the FPV camera. The video demonstrates how the tracking camera snaps to a person moving in front of it. We show both the view captured by the tracking camera (the smaller video), and the view from a different camera that shows the movement of the tracking camera (the larger video).

How to build it

Parts List (links to parts included)

Note: the software (downloadable below) requires a PC with CUDA-capable graphics hardware (GPU).

The Camera
We used a 420-line pan-tilt camera manufactured by Fat Shark. The camera is mounted on two servo motors, which allow for about 170° of rotation on the yaw axis and 90° of rotation on the pitch axis. The camera produces composite video in PAL format. An NTSC version of the camera is available as well, but it was out of stock when we ordered our parts.

Power
Because the video transmitter requires the 12 volts, we power the camera with a 12V rechargeable Lithium battery. We use a voltage regulator to provide 5 volts for the camera and the servos. We added capacitors before and after the regulator to eliminate any voltage fluctuations. Both the video and servo cables from the camera connect to headers on the voltage regulator circuit, which provide the regulated 5V power supply. The servo control signals and the video output are passed through to a second set of headers, which connect to the frame grabber and the Arduino, respectively. The video output header additionally provides a 12V power supply for the video transmitter.


A picture and the schematic of the voltage regulator circuit.


Digitizing the Video

We used a USB frame-grabber manufactured by StarTech to read the video into the host PC. The frame grabber supports both NTSC and PAL composite video, so the NTSC camera could be used without any hardware changes. We used a video cable sold by Digital Products Company to connect the frame grabber to the video output header on the voltage regulator circuit. The cable also has a power jack, which provides 12 volts to the video transmitter.



The camera is connected to the frame grabber (L), and the Arduino is connected to the servos (R).

The frame-grabber provides 640 x 480 interlaced video at 25 FPS. For efficiency, we downsample the video to half resolution for tracking. Our downsampling filter discards the even lines to eliminate errors due to combing artifacts. We display the video at full resolution, after eliminating combing artifacts with a standard deinterlacing filter.


Controlling the Servos

We used an Arduino Diecimila to generate the control signal for the servos. The Arduino receives the desired pulse widths for the servos over its serial port. Each pulse width is encoded as a 16-bit integer, with 1 bit reserved to select one of the two servos. We use the servo library included with the Arduino software to generate the PWM signals.

Wireless Operation

We can eliminate the wired connections to the host PC with a wireless transmitter and receiver for the video, and a wireless RF link for the servos.

The RF Link

The wireless RF link transmits the servo angles digitally, with a range of up to 500 feet. Both the transmitter and receiver connect to Arduinos running the Virtual Wire library. The transmitter Arduino (connected to the host PC) broadcasts each 2-byte angle, followed by a byte of all zeros to keep the transmitter and receiver in sync. The receiver Arduino updates the servo angles when an angle is transmitted correctly (that is, all 3 bytes are received). Because Virtual Wire is incompatible with the Arduino's servo library, we use the Software Servo library to control the servos.

Wireless Video

The wireless video transmitter broadcasts NTSC or PAL video with a range of up to 500 meters. The transmitter plugs directly into the RCA jack from the camera. The 12 volt line on the video output header powers the transmitter. The RCA jack on the receiver plugs directly into the frame grabber. The receiver can be powered by a generic 12 volt power adapter.

Software

The software for the project, including source code and build files, is available via the links below.   The tracking software is based upon an algorithm developed jointly by the UMass Computer Vision and UMass Computer Graphics Labs. It is written for an NVidia GPU using the CUDA specification. Running on the GPU is necessary to get the real time rates we show in the video. Our implementation has only been tested in Windows 7, but we do not foresee major difficulties in porting it to other versions of Windows. The software can also be built for Linux (Ubuntu), but we did not have a frame grabber that worked under Linux, so we have not built a complete system under Linux. Still, we have tested each of the components of our system under Linux and they all work properly. More details about the software and how to build it are given in the attached README files.

Download Software:
Linux

Behind the scenes with the next-gen $100 bill

July 1, 2010 10:00 AM PDT
Daniel Terdiman

CNET reporter Daniel Terdiman got behind-the-scenes at the Bureau of Engraving and Printing's Washington, D.C., production line of the brand-new, next-generation $100 bill.(Credit: Daniel Terdiman/CNET) WASHINGTON--

I'm staring at $38.4 million in cash, and it's hard not to drool.
I'm here at the U.S. Bureau of Engraving and Printing, which, as is probably best described by its official Web site, is America's "money factory."
More specifically, this is where the U.S. Treasury Department prints its paper money, and as part of Road Trip 2010, I've come here to see how the bureau makes the brand-new, next-generation $100 bill. The bureau's mission is emblazoned in red, white, and blue neon on a wall near where I came in: "We make money the old fashioned way, we PRINT it."
But jumping ahead of that process a little bit, I'll say it again: At the end of my behind-the-scenes tour, I've come face to face with two giant piles, or "skids" of perfect, clean, crisp $100s, all packaged up and ready to be shipped out, exactly 384,000 of them, and I can only shake my head and think, "what if."
That's getting ahead of myself though. 

Offset
Although the bureau prints each of America's paper denominations, my tour is of the production process for the new $100, partly because it's the most advanced bill the country has ever printed, and mainly because the bureau is still in publicity mode for it. The new bill was unveiled officially on April 21.
My tour began in what is called "Offset." This, explained Offset supervisor James Sutherland, is where background color is printed on what until then had been blank sheets of the special paper the bureau uses for all our currency. That paper comes delivered with embedded purple anti-counterfeiting strips, and as well as the little colored security fibers that set our money apart, but nothing else.


Once Offset has printed the first rounds of background colors, the future $100 bills--which start as sheets of 32 bills--four across, eight down--are stacked up and set aside to dry for 72 hours. It seems a little weird to me that they dry in these large stacks, but that's how it works. After every stage in the printing process, the sheets must dry for 72 hours. And then it's on to the next stage.
We moved on to what is known as "intaglio," the section where the many elements of the new $100--the lettering, the back, the face, the seals, and more--are added.
This is also where many of the additional security--read: anti-counterfeiting--features are added. Here, that means specialty inks and color-shifting inks. I was asked not to say more, as a security precaution.
First up is the printing of the back of the bill. This is pretty straightforward, and when I come in, I talk to assistant supervisor Bob Smith, who explains what's going on. One interesting part of the process is the printing and examination of the so-called "smear sheet," which looks like a sheet of 32 $100 backs, dipped entirely in green ink. A smear sheet is printed once every 8,000 sheets or so.

A smear sheet, which is used so that printers can examine a run in order to see if anything is missing from the print.
(Credit: Daniel Terdiman/CNET)
 
The smear sheet, said Smith, is used by the printers as a way to see if everything in a run has been printed where it's supposed to be. On every sheet, the note's many authentication patterns are supposed to be in precise places, and by looking at the smear sheet, he added, the printers are able to ensure that that is the case.
But there's also automatic examination going on, Smith said. Built into the printing presses are inspection sensors that scan each sheet as it goes through, looking for defects, in a bid to "reduce spoilage." Those that the machine rejects are automatically separated "from the good work." All told, he added, about 85 percent to 90 percent of the sheets that come off the printer are deemed defect-free.
If, however, a defect is found--perhaps it's missing some print, is over-inked, under-inked, too lightly printed, or has smudges--the sheet isn't destroyed. Instead, if enough of it is salvageable, the good bills will be set aside and used as what are known as "star sheets." But more on that later.
Smith said that the bureau's printing presses have a general capacity of about 10,000 sheets an hour, but that for the new $100 bill, they're producing about 20 percent less, or about 8,000 sheets an hour. And that's because they're still in the earliest stages of the bill's production. Eventually, Smith suggested, the number will rise to normal production levels. 

Faces
We've now moved on to faces, and here, too, printers will produce smear sheets, again to determine if the security features are properly positioned on each new print load.
A print load is five piles of 888 sheets, for a total of 4,440 sheets or $14.2 million.
Essentially, though, the process here is the same as in the back-printing section: print the new elements, and then let the loads dry for 72 hours.
Then it's on to the examination area. Here, explained assistant acting foreman Ron Perkins, loads of 15,000 sheets arrive and must be inspected to ensure they are defect-free.
This, of course, is not manual work. Instead, the sheets are fed into an examination machine, which scans each 32-bill sheet, one at a time looking for any inconsistency--again, under-inking, over-inking, smudges, and so on. If defects are found, the offending sheets are separated and don't get sent on any further in the production process.
The sheets are fed into the machine, where a stream of air lifts them individually, and a vacuum picks them up so they can be guided along a series of bearings. A camera takes a picture of the front of the sheets, which then hit "the knives," where the tops and bottoms get about half an inch of excess paper trimmed off. Then the sheets execute a nifty maneuver where they are flipped over in a 90-degree turn, without creasing them in any way. Then a second camera takes a picture of the back of the sheets before sending them to a second set of knives, where the sides are trimmed. Here, as well, the sheets are cut in half, down the middle, splitting sheets that were four bills by eight into two sheets of two bills by eight.
And then one more camera, which takes a final picture that is used to ensure that the front side of the bills matches the back, and that they are not off-center to each other.
After passing under the third camera, the sheets are sent to a separation point. The "good work" go up a ramp, and the defects go straight through, ending up in a bin appropriately marked "mutts."
The mutts are not saved. Rather, they are pulled aside, accounted for, and then destroyed.
At this point, Perkins explained, the printing process is basically done, and the sheets of 16 bills are sent to their final area--known as Cope-pack. 

Cope-pack
All around the printing sections of the bureau are signs that read, "2 person rule in effect at all times," meaning nobody can be in the area alone. Clearly, they take security very seriously here.
In Cope-pack--which stands for Currency over Printing Equipment and Packaging--the last step in the bills' production is to add the Treasury Department and Federal Reserve seals and the serial numbers.
The hundreds come in, still in 16-bill sheets, and go through one final press, where those seals and the serial numbers are added. Then, they emerge, in stacks of 100 sheets of "16 subject."
At this point, there's still one more set of knives to come. The sheets slide along a belt first that does a set of horizontal cuts, dividing the two bill by eight bill sheets into single two-bill sheets, and then a vertical cut splits them into piles of 100 individual $100 notes (see video above).


This brick contains 4,000 $100 bills, or $400,000.
(Credit: Daniel Terdiman/CNET)
 
Those come off the machine, and end up in the hands of an examiner, who manually flips through them, $10,000 at a time, looking for any defects that have escaped the automatic systems. These are the crispest, cleanest bills you can imagine, perfectly aligned, and a pleasure to look at.
If even a single defect is discovered here, the entire stack of a hundred notes is destroyed, and is replaced by pre-printed stacks of a hundred star notes, using the notes that were pulled aside much earlier in the process.
Then, 10 packs of the hundred notes, each with a paper band around it denoting that it amounts to $10,000, are put together in what's known as a bundle, or $100,000. Four of these are combined, making a brick, which equals $400,000.
And then 24 bricks are put together in the "skids." They're put on palettes and readied for shipping.
And here, at the end, is where I find myself face-to-face with 384 bricks. Or $38.4 million.
But no, I didn't get any samples.
For the next few weeks, Geek Gestalt will be on Road Trip 2010. After driving more than 18,000 miles in the Rocky Mountains, the Pacific Northwest, the Southwest and the Southeast over the last four years, I'll be looking for the best in technology, science, military, nature, aviation and more throughout the American northeast. If you have a suggestion for someplace to visit, drop me a line. In the meantime, you can follow my progress on Twitter @GreeterDan and @RoadTrip and find the project on Facebook. And you can also test your knowledge of the U.S. and try to win a prize in the Road Trip Picture of the Day challenge.
Daniel Terdiman is a staff writer at CNET News covering games, Net culture, and everything in between.