Wednesday, December 18, 2013

Check this out: Muscle wire

Have you heard of muscle wire?

It contracts when you pass current through it, heating it up, and returns to its original length when it cools.

It's made of shape memory alloy called Nitinol which undergoes a "reversible solid-state phase transformation known as a martensitic transformation" [Source: Wikipedia].

Tuesday, December 17, 2013

Robotic Christmas, Autonomous Systems Lab

Here's the 2013 Robotic Christmas video from the Autonomous Systems Lab. Enjoy!

Tuesday, December 10, 2013

Trash Robot Design, Part 2

Requirements | Design 1 | Design 2 | Chassis ]

Previously we looked at an option of lifting the trash can and driving it down the driveway to the curb. This time around let's look at the other option of grabbing the can's handle and wheeling it to its destination.

Grab the handle and wheel the cans to the curb

The robot can either tilt the can and roll it like I do or drag it flat. Again, one robot. Stock (or slightly modified) can. Less force is required to tilt the can than lift it as you might intuitively guess.

Probably a good idea to do some preliminary calculations on this tilty thing. The force required to tilt the 25kg can around its wheel axles measures 45-50N.

 About 45-50N is required to tilt the can at its handle.
If you use some kind of arm to do this tilting, how much torque is needed?

Tuesday, December 3, 2013

Trash Robot Design, Part 1

 To be taken out.
Requirements | Design 1 | Design 2 | Chassis ]

My trash robot, TOTT Bot, is going to take the trash to the curb for me. I have a clearer picture of the problem from last time. Time to think about some designs. This is the fun part. Here's what I came up with. Chime in if you have other ideas.
• Convert the trash cans into robots
• Put the trash cans on trailer and tow them
• Lift the trash can and drive it to the curb
• Grab the handle and wheel the cans to the curb
When one evaluates candidate designs it's best to brainstorm a bunch of ideas and forget about feasibility. Be crazy. Put on the mad inventor hat. You can stodgily evaluate each later, looking for potential issues, and attempt to prune down the list of candidates to explore more fully...

After thinking about zany ideas it's time to be the dark-suit-wearing buzzkill. Frown and look stern. It helps get you in character.

The first two options are out. Why? I don't want to add extra weight to cans that the trash carriers must deal with and I only want one robot.

Let's talk about lifting the can and driving it to the curb first. Some potential difficulties may arise designing for the weight of the cans, their center of mass being so high, the inclined path, among other things.

Lift the trash can and drive it to the curb

Only one robot required. The chassis will have to be able to hold a full 50lbs (20-25kg). And something will have to lift that weight up a short distance off the ground. This might work, but we probably should do some quick calculations.

Drive Motor Torque

So, first of all, how much torque is required to move a 25kg (+5kg robot?) on an inclined driveway? Same answer whether I'm lifting or rolling the can, by the way. And the answer depends on the wheels and gearing and on how much acceleration you want. Actobotics has a 6" heavy duty wheel and a variety of precision gear motors.

You may know that torque is equal to force at a specified distance (wheel radius). And force is equal to mass times acceleration.

$\tau&space;=&space;Fd$

$F&space;=&space;ma$

$\tau&space;=&space;mar$

I'm using SI units like all the cool kids. Mass is 30kg. Wheel diameter is 0.1524m (6") and the torque acts at the radius. Here's a diagram from Wikipedia showing the forces involved in a free body on an inclined plane.

Gravity, g, is 9.81 m/s2 and the angle is up to 8 degrees. If we were climbing the hill, the geartrain and motor need to generate a force equal to f to stay still (zero acceleration), greater than f to achieve any acceleration uphill, and less than f to accelerate downhill. So how big is f?

$\\f=mg\sin\theta\\f=(30)(9.81)\sin(\frac{8\pi}{180})=(294.3)\sin(0.1396)\\f=40.95\textup{N}$

