Archive for the 'SEGFAULT' Category

 

SEGFAULT Update 8: IT’S ALMOST THEEEERRRRRRREEEE

Jan 22, 2010 in Projects, Reference Posts, SEGFAULT

Hey Charles, what ever happened to Segfault?

You know, that scooter you were building? With those sensors and shit? That one with the big saw blade…. or was that your robot? Or whatever else you’re building?

It is true that Segfault was sidetracked so I could start on Cold Arbor. I suddenly felt the urge to revisit Segfault again after a lull in the parts shipment schedule for Arbor. I wanted to get at least something done by the end of IAP. It’s probably also wiser to get Segfault out of the way so I can continue work on Arbor with no other project distractions, right up until Motorama 2010.

And so I pulled Segfault out from its corner behind LOLrioKart. In the few weeks that I have neglected it, the MITERS industrial grunge fairy had already deposited a fine layer of her dusts and particles of unknown origin all over the frame. In the last Segfault episode, I finished the wheel hubs and got the vehicle supporting its own weight … to the extent that a Segway-like vehicle can without any electronics, that is. Essentially all the mechanical aspects of the vehicle were done.

Except one.

I had always just hand-waved the steering column’s mechanical detail, telling myself that I’ll take care of it when I get there. After all, how hard can it be to rig a few springs to keep the column centered?

Turns out the answer was very. The control box weighed several pounds, and it was on a lever of nearly 4 feet. So, I couldn’t find springs stiff enough at MITERS to provide a strong enough return force such that the whole handlebar assembly didn’t just become a severely underdamped harmonic oscillator. Design negligence played a part in this, because I didn’t even design in any provisions for mounting springs of any sort – just a hole in a piece of 80/20.

Hello, attention to detail.

Anyway, that was part of the reason for my ditching of Segfault. I moved onto Arbor while solutions to the centering problem slow-cooked to completion. The idea I ended up settling upon was using small gas springs, discovered while virtually rummaging the nether regions of Surplus Center.

I ordered these as a curiosity along with some sprockets and chain for Arbor. They are very basic bidirectionally damped, rod mount gas springs.

Alright, so how was I going to mount these? Because I didn’t design in any mounting provisions for actuators, I had to adapt around what existed in the Segfault frame. I decided to use the gas springs in a triangular arrangement, with the rod ends meeting at a single point on the column and mounted to two points on the longitudinal (front-to-back) rails next to the bearing blocks.

I DOTF’d these mounting “clips” for the piston body end out of aluminum bar. The width of the channel is the width of the longitudinal rails, and the depth just a little more than the thickness. These just slide onto the rails, and the downward force of preloaded gas springs keeps them in place. No further mechanical retention is needed.

Here they are installed. The column mounting point is provided by a shoulder screw and a convenient 80/20 channel nut, so I didn’t have to drill the extrusion.

A better view from the other side. I can’t just drop the gas springs in their fully extended position onto Segfault, because one side of the triangle must necessarily get longer as the column pivots about the base. So they had to be preloaded.

No way was I going to just tighten them down while holding onto them, so I enlisted the help of a bar clamp to squeeze the gas springs a half inch or so.

I needed to cut away a small piece of the top plate in order to clear the new gas springs in both directions of swing. So, feeling the lazy bug, I took a bandsaw to my Shiny Precision Waterjet Machined top plate. It *ALMOST* looks like I designed it that way to begin with!

Almost, meaning “wow, what happened here?”

On the same pass, I opened up the square hole that the column protruded from so I could quickly remove the top plate.

The Continued Tale of the Hardware Balancing Controller

Overall, SEGFAULT’s controller has three major components besides the Class D power amplifier that will drive the motors.

  • The complementary sensor frontend, which reads the angle of tilt of the vehicle
  • The PID compensator block, which attempts to hold the angle signal to zero
  • The steering controller, which creates a speed (voltage) differential from the single output of the PID controller and passes it to the two motor drivers. This differential allows the vehicle to turn.

