SEGFAULT Update 5: Electric something-or-other

Sunday, November 29th, 2009 @ 13:40 | Project Build Reports, SEGFAULT

sup dawg we heard u like segways so we put a segway on your segway so you can balance while you balance

Would two segways, one stacked on the other, demonstrate dynamics of double inverted pendula? Maybe I’ll find out soon.  Segfault is edging ever closer to completion. The end of term is quickly approaching, and I’ll be effectively out of commission (read: back in Georgia) from December 16th until the end of the year. I’m not sure if I can get the whole thing done by then, but plan for the Inaugural Faceplant to occur in the first half of January.

Course 2

I wasted more aluminum cut out the last structural frame members.

The motor mounts (trapezoidal pieces) form the bottom structure of the vehicle. Since all the force from me standing on the thing will end up being supported by the motor and wheels, the motor is extremely well secured – screwed in from both sides, then structurally reinforced by the cross pieces.

I didn’t pop the cutout scrap off the front and back rails before taking the picture. They were left tabbed (as were most cutouts, just zoom in on the picture) in order to prevent nozzle and workpiece from attempting to occupy the same volume in 3-space.

Civil engineers would note that the trussing on the frame is completely bogus. They would be right, because the number one goal was to reduce weight, not be overtly structural.

I also cut the single shiniest piece of metal that I have ever handled:

Check it out! The top plate is a single piece of 1/8″ aluminum diamond tread plate. Too bad this is going to get banged up and scratched, because it’s so incredibly shiny.

To promote tight tolerances and to avoid sand damage to the incredibly shinyness, the piece was cut diamond-side-down.  The SEGFAULT cutout will eventually be covered on the underside by something high-contrast, or perhaps glowy.

Time to start putting things together!

Here are the “risers” being attached. Along with the front and rear, they form most of the loadbearing upper structure. I was planning to have two more rails in the middle, but elected to keep the aluminum for something more productive later on. The holes left will probably be filled by standoffs.

As usual, everything is t-nutted, so it went together quickly.

Uh oh. The new 3/8″ parts required alot of sanding and fitting. It turned out that my 3/8″ aluminum (0.375″) was actually 10mm aluminum (0.390″).

Wow, that’s a  hell of a press fit. Even worse, the waterjet nozzle offset distance was incorrect, from Previous User Syndrome or otherwise. This was a machine setting I did not mess with because it’s usually set by the shop head. Unfortunately, all the slots finished nearly 0.01 undersize on each linear dimension. That means my .375″ slot was actually closer to .360 than anything else.

I gave in, and instead of riding the belt sander all night, I threw the 3/8″ pieces on the mill and shaved off some of the tab thickness.

To make sure I can maintain a dead straight cut across something almost 20 inches long, I used a Neato Machining Trick that I picked up off the intergoogles.  An accurate steel rod of greater diameter than the width of the machine table T-slots is dropped into one of said slots, where it acts as a really long parallel. Tables are generally ground and finished dead square to the machine axis, so it creates a reference surface to back your long part against.

After abrading the tabs more, I dropped a motor into the mounts to see if everything actually fits.

Answer: Yes.

T-nuts get installed with a quick mallet whack. #10 square nuts are 3/8″ wide, which makes them a perfect flush fit for 3/8″ aluminum. The same works for #6 square nuts and 5/16″ aluminum.

Repeat once again, and the bottom half of the frame is done! I didn’t have the correct screws to put everything together, so had to scrounge a bit to find some temporary hardware. This is fortunate, because i forgot to lay out the holes in the bottom plate for the front and back.

Way to go me. That’s some drill press work to come.

That’s enough for now. The frame achieved enough freestanding structural integrity such that I was able to hop on it and jump up and down with no ill effect – just the requisite bowing of the top plate from over two square feet of unsupported sheet metal.

Check out the degree-o-meter and nascent gain knobs installed in the control box!

Fellow MITERers noted that this should be a permanent installation for SEGFAULT; that is, I shouldn’t have handle bars, but rather have to sit on the platform (which is actually expansive enough to allow comfortable sitting).

This will probably mung around with the dynamics, but isn’t unreasonable.

More to come! Hubs! Wheels! Motors! Actual machining because I haven’t made a real part at MITERS in a month!

Course 6

While waiting to hog the waterjet, I continued investigation of the analog balancing circuit. So here’s where things stand:

Version 2, however, did suffer from severe electrical noise issues from the switching converter. I also had trouble keeping the gyro integrator from pegging and having poor transient response. Despite building “drift correction” circuits, the integrating capacitor would either hover at some DC level or very slowly float towards the plus or mins rails. Attempts to zero the integrator by controlling the gyro reference voltage only worked for 1 power cycle – at the next turn-on, it would fly away again.

This only occured at near DC inputs – that is, when it was standing still. In the Version 2 video, I essentially kept things moving the whole time, so there wasn’t enough time for the integrator to wander. While in operation SEGFAULT would be considered a dynamic system and thus won’t ever see DC inputs, just staying still (no input? zero DC input?) would be troublesome because there would always be an “angle” being reported.

So, how to fix that? First, a picture of version 3, and its associated schematic.

First off, yes, I know, that’s a crapton of op-amps and half of them COULD probably go, but I opted to buffer what I could in order to not have mysterious loading issues crop up.

First-and-a-half, the switching noise has been greatly attenuated by adding lots of bulk capacitance, while keeping the switching frequency at something like 200kHz.

