A few weeks ago (at the end of May) I started to feel my brake pedal sinking towards the floor, which obviously was a bad sign. It took a while to notice a loss of braking authority and I stopped driving. What I noticed was the front brakes not functioning as strongly as the rear brakes, so I started looking for a leak. While I've been told it's not common for the master cylinder to be the culprit, that's where I started. I found the issue almost immediately. There was a strange goop directly under the master cylinder pin, which smelled distinctly of brake fluid.

I got a AAA tow from my apartment back to my parents house, and the work began, which quickly devolved into a lot more than a master cylinder replacement over a single weekend.

cleaning up the pedal cluster and floorpan

I started by removing the pedal cluster and the old master cylinder, which was very crusty. It looks like it's been there a while. Not sure if it's original (I think that would be quite a miracle), but seeing the VW logo on the cylinder was a nice little surprise.

image

These strange crystals had formed on the pedal cluster, alongside a good amount of rust and dirt. I might be wrong, but I think the crystals might be crystalized brake fluid.

image

I cleaned out all of the grime that was on the floor pan underneath the pedal cluster with a vacuum and a wire brush. There was some rust forming on the floor pan and inside of the front frame cross brace, so I painted it with some rust converter, which turns the rust into an black coating that inhibits rust and can be painted. It paints on white, then turns into a black surface. After the rust converter had done its magic I gave the area a coat of black Rust-Oleum spray paint.

I completely dissassembled the pedal cluster and cleaned all of the parts with some degreaser and a wire brush. During reassembly I applied new grease to the shaft of the clutch pedal hook.

image

image

image

image

image

installing the new master cylinder

I don't have many photos of the process, but at this point I ran a new hard brake down the outside of the body tunnel (inside the car). It took quite a bit of effort to get all of the bends in the right place. There's a tee in the rear which splits the brake line off to the left and right brakes in the rear. It's in the worst place, sitting on a flimsy l-bracket pushed up against the bottom side of the luggage tray (part of the body of the car). It took a lot of attempts to get the new brake line bent in such a way that it would thread into the connector.

I tried one or two different bench bleeding methods but wasn't having much success. I don't have any photos of the process because I was too busy trying to keep brake fluid from spilling everywhere. What I ended up doing (at the suggestion of my dad) was installing the cylinder in the car, installing the pressure switches, plugging off the two outlet ports, and connecting the cylinder to the reservoir. I used a vacuum tool to pull a slight vacuum on the fluid reservoir while I pushed in the piston in the master cylinder. This pulls all of the air (or most of it) out of the cylinder.

The main brake line I got in the brake line replacement kit was a bit too long, which made the bend near the master cylinder a little more extreme than I would have liked. But it'll be fine.

image

