October 6, 2023

Trike Revival for the BD Car Show

Robot land has an annual car-and-other-vehicles show.  Last year I brought the hybrid car powertrain go kart, but this year the kart's geting some upgrades (stay tuned), so I brought the electric tricycle instead.

The trike has been hanging from a miters wall unused since  2019.  The last time it was ridden, someone crashed it into a curb and bent the head tube inwards, so it needed some work to get back into a rideable state.

Somehow it's been ~11 years since I built the tricycle - looking back at the blog to jog my memory, this was one of my first big projects at miters, one of my first projects using a mill and lathe, and the first thing I ever designed in Solidworks.  It's a miracle it worked.

Here's the trike pulled down from the wall.  The battery cover broke ages ago so the battery is strapped in with tape.  Most of the wires are held together by duct tape.  The brake and shifter cable housings are frayed, and 5th gear sounds super crunchy.  And that head tube angle...


First order of business was to take it apart and do a little inspection and de-grunging.  I'd forgotten how much mileage the trike got - there was  period of time in undergrad where it got ridden once or twice a week, and it shows in the amount of chail lube and dirt caked onto everything:


The shifting wasn't working well, so I pulled the chains and Shimano gearbox:


The spur gear differential was one of the more complicated things I'd machined at the time, and it was... a learning experience.  At the time I didn't know that I should never trust communal mills to be trammed (or how to tram a mill, for that matter), so the bores for the six shafts that span across the differential aren't very perpendicular to the end plates.  As a results, the differential was super finicky to assemble and would bind up if the fasteners were tightened in the wrong order.  Also apparently I hand't learned about chamfers either - those corners sure are sharp.


The turnigy 80-100 motor Shane donate to the cause was still working fine, but the position sensing and motor control setup was never great - I used a Kelly KBS brushless controller plus one of Charles's external hall effect sensor boards that measures flux leaking through the OD  of the rotor.  The Kelly controllers aren't great at driving low inductance hobby motors, and would periodically fault when pushing the trike hard.  The external hall sensors weren't great either, between the wires falling off, the hall sensors mysteriously dying, the sensors rubbing the outside of the motor, and the timing vibrating out of alignment:


The original seat was a fiberglass monstrosity made of an old bicycle saddle, and years of newbie riders doing wheelies by accident had scraped the back edge off.


I found a perfect replacement for the seat in a bin at miters: an old Brooks B-67(?) double-rail saddle:


The trike wasnt bult with swapping seats in mind - I welded the rails of the original bicycle seat straight to the frame.  This Brooks saddle uses a funny double-rail mounting system where the clamp is built into the saddle, rather than into the seatpost like normal.  Instead of welding more stuff to the frame, I turned a little seat post stub and bolted it on:



The curb incident bent the curved frame tube rather than breaking the weld with the head tube - I found this tube pre-curved on the miters floor, so it's made of some mystery-alloy low strength steel.  I put a steel bar in the vice and did some gentle persuasion to get the steering back in alignment.  I think the trike would handle better with a slacker head tube angle , but to change the angle that much I should really chop and re-weld the head tube.


I brought the pile of parts home from miters and did the rest of the repairs in the home shop.  I got this cheap e-bike controller shaped VESC as a replacement for the Kelly - it's not higher power, but supposedly supported external SPI encoders, and a real encoder + FOC should be big improvement over the old hall sensor and trapezoidal drive setuop.  It claims to be a 120A max controller, but I've only gone up to 75A so far - internally it's just got 6 TO-220 package FETs, so I'm probably not going to push it much further:


Turns out the controller didn't really support external SPI encoders.  I wired up the encoder to the hall sensor cable according to a guide I found online, but it didn't work.  Probing around with a scope, the signals looked nothing at all like SPI. 

I cracked the controller open and immediately found the problem - there were RC filters and pull-ups/downs on the pins, for hall effect sensors.  More probing around and I was able to figure out what modifications to make - the picture below shows the full set of changes I made to the drive.  Initially I had solder bridges instead of the 100 ohm resistors, but I found that the SPI only worked when I was scoping the clock pin - I gues the tiny bit of capacitance from the scope probe was damping out some ringing edges.  The 100 ohm resistors in series fixed everything.


I machined a holder for a diametric encoder magnet:


And 3d-printed a holder for an encoder breakout board:


The original plastic battery cover got destroyed ages ago, so I did some CAD - the other CAD - and whipped up a new one out of some thin aluminum sheet.


Yes, that's a frozen pizza box, thanks Jared.


I don't have any sort of bending brake, so the sheet was bent with a combinations of quick-grip clamps and aluminum billets.



I made a cover for the other side of the battery (which it never had before):