Secondly, the gyro now has two different stages of AC coupling such that the integrator only sees AC. It may find its own happy DC offset without affecting the rest of the circuit!

The epiphany that led to this circuit design was my realization that the gyro’s only purpose is to respond to high frequency inputs that would cause false readings in the accelerometer. It should never be working at DC, because unchanging angular velocity in this case means the vehicle is rotating out of control or standing still. In one case, I’m boned, and the other is taken care of by the acclerometer.

This meant that the gyro could be safely high pass filtered. High pass filtering implicitly decouples the output of the circuit from the DC level of the input. In the schematic, IC1D buffers a passive RC HPF with a corner frequency of about 0.6hz (REAL SLOW).

IC1C and IC1D form kind of a poor arrangement of components from an EE perspective, because they could be replaced by 1 active filter, but it’s okay for now. IC1C was originally there because I found the gyro incapable of driving the RC circuit. IC2C is the integrator, which is also a form of low pass filter. It is followed by one more stage of HPF with the same time constant as the first, in order to remove whatever DC offset the integrator might introduce.

Unfortunately, none of this actually worked. The actual behavior demonstrated by Version 3 was closer to an angular accelerometer. What the flick?

So I mentioned that integrators are actually low pass filters. The relationship goes the other way also – under certain circumstances, high pass filters are … uhh, derivators. Derivativizers. Derivatificators. What happens is that integrators only “integrate” at frequencies significantly higher than that which is associated with their time constant. Such a circuit with a time constant RC = 1 will only act like an integrator for circular frequencies much higher than 1 radian per second – 10 times the break frequency seems to be the rule of thumb.

I threw everything onto MATLAB to run the numbers. Above is the Bode Plot of the integrator comprising IC2C, C3, and R7. The break frequency of this system is 1 / R7 C3, or 10 radians per second. So, for frequencies substantially greater, it acts as an integrator. This is shown above. The phase is a flat +90 degrees, which is indicative of ideal integration.

This is the HPF that links the stages of the gyro circuit together. There are two in total, which just makes the slops steeper. High pass filters act as differentiators for frequencies substantially less than their 1/RC break frequency. For both filters, said frequency is 1 / (560,000 * 470E-9) = 3.79 radians per second.

So, for a band between about 1 and 3.79 radians per second, my math functions are fighting eachother.

For any frequency less than 1 radian per second, I have an angular accelerometer (because d/dt of velocity is acceleration.

Only for frequencies substantially higher than 3.79 rad/s do I have something meaninfgul. Here’s the bode plot of the entire bottom half of the schematic, demonstrating these characteristics!

Sweet! I have THREE SENSORS IN ONE! An angular accelerometer for very low frequencies (< 1 radian per second, or 1/6Hz-ish), a gyro for medium ones, and an inclinometer for higher ones.

That’s WRONG.


To fix this, I made version 4:

It doesn’t look that different. In fact, it’s essentially the same circuit. It’s just that the filter values have been substantially modified to yield proper behavior. I made the following changes:

  • Moved the HPF break frequency to about 10Hz
  • Moved the integrator break frequency to 1Hz
  • Added “pre-gain” to the gyro output to compensate for the severe magnitude attenuation
  • Modified the accelerometer zero set circuitry so that it… uhh, works.

I can say that I’m approaching satisfaction.  For movements that contain frequency components above 10Hz (actually more like 3 or 4, but x10 is the rule of thumb for effective attenuation of unwanted freqs), the gyro contributes much of the resulting output. The accelerometer’s bandwidth-limiting LPF is also set for 10Hz, so they form rough complements.

Here’s a video of version 4 shaking and baking! It seems that the gyro stage needs more amplification, but otherwise the response is decently quick and clean. I should never be shaking that fast while on the vehicle anyway. Notice that all the time constants are absurdly low by signal processing standards because SEGFAULT is a very massive mechanical system, and the same differential equations that govern mechanical systems dictate that big things move slower.

oh man oh man it’s almost there



  • Dragon Con 2018: Postmodern Robotics Comes Home With a Vengeance
  • All-Vans Quality of Life Rollup – Mid 2018 to Now
  • Roll Cake 3: The Build!
  • The Roll Cake that Won’t Die: Roll Cake 3.0
  • Operation Bad Timing II: The Epilogue
  • Operation Bad Timing II: Chinesium Rising; The Zero-Delta-Entropy Point
  • Operation Bad Timing II: The Soundtrack – Pistons and Valves and Seals, Oh My (God Everything Sucks)
  • Operation Bad Timing II: The Soundtrack; or Zen and the Art of Van Maintenance
  • What’s Inside that Surplus Center Bomb Hoist Motor? A Quick Break from BattleBots with Beyond Unboxing
  • The Overhaul Design and Build Series, Part 5: “Don’t you have to ship this on Wednesday, dude?”

    3 Responses to “SEGFAULT Update 5: Electric something-or-other”

    1. MarkMellors Says:

      Looking good (if a bit sharp).
      Your filtering approach sounds a bit like a Kalman Filter.
      Are you desinging/modelling the whole control system or just taking educated guesses?

    2. the chuxxor Says:

      More like educated stabs in the dark. I have a general idea of what needs to happen, and am relying mostly on introductory electronics textbooks and the Intertubes to confirm or reject my preconceptions.

      I’m satisfied with the basic concept of the circuit, and think only the gains and filter values need changing around at this point.

    3. the chuxxor Says:

      The MATLAB modeling was retroactive so I could actually put some numbers to guesses. I don’t think I’ll design everything else out first.