Monthly Archives: August 2016

Giving Wall-E2 A Sense of Direction, Part X

Posted 15 August 2016

In my last post on this subject, I described a series of ‘field’ tests of the magnetometer on Wall-E2, my wall-following robot.  These tests demonstrated that the magnetometer was operating properly, but heading results were unusable due to significant distortion of the magnetic field along the west (garage-side) wall of the entry hallway.

This post describes a similar test in an interior hallway. The interior hallway in our home is oriented orthogonally to the entry hallway, i.e. at 110/290 deg magnetic. The walls are about 1 m wide, and constructed of standard wooden stud and sheet rock construction.  There are several rooms opening off this hallway, but all the entry doors were closed for this test.

As shown in the movie and the associated Excel chart, the robot starts at the west end headed east, travels the length of the hallway, maneuvers around for a while, and finishes up headed west.  During the first and last 10-15 seconds of the run, Wall-E2 is physically heading in a more or less constant direction (about 110 deg in the first part, about 290 deg in the last part).

Wall-E2 heading results from interior hallway run

Wall-E2 heading results from interior hallway run

Unfortunately, the Excel chart shows a different story.  During the first 15 seconds of the run, there is a definite linear change in the average heading, from about 25 deg to about 75 deg, even though the robot is physically tracking along a wall that is oriented at about 110/290 deg.  During the last 15 seconds or so, the opposite happens; there is a linear downward trend from about 300 deg to about 225 deg.   These trends are physically impossible, so the only possible explanation is that either the magnetometer readings are in error, or there is something in or near the interior hallway that is distorting the earth’s magnetic field enough to produce these results.

I had hoped that the interference noted in the previous post was due to the common wall with the garage and its associated metal structures,  and that the interior hallway would be free of such problems, but apparently this is not the case.  So, I’m now forced to consider other ideas for interior geo-location.

Stay tuned!

Frank

Giving Wall-E2 A Sense of Direction, Part IX

Posted 12 August 2016

For the last several months (or was it years – hard to tell anymore) I have been trying to implement a magnetic heading sensor for Wall-E2, my wall-following robot.  What started out last March as “an easy mod” has now turned into a Sisyphean ordeal – every time I think I have one problem figured out, another (bigger) one pops up to ruin my day.  The first problem was to  re-familiarize myself with the CK Devices ‘Mongoose’ IMU, and get it installed on the robot.  The next one was to figure out why it didn’t work quite the way I thought it should, only to discover that sensitive magnetometers don’t really appreciate being installed millimeters away from dc motor magnets – oops!  So, that little problem led me into the world of in-situ magnetometer calibration, which resulted in my creation of a complete 3D magnetometer calibration utility  based on a MATLAB routine (the tool uses Windows WPF for 3D visualization, and Octave for the MATLAB calculations – see this post).  After getting the calibration tool squared away, I used it to calibrate the Mongoose unit (now relocated to Wall-E2’s top deck, well away from the motors), and once again I thought I was home free.  Unfortunately, reality intruded again when my ‘field testing’ (in the entry hallway of my home) revealed that there were places in the hallway where the  magnetometer-based magnetic heading reports were wildly different than the actual physical robot orientation, as reported in my July post on this subject.

After the July tests, I knew something was badly wrong, but I didn’t have a clue what it was, so I decided to put the problem down for a while and let my subconscious poke at it for a while.  In the interim I had a wonderful time with my two grandchildren (ages 13 & 15)  and a real 3D printing geek-fest with the younger of the two.  I also got involved in creating a small audio amplifier in support of the Engineering Outreach program here at ‘The’ Ohio State University.

So now, after almost a month off, I’m back on the case again, trying to make sense of that clearly erroneous (or at least non-understandable) data, as shown below (repeated from my previous post)

July continuous run test, showing two areas where the reported headings don't match reality

July continuous run test, showing two areas where the reported headings don’t match reality

The two areas marked with ‘???’ correspond to the times where the robot was traversing along the west (garage side) wall of the entry hall, the first time going north, and the second time going south.  The robot was clearly going in a mostly constant direction, so the data obviously doesn’t reflect the robot’s actual heading.  However, on the other (east) side of the entry hallway, the data looks much better, so I began to think there was maybe something about the west wall that was screwing up the magnetometer data.