I replaced the brake and shifter cables as well - the originals never had ferrules on either the cable housing ends or cable ends, so they were fraying and in terrible shape.  I did a test ride the evening before the show with a 50A current limit and didn't run into any issues.  I turnued it up to 75A the morning before the show and didn't test, fortunately it didn't blow up despite some coworkers' thrashing it.


I didn't take many pictures or videos at the show itself, but parking it next to a Ferrari wagon (I can't beleive that's even a thing) was entertaining.  Lots of test rides with no issues other than a set screw coming loose once.  It could definitely use a bit more motor controller - it's noticeably less peppy than before (with a 120A limit on the Kelly controller).  

November 25, 2022

Lathe DRO Installation

I installed a DRO on the Clausing.  I got Aikron scales and console - the LCD console, a 1 micron slim magnetic scale for the cross slide, and 5 micron standard width scale for the carriage.  So far I'm very happy with it - the user interface is better than some US-made, much more expensive DRO's I've used, and being able to store a library of tool offsets is a real game changer - all the lathes I've used until now have been communal (and thoroughly abused...), so even though some of them had DRO's none of them had proper tool libraries.  Tool libraries make turning so much more efficient, and for tolerances over 50um or so I don't even need to measure anything. 


Mocking up the cross slide scale and read head placement - In order to not loose any travel, I had to get a scale that was slightly longer than the cross slide.  To get the the scale mounting fasteners to overlap, I had to make a longer cover on the back side of the cross slide.

The chuck-side scale mounting is a little unusual - this video from Robin Renzetti was the inspiration for that - as he points out,  if the scale is directly under the tip of the tool, machine inaccuracies like curvature in the travel of the cross slide don't cause diameter error between the scale measurement and where the tool actually is.  And these magnetic scales are small enough that chuck interference isn't an issue.


The original cover was a casting, but was almost the same profile as some off the shelf steel u-channel, so that's what I used for the new cover:



The extrusion was too big for my tiny mill so I used a Bridgeport at work:


I fastened the u-channel to the cross slide and indicated the faces of the cross slide in for final machining to ensure the faces (especially the scale mounting face) were flush and parallel to the cross slide:


Before un-bolting the cover from the cross slide, I match-drilled a couple dowel pin holes and fixed them into the cross slide casting with retaining compound.  If I have to disassemble the cross slide at some point, it'll go back together repeatably.

Checking that the scale aligns with the cross slide travel - I did the vertical alignment by loosely tightening the mounting fasteners at each end and just tapping the the scale into alignment:

Thanks to the match-machining I did on the cross slide cover, I didn't have to do any shimming to get the z-alignment of the scale right:

Scale and read head both mounted:

I made a scale cover by gluing a neoprene rubber sheet to the cross slide with some Loctite 380.  Eventually I want to make a proper guard for the scale and proper way covers, but this does the job for now:

Mocking up the position of the carriage scale and read head on the back side of the machine:

To get the scale parallel to the lathe bed vertically, I sandwiched some bearings between a ground surface on the underside of the bed and the top of the scale:

Double checking the alignment with an indicator after mounting, but no adjustment required on this axis.  It took a few shims between the bed casting and scale in the other direction:

The read head was mounted with the stock hardware that came with the DRO, with a few modifications:


A couple p-clips hold down the cables and route them in a manageable direction:


The console was mounted to the power switch enclosure with a scrap piece of aluminum u-channel:


And here it is all set up:

November 2, 2022

Mini Cheetah Clone Teardown

Not long after my masters thesis went online, clones of the mini cheetah actuators started showing up on AliExpress/Alibaba.  Within another six months, there were clones of the whole robot.  A dream outcome for the project - early on in the project I joked that it would be great if I could buy the stuff I designed from China cheaper than I could make it for (hence the original name, HobbyKing Cheetah), but it really happened.  Now, a few years later, I have one of the clones.  

Bayley (who also has one of these robots)  put me in touch with someone from Dogotix (or as the manual calls it, Shenzhen Dogo Robot Technology Co., Ltd.).  He said something to the effect of "I'm not making them any more but my friend still is, we'll put one together for you".  And a month or so later a robot appeared.  Robots identical to the one I got seem to be available from a variety of places (AliExpress from multiple sellers, RobotDigg), so I'm still not sure if there's just one manufacture behind the scenes, or several building the exact same thing.

And here it is:



First power-up after reading the manual:


We have some miniature sheep (Ouessant) out behind my house (not my sheep, the owners of the property rent out the field out back).  I was curious how they'd react to the robot:


The backflip didn't work in the video above, where the battery was nearly dead, but worked once it was charged:


Since the robot works, time to take it apart.  On the operating table:


First hilarious mechanical detail, the feet are still squash balls:


The squash balls are stuck onto some SLA printed "socks", glued onto the lower leg  - just the way I did it on the original robot.  The later robots I made had easier to replace feet.


The major leg and actuator structures are all die cast!  Visible ejector pin marks:


Cracking the leg open - the robot has a 3-piece leg upper design, which on the original Mini Cheetah was a relic of the design of the teleoperation setup I built, which had one actuator on each side of the leg.  I originally thought the Mini Cheetah legs were going to have the same layout, but I ended moving things around.  But I'd already machined all the leg parts myself on the lab Haas, so I wasn't going to re-do all that work.  Amusing that they just copied this instead of doing a simpler 2-part clamshell like I did on the later robots.


More molding marks inside the upper leg structure:


The knee belt isn't a Gates belt like I used, and has fiberglass tensile members rather than Kevlar.  A few spare belts were shipped with the robot, that's probably why.  


Close-up of one of the belt tensioners - the roller is a drawn cup needle roller bearing, which isn't great since it doesn't evenly support the full width of the belt.  Tensioner looks a little anemic too, I wouldn't be surprised if they get bent (especially if the belts are upgraded to kevlar).  After breaking the first set  of tensioners on the original Mini Cheetah doing backflips, I made them way beefier and 7075.


One kind of neat change, the actuators have mounting features built-in so they can be axially stacked at the hip.  


Cracking the cap off the motor drive - more die casting:


Close-up of the motor drive.  It uses the same STM32F446RET6 micro and DRV8323RS gate driver I do, but different FETs and passives.  The power and CAN wiring are hard soldered into the motor drive PCB - I'm not a fan of that.  


There was a surprise on the underside of the motor drive - in the middle is an AMS AS5047 encoder IC (one I've used in the past but switch away from due to availability), but circling the encoder is another board with an array of analog hall sensors:


Through these holes in the rotor, you can see the corner of a bar magnet - the magnet is glued to the back of the planet carrier, on the output of the actuator.  This is actually a pretty neat trick - the analog hall sensors and bar magnet give rough output position - accurate enough to determine which rotation the input encoder is on relative to the the output.  For the Mini Cheetah, I didn't have any sort of output encoder, so the robot had to be turned on in a zero-configuration, within one rotor rotation (60 degrees at the output).  That would be totally unacceptable for a product, so it's neat to see this cheap solution that doesn't use a full-fledged output encoder. 


Cracking the covers open - looks like a bit of a wiring mess in there:


Closer view of the power management board.  In addition to the precharge circuit, there are a few interesting features here that I didn't have.  First, there's bus current sensing and over-current protection.  The big bug-like component on the right of the board is an Allegro hall effect current sensor.  The two DIP switches let you set the current limit (or turn it off, as you need to do for backflips...).  Also neat, there's an STM32F103 on the board, and an isolated CAN circuit copied from the SPIne board.  The CAN connector isn't populated, and I don't know if the micro even has any firmware on it, but presumably you could hook this into one of the CAN busses and log battery voltage and current.


Here's the robot propped up in a pin-up pose for accessing the side panel screws.  A pose the robots were frequently in for (dis)assembly back at the lab.


Nothing too exciting on the panels - a pair of switches for motor and computer power that plug into the power boards, and a chassis mount ethernet extension plugging into the computer



The battery on this robot is integrated rather than swappable (I guess you can't ship off-the-shelf drill batteries in a product), so there's a charging port on the outside:


All the panels removed.  Blue battery visible under the power board:


Rather than wiring harnesses from the legs straight to the power board, there are power/CAN distribution boards on both ends of the robot, with one XT30 connector and CAN connector per motor:



The computer (UP Board) and SPIne board (SPI to quad-CAN interface) is nearly unchanged from my design.  Curiously, they aren't running the CAN grounds to the actuators, even though the CAN interfaces are isolated.  I haven't probed around too closely, but it sure looks like the CAN transceivers on the computer side are just floating.  Seems kind of sketchy. 


Pulling off the power board I found this funny assembly issue - the coax cable running from the RC receiver to the antenna on the back of the robot somehow got snaked through the leads of the isolated power supply powering the computer:


6s LiPo battery built in - I didn't take it apart any further than this:


I was expecting a cell-phone grade IMU in this thing, but it actually has something kind of expensive, a YIS300.  Never heard of these before, but it seems similar to the Vectornav or Microstrain IMUs I used, with an on-board orientation estimate.  These seem to be a few hundred dollars at least on AliExpress, so not cheap.  The hot-glue based micro USB connector retention is... questionable.


That's about it - I didn't want to recalibrate anything, so I didn't take the actuators fully apart.  I don't have any concrete plans for the robot, but I'm sure it'll show up again here.