I’ve already explored #1 pretty thoroughly in updates past. An uncomfortably high portion of this entire venture is me firing into the dark and seeing what happens. I don’t have a solid background in the EE side of things, especially not in the hardware, so the whole thing is one big learning adventure. I think I have gotten the complementary sensor rig working reliably enough to continue.

The next longshot of the project is the steering controller. To steer a Segway-type vehicle, the wheels have to rotate at different speeds. A steering controller would have to take the speed command being sent to the motors and superimpose a differential between the left and right sides.

Let’s hit all of these one step at a time. Here’s the latest wiring nest, labeled for convenience.

A. Version 4 of the Complementary Sensor

Documented in Update 5. It uses a MEMS accelerometer and rate gyroscope in unison to yield a roughly linear function of voltage and tilt angle.

B. Negative-5-voltificalator

A charge pump type circuit to create a -5 volt power supply rail for the op amps.

C. 30kHz Main PWM clock

I made a simple oscillator using a 74HC14 Schmitt Trigger inverter chip. This creates a 30,000Hz triangle wave that is centered roughly around 2.5 volts, with a peak-to-peak of roughly 1 volt. It will be the clock signal from which the motor driver signals are generated.

There’s no need to use such a large chip for exactly 1 function,  so I will probably hand this off to a 555 or something.

D. PID Input Level Shifter

The main control loops on the sensor board use a symmetric +/- 5 volt power supply with 0 volts being “straight up”. To be compatible with the rest of the logic, it needs to be turned into something between 0 and 5 volts, positive. Assuming the signal itself stays within the bounds of +/- 2.5 volts, which it should barring extraordinary circumstances (keeping in mind that the PWM triangle wave will only span 1 to 2 volts total), just adding 2.5 DC volts to the signal will take care of things.

This is done with a simple inverting summation circuit.

The arrangement is unity gain, so it’s just PID_INPUT + voltage at the pot. If the PID input is centered around 0 volts and the pot is set to 2.5, then the new center voltage is 2.5 volts.

But wait… why is that -5 volts going to the potentiometer there? I thought the point was to make the output positive?

Because this arrangement of components creates an inverting summer, if I just feed it + 2.5 volts, then the output will become -(2.5v + PID_INPUT). So the hackaround for this is to feed the circuit -2.5 volts, such that the output is -(-2.5v + PID_INPUT), which is to say, 2.5v – PID_INPUT.

This adds 1 layer of inversion to PID input which I’ll have to compensate for elsewhere. Or perhaps it will cause the system to feature the correct number of inversions again? Who knows…

E. The Differential Signal Generator

This is where the now level-shifted signal is split into left and right channels. With 1 potentiometer (eventually to be mounted to the handlebars), a small voltage is either added or subtracted to the motor command to generate two slightly different, but symmetric commands.

The potentiometer has inputs at +5 and -5 volts, making “center” 0 volts. Using either a unity gain summer or a unity gain subtractor (only slightly more complicated than swapping inputs on the op amp),  the voltage at this pot is superimposed onto the 2.5 volt centered motor command.

Thus the vehicle can spin in place assuming otherwise perfect balance (2.5 volt command), as the left and right channel motor commands would be, for example, 2.6 and 2.4 volts, or vice versa. If the pot is exactly centered… well, nothing happens. 2.5 +/- 0 is still 2.5.

This is why I like having symmetric power supplies. Zero is zero… is zero, which is zero.

F. +2 Comparators of PWM Generation

This is a fairly conventional PWM generator using the intersective method. The aforementioned triangle wave is fed into both comparators, while each individual one receives either the left side or right side signal.

So what the heck is “STP”? Besides “Standard Temperature and Pressure”, it stands for shoot-through protection. H-bridge drives need some form of this to prevent the top and bottom switches in each half from conducting at the same time, which leads to Bad Things happening. This was securely drilled and bolted into my head in 6.131.

Essentially, the STP circuit will force a delay between the top and bottom switches changing states. There are a few ways of doing this in hardware, most of them involving a bunch of inverter gates and diode-shunted low pass filters.