We're talking about 41 Newtons (kg-m/s2) to stay still. I have no concept of 41N because I live in America but no matter, let's just figure out motor torque. For a 0.1524m (6") diameter wheel, the torque generated by the motor and geartrain at the wheel radius must exceed 3.12N-m. (If the wheel radius was 1m then the torque required would be 41N-m). It's possible that if the motor is in braking mode, with the torque multiplication of the geartrain it'll be ok. I'll have to verify that later.

Lifting the can

How much force is required to lift the can vertically? The force would have to exceed the can's mass times the acceleration due to gravity, mg or 9.81m/s2 times 25kg which is about 245N. Let's suppose you use a motor or servo with an arm to somehow lift the can. Or a winch with a drum. If the arm/drum has a 0.01m (4") length/radius, the force at that distance is 245N so the motor driving it needs to supply at least 0.01 times that, or 2.45N-m of torque. Two motors halve that requirement. The shorter the arm, the less motor torque required but also the less movement possible.

ServoCity offers a selection of precision gear motors that look like possible candidates for driving such an arm. There are also hi-torque, geared servos available. The 45rpm gear motor supplies a torque of 1.963N-m. Two of them give 3.93N-m which should be adequate for a 0.01m arm. There's also a 20rpm model as well as lower and higher geared models.

ServoCity also offers some killer geared servos. The one pictured above puts out 1281 oz-in of torque when geared 7:1, or over 9N-m. Just one of these servos should be more than enough to lift 50lbs with a 0.01m arm.
 Vertical force from rotating arm

Something else to consider is that the torque required is at a minimum when the force is perpendicular to the Earth's surface.

Using a rotating arm, the force will be applied at increasing angles to the force of gravity (see picture). The vertical component will diminish to zero as the arm reaches vertical.

Therefore, it'll be best to operate the arm in a narrow range of angles. Below is a plot of available torque for several motors, given a 0.01m arm, at different angles.

Here's a plot of 0.01m arm angle versus vertical force. The 60rpm motor can operate up to 30 degrees. Any of the lower-geared motors can run up to 45 degrees, no problem.

Ok, that design could work. I still want to double-check the lifting capacity of these motors and servos in the real world in case I goofed up something.

Next: Grab the handle and wheel the cans to the curb

Wednesday, November 27, 2013

Robot, take out the trash!

Requirements | Design 1 | Design 2 | Chassis ]

I hate wheeling the trash to the curb on trash day and sometimes I forget. Screw that noise, man. A robot wouldn't mind, wouldn't forget and wouldn't care if it's freezing outside. I'm building Take Out The Trash Robot. TOTT Bot, for short. So there.

 A few of the many Actobotics parts I'm evaluating
ServoCity was kind enough to send me a giant box of cool Actobotics parts to evaluate. Seriously. I'm like a kid on Christmas opening the coolest new lego-lincoln-erector-tinker-riviton-toy ever designed!

What the Isaac Asimov is Actobotics, you ask? Lots of cool parts. Precise parts. With drill holes in compatible locations. So, it's easier to prototype. Between the ball bearings, precision shafts and tubing, lightweight aluminum channel, gears, sprockets, chains, belts, and pulleys, not to mention ServoCity motors and giant servos I'm seriously giggling with glee here.

As it turns turns out, I've been wanting to build a trash robot for a few years now. After wondering "what am I going to do with all these parts?" for awhile, I decided the trash robot is the perfect project to see what the Actobotics platform can do for us robot-builders. It's going to take several weeks to build and I'm capturing it all here. Hope you'll tune in while I prototype, build, figure, calculate, screw up, fix, and all that joy. On to the problem statement...

Tuesday, November 26, 2013

Pololu Black Friday

Pololu is doing another Black Friday sale this year! Lots of great deals. (No affiliation, I just like Pololu). (Update: click here for deals from Sparkfun, GHI, Parallax and Bot Thoughts!)

Pololu Robotics and Electronics is having its biggest Black Friday sale yet, discounting hundreds of sensors, actuators, motor controllers, and other robot parts by 30% to 60% and offering an additional 11% to 15% off orders over $100! Buy one Zumo Robot and get one free, save on a 3pi Robot and get a free programmer, and take advantage of great deals on select Arduinos, Raspberry Pis, and mbeds. The first doorbuster deals go live Wednesday, November 27, and the sale runs through Cyber Monday (December 2). For details, visit www.pololu.com/blackfriday. Sunday, November 24, 2013 Cyber Monday, New Products! Announcing Bot Thoughts Cyber Monday discounts! Details here. Thursday, November 21, 2013 Microchip PIC 24F, 10MSPS 16-bit ADC, 2x OPAMP, DAC 16-bit, 10 MSPS ADC, dual op amps and 2x10bit 1 MSPS DAC. In case you were wondering MSPS is Million Samples Per Second. If you're not picking your jaw up off the floor then maybe some comparisons will help. AVRs have 10-bit, 15 kSPS ADCs. That's kilo-Samples Per Second. Two orders of magnitude difference. The ARM NXP LPC1768 can do 10-bit conversions at 500kSPS. There are Kinetis ARMs that do over 800kSPS. The dsPIC33F has 10-bit, 1.1 MSPS converters which used to be impressive to me. Oh, and 10 bits is ok, 12 bits is pretty good. But 16 bits is crazy resolution for an MCU. Usually more bits means slower sample rates. And yet... Tuesday, November 19, 2013 Hacking a dual rail supply for HP204 oscillator I built a custom power supply for my HP204 oscillator and cleanly modded screwed up, hacked things together, and eventually shoehorned it into the case. Now why would I go and do all that? Read on... Monday, November 18, 2013 Sparkfun AVC 2014 Announced Sparkfun has announced the date and venue for the 2014 Autonomous Vehicle Competition. June 21st at the Boulder Reservoir. Details here. Thursday, November 14, 2013 ATtiny Software Serial ATtiny software serial transmit and receive, based the Arduino SoftwareSerial library, and around 1K compiled. That's what I've been working on. Why?  Spy photo :) of ultra compact eeZeeISP AVR programmer I'm designing a low cost, really small AVR Programmer, that's why. It's based on an ATtiny84A and requires SPI which claims the USI peripheral, leaving no hardware serial. Here are the details on TinySoftSerial. Saturday, November 9, 2013 Robot Art My best friend is an artist. His latest blog post features some of the robot head art he's been working on. His prices are reasonable so if you want one, let me know and I'll put you in touch. Wednesday, November 6, 2013 JavaOne: Raspberry Pi Embedded Challenge After a couple late night hours at JavaOne Java Embedded Challenge, Bruno and I had written a field sobriety tester on a Raspberry Pi using JavaFX and Java Embedded Suite. It's an example of how easy it is to build embedded solutions when all the hard work is already done for you :) Here's what we put together... Friday, November 1, 2013 AVR Watchdog as Sleep Delay Use the AVR Watchdog Timer as a sleep delay. Put your ATtiny / ATmega to sleep and the Watchdog Timer will wake it up after a specified interval.  oh no, it's the glowing, blinking eyes of a chupacabra! This is the technique I used for my lost R/C airplane model alarm. I also used it last night for my Halloween glowing, blinky eyes. Here's how. Thursday, October 31, 2013 Happy Halloween! Happy Halloween. After failing to make a bright enough flickering candle on an ATtiny13A, I quickly threw together a "blinking, glowing eyes in the bushes" thing using one of my eeZee Tiny boards with some resistors and LEDs soldered on. This is what I was picturing... This is what I ended up with... Wednesday, October 23, 2013 Review of Free Gerber File Viewers for Linux Here's a review of free Linux Gerber file viewers. PCB fabrication shops usually require Gerber files of your latest PCB design. Taking one last look can prevent mistakes, so you'll want to view the designs graphically with a Gerber file viewer. Windows users have quite a few options which I've previously reviewed. For Linux users the choices are very limited but here's my review of the available options. Wednesday, October 16, 2013 Check this out: Boston Dynamics Wildcat Boston Dynamics posted a video of their Wildcat on Youtube bounding and galloping autonomously. At a speed of 16mph. Two thoughts. First, they should enter the 2014 Sparkfun AVC. Second, I'm incredibly curious about what's involved. Balancing, leg placement. Sounds like an utterly fascinating topic to explore. Do their robots teach themselves how to balance (like that kid from my alma mater that built a six-legged robot that teaches itself to walk)? Or is it carefully tuned, hardcoded, etc? Anyone know? Wednesday, October 9, 2013 Check this out: Electric Imp  Electric Imp, WiFi for all You know how when you talk with geek friends you learn about cool stuff you didn't know about? For the next several weeks, in addition to the regular posts, I'll make a valiant attempt to share some things I think are neat-o in case you haven't heard of them or have but forgot. I'd love to hear your feedback. Could you take a second and post comments good or bad? Thanks. First up is the Electric Imp. It's been around awhile. It's a device in an SD card form factor that bridges your widget to WiFi. On-board is a transceiver and an ARM Cortex M3. It's programmable via cloud-based development. You can get 'em for$30 at Sparkfun and other places.

