Wednesday, December 3, 2014

Bubble Display, Propeller

HP 4-Digit Bubble Display (7-Segment LED)
I used a Sparkfun coupon to buy a couple of vintage, 4-digit, 7-segment, HP LED bubble displays. The kind you'd find in really old calculators. Their guide is most helpful.

I used one of my spare eeZee Propellers to play around with the display and create driver code. I haven't played in Spin in awhile, so it was a good refresher. Here's what I did...

Tuesday, November 25, 2014

Holiday Deals for Nerds Like Us

Lots of sales going on again this season at our favorite geek retailers:

Tindie Cyber Monday : Big sales from many vendors this Cyber Monday.

  • 15% any one item in the Bot Thoughts Store, coupon code DA54D6C, good through Friday
  • $2 off Digispark - Lowest Price Ever! Digispark! The micro-sized, Arduino enabled, usb development board - cheap enough to leave in any project! Coupon 9D4B1F3
  • 30% off PiScreen is a 3.5" TFT (480x320) with touchscreen control for the Raspberry Pi. Never need a monitor again! Coupon 02971ED
  • 20% off much of the Arachnid Labs' Store - including the successful Kickstarter, Re:Load Pro. Coupon 21A2FD3
  • 15% off all products in the Geppetto Electronics store! Coupon 92C9FC5
  • And lots more on sale; full list here
Pololu Black Friday 2014 : Starts Wednesday with doorbuster deals.

Pololu Robotics and Electronics is having its biggest Black Friday/Cyber Monday sale yet, offering huge discounts on over 600 products, along with 11% to 15% off orders over $100!  Save big on robots, programmable controllers (including A-Stars, Arduinos, Raspberry Pis, and mbeds), sensors, motor drivers, power supplies, LEDs, actuators, wheels, breadboards, wires, and more.  The first doorbuster deals go live Wednesday, November 26, and the sale runs through Cyber Monday (December 1).  For details, visit http://www.pololu.com/blackfriday2014

E-Z Robot Black Friday
 : 20% off all robot kits + free shipping!


Science Fiction inspired robots that don't require programming (unless you want too)! In 1977, the world invited the Apple II Personal Computer into the home. 2014, ezrobot has launched Revolution, a robot for everyone! Whether you choose the Revolution clip'n'play robots or developer kit, ezrobot is making robotics, well... easy!

HobbyPartz Black Friday Sale: 15% off select items including Gens Ace batteries.

Coupon code BFSALE15, ends Nov 30, 11:59PM. Sale on LiPo batteries, RC gear, video cams, and more.

Schmartboard Black Friday : 25% off the entire store! Limited time.

"Look for an e-mail on Friday. The special will be very limited in time, very unlimited in its breadth, and significance. Schmartboard thanks you for a good year."

RoboSavvy Black Friday : 50 products with savings up to 67%

FriedCircuits Black Friday : 25% off USB Tester 2.0 and Sharp Distance Sensors. All other products are 15% OFF. Sale beings Thursday 11/27 and ends Monday 12/1, midnight PST.

Adafruit Black Friday : 15% off plus free stuff. 
Welcome to the Black Friday sale – 15% off plus all the free items & shipping as you shop! Use code: BLACKFRIDAY on check out. We thought about doing flash sales or complicated codes but that’s a lot of frustrating hoop jumping for everyone, so we came up with what we think is an amazing deal that is straight forward, no stress and valuable – a 15% off discount anything in stock and lots of great free things automatically depending on how much you order.

We are currently offering a FREE Adafruit Perma-Proto Half-sized Breadboard PCB for orders over $100, a FREE Trinket 5V for orders over $150, FREE UPS ground (Continental USA) for orders $200 or more, a FREE Pro Trinket 5V for orders over $250

Sparkfun Cyber Monday 2014 : 20% off Actobotics, hourly flash sales 7am - 7pm