Huh?

Just plug this:

$ 1 5.0E-6 0.27182818284590454 46 5.0 50
I 272 288 352 288 0 0.5
w 272 176 352 176 0
r 352 176 416 176 0 1000.0
r 352 288 416 288 0 1000.0
c 416 176 416 288 0 5.0E-8 4.009206304089476
w 416 336 416 288 0
w 352 288 352 336 0
w 352 176 352 128 0
w 416 128 416 176 0
R 176 176 112 176 1 2 1000.0 2.5 2.5 0.0 0.5
w 176 176 176 288 0
I 416 176 496 176 0 0.5
I 416 288 496 288 0 0.5
p 496 176 544 176 0
p 496 288 544 288 0
g 544 176 544 224 0
g 544 288 544 336 0
d 352 128 416 128 1 0.805904783
d 352 336 416 336 1 0.805904783
w 272 176 176 176 0
w 176 288 272 288 0
o 13 1 0 38 8.183476519740355 4.8828125000000005E-155 0 -1
o 14 1 0 38 5.0 9.765625E-5 0 -1

into here. Observe the square wave pattern – never do the top and bottom square waves go HIGH (which would translate to switches turning on) at once!

In the course, I combined the triangle wave generator and STP for a single half bridge (two signals) into one 74HC14. The STP requires 5 inverters and the triangle wave only one, and the 74HC14 is a 6-inverter chip . But, this time, I will need two STP circuits, since I have two sides of the drive to deal with. Nothing special will happen – I’ll stick with what I know for now, and just use two 74HC14s.

Speaking of the two H-bridges, here they are!

A neat little design using the same IXYS half bridge driver chips that I bought for LOLrioKart’s last motor controller.

So how do I control 8 FETs with what amounts to 2 square waves? Locked-antiphase PWM is the secret. Each gate driver controls diagonally opposed FETs instead of two in the same half-bridge. To change the direction of the motor, I merely select the other gate driver. Locked Antiphase PWM is essentially doing this rapid switching of motor direction in complementary duty cycles.

If this complementary duty cycle is symmetric, i.e. 50/50, then the motor will remain still.

If it is off balance, e.g. 75/25 or 25/75, the motor will rotate with half maximum speed.

If the duty cycle is more like 99/1, then the motor will run very near maximum speed.

The final breakdown of the “digital” part of my analog controller is something like:

  • LEFT_STP and RIGHT_STP are “master duty cycle” commands, directly affected by the angle of the vehicle and my steering command input.
  • The STP circuit for LEFT_STP will create an inverted, slightly delayed version of itself. Let’s call this LEFT_STP’. Same goes for the right side.
  • LEFT_STP controls two diagonal legs of the left H-bridge, and LEFT_STP” controls the other two.
  • Hence, the diagonal legs will swap on-times with eachother, rapidly reversing the motor back and forth at 30,000hz.
  • Varying LEFT_STP and RIGHT_STP duty cycles will therefore cause the drive motors to spin.

Now that I’ve written the 1000 words, here’s a VIDEO!!!!

Some things to note about the video:

  • The controller itself was too tied up in wires to actually show on screen.
  • The two square waves are LEFT_STP and RIGHT_STP.
  • They grow and shrink in unison if I rock the controller around.
  • They grow and shrink oppositely if I turn the steering potentiometer.

I haven’t actually implemented the STP circuitry yet, or the actual PID part of the PID controller. Currently, a wire bridges the output of the sensor and the input to the level shifter. I suppose that amounts to a P of 1, I and D of 0.  So what you see on the screen is essentially 1:1 with what’s coming out of the sensors.

Left to go are prototyping the PID stage and the STP circuitry for both sides, then putting the entire mess onto some perf/vector/strip/veroboards! The Inaugural Faceplant draws ever closer!

AAAAAAHHHHHHHHHHHHHH WHAT THE FUCK IS THIS SHIT

SEGFAULT Update 7: The Hub of the Universe