I haven't played with one yet. I already have a mountain of microcontrollers and other goodies waiting for my time. How about you?

Thursday, October 3, 2013

Eagle Tips: Default Via Size

In Eagle, vias are square and overly large by default but you can change the default. All you have to do is create/edit eagle.scr in the scr directory of your Eagle installation. Enter the following lines:

Tuesday, September 24, 2013

Logic Analyzer Shootout

This is a smackdown cage match between my three logic analyzers, a vintage HP 1650A, cheap Open Workbench Logic Sniffer and tiny Saleae Logic. Who will win? Read on...

Thursday, September 12, 2013

Eagle: sudden clearance errors, isolation wrong?

You open up an Eagle board file only to find clearance errors when you run design rule check (DRC). Clearances that were working yesterday, and for the past hundred days on numerous boards, in fact.

Then you notice polygon isolation (clearance between polygon and trace) is too large. Pins that used to be connected to the polygon aren't. You can't manually reduce isolation. How do I fix this strange behavior?

Monday, September 9, 2013

Out Sick

Reason for no posts lately? Strep throat. The month/year from hell continues...

On the upside my Rover RC Multiplexer is successfully funded on Tindie.

Code: 6ED0F82

Friday, May 31, 2013

Encoder Fixed

 Naughty little wheel encoder!