I installed the pedal cluster back and bled the brakes, and there still wasn't a great amount of braking power. I think in the end I didn't bleed nearly as much air out of the system as I should (I also didn't set the star adjusters to get the shoes as close to the drums as they should be), but at the time I figured that the lack of "hardness" in the pedal was a sign that the brake shoes needed to be replaced. I hadn't replaced them since purchasing the car four years ago, and I had no idea how old they were, so I figured now would be the time to do a brake overhaul. Maybe a premature conclusion on my part which made more work than necessary, and I probably should have stopped to assess the situation a bit more, but what's done is done.

strut and shock removal

I removed all four brake drums, shoes, springs, slave cylinders, and backing plates. At which point, I thought it would be a good time to replace my struts and shocks, since I had such easy access to them. In the front, this involved unbolting the steering kuckle from the ball joint and unbolting the strut tower bearing from inside of the trunk. My dad was a huge help with this. We used a spring compressor to loosen the tension on the spring to remove the entire strut tower assembly as one unit.

image

To remove the nut that holds the strut piston inside the strut tower bearing (which allows the strut to rotate while still being connected to the frame of the car) an offset wrench is typically used. We didn't have one large enough, but my dad did have this kit of offset sockets that are intended for removing O2 sensors, which worked great.

image

image

The bottom of the strut tower was stuck inside the steering knuckle and didn't want to budge. My dad and I tried lots of prying and PB Blaster before getting out the torch and a the big puller to get it un-stuck.

image

Removing the rear shocks was a much easier process. Two bolts and they were out. When removing the rear shocks, I noticed a different between the existing ones and the replacements I purchased. The replacements had a longer "tube" in the bottom mount, which would not fit into the existing mount for the shock, or so I thought. Here's what the new shock looks like compared to the old shock, and here's how the old shock was mounted into the car.

image

image

This didn't seem right, and I was pretty certain I had purchased the right shock. I messaged a member of my local VW group and asked him what his rear shock mount looked like, sending along the photos above. He affirmed my fears. A previous owner or shop had purchased the wrong shock, and instead of finding the correct part, dropped it in and tightened down on the bolts bending the mount out of its square shape. I ended up fixing this, which I'll show in a bit.

After removing both struts and both shocks, it was easy to tell they needed to replaced. All of the oil had leaked into the strut towers from the two struts and they were very easy to move compared to the new struts. The old shocks were potentially in better shape but they were still in very poor condition.

repainting everything

I took all of the brake and suspension parts to a local sandblaster and had them taken back down to the bare metal. This can be done by hand, but it's a time consuming process and some small nooks and crannies are impossible to get to with a wire brush. I got all of these parts sandblasted in under an hour and it only cost about fifty dollars. I mounted them all on this swing trestle we have sitting in our backyard and painted them all with the cheap basic matte black Rust-Oleum paint, which I have had really great results with.

I also painted the new rear brake drums in a high-temp black grill paint, cleaning them thoroughly with brake cleaner and degreaser. My dad also cleaned up the strut bearings and I repainted them as well. I had decided last minute to upgrade to disc brakes in the front, so I painted the calipers as well.

image

image

image

image

image

reinstalling struts, disc brakes

The struts were installed back in the strut towers and clamped in with the clamping ring. My dad and I actually fabricated a custom face spanner with some c-channel and two nuts ground square to tighten these. I installed new ball joints as well. I don't have many pictures from the rest of the installation process as it was a two person job. My dad and I compressed the springs onto the strut towers and secured the strut tower into the ball joint (along with the steering knuckle) and the strut tower bearing as described in the Bently repair manual. I replaced the strut dust cover and rubber stops with new ones from JBugs.

image

image

The disc brake calipers mount onto brackets that take the place of the old drum brake backing plates. I installed these, installed new wheel bearings into the discs, mounted the discs onto the front spindles, mounted the calipers and installed the brake shoes. I also replaced the soft lines in the front, and routed new hard lines from the soft lines to the calipers. I'm pretty proud of my routing.

image

Here's an overview of all of the work done on the front suspension and brakes, just before the wheel went on (don't worry, I connected the steering linkage).

image

rear shock installation

