Making New Things is Hard

Paul Breed has a post that resonates with me over at his blog Unreasonable Rocket:

“Making a new thing is hard. You will fail, over and over again, you will fail.
Edison tried thousands of light bulb filaments before he found one that worked.”

-Paul Breed

Paul knows this much better than I do. He’s had rockets blow up on the launch pad that he spent several months and several thousand dollars making.

I’m a tightwad, and I’m also not a risk taker. The combination of those two traits has led to some frustration lately as I try to find a way to fabricate the robot lawn mower.

The tightwad in me says find the cheapest way to do it, even if the trade off is more of my time and frustration. I don’t need a drill press. I’ve got a perfectly good cordless drill! That’s the mentality, anyway.

Because I’m not a risk taker, I spend a lot of time planning in my CAD software. You can prevent a lot of issues by planning well. To see the flip side of this coin, search the internet for “DIY robot lawn mower”. Most of the results you get are… janky, to say the least.

Because of these two traits, my initial plan was to have someone else make the robot lawn mower for me. I’m an engineer, not a machinist or welder. I was willing to spend about $2,000 dollars to have someone make my weldments complete. I can do the final assembly work myself; I have hex keys and wrenches at home.

Unfortunately, very few weld shops are willing to do anything but weld for me. They want you to bring them parts, and they’ll weld them up. The ones that are full up fab shops aren’t too interested in my work right now. A few of them have talked to me, but their quotes were several thousand dollars for just the mower deck. I’d hate to see their quotes for the chassis weldment.

For the cost these folks quoted me, I can go get my own band saw, drill press, slip roll machine, and various other tools to make my parts, and come out way ahead. There are lots of guys that can weld aluminum out there. They just don’t want to go buy material, cut it, make it per your print, etc. They’re welders, not prototype makers.

So based on the astronomical quotes I’ve received I’m going to go purchase my own tools, and start fabricating the parts I need for the robot lawn mower. I’ve done a good job making sure I can actually make each part I’ve designed. Now I just need to shell out some money for some good tools, and make it happen.

On my shortlist of items to buy:

tooling
The tools I’ll need to make all the parts for the prototype robot lawn mower.

Having my own tools will be nice. I’ll finally be able to control my own destiny, and make exactly what I need.

Combined Battery Bays

version 5 and 6 compare
Version 5 compared to version 6 of the robot lawn mower.

I started drawing up what the robot lawn mower would look like if we didn’t care about separating the compass from the electric motors. Removing this constraint allows several design efficiencies, some of which I was not expecting.

I decided to use two battery bays on version 5 because I had to mount a mast smack dab in the middle of the chassis. I didn’t want to mount it on a removable lid because it would be cumbersome to remove to get access to the batteries. Instead, I put hinged doors on both bays.

It looks neat in the picture above, but what you don’t see is all the wires running through my chassis tubes between bays to connect the batteries and all the signal wires run through the mast weldment up to the control enclosure. It started getting ridiculous drawing all of that up.

A separate design constraint I’ve been trying to achieve is to keep the wheel base of the robot to a minimum for handling reasons. Unfortunately, the mower deck design I settled on has a motor in the middle of the deck that is a pain to locate such that it doesn’t interfere with the battery bays.

Because I was splitting the battery bays anyway, I positioned the mower deck the way you see in the version 5 picture above. One downside to doing this is that the mower deck is pointing backward from what you see on virtually every riding mower.

bottom compare
The bottom view of version 5 and version 6.

Combining the battery bays let me rotate the mower deck 180º. In the back of my mind I have been worrying the backward orientation of the mower deck might cause performance issues. Now we won’t have to find out.

Additionally, both power and control enclosures can be mounted directly to the battery bay, which will drastically shorten the wire runs I’ll have to make. I’m actually excited to start drawing wires again. Things aren’t so claustrophobic anymore.

And on top of all the benefits above, the chassis weldment went from having 28 total parts to 15. Not too bad!

Where Does All That Power Go?

I’m estimating the electric deck motors on the robot lawn mower will use about 168A of current collectively, and at 24V that means they consume just over 4kW or 5.3hp of power. Even in a worst case scenario, saying that aloud sounds ridiculous. Really? Where is all of that power going?

Remember that power is equal to torque times angular velocity. The angular velocity of the mower blade is governed by the blade tip speed limitation of 19,000ft/min. The linear velocity of the blade can’t exceed this value. If we know the blade length, we can do the math and determine the necessary angular velocity to achieve that blade tip speed.

velocity
The maximum angular velocity of a 21in mower blade for compliance with ANSI B71.1-1990. Don’t forget the calculation between radians and revolutions.