Dec 15, 2009 in Projects, SEGFAULT

You can’t have drive wheels without hubs. Before I slinked back to Atlanta for two weeks, I wanted to get Segfault at least off the ground on its own two wheels. I have yet to actually lay out the control electronics or devise a way to center the steering column.That will probably happen after I return, since I’m not taking all of MITERS with me (but I’m guaranteed to, given the opportunity, trust me.)

To make large wheel hubs, you need large chunks of metal.

Which I have plenty of. The hubs were designed on the fly and are made from a 3″ diameter round of aluminum. I quickly popped off the basic shape and external features on the MITERS Old Mercedes (so called because of its completely beat-to-shit but flawlessly reliable nature) before transferring to the mill to drill the bolt circle.

Here’s an idea of the fit. After putting in the bolt circle, I took a trip over to the Formula SAE team shop and borrowed a keyway broach. The KOOOOOOOOOOOOOOOOLmorgen motors have  a 1/2″ keyed shaft, and I figured that using the existing keyway was better than hacking my own solution, or keypepgging.

No design of mine is complete without a Giant Set Screw. So here it is, sitting directly over the keyway. I discovered that the Bridgeport spindle has enough rotational inertia in low gear to crank a 1/2″ tap through half an inch of aluminum just by coasting.

That is why I am dismayed by “miniature” machine tools.

The wheels bolt on and…

AAAAAAAAAAHHHHHHHHHH

IT’S BALANCING ITSELF!

No, just kidding.

Here’s a view of the drive wheels, as featured in an earlier episode of Charles’ Amusing Non-Academic Distracting Adventures (CANADA). There is no additional support past the motor shafts, so here’s hoping those KOOOLmorgen motors have really stiff bearings.

Alright, so this thing isn’t really any good without handlebars to hold onto. At this point, I pulled out a diversionary project that I embarked on a few weeks ago to explore new means of lazily putting together pieces of metal.

The handlebars, just some pieces of 7/8″ diameter bike frame tubing, are attached. Hey, what’s that holding them on there – are those fillet welds?! Did MITERS finally get a TIG welder?

Has Charles finally broken down and welded something together, knowing that some times, sturctural integrity is more important than the ability to be easily disassembled?!

No, and yes. I remembered the existence of low temperature aluminum brazing solutions and decided to give it a run. The most promiment label in this field seems to be Durafix. Basically, the alloy rod is a high aluminum-content zinc material that melts at around 750°F and flows over bare aluminum metal. You’d heat the metals to be joined to greater than 750 degrees, higher seemingly better, then rub the rod over the joint to break the oxide layer. Using a stainless steel wire brush and abrading the joint results in better flow because the oxide layer disintegrates under mechanical pressure. The process is flux-free.

I have a hard time coming to terms with the no-flux part, but have also been having trouble finding high temperature (700+F) aluminum soldering flux. The vast majority seems to be designed for lead-tin soldering of aluminum which occurs at lower temperature. Whatever. The dude in the demo video could do it, so I can do it, right?

I saw that McMaster listed a similar “zinc-aluminum solder” in their catalog. I’m a stickler for instant gratification, and McMaster is about as close to instant as I’ll get this stuff. It came in a tube, in the form of bunch of 1/8″ diameter rods.

Leap of faith! Using my newfound joining abilities to put together random pieces of scrap aluminum, I discovered that…

  • You really need to get the parts HOLY FUCK HOT. After sufficient heat is applied, the stuff just sort of flows itself across the joint without much assistance. The problem is the HFH requires a massive heat source, and much time (like sitting there holding the torch for a minute or two), and so far, my torching ability is only limited to small or thin parts. The 1/8″ thick pieces took forever.
  • It seems too viscous to “wick” into tight joints, at least without the help of flux. It’s great for fillet and butt joints, but I don’t see it filling the entire inside surface of, say, a lap joint.
  • No, it’s not welding. There’s no mixing of the alloy with the parent aluminum, unless you melt the aluminum. Then you’re doing it wrong.
  • No, using a soldering iron doesn’t work, not even if your soldering iron is 15″ long, has a copper tip an inch in diameter, and has a 300 watt heating element. Clearly it just needs overvolting.