At a recommendation from (Clyde)[https://clydesaircooled.com/] I used a piece of threaded rod with some nuts to stretch out the lower rear shock mounts back to the correct shape. It worked incredibly well. Installation of the shocks was as easy as removal, just two bolts.

image

image

rear brake rebuild

I reinstalled the backing plates in the rear, adding some Permatex aviation gasket maker (No.3, the same stuff I used to join my engine case halves) between the swing arm and the backing plate, and between the backing plate and the bearing cover. There should be gaskets here, but they weren't there when I took the backing plate and bearing cover plate off. I had seen a few people online use gasket maker with no problems, so I went with it. I added some extra bearing grease to the inside of the bearing cover. I installed new slave cylinders, new pads, and new springs and pins.

It's probably about time for a rebuild of the CV joints and rear bearings, but I decided to leave that to another day.

image

routing rear brake lines, installing suspension stops

I installed new soft lines in the rear as well as new hard lines from the soft lines to the slave cylinders (I actually replaced every hard brake line in the car except for the hard line that goes across the top of the transmission and the hard line that goes from the drivers side to the passengers side in the front). I also installed new suspension stops in the rear as the existing ones were falling apart being held together with bits of wire. I tried my hardest to get these on by hand but was having no luck. I came up with this way of compressing them on using a c-clamp. I put a bit of lithium grease on the metal nub to make the rubber slide easier over it.

You can also see the routing of the new hard line in the rear.

image

image

finishing up

It took a while to bleed all of the air out of the lines and adjust the drums correctly. After bleeding all of the air out of the system the brakes were orders of magnitude better than they have ever been. However, the most rewarding part of the work was probably the improved ride quality. It was night and day. The car handles much better than ever before and going over potholes around Atlanta is almost an enjoyable experience now.

I think that about wraps things up.


05/10/2017

graduated!

Just thought I'd share this photo I got with my brother.

image


board layout (wsb)

After designing both boards, it was time for layout. I really have to hand it to my teammate Evan here. He's never laid out a board before, so I sat with him throughout the process, giving little hints here and there and he had no trouble routing the CCU board. For his board, we decided to go two layer, since the number of components was much smaller and there wasn't any circuitry that would be affected by poor power supply routing. For the sensor interface board, I decided to do a four layer layout. The extra layers really helped speed up the process (as I didn't have to worry too hard about power or ground connections) and helped me make the board pretty dense.

Here's what Eagle gave me when first generating the board file. This consumed me for about two weeks.

image

I actually really missed being constrained to a physical size. With the business card board, I knew that I wanted it to be a certain dimension. In this case, the dimension of the board was just whatever I could make it work out to. I basically started in a corner, decided that I wanted all of the connectors on a single edge of the board, and went from there, stacking things in as I could. Before I did any layout, I grouped all of the components together with their nearest logical neighbors on the schematic. This meant I could route bits in little sections and then bring them into the board as a group. Here are some progress photos.

image

image

image

Here's the finished layout. I ended up fitting 400 parts in just under a 2.5 inch square, which I was quite proud of.

image

image

Throughout the layout process, I threw away some of the connectors I had on the board. I originally brought all of the sensor supply voltages out to a connector, but I didn't see much purpose in it after thinking about it for a while. I also removed the DC power jack and kept only the one power connector. I also removed a lot of test points, a decision I sort of regretted while debugging the board.

sending the boards to fab

At this point, we had only four weeks or so before the expo, so I was in full crunch-mode. What terrified me was waiting for the boards to come in the mail. OshPark has a rush service for two layer boards, but doesn't have the same option for four layer boards. We went with the rush service from OshPark for the two-layer CCU board, and then I sent the WSB boards to PCB minions at the recommendation of the senior design lab manager (who handles all of the procurement for the teams). I wanted to go with PCB Zone, but unfortunately the senior design ordering guidelines prohibit the use of PayPal, which was the only method of payment available on their website.

image

While I was waiting on the boards, I ordered some stencils from OSH Stencils.

image

ordering the parts

This was a huge effort. We manually combined the auto-generated BOMs from each board, as each shared a good amount of parts. What further complicated the ordering process was parts that had various qualifiers at the end that I didn't specify in the packages I made for the schematic library. I ended up going through each page of the schematic, covering each part with a rectangle when I had confirmed that it was in the BOM and that the value and link to Digikey was correct. I added ordering margin to each part to ensure we had enough if we messed up a few.

Once the spreadsheet was done, actually assembling a Digikey cart was another hurdle. I added the parts one by one, double checking the quantity in each line item. After each part was added to the cart, I colored a square red in the spreadsheet to confirm that I had actually placed the parts into the cart.

image

assembling the boards

Assembling the boards took a solid week of 12+ hour days in the lab with my group. While I had worked mostly alone on the design of the sensor boards, and with only Evan on the design of the central control board, the entire team came together and really helped get these things together and working.

I realized almost immediately that I had made an error in ordering the stencils. There was an incredible amount of bleeding, making the solder paste look more like a contiguous blob rather than distinct rectangles. I realized I forgot to shrink the cream layer in the design rules inside eagle. This meant that the holes in the stencil were the identical in size as the pads. I reordered the stencils, but in the meantime we made it work. You can see the difference below in the two different stencils, old on the left, new on the right.

image

I made this jig out of some pieces of acrylic that were laying around to hold the board off the table while the solder paste was applied to the back side of the board. Pictured are Evan's boards from Oshpark.

image

The first bit of the first board took a huge amount of time. For every component I placed, I looked in the board in Eagle, right clicked to get its information, found the component in a box of 200 other bags, took one component out, placed it, ad nasuem. After a few hours of this, I printed out the board and went through and labeled every component with a part number or a value. This way I could take out a capacitor, quickly look around the board for how many others there were, and then place all of them at the same time.

image

It took a long time, but the boards started to come together, and as my team became more confident in assembling the boards, I switched to working on board bringup of the sensor boards. My teammate Ethan had already been writing a lot of code for the CCU (since we based it around the MBED, a lot of it was breadboard-able), and he switched to ensuring the one CCU board we assembled was fully functioning.

image

image

board software

I don't think I'm going to go much into the particulars (line by line) of the code I wrote for the sensor boards here. Though I will say I am very proud of how clean the code was in the time crunch situation I wrote it in. I abstracted away almost all of the hardware and register settings into small libraries. I started with the SPI peripheral, and then built on top of that to abstract away the I/O expanders and the A/D converter. Eventually I abstracted away most of the analog sensor front end to the point where I could set a voltage division ratio by calling: afe_set_voltage_division_ratio(AFE_DIVIDER_RATIO_OPEN);

Getting the boards to work was quite a task. I spent a lot of hours with them on my desk in this configuration:

image

The most exciting moment was probably when I brought my code that I had written for the sensor interface boards together with the software that Evan had been writing for the control board. Here's the first time we got a voltage reading to transmit over to the central board.

Here's really the first time our design goal was completed. In this video the sensor (in this case a potentiometer's wiper voltage) is being read, transmitted wirelessly to the central control board, where it is relaying it to an OBD-II dongle over the CAN bus, which relays the information to a smartphone.

design issues, lessons learned

There's lots of these. This was the most complicated electronics project I've ever worked on, and while our solution was somewhat complicated by me in a desire to make a generic solution, I am happy I made it hard on myself since I learned so much in the process. However, my design was not without fault, and I caused a lot of headaches with some simple mistakes, so I thought I'd cover those here.

part/library management

I should have added a lot more metadata to each component to make the ordering process easier. We burned a lot of time going back over parts that had been picked weeks before trying to figure out which one was meant to be ordered. Some parts made this particularly difficult. A few TI parts are identical except for a different letter at the end of the part name which signifies a newer or older part, even though both parts may still be actively produced. I'm not sure this can be remedied for every part without spending a large amount of time. At past jobs, each capacitor and resistor value is a different package in the library, each associated with a part number from the manufacturer. I could have done this for the larger parts though.

incorrect relay package

This is a simple one, I didn't realize the part in the relay datasheet which noted the pinout was as seen from bottom. As the relay had two poles, symmetric down the middle of the package. However, it does matter the polarity in which the relay is driven, if the primary side is energized in the wrong polarity it simply reinforces the resting state of the switch. To fix this, we soldered a few relays upside down with little pieces of wire draping down and connecting to the pads.

incorrect calibration logic

The relay was useless anyway, as I didn't fully think through the calibration idea that I had. If even the lowest current source is enabled when the sensor is disconnected, and I have a 0 ohm jumper as one of the tails of the voltage divider (to ground), then the current still passes through a fixed 499k resistor. At a microamp of current this creates a half a volt. This would work to calibrate the lowest current source, but as soon as the next order of magnitude of current is selected (10 microamps) the output jumps to a half of a volt, which is outside the input range of the A/D converter. So, this means only the lowest current source can be calibrated.

To fix this a smaller resistor would have to be picked as the top of the voltage divider, but this has other issues, such as loading down the output of the sensor. So more work would have to be done here for this to be a great idea.

bad voltage buffer buffer design

If you'll note in this schematic, if none of the open drain buffers are enabled, then the noninverting input of the voltage buffer is left floating. In the early stages of testing the board kept browning out in cycles after the boost converter was enabled, which brings up the 5V rail that powers the analog circuitry on this page. We spent a lot of time tracking down soldering issues with the boost converter before I realized that when no voltage division was enabled, and no sensor was connected, there was nothing pinning down that opamp input. The input capacitance of the opamp charged up over time, before it was buffering around 3.3V, which is then clamped to the 3.3V rail without any current limitation through D14.

I solved this by making sure in software that the boost converter wasn't turned on until at least one voltage divider was enabled or a sensor was connected to the board. A real fix would be adding some current limiting resistors to the clamping diodes D14 and D15.

backwards mosfet

I couldn't get the current source to work at first, and I scratched my head a bit until measuring the output of OP1A and realizing it was pegged at the rail, keeping the MOSFET fully on. I couldn't figure this out until I looked back at the schematic and realized that the drain and source of the MOSFET are in the opposite positions as needed. With the configuration shown in the schematic, as soon as the mux connects one of the resistors to the 5V rail the body diode is forward biased which then turns the MOSFET on. My quick fix for this was flipping the MOSFET upside down and rotating it into place on the board, bridging the gaps to the pins with some blobs of solder. Not pretty, but it made my current source work.

I/O expander bringup

I couldn't for the life of me get any I/O expanders to respond at first. I kept noticing very weird behavior on the bus. I hunted down shorts on the board for a while, which made the behavior different, but didn't fix the problem. It wasn't until I noticed in an app note for the expander that the addressing feature is disabled until a register is set. Until the register is set, all I/O expanders respond as if their address pins are tied to ground. So one of the first steps when the board turns on is to communicate to address 0, 0 and enable addressing, after which each expander only responds to its specific address.

12V voltage divider

I really wanted to show that the sleep-mode that I had designed into the board was actually low power, except when I put the board into a sleep state by disabling the buck converter and putting the microcontroller into a sleep mode I was still seeing over a milliamp of current consumption on the 12V input. At first I thought it was an oscillator issue, so I spent a while making sure the microcontroller was switching from the external crystal oscillator to the low-power internal oscillator. It didn't seem likely that an oscillator was consuming an entire milliamp, and that was in fact the case.

It took me a bit of looking over the schematic to find the voltage divider I had placed to measure the battery voltage. Sitting between the 12V rail and ground was a 10k and 787 ohm resistor forming a divider. As soon as I removed the 10k resistor from the board (disabling the battery voltage measurement feature) the current was well into the microamps, and I was happy.

poor component selection

I tried to keep most of the components in an SOIC or TQFP package to keep the pins exposed, but for some reason I chose the most needlessly tiny parts for some of the most critical components, namely the buck converter and the low-current sleep power supply. These things were a complete pain to get soldered correctly with the tools we had at our disposal. The buck converter was especially tricky with it's tiny unexposed pads.

have margin, but not too much

One example here would be the sensor supply linear regulators. These things are huge, I think they have a maximum rated current of about 1.5A. One of the specifications for the sensors we had was not consuming more than 20mA. I could have picked a much smaller regulator.

overdesign

I mean, I'll be honest, all of the things this board did probably could have been done with much simpler hardware targeting the specific sensors, but generic-ness was a part of the design goals, so some of the complexity was necessary. However, the analog front end ended up being much more precise than the A/D converter could resolve and most of the sensors that we were interfacing with are low precision anyway, so the extra complexity probably was not needed. Taking a step back could have been useful, to determine what margins and accuracy was really needed (do I really need 0.1% resistors?).

results

In the end (the night before the expo), we got a wireless board wired up in my car to my existing sensor, transmitting oil pressure data to the central board. On our table at the expo we also had a resistive sensor and a pulse frequency sensor (a flow-meter measuring water flow in a jig that my teammate Kyle built), showing that we had gotten all three sensors working. All of the data was transmitted to a laptop using a Bluetooth OBD-II dongle. Here are some photos from the expo.

image

image

The judges seemed fairly impressed with our project, though I think a lot was lost on the non-EE judges. From first glance, the results of our project appear very simple. Stepping on the gas, increasing oil pressure, just makes a little dial on the computer screen turn. It's not really that interesting of a thing until you realize how much work went into the project, and understand how the solution can interface with any number of different sensors.

I think this is a great first start, and actually something that I would be interested in developing further with my team members. I can think of a lot of improvements to the hardware and software that would make it much more usable, but I think we'll be preoccupied with celebrating finishing our undergraduate degrees for a while.