So we have a very good handle on angular velocity. The mystery variable in the power equation is then torque. The amount of torque we need when the blade is spinning is going to determine how much power the motors are going to consume.

In my previous power calculations, I made a huge assumption:

I have no clue how much torque a mower blade needs. Let’s just use whatever my 21in Toro push mower outputs. It mows grass pretty good. Close enough.

-Me, making poor decisions

The engineer in me loves that assumption. Find the appropriate RPM, pull up the power curve for the engine and boom, there’s your torque value on a silver platter.

The problem is that the robot lawn mower and my Briggs and Stratton push mower are two different animals. I should have made this chart a long time ago, but here is the performance curves for the E30-400 electric motor compared to a Briggs and Stratton 450e gasoline engine, typical of a push mower with a 21in wide deck:

Gas Versus Electric Comparison

The chart above makes more sense when you remember that the 450e gasoline engine is paired with a 21in long blade, but the robot lawn mower has 12in blades. This is why the electric motor curves go all the way to 5,700RPM whereas the gasoline engine curves end at 3,600RPM. Their respective blade length gets you close to the allowable blade tip speed.

Remember that these curves represent the maximum torque and power created at a given speed. When you’re mowing your lawn, how often does your mower bog down? Not much, hopefully. If it’s designed well and your grass isn’t a foot tall your mower probably isn’t operating at it’s maximum torque or power.

Because you shouldn’t often need the maximum torque or power out of your mower engine, the guys that engineered them installed a cleverly designed throttle governor, which varies the amount of fuel and air fed into the engine in such a way that its speed stays in a narrow RPM band.

Instead of letting the engine spool up to the fastest speed it can achieve under a given load, the governor limits speed of the engine, and subsequent power output, making it more efficient. If you need more torque or power, it adjusts the air and fuel mixture accordingly. The governor also ensures the blade tip speed stays safe.

This is where my power calculations go off the rails. I’m using the maximum torque values from these curves (measured in laboratory conditions no less) and sizing an electric motor such that it can achieve this torque value. This is inflating the estimated current these motors will consume.

Remember the motor from the electric push mower I got off Craigslist? It doesn’t appear quite so undersized now, given that our gasoline engine is likely operating somewhere below those maximum torque and power curves.

Our E30-400 electric motor, on the other hand, has no throttle control. This makes the analysis simple: it will always be operating at the curves on the chart above. A brief look at the chart shows that it should still perform very well.

Under no load, it will spin at 5,700RPM. As the required torque increases, the motor speed will drop, but the total power output from the motor increases until the motor is spinning at 2,900RPM. At this power output, one single motor is almost generating the power created by the 450e gasoline engine. Nice!

So realistically, the 168A of current for all three motors is probably on the high side. By how much, I am unsure. But I suspect it’s a significant amount. The robot lawn mower uses three of these motors. Collectively, I would imagine they won’t need too much torque to spin through whatever resistance they encounter.

This is looking more and more like a problem best solved by experimentation, not analysis…

Battery Selection Revisited

battery
A typical lead acid battery. It’s 12V, 80Ah. Or is it?

Batteries are often advertised with a nominal voltage and nominal charge. It’s tempting to take those numbers at face value and assume that regardless of operating circumstances, a battery will sit at its nominal voltage and run until its nominal charge has been depleted. Reality is more complicated than that.

Christopher Milner reminded me of this in a brief conversation this week. He is using 13 3.2V, 100Ah LiFePo4 batteries in series to power the deck motor on his mowing rig. Stringing them together in series gets you close to 48V in their charged state. He reports getting about 3 hours of runtime while powering a motor that consumes 1300W.

This surprises me because my own calculations suggested four 12V, 35Ah lead acid batteries should be sufficient. Christopher obviously knows what he is doing and I trust his experimental results much more than I do my own back of the envelope calculations. The discrepancy means I need to reevaluate my numbers.

When making my calculations I did not take battery discharge rates into account. This is a big mistake, as I’ll show below. But first, for my own educational benefit, I’d like to introduce you to the C-rate, a way to quantify how fast you pull current out of a battery.

The C-Rate

What is a battery’s C-rate? Our good friends at Wikipedia define it as:

The C-rate is defined as the charge or discharge current divided by the battery’s capacity to store an electrical charge.

In layman’s terms, the C-rate is just the ratio of an arbitrary discharge rate to the battery’s charge capacity. It’s a simple way to describe how much current you’re demanding from a battery relative to the battery’s total stored charge. If you’ve got a battery rated for 10Ah and you discharge it at 5A, the C-rate would be:

Untitled
The C-rate if you were to discharge a 10Ah battery at 5A.

It’s kind of a janky way of defining things in my opinion. A is really an inverse hour, or stated differently, the unit of measure for a C-rate is h−1. Also, don’t confuse the C-rate with Coulombs, the unit of measure for charge. Clear as mud?

The reason I write all of this is so we’re all on the same page about what a C-rate is. If I’m wrong, please comment below, because I am going to proceed with this understanding of the C-rate going forward.

The C-rate is a useful measure because the total amount of charge you can extract from a battery depends on how fast you take it out. If you try to pull 100A out of a 10Ah battery, you’re not going to get nearly as much charge out of the battery as you would if you discharged it at 1A.

Additionally, when you demand a large amount of current from a battery, your voltage starts dropping fast. This is important because electrical power, which is ultimately what we’re after, is voltage times current. If your voltage drops you get less power, even if you’re withdrawing the same amount of current from the battery.

Your batteries are going to be much happier and live much longer if you stick with a reasonable C-rate. Having said all of that, how do the four 12V, 35Ah batteries I selected stack up against the expected current draw they’ll experience?

Our SLA Batteries Reevaluated

Previously I estimated the total current consumption of our robot at 197A. I think this is a conservative number, but I’m going to roll with it anyway. The number reflects current consumed by the three deck motors, two drive motors, and various electronics at their worst case scenarios.

I’m using two sets of two 12V, 35Ah batteries wired in parallel, then in series to get an equivalent battery that’s 24V, 70Ah. The discharge rate for one battery in this configuration is half the total current consumption because we have two sets of two batteries wired in parallel. This means that one battery is discharged at a rate of 98.5A.

The datasheet for one of these batteries shows the following chart, with various C-rates:

SP12-35 Discharge Characteristics
Run times and terminal voltages for our 12V, 35Ah SLA battery at various discharge rates.

At a discharge rate of 98.5A, our C-rate is 2.81C. Looking at the chart above, that would mean our batteries will last for ~8 minutes. Yikes. And realistically, the 2.81C curve may extend to about 8 minutes, but the voltage drops off so fast after about 4 minutes that you’ll probably start noticing performance problems very quickly.

Also interesting to note from the chart above is that the one hour discharge rate is in fact not 35A as you’d expect with a 35Ah battery. It’s actually 0.628 times 35Ah, or 21.98Ah. To truly extract the 35Ah charge from the battery, you can only discharge it at a C-rate of 0.05C, or 1.75A.

Having written all of this, I wonder to myself why manufacturers don’t just list curves with specific discharge rates in Amps. The chart above would be completely unambiguous if they just showed a curve for 105A, 70A, 35A, 21.98A, etc. The conversion is tedious and honestly, if you don’t truly understand C-rates you leave with the impression that these SLA batteries are much more capable than they truly are.

Looks like we will need to use some lithium batteries after all. Thanks for saving me $400 on some batteries that wouldn’t have worked Christopher!

Is a Compass Even Necessary?

bad compass health
My favorite Mission Planner error message: Bad Compass Health.

The compass drives two very costly design constraints into the robot lawn mower:

  1. The need to minimize the number and size of steel or ferrous parts in the design.
  2. The need to separate the compass from the motors to prevent electro-magnetic interference.

To address the first constraint, I selected a 5000 or 6000 series aluminum for the robot chassis and deck. That is quite costly both from a material standpoint and from a fabrication standpoint. And ultimately, you’re going to have some amount of steel in your robot. You can’t avoid it.

The second constraint requires the compass to be raised above the motors to a level high enough to get it out of the magnetic field created by the motors. Because I’ve placed the flight controller and other electronics in the same control box with the compass, several wires have to be run between this box and the power box. Shielding those wires is going to be tricky. Long story short, it creates lots of secondary design inefficiencies.

Reading through the forums and in my own research, I’ve come across a few interesting anecdotes:

  1. Kenny Trussell reports that when steel mower blades begin to spin at high RPMs, the compass heading begins to drift by some amount, about 20º.
  2. Christopher Milner had to place a 4ft tall mast on his vehicle to sufficiently separate his compass from the noise created by two drive motors and one brushless DC motor.
  3. Unplugging and disabling all compasses on my wheelchair robot doesn’t cause any EKF errors, and after traveling a few feet in the wrong direction, the robot corrects its heading somehow, without the compass. I suspect the wheel encoders aid this process.

In light of this information, I am beginning to question whether I even need a compass. It seems to be creating more problems that it solves. The bad compass health error messages in Mission Planner are starting to get very annoying, even though they don’t usually seem to impact the robot wheelchair’s ability to navigate properly.