I mentioned suspicious signals from the encoders. Here's what I was seeing. This is a plot of the distance traveled versus time. The plot is showing that one of the wheels is able to travel more than 300m in a fraction of a second. Cool.

Thursday, May 30, 2013

AVC Update

Over on diyrovers Google Group we've been getting some sneak peeks at the 2013 AVC competitors' progress!

Team 0x27, winners of last  year's AVC posted up a video of preliminary testing of their unicycle robot...

Meanwhile, Savage Solder, a recent Robomagellan champ, is performing brilliantly in this test video:

Thursday, May 23, 2013

GPS Noise Isolation Part 2

 Experimental opto-isolator board on Data Bus
I'm now using a opto-isolators on my GPS to mbed connection, a much better solution than the chokes I used to stamp out RF interference previously.

Tuesday, May 21, 2013

Data Bus Baseboard on Tindie

Data Bus mbed baseboards are now available on Tindie as a fundraiser!

Now you can build your own autonomous rover! This board is the fifth revision of the board that's been powering my AVC-podium-placing rover, Data Bus, the last few years.

If you want to experiment with your own algorithms on a powerful 96MHz ARM processor and want a head start on building their 2014 AVC ground vehicle entry, well, here you go!

Features
• Three UART ports, one 3.3V, two 5V, series resistor protection
• Five I2C ports, all 3.3V
• ESC and steering Servo connector
• Dual wheel encoder port
• Onboard 5V regulator powered by ESC 6V BEC powers 5V UARTs
• Separate mbed supply rail to keep noise out of your GPS.
• Filtering / bypass caps

Just get an mbed, load it up with my code, add an L3G4200D gyro, Venus or uBlox GPS, wheel encoders.

Data Bus source code repository
AVC2012 code on mbed.org

Friday, May 17, 2013

Noise and the 3DR uBlox LEA-6 GPS

 3DR uBlox LEA-6 GPS + secret sauce
I'm evaluating a 3DR uBlox LEA-6 GPS for use on Data Bus to either replace or supplement its current module, the Venus 638FLPX.

At first the GPS could not obtain a fix. Here's how I brought the GPS from no fix to a 10-satellite fix. From my basement!

Tuesday, May 14, 2013

Ramp Jump Breaks Data Bus

I built a ramp very similar to the one for the 2013 AVC so I could get a sense of how the robot will handle the jumps.

Unfortunately I stripped out one of the plastic idler gears doing a high speed jump. I've got a metal set on order to arrive Friday.

 Can you see the stripped teeth on the small idler gear?
I was hoping to test my revised path following algorithm. That'll have to wait until I replace the gear set. More on the path following algorithm soon.

Just under four weeks left.

Thursday, May 9, 2013

Reverse Engineering GM ECMs