With that established, here’s the joint on the control box!

Eww. This is probably the most obnoxious overuse of the stuff on the planet. It looks like more of it got on irrelevant surfaces than in the actual joint. I think I dumped at least a third of a rod onto this thing.

What made it worse was that I didn’t have a good set of wire brushes. I totally wrecked two cheap plastic ones because… well, once the stainless wire gets hot, they just sort of melt off.  To do this right, I’d need a good set of wood or metal handled brushes.

As I hinted at before, the tab-and-slot construction of the control box itself is *very* amenable to this type of unwelding.

That looks MUCH better.

I did a few things differently on this joint. I thoroughly sanded and brushed down both surfaces so there is minimum surface oxide present. I held the torch to the pieces for about two minutes, and made sure the whole joint was evenly heated by moving the torch around. This was tested just be pushing the rod against the joint to see where it melted the easiest. Then I added the alloy kind of like how you’d add filler metal to a TIG joint (slightly hard to describe past “poke-swirl-move-repeat”) .

The process was repeated for the inside joints. I made sure that there was metal holding onto metal on both sides of the control box (i.e. it’s two fillets, not just a butt joint).

That worked substantially better, and it was without in-process brushing. Still a bit globbier than I’d like it, but that’s something which gets better with practice.

Completed control box!

I’m very satisfied. Time will tell how my crazy unwelding job holds up.

Alright, it’s glamor shot time!

Yes, this picture is totally posed. How’d you know?

And one more, showing the SHIIIIIIIIIIIINY aluminum top plate.

SEGFAULT Update 6: The Impending WHEE-SPLAT Gets Closer

Dec 05, 2009 in Projects, SEGFAULT

With the balancing circuit prototype demonstrating consistent and non-glitchy angle indication, I’m picking up the slack on the mechanicals. Work continues with the frame being fully assembled, motors mounted, and the tilting handlebar essentially finished! I’m now just missing the handlebar tubes themselves and some big chunks of aluminum to carve the wheel hubs out of.

Things are on track for the Maiden Faceplant some time in early January. Meanwhile…

When you make fancy waterjet-cut puzzle frames, you shouldn’t forget, like me, to lay out the fastener holes that will put them together.

In this case, I accidentally the front and rear structural screw holes. So it was back to the old center punch and caliscribing, followed by some quick drill press work. Manual fabrication… can you imagine that?

While I had the temporarily-fastened frame taken back apart to drill the new baseplate holes, I decided to fill the empty motor cages with motors. The KOOOOOOLmorgen motors are sandwiched between the two rails, mounted on both ends for maximum load carrying ability. I need high stiffness in the motor mounts because of the single-supported axles.

Rinse and repeat for both motors. After adding the requisite hardware, I should not have to fiddle with the bottom structure ever again. At least, until something breaks.

In this image, the “pillow blocks” for the tilting handlebar are already mounted in place. Said handlebar assembly will pivot at this location a few degrees to either side, and the rotation will be read by a potentiometer and translated into a differential motor speed to let the vehicle turn.

The pivot pin is a 1/2″ steel rod with a milled flat to position the handlebar and an axial center hole to couple to the feedback pot.

By pure chance, I managed to select a piece of 1/2″ alloy or tool steel. What a total bitch to machine – I had to break out the carbide to mash through it- but the shaft took on an almost polished appearance after a run through with 1000 grit sandpaper. I guess that’s why they grind tools instead of mill them?

The complement to the above is a single 40″ stick of 80/20 structural extrusion, the 1″ flavor. Conveniently enough, the extrusion has a center hole that is the correct diameter to be tapped 1/4″-20. This meant I had a set screw attachment solution practically ready to go.

To interface this with the pivot pin, I just crammed a 1/2″ cutter through the extrusion from one side to the other.