As usual with experimentation, it is important to design experiments where the number of variables is kept to the minimum, ideally just one.   By keeping all other parameters fixed, any variation in the data must be due solely to that one variable.  In this case, there were several variables that needed to be considered:

  • The anomalous data might be due to some changes in motor current.    When the robot is wall following, there are constant small changes  to the left & right motor currents.  When the robot encounters an obstacle, it backs up and spins around, and this entails radical changes in motor current direction and amplitude.
  • The anomaly might be due to some timing issue.  It could be, for instance, that the heading  data from the  magnetometer is coming in too fast for the comm link to handle, so it starts becoming decoupled from the actual robot position/orientation, and then catches up again at some other point.
  • The anomaly might be due to some physical characteristic of the entry hallway.  The west side is where the most obvious anomalies occurred, and that wall is common with the garage.  Maybe something in the garage (cars, tools, electrical wiring, …) is causing the problem.

Using my new magnetometer calibration utility, Wall-E2’s magnetometer has been  calibrated with the motors running and with them off, and there was very little difference between the two calibration matrices.  Moreover, my bench testing has shown very little heading change regardless of motor current/direction.  So although I couldn’t rule it out completely, I didn’t see the first item above as a  viable suspect.

Although I haven’t seen any timing issues during my bench testing, this one remained a viable suspect IMHO, as did the idea of a physical anomaly, so my experimental design was going to have to discriminate between these two variables.  To eliminate timing as the root cause, I ran a series of experiments in the entry hallway where the robot was placed on a pedestal (so its wheels were clear of the floor) at several fixed spots in the entry hallway, and heading data was collected for several seconds at each point.  The following images show the layout and the robot/pedestal arrangement

Experimental layout. Blue spots correspond to numbered/lettered position in layout diagram

Experimental layout. Blue spots correspond to numbered/lettered position in layout diagram

Wall-E2 on a pedestal so motors can run normally without moving the robot

Wall-E2 on a pedestal (at position ‘A’ in diagram) so motors can run normally without moving the robot

10-12 August Mag Heading Field Test Layout

10-12 August Mag Heading Field Test Layout

Data was collected at the positions shown by the  numbers from 1 to 5 along the west (garage) wall, and by the letters from A to F along the east wall.  At each position the robot was  placed on a pedestal and allowed to run for several seconds.  If the heading errors are caused by the physical characteristics of the hallway, then the collected data should be constant for each spot, and the data should correspond well to the heading data from my earlier continuous runs.

The above graphic shows the results of all 10 test positions.  For each position, data was collected with the robot oriented ‘north’ (actually about 020 deg) and ‘south’ (actually about 200 deg),  as denoted by the small black orientation arrows.  The ‘north’ heading  results are represented by the blue arrows, and the ‘south’ heading results are represented by the orange arrows.  There is no meaning associated with the length of the arrows.

Results:

  • Northbound and southbound data are almost exactly opposite each other at all points. To me, this indicates that the 3-axis magnetometer data and the heading values derived from that raw data are valid.
  • The data clearly shows that there is a significant  magnetic interferer in the vicinity of the west (garage) wall of the entry hallway.  The west wall data is skewed more significantly than the east wall results, indicating that the magnitude of the interference decreases from west to east. Since mag field intensity decreases as the cube of the distance, I infer that the interferer is very close to the west wall (if it were farther away, then the difference between the east and west wall results would be smaller, because the distance difference would be smaller).
  • The data at each position corresponds well with data from the same position and orientation from the various continuous runs.  Given a continuous run and the knowledge of the interference pattern, it is possible to determine the robot’s location to a fair degree.  The following image shows the heading results from a 10 August continuous run, labelled with the position numbers from the entry hall layout diagram.  The positions were deduced from a movie of the run.
10 Aug continuous run, labelled with positions from the entry hall layout diagram

10 Aug continuous run, labelled with positions from the entry hall layout diagram

Conclusions:

  • The magnetometer and the heading calculation algorithm are probably working correctly
  • Magnetic interference is certainly a problem in the entry hallway next to the garage, and  may (or may not) be a problem elsewhere
  • Magnetic heading information may not be reliable/accurate enough to determine location with any precision, even coupled with left/right/front distances.

My next task is to run some continuous and step-by-step tests in other areas of the house, to determine if the entry hallway issue  is unique to the house or an ubiquitous problem.