This is the tale of how I wrote a Perl disassembler for the Motorola 6801 CPU to learn how the fuel injection computer that I installed onto my Jeep works.

Almost 200 pages of source code and data create code to run late-80's GM fuel injected engines. DIYers retrieved machine code, disassembled it, and reverse engineered code and hundreds of parameters 15 years ago.

Complete ASDZ Source for 1227747 (pdf)

Wednesday, May 8, 2013

2013 Sparkfun AVC Entry Video

Here's a demo of Data Bus driving itself around in the rain outside my house. Sparkfun requires a demo submitted before the May 8 deadline. I actually submitted it on the afternoon of May 8, so I hope I'm not too late.

Data Bus is configured to travel slowly, around 6 m/s, between four waypoints outside my house. I ran it a few times and it seemed to traverse approximately the same route each time.

With only a month left, I guess I can stop procrastinating, now. I'd like to at least get a sense of how accurately I can control its path and make a few improvements before June 8.

Wednesday, May 1, 2013

Taking Time Off

I am taking time off posting for the next couple weeks due to personal reasons. Last week I was too focused on fuel injection tuning for my Jeep to work on robotics or write articles.

Thursday, April 11, 2013

AVC 2013 Course

 Sparkfun 2013 Course (from avc.sparkfun.com)
Unlike previous years, the 2013 Sparkfun Autonomous Vehicle Competition course is fixed through all three runs and the dimensions are, more or less, provided. However, after drawing a SketchUp model of the course, I am taking the dimensions with a grain of salt.

Tuesday, April 2, 2013

Thanks, Subscribers!

This is long overdue, but thanks, readers!

I really appreciate you and I hope you find stuff on my blog helpful, entertaining, amusing or of value in some fashion. Maybe this is corny but you make blogging a really rewarding experience.

Several months ago, Bot Thoughts finally broke the 300 subscriber mark. Sweet! It's taken me awhile to announce that. So long, in fact, that the blog is now closing in on the 400 subscriber mark. Wow.

Friday, March 29, 2013

Sharp IR Ranger Noise

Time to look at supply and signal noise on the Sharp IR I2C adapters I'm working on.

You often read how noisy these sensors are. Now you can see it for yourself.

Tuesday, March 26, 2013

Tindie Items in Stock

The gamut of breadboarding goodies are back in stock at the Bot Thoughts Store on #tindie:

Tuesday, March 19, 2013

How do you organize your cables?

I don't and am soliciting your wise advice. Here's my mess of cables.

How do you organize yours? What containers, retainers, thingamajigs do you use to maintain order?

Friday, March 15, 2013

MRP App for Makers

When done, MakerMRP will help me track parts inventory, BOMs, product inventory and sales for all boards I've been building and selling on Tindie.

After using LibreOffice Calc to try to keep track of nine products each with a dozen parts, I committed myself to spending 20+ hours writing a LAMP/AJAX/jQuery application from scratch while learning more about each on the fly.

Writing the app isn't about saving time. It's not motivated by laziness.

The mother of invention is an extreme, gut-wrenching, violent hatred of mind-numbing, boring, busy-work and the willingness to do nearly anything to avoid it.

Thursday, March 14, 2013

AVC 2013: Rules, Walkthrough

Sparkfun posted the rules and course walkthrough for the 2013 Sparkfun AVC.

https://avc.sparkfun.com/

For us ground vehicle folks the rules are rather different and it really changes up the strategy.

If you finish the course you get 300 points from which your time in seconds is subtracted. You get 25 points for every corner you pass.

Two bonuses are possible, the hoop from last year earning 50 points and a jump ramp for another 50 points.

Finally, every run counts towards your final score.

Speed is no longer king. Consistency, accuracy, and precision are.

Saturday, March 9, 2013

My Propeller VGA kit is $4.75 with 2 days left to order on Tindie. Generate VGA signals with your Propeller with software from the OBEX.  Propeller VGA breakout kit (prototype) Tuesday, March 5, 2013 Furby Disassembly: Part 1  "Cookie Muffin, Too" Faced with a malfunctioning$8 Goodwill Furby, I set about non-destructive disassembly of my daughter's new sick pet, inspired by the dramatic skinning of a Furby by Becky at Adafruit.

I was also inspired by Doc McStuffins.