A view inside. Visible are the pivot pin (kinda…), its +2 Set Screw Holes of Potentiometer Retaining, the 80/20 handle stick, and some spacers. A big cap screw is cranked down the center hole to lock the pieces together.

Another view of the assembly. I need to come up with a way to spring load the stick such that it tends to center itself. I actually couldn’t scrounge either 1) two matching springs or 2) stiff enough springs or 3) springs of a workable physical dimension, so a hardware store run will be made in the near future.

Without the centering, I’d have a hell of a time actually trying to operate the thing.

On the other end of the handle stick is the control box. It’s retained by a single cap screw, threaded into the 80/20 center hole. This isn’t particularly structural, but… it doesn’t need to be. Right?

The control box will never have to support the full vehicle weight, or any number over, right?

Right? :(

Oh, the 4 perimeter holes don’t serve a mechanical purpose – they are only there to pass wires through. They are at the same distance from the center as the cavities in the 80/20 X profile, to encourage clean wiring.

Speaking of the control box… I finally got my SHINY ALUMINUM KNOBS from my most recent favorite Sketchy-ass Ebay Electronics Dealer (SEED). I purchased a grand total of 20. They’ll be useful for future knobbery, but Segfault only needs 3. The other Big Knob was scrounged. Besides the knobs, the same order brought in a handful of multiturn trim potentiometers and a stack of single-sided protoboard.

So the user interface is now complete, with exception of the power switch. Can you find the power switch? I can’t either right now, because it doesn’t exist, but the ultimate goal is to hide it in the most obscure location possible, characteristic of older electronics equipment (designed by engineers rather than product designers, I imagine). For instance, all the MITERS oscilloscopes have their power switches integrated as a small selectable section of the scale illumination & beam intensity knob, hidden amongst the other knobs.

Here I am trying to think of some dastardly way to make the zero adjustment screw on the degree-o-meter the main power switch.

Okay, enough is enough – here’s where SEGFAULT stands (LOL PUN) as of today.

Missing: things which herd electrons, wheels, and handlebars. And cool glowy lights.

I’ll be making the wheel hubs soon, hopefully out of one of my “stock” hugeluminum billets. The handlebars are easy – they can be just about any steel or aluminum tube. I should at least be able to stand on this thing and practice static balancing soon. Then it’s back to the electronics!

Here’s a “global perspective” picture  showing the proportions of SEGFAULT in relation to other things in MITERS. It’s a good 4 feet tall without wheels.  The handlebar position will be higher than real Segways, if nothing else but to lessen the sensation of standing on a pogo stick.

MORE TO COME!

SEGFAULT Update 5: Electric something-or-other

Nov 29, 2009 in Projects, 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.

TOTALLY. 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

Segfault Update 4: Fancy Ass-Inclinometer Lives

Nov 16, 2009 in Projects, Reference Posts, SEGFAULT

As promised, I went back to revise the sensor logic for Segfault. I am proud to annouce that I now have a stupidly overcomplicated inclinometer.

WOOOHOOO I AM SO SWITCHING MAJORS TO COURSE 6

Just kidding.

The first order of business in the new construction is creating negative 5 volts. As I mentioned before, having balanced power supply rails is tantamount to approaching more theoretical performance from op-amps.And when you’re used to crashing through EE projects like very small silicon-based china shops, textbook debugging is invaluable.

So here’s the negative-5-voltificalator.

It’s a 555-based switched-capacitor dealie found all over the blagotubes in myriad configurations. I ran the 555 at 30kHz. Maybe it should be faster, maybe not – I didn’t run any numbers, like a bad engineer. The converter takes +12 volts and yields -11 volts or so. Both are regulated using the appropriate 5 volt regulators to yield stable, double-sided rails.

Who knew it was such a pain in the ass to get a negative voltage? Why can’t I just plug it in backwards?!

So much smaller. My goal with this board was to put everything pertaining to sensor signal processing on it so I can make a simple robot-on-a-stick to test the concept. It took a while to cram the componenets that tightly. The circuit up to this point produces a voltage out that corresponds to tilt angle.

No, I didn’t calculate how many volts per radian. Bear with me as I machine-gun into the darkness with exploding electrolytic capacitors.

The hardware configuration of the sensors means that I’d actually have to run the breadboard edgewise on a robot (sensors at the bottom, edges facing front and rear). Segfault itself will have the sensors mounted more appropriately.

Hey, let’s take a look at the outpuHOLY SHIT WHAT IS THAT I DONT EVEN

Well, that’s certainly disappointing. It looks like at least some part of the -5voltificator’s 30,000hz switching frequency is making it through to the output. Strange, because it doesn’t happen anywhere else. What the heck is this? Shoot-through? That’s 3 volts plateau-to-abyss!

Piling bypass caps by the gross onto the circuit didn’t help one bit, so I tried pumping up the volume on the switching converter…

…to around 220kHz. I figure I could knock it out of the range of the op-amp’s break frequency. But no, the LMC6484 is unity gain up to 1.5Mhz.

What did the ripple look like now? Maybe I knocked it instead out of the range of whatever is resonating.

Uhh, no. In fact, I think it got closer to resonating, because the wave is now significantly more sine-like. The ripple has been reduced to around 1 volt p/p.

That’s still pretty intense, though. This can probably be lowpass filtered out without affecting the circuit operation because it occurs at hundreds of kHz, and I will hopefully not be moving fast enough to warrant conveying angle information that fast. Since the motor driver PWM frequency will probably be around 20kHz, this ripple might not even matter because the motor drivers will “sample” much slower. I use “sample” loosely here, as techically a PWM comparator would be running all the time.

Oh well. I’ll just crank the horizontal sweep way up to 1ms and pretend it isn’t there. Here’s a video demonstrating quite a few improvements over the last sensor rig:

  • No nonlinearity or weirdness around the zero crossing! Probably because zero is zero, and I properly buffered the sensor outputs.
  • Symmetrical about zero!
  • No drift! If the gyro integrator is too far off base, the DC offset of the signal increases slightly and that’s it. Same for the accelerometer. The last version would slowly drift – not significantly, ultimately settling at a small DC value, but still visibly drift.
  • Real zeroing, not “leak rate control”. The accelerometer zeroing potentiometer will be available on the user panel to adjust the rest angle. The gyro zero will be glued shut in the position of least drift. I already mined every 10-turn miniature precision pot at MITERS for this.

It’s almost time to put together the bot-on-a-stick. Since this is comparatively easy, mechanical work on the Segfault chassis is continuing. In Course 2 news,

Shazam.

After round 1 of Segfault JetMachining™, the baseplate and some minor frame structral components are done. The parts on the left are spacers for the motor mounts, and the little things on the right are vertical standoffs for the eventual upper deck, for which aluminum plate has yet to arrive.

Yes, I did cut that whole piece out from a single large sheet of aluminum.

Something is just not right when your scrap weighs more than the part. I’m sorry, Kaiser and Alcoa. I bet you’re mad at me for wasting good metal like that.

Actually, who the hell am I kidding – you probably want me to keep making large, flat unibodies so I’ll buy more aluminum.

The bigger squares will be reused for little widgets.

Hey, it’s the upper control box! This is looking pretty crazy. After a few knocks with a belt sander, the tabs and slots just sort of fell into eachother.

They will be assembled by t-nutting, but this is the sort of thing I could seam weld and get great results from.

Check THIS out! The 7-LED battery bar graph slides into its final mounting location. There are two red LEDs, a yellow, and three greens. LED bar graphs on anything just makes it look epic.

The midpoint shown here is about 34 volts or so. All the LEDs are lit at 40 volts, and all go out at about 27. Since the Koooooooolmorgen motors are actually rated for 33 volts, the midpoint is an excellent “time-to-go-find-a-charger” reference.

The chase is on. The most difficult part of the project as I envisioned it, the analog inclinometer, has been conquered. More aluminum is on the way, and the end of the semester draws close.

Bot the fuck on.