Stay tuned!

Frank

 

OSU/STEM Outreach Speaker Amplifier Project, Part IV

Posted 04 August, 2016

In my last post on this subject, I described the finishing touches on the project to design and fabricate a speaker amplifier for the OSU Engineering Outreach ‘paper speaker’ student project. The ‘finished’ project featured an audio activity monitoring circuit piggybacked onto the Adafruit 20W Class-D amplifier board, using my almost-forgotten  hand-wiring techniques on fiberglass ‘perf-board’, as shown in the following images.

Cut-down perfboard, top view

Cut-down perfboard, top view

Cut-down perfboard, bottom view

Cut-down perfboard, bottom view

While this technique is perfect for a one-off project, I ultimately wanted to fabricate a number of these amplifier/monitor modules for use by the OSU Engineering Outreach team.  So, I decided to investigate the feasibility of obtaining a printed-circuit (PCB) board version of the LED monitor circuit, so I wouldn’t have to hand-fabricate the same circuit multiple times.  Of course, I knew in my heart that I could probably hand-fabricate ten (or a hundred) LED monitor circuits in the time it would take me to research the PCB design/fabrication field, acquire and learn a PCB design (aka EDA) package, actually design and implement the PCB, and then have the boards fabricated by a PCB house, but where’s the fun in that?

The last time I dealt with PCB design and manufacture was about 15 years ago while I was a researcher/JOAT (look it up) at The Ohio State University ElectroScience Laboratory, a research lab that specializes in Electromagnetics research and applications.  At the time I was a relatively new grad student at the lab (but one with about 30 years of electronics design  experience  in a prior lifetime with the CIA) and had somehow managed to get involved in a project that required some small-quantity PCBs.  The lab’s normal supplier (a local PCB manufacturing house) was still using hand-taping methods and the result was very high priced and of somewhat inconsistent quality (at least in my opinion), so I started looking for ‘a better way’.  In short order I found some low-cost, high quality EDA tools, and also found a small PCB house in Canada that would deliver small quantities in about 1/10 the time and 1/10 the cost as the local house. This made me a hero in the eyes of the lab director (but an enemy in the eyes of the guys who were comfortable dealing with the local supplier).  Anyway, it’s been another decade or so since I last looked at the EDA/PCB field,  so  I suspected things were even better now – and I wasn’t disappointed!

After a few hours of Googling, I found a number of posts that indicated that one of the better/easier-to-use EDA packages was Dip Trace, and they had a freeware version for those of us who can get by with 300 pins or less and only 2 signal layers – YAY!!  With a little further digging, I found some very complimentary reviews, so I downloaded the ‘free’ version and started trying to refresh  my PCB ‘game’.  Right away I found that DipTrace has a very complete and readable beginner’s tutorial, and unlike most ‘tutorials’ these days, the DipTrace one doesn’t skip steps – everything is explained and demonstrated in what had to seem like completely unnecessary detail to the experts, but in fact is absolutely crucial for a (almost) first-timer like me. If you are a hobbyist/enthusiast interested in PCB design/fabrication, I highly recommend DipTrace.

After working my way through most of the tutorial, I decided to try my hand at implementing my LED monitor circuit.  I started by porting my schematic from Digikey’s ‘scheme-it‘ (a free, browser-based schematic capture utility).  Here’s the schematic – first from Scheme-It, and then as it was ported to DipTrace.

LED Monitor circuit schematic as captured in Digikey's 'Scheme-It' app

LED Monitor circuit schematic as captured in Digikey’s ‘Scheme-It’ app

LED Monitor circuit schematic as captured in DipTrace

LED Monitor circuit schematic as captured in DipTrace

Following the procedure described (in exhaustive detail – YAY!) in the DipTrace tutorial, I then created an initial PCB design using ‘File -> Convert to PCB’ (or Ctrl-B) in the schematic capture app. This launches the PCB designer, and presents an initially disorganized parts layout as shown below.

Initial PCB layout

Initial PCB layout

Had it not been for the great tutorial, this mishmash of parts would have been a real turnoff; fortunately, the tutorial had already covered this, so I knew to ‘keep calm and carry on’ by selecting ‘Placement -> Arrange Components’ from the main menu, which resulted in this much more compact and reasonable arrangement.