And yes, I was secretly happy the Furby wasn't working; I confess wondering what was inside the moment after I saw the price tag.

Don't worry. No Furbys were harmed in the making of this blog post.

The Furby was making odd chattering noises, strange light fluctuations in the eyes, and shutting off unexpectedly. For awhile the eyes and beak weren't moving in time with speech. New batteries helped a little but this was a sick little fella.

Friday, March 1, 2013

Graphic LCDs for Data Bus

Graphic LCDs are excellent debugging tools. Digole offers an I2C adapter with Arduino library that I've ported to mbed.

 128x64 Graphic LCD on Data Bus displays GPS, battery, etc.

Thursday, February 28, 2013

2013 Sparkfun AVC location announced!

 Barrels of doom. 2012.
Sparkfun announced the location of the 2013 AVC on their Google Plus page:

Ladies and Gentlemen, start your engines! We have now nailed down the location for the 2013 SparkFun Autonomous Vehicle Competition - it will take place on June 8th, 2013 at the Boulder Reservoir. We are still hammering out some final details (including entrant and spectator signups) which will be forthcoming, but save the date! We hope to see you there!

Tuesday, February 26, 2013

mbed sdk is open source

 from mbed.org
The mbed team announced a few days ago that their SDK, that is, the new mbed library, is open source.

I'm sure more than a few folks had some reservations about such a previously closed system.

For me, it'll be very educational with great examples on how to implement the mbed library of which I'm quite fond on LPC. They have extensive internals documentation posted up. I've scanned through it and I think it'll make a fascinating read.

It will likely open the door for porting to other Cortex M chips and platforms as well. Think LPC1769, STM32F4, Stellaris, etc.

Friday, February 22, 2013

AVC 2013, Sharp IR I2C

My AVC 2013 preparations have begun.

I have a list of improvements planned for my rover Data Bus to make it faster, more precise and accurate. I'll soon add the convenience of telemetry and FPV.

Some changes are small but quite helpful. One such improvement is to I2C-ify my Sharp IR Rangers.

Wednesday, February 13, 2013

Stuff I'm up to and Tindie

First, I'm very honored that Bot Thoughts blog has been selected as one of the Top 100 Resources for Electrical Engineers

Stuff I'm Up To

As usual, I have a number of irons in the fire.

In prep for the 2013 AVC, I plan to add an Xbee radio to Data Bus, my autonomous rover, to implement remote telemetry and control. I must first free up a serial port on the mbed. I bought an I2C-based Digole LCD adapter to replace the rover's invaluable serial LCD.

I discovered and repaired an mistake (the wrong 0603 resistor was installed) and now it works with I2C on the mbed. I'm currently porting the company-supplied Arduino Library to mbed while learning more about C++ inheritance and virtual member functions.

I'm redesigning the Data Bus baseboard. It will be pro-fabbed after home-etching the first few iterations. It'll either be mbed- or LPCXpresso-based. Next version will get an onboard ARM, either LPC1769 or STM32.

My Raspberry Pi telepresence rover is done. Or, at least the initial phase. I'll share more about that soon and document enhancements as I go, too.

I'm also starting to gear up for STM32F4 development. I'm planning a machine-vision system based on the Toshiba tcm8230md camera. Some of the STM32 series have camera peripherals that should work with the this Toshiba 640x480 color camera.

If a little ATmega8 at ~17MHz can run the AVRcam to track multiple colored objects, then a 168MHz STM32 with far more memory and the benefits of DMA should be able to do a lot more.

On a related note I've been working on interfacing a Game Boy camera (Mitsubishi M64282FP) with a dsPIC33F and digging into assembly on that MCU. It's really quite fun. It's on hold for a little while but I'll get back to it soon.

The mailbox notification project, using JeeNodes, is on the back burner but not forgotten.

Tindie

The eeZee Propeller is back in stock on the Bot Thoughts Store and the ATtiny24/44/84 Board should be soon. Same for the ATtiny2313/4313 boards. My eeZee Power usb breadboard power module is funded and then some. Cool.

The fundraiser microSD boards will be delivered in the next few weeks, populated, and sent to supporters.

I'm also working on a a couple new products: a Sharp IR Ranger I2C adapter and a VGA breakout adapter for Propeller.

Monday, February 11, 2013

Migrating to Linux: Day 7