On Cyber Monday (12/1), everything in our Actobotics category is 20% off. That means everything from Actobotics Kits to DC Motors is marked down. If you’re looking to start exploring the world of robotics, or stock up for your next build, this is a killer chance to do so. Next on 12/1/2014, we are offering hourly flash sales from 7 a.m. to 7 p.m. Mountain Standard Time, with 30-50% off on some of our most popular products. These items have been hand-selected by our employees and are some of our favorite designs! Details: Sparkfun Cyber Monday 2014

2014 Parallax Holiday Sale : Their holiday sale includes microcontrollers, robots, and more.

BASIC Stamp Sale started Nov 10. Free USPS Priority shipping and 10% off the entire store. Robot kit sale (ELEV-8 Quadcopter, Arlo Robotic Platform System), Best Sellers Sale, and other mystery deals! Also, a free WS2812B module with every order.

GHI Electronics: Black Friday through Cyber Monday sale on FEZ MCU boards and more!

The sale will start this Friday, November 28th and will end Monday, December 1st (UTC-05:00) Eastern Time (US & Canada). Lots of great boards on sale including discontinued models.

Trossen Robotics Black Friday : Interbotx & RobotGeek 20% Off, 10% off everything else in the store!

Black Friday / Cyber Monday is here at Trossen Robotics! Interbotix & RobotGeek brand kits and parts are 20% off, everything else in the store is 10% off! Use coupon code "Friday14" to redeem your discount at checkout! Offer good from 12/28/2014 - 12/1/2014 *Offer excludes HR-OS1 and HR-OS5 Humanoid Platforms.

HobbyKing Cyber Week Sale: LiPos, servos, motors, planes, and more.

Running all week, we will be dropping prices and offering amazing deals on literally hundreds of the most popular items in the HobbyKing catalog. Models, lipos, tools, chargers, we'll be offering amazing discounts from all product categories, so you're almost guaranteed to pick up an amazing deal. If you don't see something you are interested, check back in an hour because our offers will be added and changed constantly. This isn't a week where you want to be away from an internet connection.

Electronics Goldmine : has a few door busters and some discounts worth looking at.

Drone Life : has a list of drone sales, too

Wednesday, November 5, 2014

Holiday Sales: Parallax

It's that time of year again. Our favorite hobby electronics stores are doing their annual sales.

2014 Parallax Holiday Sale Schedule
Our season of promotions has begun! Here is a sneak peek of upcoming sales on www.parallax.com. These deals will be available for online orders only.
  • BASIC Stamp Module Sale - Begins 11/10/14
  • Free USPS Priority Shipping and 10% Off Entire Store
  • Robot Kit Sale (including ELEV-8 Quadcopter, and Arlo Robotic Platform System)
  • Best Sellers Sale
  • and other mystery deals!
Also, they're offering a free WS2812B module with every order.

Tuesday, October 14, 2014

pcDuino V1: getting started

pcDuino is a single board computer based on the Allwinner A10 ARM Cortex A8 processor. It's powerful, running 1GHz and featuring 1G of memory.

Installing an OS on the pcDuino is  different than with a Raspberry Pi. It uses onboard flash for storage, 2G for the V1, and it uses a kernel flashed onto the board, as well.

So, here's how to get started with a pcDuino V1, using a Linux workstation...

Tuesday, October 7, 2014

ATtiny and WS2812B

Did you know it's easy to drive a WS2812B smart RGB LED with an ATtiny?

eeZee RGB WS2812B breakout board on Tindie
I'm not talking about Adafruit's well-known NeoPixel library.

There's a much lighter-weight library for driving these LEDs that's perfect on memory- and flash-limited ATtiny AVRs -- or really any AVR for that matter.

All you need is the light_ws2812 library. I'm using it with the ATtiny25 on my eeZee RGB test jig.

Adafruit gets all the attention, but this little library is small, easy to use, and works great; it deserves more press. Pass it on, k?

Monday, October 6, 2014

NoCo Mini Maker Faire

Failures, faces and fun. This past weekend I attended the NoCo Mini Maker Faire as a maker.

We had a lot of curious, inquisitive people of all ages at the SHARC / Bot Thoughts booth, where they found Ted's Shapeoko, my Hero Jr which failed miserably (fodder for a future post), Sawyer's robots, and my newest robot (also blog fodder):