After 'Placement->Arrange Components'

After ‘Placement->Arrange Components’

Working back and forth between the tutorial, the actual Adafruit 20W amplifier board, and the PCB design/layout screen, I was able to arrive at a final PCB design that implemented the entire circuit in a form factor that fit into the space available, as shown below.

Finished PCB layout. Note the purple board border is customized to fit on top of the Adafruit amp board

Finished PCB layout. Note the purple board border is customized to fit on top of the Adafruit amp board

The above layout was significantly customized to fit on top of the Adafruit 20W amp board and in the 3D-printed enclosure.   This required a number of iterations, but the process was well supported by DipTrace; in particular, the ability to print the layout on my local laser printer in 1:1 scale helped immensely, as I was able to cut it out with scissors and actually lay it on top of the amp board to check the fit.

I was curious about how close I came to the ‘free’ version limitation of 300 pins, so I displayed the ‘File->Layout Properties’ dialog as shown below.  From this it was obvious that I still have plenty of room to play with for future projects, although I did use both the available signal layers. ;-).

PCB properties, showing that this design fits well within the 300-pin maximum for the 'free' version

PCB properties, showing that this design fits well within the 300-pin maximum for the ‘free’ version

All in all, I probably spent 2-3 days from start to finish with DipTrace to get a finished PCB layout – not too shabby for an old broke-down engineer who can’t remember where he left his cane and hearing aids ;-).

But, all of this wasn’t even the really cool part of working with DipTrace!  The  really cool part came when I realized that DipTrace features a ‘baked-in’ link with Bay Area Circuits  for PCB procurement (File -> Order PCB…) as shown below

The 'File->Order PCB' menu item

The ‘File->Order PCB’ menu item

When you click on this option, the relevant data is scarfed up from the PCB layout information and you are presented with a simple ordering screen, complete with per-unit and total prices for your design.  All you have to do is select the quantity desired and press the ‘Place Order…’ button.  No messing with Gerber files, net lists, drilling schedules, mask layouts, etc etc.  One button, 30 bucks from my PayPal account – done!!!

The order detail screen

The order detail screen

So, the lead time on the board order was quoted as about 10 days, so I won’t know for a couple of weeks how the whole thing worked out, but I’m quite optimistic.  I have to say that this was the most pleasurable and trouble-free PCB design project I have ever experienced, and I have experienced  a lot of them over the last 50 years, from hand-cut 10X mylar PCB masks, to hobbyist acid-baths, to $10,000 setup charge custom PCB shops, to this – wow!  I may never do another PCB project, but if I do, DipTrace will be my drug of choice!

Stay tuned,

Frank

 

 

 

Giving Wall-E2 A Sense of Direction, Part VIII

Posted 07/19/16

In my last post on this subject, I described moving my CK Devices ‘Mongoose’ IMU from a wooden stalk mounted on the 2nd deck to a more compact bracket mounted in the same location, and showed some data that indicated reasonable heading performance.  This post describes some ‘field’ (a hallway in my home) test results using the bracket-mounted configuration.

Field Test Site:

My ‘field test’ site consists of two hallway sections in my home. The two sections are oriented about 45 degrees to each other, as shown in the following diagram.

Field test area physical layout, oriented north-up

Field test area physical layout, oriented north-up

For my first ‘Field Test’, I simply set Wall-E2 loose at position 1, pointed in the direction shown in the diagram, and recorded via the  wixel-pair wireless connection implemented last December.  Wall-E2 successfully navigated (with a few ‘back-and-forth’ iterations) from point 1 to point 8 in the diagram, as shown in the following short video.

The captured telemetry data included the run time in seconds and the magnetic heading in degrees, and I sucked this information into Excel, where I graphed the mag heading versus time, as shown in the following screenshot.

Heading vs Time for Wall-E2 continuous run. Areas of puzzlement marked by '????'

Heading vs Time for Wall-E2 continuous run. Areas of puzzlement marked by ‘????’

As the caption notes, most of the graph makes sense, but there are at least two different areas where there is a more-or-less linear change of heading versus time, where there shouldn’t be any (or at least, where I don’t *think* there should be any).  Either Wall-E2 has some tricks up his sleeve that he wasn’t telling me about, or I don’t fully understand how the data and the physical record (the video) correspond.