That does it. I give up.

I'm writing this within Windows Vista.

When you spend two hours trying to get any kind of stupid serial terminal emulator working, and wind up not getting any of them working, something is not right.

Flashing STM32F4 Discovery

I almost gave up. Trying to flash my STM32F4 Discovery has been a nightmare. The stlink code I found didn't seem to work reliably for me. At long last I discovered OpenOCD does work. Then realized that it was mass-erasing the chip before flashing. Trying that with stlink works better. But I'd rather erase only what's needed. So, still struggling but at least there's hope of developing on STM32 on Linux.

Time Machine

Meanwhile I discovered something that would be painful to do in Windows (I think), emulating a TimeCapsule. Using netatalk 2.2 (apt-get install netatalk) I followed this guide but ignore the bit on Avahi and use the tm option on your volume.

Friday, February 8, 2013

JeeNode AA Power Board

I'm using JeeNodes for a project to notify me when the mail has arrived. You know, like packages containing electronics goodies.

With basic communications working in the lab, it's time to prepare the mailbox JeeNode to run off a battery.  I bought a AA Power Board from Modern Device and installed it. The Power Board powers a JeeNode at 3.3V by boosting a single AA battery voltage using an LTC3523 boost regulator.

The design is very clever, offering many ways to connect the power board to your existing JeeNode. I chose to put it on the bottom side. Here's how.

Tuesday, February 5, 2013

Migrating to Linux, Day 2

I finally got fed up with Vista and decided to switch over to Linux Mint 14 as my primary OS...

...with the intent of never going back.

Will I survive?

Thursday, January 31, 2013

Easy Pogo Pin Test Jigs

Tindie update: I have a few of the older Rev 0.2 eeZee Propeller breakout boards on clearance at Tindie, \$16 each. Also, 10% off eeZee Tiny, 8-pin ATtiny breakout board (coupon code 52CAF8E)

All the Rev 0.3 eeZee Propellers ordered during the Tindie Fundraiser have been shipped after extensive testing.  My test jigs are primitive, but are huge time-savers. One jig programs the board. Another tests VGA. A third tests output pins.

Monday, January 28, 2013

Robot Magazine Article

I'm very excited to announce that I've been published in the March-April 2013 issue of Robot Magazine! They should be on the newsstands now.

My article about Data Bus and the 2012 Sparkfun AVC goes into some of the trials and tribulations of building a high speed autonomous rover.

Thursday, January 24, 2013

555 Schmitt Trigger Circuit for Wheel Encoders

I've been playing with Schmitt trigger circuits again, this time using a 555 Timer based on a discussion on diyrovers started by Jason.

Schmitt triggers are circuits that provide hysteresis. The concept is simply that instead of one threshold for on and off, there's an upper and lower threshold.

 Signal (U), no hysteresis (A), Schmitt (B) - Wikipedia
With one threshold (red line, U above) a noisy signal can trigger an action more often than intended (A). When there's an upper threshold to trigger on and a lower threshold to trigger off (green lines on U), noisy signals won't trigger falsely (B), so long as the noise doesn't cross the thresholds.

To measure speed and distance travelled, Data Bus uses Sparkfun QRE1113 IR reflectance sensor breakout boards and wheel encoder discs printed with WheelEncoderGenerator.

On my robot, using QRE1113 reflectance sensors running at 5V, this is the waveform I get.

It looks similar to a half-rectified AC signal, about 3V peak and around 1.5V offset. Running on 3.3V, I get a 1.8V peak with 0.9V offset. Either one should be enough to trigger logic circuits.

It's not a bad idea to add hysteresis, though. If the sensor is right between encoder stripes, add a little noise and it could trigger more than intended.

555 Timer Schmitt Trigger

While you can easily find many examples of 555 timers wired to provide hysteresis triggering, and we'll look at the two common ones, a third circuit works better for the wheel encoder system on Data Bus.

In all cases, the encoder signal is ultimately wired to the Threshold and Trigger pins of the 555.

Inside the 555 timer is a 3-way voltage divider that provides the hysteresis thresholds. When the input voltage is above 2/3 Vcc, the 555's output goes low. When the input is less than 1/3 Vcc, the 555 output goes high.

 555 Internals, more or less