According to U-Blox, you can use two ZED-F9P modules configured as a moving base-rover combination to calculate the vehicle’s heading. Even with a spread between the antennas of 10in, U-Blox says the heading accuracy is 0.8º. Some folks on the Ardupilot forum are starting to investigate using the modules in this way, and I suspect it will be a much more accurate way to obtain the vehicle’s heading.

I’ve had enough bad luck with compasses that I’m willing to get rid of them altogether and use the ZED-F9Ps for heading exclusively. This allows some significant improvements to the robot design. I guess I’ll head back to the drawing board for the time being…

A Poor Man’s RTK Base Station

enclosure-closeup.png
I may not be able to afford a Emlid Reach RS2, but I’ve got a cordless drill and an Amazon Prime account, dang it!

Putting my RTK base station on the mailbox works pretty good, but it takes a while to set it up and it’s not very robust. Using it in this manner results in a few problems:

  1. The cell phone battery pack that I use to power to the receiver turns off after a while. I’m not sure if this is because the receiver only draws ~120mA of current and it doesn’t detect the receiver, or if it just times out. Either way, it’s quite annoying to discover the reason I can’t get an RTK fix or float is because the base station isn’t even on.
  2. The neighbors getting their mail usually block enough satellite signals to cause the receiver to lose an RTK fix. Cars driving down the street will often affect the quality of reception, too. Unfortunately, I can’t pick up the mailbox and move it to a more favorable location.
  3. The receiver and antenna are exposed to the elements. While I usually use them in good weather, I would like to be able to use them without having to worry about risking damage to the units from rain, wind, and the Kansas critters.
  4. When I’m out testing in the parking lot there’s not an equivalent of my mailbox out there for me to set the receiver on. The roof of my car doesn’t count because it’s not geostationary. I’d like to have a way to repeatably locate the receiver when I’m testing in the parking lot.
  5. Maybe I’m paranoid, but I’m always worried about some punk kid walking off with the base station module when it’s not within my line of sight. The punk kid I used to be in my teenage years would have done something malicious like that. It’d be great if I could make it a little bit more difficult to steal.

With these goals in mind, I decided it was time to build a real base station. One like the Emlid Reach RS2, but doesn’t cost me $1,899.

A Glorified Enclosure

The Emlid guys are geniuses. They basically took an RTK GNSS chip they can buy in bulk for $150 a piece, slapped it in a super nice thermoplastic case, developed an app that is more or less equivalent to U-Blox’s U-Center, and then stuck a price tag of $1,899 on it. I’m embarrassed I didn’t think of doing it myself.

They do offer some nice benefits with that $1,899 price tag, such as integral Wi-Fi and data logging capability, but in my humble opinion, those features aren’t worth what they’re charging. Realistically, I need a tripod, a mostly waterproof enclosure, a lead acid battery with a charger, and a cover for my GNSS antenna. Something like this:

RSTP-A10001 (06-21-19)
My version of the Emlid Reach RS2.

I have a 12V lead acid battery and charger I stole from an old weed eater that I intend to use for this enclosure. The battery is rated for 3.6Ah, and according to the Ardusimple website, the board consumes 600mW at 5V, so 120mA of current. That would mean you could keep the Ardusimple board on for 30 hours. Not too shabby! I don’t know if they’re including the radio current consumption in those numbers, but even if it’s twice the 600mW they listed, we should be in good shape.

I’m still learning how to use these GPS modules, so I want to have access to the micro USB port that lets me communicate with them via U-Center. I found one of these cables for that purpose. I want to be able to interface with the board without opening the enclosure.

The guys that designed the Ardusimple boards were very forward thinking, and they made them such that you can power the board from any port or all the ports. The board has two micro USB ports, one for GPS data and the other for debugging the XBee radios. I don’t anticipate needing to use the XBee port often, so I am going to power the board with it instead.

To step down the 12V to 5V the board needs, I am going to use one of these DC to DC buck converters. Instead of two wire leads for the 5V output, it has a micro USB connector. Very handy. This converter should plug and play right into the XBee micro USB port.

One concern I have with it is RF interference. I’ve read some comments saying these converters don’t play well with FM radios. The way my enclosure is designed, I’ve got it sitting right below the Ardusimple board. GPS signals are in the 1.5GHz range if I remember right, so maybe we’ll be okay.

I’d like to use a tripod that’s stouter than your consumer grade camera tripod. Ideally it would have a hook under the center that I can hang a plumb bob from to make sure I’m setting the tripod up in the same location every time. I found a tripod that appears to fit the bill on Amazon.