Tuesday, September 30, 2014

Making Test Jigs

Here's some cheap test jigs I use to test boards I sell on Tindie. Selling a quality product is of personal importance to me. With these test jigs, I've uncovered several board fabrication problems, more than several assembly problems (hey I'm not perfect), and identified ways to improve yield rate.

eeZee Power Jig

The goal for this jig is to measure 3.3V regulator output from the eeZee Power board. If it's 3.3V within the specified tolerance, that proves the regulator is populated correct, the USB connector is also populated, and all the corresponding traces are ok.

To build the jig, I installed pogo pins and test leads to an unpopulated eeZeePower board (to save time and money). When engaged with an eeZee Power, it enables the 3.3V regulator and connects the VCC and GND pins to the test leads. 

I plug a Mini USB into the DUT (Device Under Test), connect my DMM (digital multimeter) to the test wires and measure output voltage. 

Stacking another eeZeePower board would stabilize the pogo pins better. It's good enough as is.

eeZeePower test jig

AVR ISP Jig

This isn't a test jig, but one I use to program Turntable Strobes, Lost Model Alarms, PIPduinos, and other AVR-based boards. You can buy a fancier version of this on Tindie from BBTech.

AVRISP jig for programming AVRs
In case the picture isn't clear, one end has the familiar 6-pin AVRISP header, the other, pogo pins.

eeZee RGB Jig

I test every one of the eeZeeRGB WS2812B breakouts I sell to make sure the RGB modules are installed correctly and to ensure they work out of the box. I had been testing these with a breadboard Arduino but the pogo pins are unstable in a breadboard so I designed a test jig using an ATtiny85. I've discovered that some of these modules don't have reverse protection as advertised.

eeZeeRGB WS2812B breakout board
OSHPark builds boards in sets of 3 so I designed a single board that can stack 2-high (or 3-high if necessary) to stabilize the pogo pins. The Tiny and USB connector (for power) only has to be populated on one of those three boards. The other two boards can simply stabilize the pins. They're mounted together with screws, nuts and standoffs.



Test Jig, side 1

Test Jig, side 2

eeZee Prop Jig

The eeZee Propeller breakout (eeZeeProp) is the most complicated board I sell with a 44-pin QFP MCU, onboard EEPROM, crystals, a half-dozen resistors and capacitors, dual programming headers. I test every output pin on the eeZeeProp as well as programming functionality before it goes up for sale with this quick and dirty jig.

eeZeeProp test jig
The test jig above has two parts. The dual row of pogo pins, resistors, and LEDs is for testing pins. In the upper right is an FTDI programmer connector and pogo pins to engage the eeZeeProp FTDI pin pads. 

I program each board with a SPIN program that sequentially turns on each of the pins 0-28. The ability to program the chip in the first place tests P29-32 and the EEPROM.

Next, I lay the Propellers down onto the pogo pin bed and ensure each of the LEDs lights up sequentially. I can then investigate any suspect pins.

You probably noticed that the pins aren't well-aligned. My previous jig had two protoboards to keep the pins aligned better, but I broke it. Some day I'll redo this jig so I don't have to spend quite as much time manually popping each pin into place on the DUT.

Common Problems

You may wonder what kind of problems I uncover most when using these test jigs.

On the eeZeeProp I most often run into problems with connections on the Propeller MCU leads or the EEPROM. I've made some improvements in techniques that have reduced the frequency of these problems. 

While I very rarely found board fab problems on OSHpark boards (It's below 1% if memory serves, so reliability is very high), OSHpark is absolutely fantastic about fixing the occasional problem. 

I've seen far more frequent fab problems on a batch of Chinese made boards I ordered. I haven't contacted the supplier yet. The fab problems are mostly under-etching resulting in shorts to the ground plane. I may experiment with a wider isolation between ground pour and pads/traces and see if that helps any.

I've occasionally populated pairs of 0603 resistors rotated by 90 degrees. In future designs I'll try to avoid confusion by spacing the resistors farther apart. I've installed a diode backwards once or twice.

Tuesday, September 23, 2014

Free Speech Synthesis For Your Robot

Newly painted Hero Jr.
I ran across a surprisingly good speech synthesis package. No, it's not Festival.

My Hero Jr had been painted blue, with holes drilled in the head, and other modifications. There's no better Hero Jr to modify and hack than this one. Possibly in time for the NoCo Mini-Maker Faire in Ft. Collins, Oct 4-5.

After painting it, the next step will be to add my recently purchased Raspberry Pi B+, or else the dusty PCduino in my closet, as a brain.

Then, implement speech synthesis. Vision: a robot "tour guide" for my Maker Faire exhibit.

While I adore the stock Votrax SC-01A speech synthesizer (it's the quintessential robot voice) I like the idea of a 20 year old robot with a modern voice even more.

Here's the fruits of my research so far...

Tuesday, September 16, 2014

Hero Jr Repaint

Ruining things sucks. I kinda screwed up and my impatience got the better of me. 


I didn't really care for the dark blue Hero Jr. I preferred the original computer beige and burnt sienna trim. So I "fixed" it... I fixed it real good...

Friday, September 12, 2014

Back to Linux Mint... 13

I installed Linux Mint 17 and have switched back and forth between Mint 14 and 17 for awhile due to instability in 17. I'm using the same home directory I had on Mint 14 which might explain it.

Yesterday, Thunderbird and Chrome kept repeatedly crashing until I logged out and back in again.

The entire computer hung at another point; I couldn't log in remotely, move the mouse, do anything with the keyboard (numlock etc).

At another point, the kernel reported some kind of error/crash/panic/something--can't remember as I was juggling several things at once.

And a few weeks ago, video was going wonky after waking from sleep (I believe they've gotten this known issue fixed since then)...

Friday, August 22, 2014

What the heck is PIPduino?

Introducing PIPduino
Our Jeep's steering servo controller, with this icky baseboard, was missing something. What?

Power and ground rails and a voltage regulator, that's what. So I made a 'duino clone with features for Putting In Projects and called it PIPduino.
  • Color-coded power and ground rails for each analog and digital pin, 
  • Dedicated I2C bus with 4 ports and pullups,
  • Combo SPI / ISP connector, 
  • Serial/FTDI connector,
  • Onboard voltage regulator, and
  • Flexible power options.
Goodbye shields. Use low cost breakout boards instead.

Before PIPduino (ick). And after (ah, much nicer).
Available soon on Tindie.

Thursday, August 14, 2014

Discovering Linux Mint 14 EOL

A little over a year ago, I converted to Linux Mint 14 for good, leaving Windows (mostly) behind.

Despite some initial bumps (and whining for which I remain deeply embarrassed), I've been quite happy with it and it is an excellent platform for my hobby electronics and robotics as well as for general use.

In the process of reworking my backup strategy, my attempted installation of rdiff-backup with apt complained about unsigned packages. Then bombed out...

Tuesday, August 5, 2014

Welcome, Hero Jr

After the AVC, my focus has shifted to four-wheeling my Jeep on Colorado mountain trails, making repairs, getting the fuel injection system tuned, and getting through emissions tests. I'm working on an automotive-ready 5V power supply that I'll be using with some upcoming projects including a Vehicle Speed Sensor Buffer.

I haven't forgotten about robotics, don't worry. In fact, a new robot has come to live at Bot Thoughts laboratories: this slightly dusty, cute, diminutive blue Hero Jr. very generously donated by a local robotics hobbyist, Michael Schievelbein. Thanks, Michael!

They were computer beige and red from the factory.
I think this will be a great demo robot for the Northern Colorado Maker Faire in Colorado or if I don't make that deadline then definitely Robots at the Hangar next April. Let's have a closer look...

Friday, July 11, 2014

Stop that Robot Jeep

Photo by Alicia Gibb, CC-BY-SA
The last thing we needed was a 5,000 lb full size Jeep going out of control at the 2014 Sparkfun AVC. One of our safety features was an on-by-default brake actuator.

The microcontroller deactivates it during a run but if hitting the e-stop, or shutting off the ignition, or arriving at the last waypoint re-activates the actuator and stops the Jeep. During the run I could still press the brake manually. Here's how we built it.

Thursday, July 3, 2014

AVC: What About Data Bus?

Though Data Bus made it to the 2014 Sparkfun AVC, it had to sit out again this year. Time ran out to fix the Bus so I focused on the Jeep.

Data Bus makes a cameo (arrow)
You can see Data Bus in the Sparkfun AVC recap video, sitting on the table near Troubled Child and also riding on top of the Jeep on our final run...

Friday, June 20, 2014

AVC: SHARC FSV, "Troubled Child"

Troubled Child, 1st Place in Doping and Crowd Favorite

Update: The SHARC FSV team Jeep, "Troubled Child," won Doping Class! And we were given the Crowd Favorite award! Wow! Yeehaw! Everyone on the team is super happy! Read on for details and video.

Congrats to all the other teams. I mean all of them. It's no small feat just to have something you can show up with. Anything beyond that is icing.

Monday, June 16, 2014

AVC: 5 Day Panic

The SHARC top secret AVC entry has been taking up a lot of time. It's come together very nicely but there are several problems to work through.

The heading estimate on Data Bus isn't working with the new technique I'm trying. So I have to get that fixed before I can look at path following. I tried to fix one thing and screwed up another.

I haven't even thought about testing it on the jump ramp or coding it for different starting line positions. Without the ramp I'm pretty certain not to medal in this thing. I'll be happy to get the robot around the track, though. Maybe that's asking too much. Next day or two should tell.

Good luck and safe travels to all the other entrants if I don't get a chance to post before Saturday.

Tuesday, June 10, 2014

AVC: 10 Day Panic

Oh crap. The competition is heating up for the Sparkfun AVC. There's only 10 days left.

And I'm doomed. As usual.

Top Contenders

I'm in the Peloton class. So are some heavy hitters.

Thursday, June 5, 2014

Ayoue 852A++ Heater Problem

My hot air rework station, an Aoyue 852A++, is broken. The heater would intermittently cut out and wouldn't come back until it'd sat awhile.

I didn't see any obvious problems until the third time I took the heating wand apart and saw signs of significant heat damage.


The old, broken, charred heating element

Monday, June 2, 2014

AVC: Heading Errors, Path Following Woes

A little over two weeks to go as I write this. That's not much time.

Testing uncovered a couple of obvious problems. The robot is experiencing heading errors and the pure pursuit path following is still working poorly.

Thursday, May 29, 2014

2014 AVC: Entry Video

Here's my Data Bus proof of concept video for the 2014 Sparkfun AVC.



Thursday, May 22, 2014

AVC: Pose and Map Display

To fix the path following algorithm on Data Bus I have to know what the robot is thinking.

To know what it's thinking, the robot is now sending some new data in its telemetry stream to the GCS.
  • All waypoints
  • Index of the next waypoint
  • Lookahead position

The GCS now opens a map window which scales and displays the data above as well as vehicle pose (position and heading).

Tuesday, May 20, 2014

Sparkfun AVC Update

The last few months, within the free nooks and crannies of an incredibly hectic life, I've done my best to fit in work on my Sparkfun AVC entries, Data Bus and the still-top-secret SHARC entry.

Thursday, May 15, 2014

AVC: Ground Control Station


With less than two months left to get Data Bus working, why am I working on Ground Control Station (aka GCS) software?

Thursday, May 8, 2014

Kids Like Taking Out Trash (With a Robot)

Where can you watch hundreds of kids volunteer to take out the trash? At the Denver Mini-Maker Faire, that's where!

Kids loved driving Trash Bot, grabbing, and dragging the recycling bin.

I spent most of last weekend manning the Bot Thoughts / SHARC combined booths where my remote control Trash Bot (TOTT Bot) was a huge hit with kids and adults alike! But that's not all.

Tuesday, April 29, 2014

Denver Mini-Maker Faire


Are you in Denver? Got some time this weekend for robots?

Saturday May 3rd and Sunday May 4th 9:00am - 5:00pm

Come visit Bot Thoughts and SHARC at the Denver Mini Maker Faire at the National Western Complex Saturday or Sunday. Tickets available here.

Thursday, April 17, 2014

Sparkfun AVC 2014 Course Preview

Sparkfun posted the 2014 AVC Course Preview today. Two changes. For ground, Micro/PBR classses can follow a line. For air, 36" red balloons are added. Pop them for a bonus (an OpenMV cam might be handy here -- we're planning to build a small batch of prototypes soon).


Friday, March 28, 2014

My Pixy arrived in the mail!



Well, can't wait to play with my just-delivered Pixy cam! Meanwhile I hope to finish OpenMV Camera assembly soon so I can demo at Robotics At The Hangar here in Denver on April 13.


Tuesday, March 25, 2014

Clock for my Mom, Complete.


Mom's clock is complete. She has trouble remembering the day of the week and has impaired vision, so after a fruitless search for an affordable solution I made my own. Here's how.

Wednesday, March 19, 2014

Powerful ATtiny841 has a breakout board

ATtiny841 pinout
ATtiny841 pinout
The ATtiny841 [datasheet.pdf] is the latest Tiny and it kicks butt. While the '841 shares pinout and memory sizes with the ATtiny84, the new chip boasts some truly incredible features:

  • One 8-bit and Two 16-bit Timer/Counters with Two PWM Channels, EachProgrammable Ultra Low Power Watchdog Timer
  • 10-bit Analog to Digital Converter
    • 12 External and 5 Internal, Single-ended Input Channels
    • 46 Differential ADC Channel Pairs with Programmable Gain (1x / 20x / 100x)
  • Two On-chip Analog Comparators
  • Two Full Duplex USARTs with Start Frame Detection
  • Master/Slave SPI Serial Interface
  • Slave I2C Serial Interface

The 14-pin AVR comes in surface mount packages, only. However, I'm selling a breakout board with AVRISP header, reset circuit, and built-in 16MHz crystal and caps. Buy it here for $10.

eeZeeTiny841 Breakout Board
I've written some really simple LED blinky demos here.

Wednesday, March 12, 2014

Tiny, Portable Turntable Strobe


I love turntables. The very idea is simultaneously insane and an awesome feat of engineering. 

Microscopic grooves in a rotating disc of plastic vibrate a minuscule, precisely ground chunk of diamond stuck on a tiny metal tube with magnets attached, inducing tiny currents in a cartridge coil, subsequently amplified up the wazoo. Somehow, instead of sounding like garbled crap, the reproduced sound is quite excellent on a decent system.

But how fast does the record spin? That's the purpose of my project, an extremely accurate, compact turntable strobe. An LP is supposed to spin at 33-1/3 RPM. Many probably don't. Not precisely. And the voices in my head like precision.

Introducing Pocket Turntable Strobe

Some turntables, like my Realistic Lab 400 above, have strobes built in that run off mains frequency to illuminate precisely spaced platter markings that appear to stand still when the platter speed is just right. Except the mains frequency varies and is only 60Hz on average.

Compare to my Turntable Strobe, which uses a quartz crystal and ATtiny25 to flash a white LED at 60.0±0.03Hz (30ppm absolute accuracy plus 20ppm temperature variation). Use it with platter strobe markings or speed check disks that you can find online. 

Turntable Strobe with speed check disc
It uses a tiny 3V, CR1225 battery which, combined with not-quite-Vcc output from the ATtiny25, produces barely enough voltage to dimly light a white LED. Adding four components makes the strobe burns bright as below, right. 

Same circuit, same LED, CR2032 left, CR1225 right
What sorcery is this? A Dickson charge pump.

From Jonathan Thompson's Web Journal [link]
The circuit is simple, requiring two capacitors and two diodes and one of the pins on the microcontroller for the clock signal. The result is a higher voltage supply (4.2V unloaded) that can brightly illuminate the high intensity, 5mm LED through a 1K current limiting resistor. I'll provide more detail on this circuit in an upcoming article.

Diagrammed in Upverter
Another trick to minimize complexity and parts count is that the microcontroller directly sinks current from the LED. You may object, claiming it's unsafe given the LED circuit is powered by a voltage exceeding the Vcc+0.5V limits of the ATtiny. Rules are meant to be broken, provided you have sufficient understanding of their purpose and how things work. I'll show you why it's safe in another upcoming article.

Meanwhile, if you want one, they are for sale.

Thursday, March 6, 2014

Freescale FRDM-KL46Z Board


I've been playing with a $15 Freescale Freedom board based on the Kinetis MKL46Z256 [pdf]. It has a built in magnetometer and accelerometer and possibly the cutest little 4-digit, 7-segment LCD I've ever laid eyes on. This is quite a capable board.

It's a 48MHz Cortex M0+ with 256K flash memory, 32K RAM. That's enough power to do some serious computation. Perhaps a Kalman Filter-equipped Segway type robot? Or AVC rover?

On top of that, typical of other Freescale chips, a fast ADC running >400kSPS at 16bit or >800kSPS at lower resolution. With DMA available.


With Arduino form-factor headers plus another row of headers in addition to those, the board provides easy access to a lot of MCU pins, 64 to be exact.

You also get a light sensor, capacitive touch slider, a couple of tactile switches, and USB host / device capabilities.

The board is supported by mbed for easy programming and prototyping. And to dispel the myths: the mbed SDK is open source and you can offline compile it for several supported ARM toolchains.

Debug, in the form of CMSIS-DAP, is available, too. A 20mm battery holder footprint is provided on the board.

Getting Started


If you plug your USB cable into the OpenSDA USB connector (use your Quick Reference Card to locate it), then your system will mount a Mass Storage Device.

On the drive are several HTML files. SDA_INFO.HTM takes you over to a P&E Microcomputer registration site where you can register your hardware. TOOLS.HTM redirects your browser to a page listing P&E debugger tools. For some reason the FSL_WEB.HTM leads to 404 error on the Freescale website. It should point to this page.

Next, head over to the mbed.org site, register or login, navigate to the Freedom KL46Z platform page and on the right side, click the "Add to Compiler" button.

Compiling Demos

On this same page you'll find a series of examples for the board. You can also search mbed.org for more. I selected an accelerometer demo from Freescale. Import it into the IDE, select your platform with the button at the upper right. Click compile and then move the bin file that is downloaded onto the Freedom's mass storage device.

The demo prints accelerometer values for X, Y and Z axes to the USB serial port. On Linux this device appears as /dev/ttyACM*. Fire up minicom and you get output...

X: 1.00, Y: 0.96, Z: 0.00
X: 1.00, Y: 0.96, Z: 0.00
X: 1.00, Y: 0.96, Z: 0.00
X: 1.00, Y: 0.96, Z: 0.00
X: 1.00, Y: 0.96, Z: 0.00
X: 1.00, Y: 0.97, Z: 0.00
X: 1.00, Y: 0.97, Z: 0.00
X: 1.00, Y: 0.96, Z: 0.00
X: 0.99, Y: 0.97, Z: 0.00
X: 1.00, Y: 0.96, Z: 0.00

On Windows you'd need to download a driver

Next I tried a touch slider demo which controls the PWM signal sent to the board's green LED. The code is really simple. Here's main:

int main(void) {
    PwmOut led(LED_GREEN);
    TSIAnalogSlider tsi(ELEC0, ELEC1, 40);
    
    while (true) {
        led = 1.0 - tsi.readPercentage();
        wait(0.1);
    }
}

Conclusion

I think this board is a decent deal at $15, the main selling point being mbed compatibility. My view is that boards are only worth as much as their toolchains and community support. And you can get other Freedom boards in the same form factor as well including other M0+ boards and an M4, the FRDM-K20D50M which boasts a 50MHz M4 with DSP capability.

While I touched on the highlights of this board, there's a lot more to explore. I'm looking forward to writing come code for it and using it in an upcoming project. SHARC will be hosting a Firefighting competition in the next few months and Pokey could use a major refit. However, come to think of it, I'm up to my ears in projects. Instead, perhaps I'll use it for one of those projects, such as my Take Out The Trash Bot. Whatever I do, I'll be sure to post about it here.

Tuesday, March 4, 2014

Lithium-Sulphur Batteries

I ran across an article on Lithium-Sulphur batteries the other day. With theoretically double the energy density of Lithium-Ion batteries, Lithium-Sulpher batteries look promising, but the chemistry comes with many challenges. However, researchers at Lawrence Berkeley National Laboratory have found some ways to address the problems. (read the Full Article)

Thursday, February 27, 2014

AVC Path Following

I implemented an improved path following algorithm on Data Bus and later, the SHARC self-driving Jeep that won Doping in the 2014 Sparkfun AVC.

The old, simple path following algorithm worked but didn't correct cross track error. The new algorithm chases a virtual rabbit, computing where the rabbit is and how to intercept it.

The Pure Pursuit algorithm is conceptually elegant and simple. It's easy to program, it's popular, and, clearly, it works quite well.

Pure Pursuit Algorithm

The robot follows a virtual rabbit that travels around the legs of the course, with each leg defined by two points. The rabbit is always located along the current leg of the course, A=[W0 W1].

The projection of the robot's position onto A is point P and the rabbit is located along A, a fixed distance from P. The fixed distance between P and the rabbit is called the lookahead distance.


The algorithm moves the rabbit's position at each update step, computes a relative bearing from the robot to the rabbit, computes an arc path tangential to its heading that intercepts the rabbit. The result of this unending pursuit is a smooth correction to the robot's heading and cross track error. This algorithm is called Pure Pursuit.

Here's the math I used to compute the intercept arc. The distance from W0 to P is the projection of the robot's position onto W, given by a dot product:


Where A=[W0 W1] and B=[W0 robot]. Vector A, divided by its magnitude, is the unit vector pointing along A. The dot product can be computed with trig functions (slow) or you can do it this way (fast):


 

Once you have a scalar from the dot product you can find your goal point, the rabbit, like this:





Even if the math looks spooky, the code is trivial. Here's the Processing code I used for my simulation.

  // Leg vector
  float Ax = Xw[next] - Xw[prev];
  float Ay = Yw[next] - Yw[prev];
  // Bot vector
  float Bx = x - Xw[prev];
  float By = y - Yw[prev];
  // Dot product
  float legLength = sqrt(Ax*Ax + Ay*Ay);
  float proj = (Lx*Bx + Ly*By)/legLength;

  // Goal point ("rabbit")
  float Rx = (proj+lookAhead)*Ax/legLength + Xw[prev];
  float Ry = (proj+lookAhead)*Ay/legLength + Yw[prev];


See? Not bad at all!

Turning

The robot now knows where the rabbit is. The robot knows it's heading and position. It can compute the relative bearing to the rabbit. But how much should the robot turn to catch the rabbit?

An elegant approach with smooth behavior that doesn't require complex programming logic or trial and error tuning is to use an intercept arc that intersects both robot and rabbit, and is tangential to the robot's heading. Here's how.

We have the robot at B, it's heading described by BC, and the rabbit or goal point at G. The distance between B and G is D.


A circle that intersects B and G and is tangential to BC with radius R will have an origin along a line that is perpendicular to BC and passes through B. We simply need to find out R, the radius for this circle. Time to break out some trigonometry.



Draw another radius line perpendicular to BG. This line will bisect BG (each line is D/2 in length). Studying the right triangles generated by these lines, notice that the relative bearing, theta, is also the angle between the new radii intersecting B and G, respectively.


We can express D/2 in terms of R and Theta, then solve for R:



The robot recomputes a new intercept arc at every update step. The result is a continuous path towards the goal point. The path is followed, the cross track error is accounted for.

Conclusion

So, despite planning to test this on a small 1:10 RC car, I ended up proving it out on the full size Jeep. Once the turning radius and lookahead distances are set reasonably, it works a treat!

If I get some time I'll post up the calculations for converting from arc radius to steering angle to servo signal. Suffice it to say that determining the correct steering angle to traverse the intercept arc is relatively simple to figure out, using basic geometry.

References
Path Tracking for a Miniature Robot.pdf
coulter_r_craig_1992_1/coulter_r_craig_1992_1.pdf