But the 555 won't trigger for my 1.8V encoder signal which is below the 2.2V threshold. It won't work at 5V either. What can we do...?

Series Capacitor

By passing the signal through a capacitor, low frequencies (including DC) are filtered. If this high-pass signal is fed in between a voltage divider, it adds a dc offsets to the signal.

If the offset is 1/2 Vcc then the new peak voltage will be 0.9 + 3.3/2 = 2.55V, more than enough to trigger. The lowest voltage will be 3.3/2 - 0.9V = 0.75, well below the 1.1V lower threshold.

In the LTSpice simulation below, the red trace is the low threshold, the blue trace the high threshold, and the green trace is the signal with the dc offset.

So we're done. Let's build the board and move on, right? Wrong. I prototyped the circuit on a breadboard and found out it doesn't work like I want. At low wheel speeds, the 555 doesn't trigger at all. Why?

In the picture above, the red trace is the signal coming out of the high pass capacitor. Because the wheel speed is so low, most of the signal is low frequency and thus filtered and thus too small to trigger.

So, all you have to do is slap a big capacitor in place of the small one, right? With a capacitor that's large it can trigger on low wheel speeds, yes. However, it can can also get the 555 output "stuck."

Stuck? Yeah. If the robot sits with the input low too long, the 555 won't trigger for a long time after the wheels start spinning.

The reason is that, with the input voltage low, DC offset increases (the series capacitor charges) until the low voltage is now the new DC offset. When the wheels start moving again, it takes a long time for the circuit to bleed off the DC offset. This is the simulated result with a large capacitor, 220uF. It mirrors the real life experiments I did.

A smaller capacitor reduces the effect. Here's a 47uF capacitor. This also shows the output of the 555. The simulations do a good job of approximating what I'm seeing in real life.

Bottom line: you have to find the right capacitor for your needs. A small cap would work on Data Bus. It goes fast, and is only stopped at the starting and finish line. Still, I don't really like this circuit for wheel encoders. I'd prefer to fix the problem with the first circuit.

Transistor Amplifier Inverter

Using an NPN transistor to amplify (and invert) the phototransistor signal works well. It's not revolutionary although I didn't notice any similar circuits when searching for 555 Schmitt Trigger circuits. So, here it is.

Connect the base of the NPN through a resistor to the encoder board output, tie the collector to Vcc through a resistor, and the collector becomes the output for the 555. Simple, eh?

The Q1 transistor is either nearly 5V thanks to the pullup, or nearly 0V when base current is permitted to flow by the QRE1113 breakout board.

As a result, the circuit triggers at the lowest practical wheel speeds and doesn't lock up. Seems reliable enough to use. The only downside is that the duty cycle isn't even close to 50%, although no circuit is going to get it perfect. One can address this issue in software.

Encoder Imperfections and Software

With a pulse train that isn't a 50% duty cycle, calculating speed and distance is probably best done by timing either rising edges or falling edges, but not both.

The longer the robot travels on a particular leg of its journey, the less jitter affects distance calculation.

For speed, it may be wise to adjust control loop timing, encoder resolution, or robot speed ranges to adequately filter jitter and other noise. A slow robot needs more stripes, a fast robot needs fewer. A slower processor needs fewer and/or slower.

Think about how often the MCU has to sample encoder counts to adequately filter noise and calculate speed with acceptable accuracy, given the number of stripes and the robot's typical speed range.

And maybe filtering isn't even necessary. If a speed PID controller is adjusting a robot's speed at every edge, jittery speed adjustments between edges may be effectively filtered by the momentum of a fast, heavy robot.

If the robot is slow and very light, momentum won't filter jittery speed changes very well. Software can do it instead. Change speed based on a running average, leaky integrator, or other software filter. Or, the PID controller can check speed by timing many pulses instead of few.

Wheel imperfections and encoder disc mounting imperfections cause a low frequency modulation of the encoder signal. Sent through a Schmitt trigger, the output pulse width will vary.

That sort of jitter may be a problem when precisely traveling short distances at slow speeds. More precision in the assembly may help. Or increasing the encoder resolution.

Conclusion

The 555 is quite the Swiss Army Knife of ICs. Acting as a Schmitt trigger is one of its many capabilities. With all that said, it's probably just as easy to just use a Schmitt Trigger inverter instead of the 555. I'm looking into that next.