tripod stud
A survey grade tripod that looks promising. The 5/8-11 UNC stud is stout, but a little inconvenient.

Most survey grade tripods appear to have a 5/8-11 UNC threaded stud, so I’ve used a low profile cap screw with a coupling hex nut to mount the enclosure on the tripod.

The tripod mount method
The coupling nut used to interface the enclosure with the tripod.

Last but not least, I need a way to protect the antenna as it sits on top of the enclosure. I opted for the OEM antennas that Ardusimple sells for the simple reason that all the other antennas they offered came with no less than 5m of extra cable. Yikes. Where would you put all of that cable? The OEM antenna cable was 30cm long.

The downside to the OEM antenna is that it doesn’t have any protective case. I could have 3D printed something, but I like to keep things simple. I really just need a dome looking thingy to cover it.

It’s kind of amazing what Google can find if you type “plastic dome” into the search field. At least for me, it turned up this on the first page of results. Pretty much exactly what I’m looking for. I intend to use a modified pipe gasket and some rubber washers for an approximately water tight seal.

The dome is about an eighth of an inch thick, so to make sure it doesn’t attenuate the GPS signals too much, I did a little test where I put a similar plastic bowl over the receiver. It affects the signal strength only marginally.

Last but not least, every GPS antenna needs a good ground plane. Sparkfun sells a 4in diameter ground plane for $5. It’s 0.125in thick steel which is a bummer for drilling holes through, but it beats routing the circular profile out of a piece of bar stock.

bom
Bill of material for the poor man’s RTK GPS base station. The items I have on hand have a zero quantity.

Total cost? Should be under $200, depending on shipping for all these items. You too can have a Emlid Reach RS2 for the low, low price of $200.

Field Testing and RTK GPS Stuff

I have decided that I need to refine the wheelchair robot’s ability to navigate accurately and robustly before I shell out a few thousand dollars to build the robot lawn mower. The goal here is to have the wheelchair robot “mow” my lawn before I invest in the actual robot lawn mower. If the wheelchair robot can’t do it, the robot lawn mower doesn’t have much of a chance, either.

So I’ve spent most of my time testing the wheelchair robot and the RTK GPS system. I have been typically placing the base on my community mailbox because it is geostationary, has a large metallic surface to prevent multipath, and a decent view of the sky.

IMG_5373
The base station, located on top of my community mailbox. The green disk is the antenna. Neighbors give me funny looks when they go to get their mail.

Surprisingly, I was able to get several RTK Fixes partially underneath my large maple tree in my front lawn. While in RTK Fixed mode I had the rover running a mission with 10 waypoints in a 3m diameter circle. I cranked down the waypoint radius to 0.3m to try and make sure the robot was accurately traveling to each waypoint.

rtk map
The circular mission in my front lawn. The satellite imagery is from winter time. GPS in blue is the U-Blox Neo-M8N, GPS2 in green is the U-Blox Zed-F9P, and POS in red is the calculated position by the EKF.

The map above shows some calculated positions prior to obtaining the RTK fix and after the RTK fix is lost.

IMG_5372
The view from the ground. The mailbox in the picture is where I have the base station sitting.

There is some offset between the satellite imagery and the actual location on the ground, which makes things a little confusing, especially when planning a mission close to many obstacles. I almost ran into my neighbor’s basketball goal after I lost my RTK fix.

To give you a better idea of the quality of the fix, here is the latitude reported by the GPS receivers and the blended location as calculated by the EKF:

rtk fixed graph
The latitude reported by the U-Blox Neo-M8N, U-Blox Zed-F9P, and the EKF position estimate in blue, green, and red, respectively.

The RTK fix in the graph above is first obtained at 18:06:15 and is maintained intermittently until about 18:14:12. The reported HDOP for both GPS receivers was close to 0.7, but despite this, I am impressed that by default, the EKF is giving much more weight to the RTK solution. You can see this in the graph: the red and green lines are much closer than the blue line.

The oscillations in the graph above are from the circular mission I was running. It looks like I had a pretty good RTK fix from about 6:09PM to about 6:13PM. This was about 11 laps about the circle.

Some additional information about the fix status:

rtk status
The fix status across time. 6 is an RTK Fix, 5 is RTK Float.
gps status
How much time was spent in each fix status.

I don’t want to oversell these results, because they weren’t typical of the entire afternoon. I spent a good chunk of time running the wheelchair robot in Acro mode tuning the throttle and steering parameters, and I wasn’t able to get an RTK fix throughout that time. It’s very much a patience thing.