Monday, July 25, 2016

Third time’s a charm…

The bookcase was mostly ready for final paint, it just needed the last little bit of filler sanded down and the round-over’s routed. With those tasks complete, Genny broke out the paint and finished it off. It turned out pretty nice.
IMG_1367_595.jpg

The south side knee was next on the list. We finished up the tip out drawers on that side and installed the drawer pulls on all the tip out drawers. If you recall from a couple of post back, we had some trouble with the top rail above the outside drawer (the one on the left in the picture below). The first attempt at putting the rail in resulted in the nail to the finger. After that we made some measurements and took the piece home. This is kind of a tricky piece to cut. It’s a 45 degree rip cut with a taper. I didn’t think I had anything up at the cabin that could do that so using the table saw at home we made attempt #2. This one fit good but the taper wasn’t quite right and the drawer opening was more trapezoidal than rectangular. It really didn’t look right. So on to attempt #3. Using bubble gum and duct tape I managed to clamp a guide to the board and cut the 45 + taper using a hand circular saw. This one actually came out right with a nice rectangular opening.
IMG_1375_595.jpg

The next task was to run the new electrical for the ceiling fan. The conduit and electrical box will end up being behind the bank of drawers so getting that in place before installing the drawers seemed like the right order. Since the existing ceiling fan and mount will be replaced, The final bit of conduit isn’t finished, but it gets the job done and as a bonus, removes the extension cord that was powering the fan. Note that the extension cord to the fan was not our solution.

We’re cutting the parts for the bank of drawers at home (again, bigger table saw makes cutting plywood sheets much easier) and bring them up for on-site assembly. We’ve also decided that it’s a lot easier to carry the individual parts up the stairs than completed boxes. Three boxes were built and set in place. These aren’t fixed in position yet but will serve the purpose of figuring out drawer slide mounting and trim size. You can see the results in the picture above.

Continued working on the knee walls over the weekend.

Back bedroom

  1. Dog cubby baseboard
  2. Dog cubby outside trim
  3. Figure out knee wall design — getting close
  4. Knee wall door trim
  5. Build/install bookcase
  6. Install hangers for clothes
  7. Install drawer carcasses — a couple are set in place
  8. Install drawer boxes
  9. Install drawer trim
  10. Install baseboard
  11. Trim wall to ceiling corners
  12. Install conduit for ceiling fan — almost finished
  13. Build new ceiling fan mount
  14. Install new ceiling fan

Front bedroom

  1. Paint balcony door
  2. Frame knee walls
  3. Trim knee walls
  4. Door for closet
  5. Drawers and doors for knee walls
  6. Install baseboard
  7. Install wall to ceiling corner trim
  8. Install conduit for ceiling fan
  9. Build new ceiling fan mount
  10. Install new ceiling fan
  11. Install grill cover for vent fan
  12. Install window blind

Friday, July 15, 2016

The Rally Computer

Back in the late 80’s and early 90’s the Sacramento TSD rally scene was quite active. There were multiple rally clubs and typically at least one rally a month (The Friday Night Rally Series) along with various weekend rallies. Some of the folks involved were also involved at the national SCCA level. They typically used a “rally computer” to accurately track their distance and compute how close they ran to the ‘perfect’ time.

One bright fall Saturday, my rally partner, Jim and I ran a tour type T&D rally from Sacramento to Reno. Official mileages were given for every RI so it was possible to do manual calculations without the need for odometer correction calculations. We decided to try this armed with only a 4-function calculator, a pen and a pad of paper. This kept Jim very busy for most of the day and he didn’t get to see much of the scenery. After it was over, me being a software engineer, thought, “It would be pretty simple to write a computer program to handle all the calculations”. And thus, The Rally Computer program was born. I had a Zenith Supersport laptop computer that I had won in a raffel and it wasn’t being used for anything else so that made a perfect test machine. This was an 8088 based machine with 640K of memory, a floppy disk drive (3.5”!), a B&W LCD display, and a very large battery pack.

I started by writing some routines to handle time manipulations. I needed routines that could subtract and add two time values, convert a time (HH:MM:SS) to number of seconds, and convert a number of seconds to a time value. Delving into the Microsoft C documentation, I found a routine, _dos_gettime (), that would read the current time from the operating system and return it in a time structure. The time structure held hours, minutes, seconds, and hundredths of seconds. Perfect! I wrote all of the time functions to use the time structure.

The first version of the program would prompt for the mileage at the end of the odometer check. It would compare the official mileage with the stock odometer reading and calculate the correction factor. It would then ask for the out time. For the rest of the leg, it would prompt for a speed and a stock odometer reading and calculate the perfect time to that point. It would also mark the time-of-day when the ‘’ key was pressed and compare that time with the perfect calculated time and display the difference as an early/late number of seconds. By entering this information for each speed change, we would know how far off we were at that point. This worked OK but we soon found out that it was definitely not perfect. If we made any errors, either in entry or by going off course, there was no way to correct them. After almost every rally we would find something that didn’t work quite right or if changed, would make it easier to use. After almost 2 years of adding features, making changes, and redesigning it is finally to the point were we felt it was competitive with commercial rally computers.

So far all I’ve talked about is the software. After a while it became apparent that reading and interpolating the stock odometer and then entering that into the computer was a major cause of errors. The next step was to add some hardware that could sense the number of wheel rotations and calculate the mileage. This would eliminate errors caused by miss-reading the odometer and by typo’s while entering it. It would also free up the navigator as trying to type all those numbers while bouncing around could be a trying experience. We investigated various methods of getting data into the computer. Making the computer count pulses would take too much of the processors time and we didn’t think it would be able to keep up. The Zenith doesn’t have any card slots so a simple I/O board was out of the question. We decided to build an intelligent electronic odometer and interface it to the computer with an RS-232 interface. The next step was to come up with a way to count wheel revolutions. I had a speedometer/odometer for my bike that used a magnet on the wheel and a reed switch to generate pulses. We decided to try and connect a $35 bicycle speedometer/odometer (CatEye) to the car. We mounted the reed switch on the top of the back brake caliper. There was a bolt holding a heat shield that worked perfectly. We then glued a magnet to the inside of the wheel and once it was aligned, spinning the wheel did cause it to pulse. We then ran the wire up to front seat and connected it to the display module. The CatEye is capable of working with a wheel diameter from 20 to 28 inches and my car tires were about 23 inches. It actually worked, we were able to read distance down to 1/100th of mile and speed, at least we could until we exceeded the units speed limitation. If we went over 60 MPH the unit would stop reading correctly. Of course, why would we ever want to go over 60 MPH on a rally? After more testing we determined that the problem was in the CatEye display unit and not in the switch sensor. It was time to build the odometer. We did some preliminary designs using an 87C51FB micro-controller, a couple of binary counters, and a display unit. Everything looked good but it would be expensive and complicated to build. I poured through the Zenith hardware reference manual looking for a simple way to do byte size I/O. The printer port looked promising. It had a 1 byte output port and 6 input bits. After experimenting with it I found I could transfer 8 bits out and 5 bits in. Maybe we could do something with this after all. I told Jim I would need a 20 bit binary counter with latchable outputs. He said, no problem, we can put that on a single EPLD chip. So he did. We have a 68 lead PLCC chip with a 20 bit counter, latched and multiplexed outputs. The counters clock is tied to the reed switch so that every pulse increments the count by one. By setting the latch line high and setting a 3 bit value to the bank we want, we can read all 20 bits, 4 bits at a time using simple I/O calls on the computer. We had our odometer.

At some point, the big Zenith laptop was replaced with a smaller, lighter 80386 based notebook which we used until the rallying scene mostly died out in the Sacramento region . We used this not only to run rallies, but to help with the creation of rallies. Since we could log everything, it was easy to pre-run a rally and log the perfect times for each instruction and leg.

Around 2002 I started to revive the software. As computers were getting more powerful, it seemed like it should be possible to eliminate the counter hardware and just count the pulses with the computer. I did some experiments using the parallel port interrupt line and a simple Linux kernel module around 2003 but never finished it into a working version.

In 2007 I acquired an Intel Poulsbo based tablet. This had a 800×480 display and could run Linux. I thought this might make a good rally computer. At the time, my wife and I were creating rally events for the local Miata club so I thought getting The Rally Computer working again might help with those. The two challenges were how to count the pulses and updating the code to work with the GUI based touchscreen. Since I wanted to do this in Linux, GTK+ / Glade make the most sense for the GUI. I created a layout and ported over some of the basic functionality. Since the tablet doesn’t have a parallel port, would a USB parallel port adapter work? What about a USB mouse button? I did some tests where I wired up the mouse button to the hall effect speedometer sensor and had mixed results. The pulse counting was a bit flaky. Life took over and I never did debug the problems.

Fast forward to 2016. Computers and cars have progressed quite a bit. Small hobbyist computer boards with multiple I/O’s, good displays, Wi-Fi, and Bluetooth are available cheap. For $40 or less you can get a Raspberry Pi that’s many times more powerful than the Zenith Super Sport of 1988. Cars all have various speed sensors that are used for traction control and ABS brakes. All it took was one trigger to start the thought process of what it would take to bring The Rally Computer into the 21st century.

It didn’t take long to finish up most of the software conversion to GTK+ but the real challenge is still getting accurate distance data. A RPI has multiple GPIO pins and those could be used to implement a pulse counter in a Linux kernel module without too much effort. The source for the pulses could be one of the car’s VSS sensor leads but that would involve cutting and tapping a wire the ECU. A less invasive approach would be to go back to the original reed switch and epoxied magnets. Both of these solution will only work with the specific car that has the modifications. Is it possible to access the VSS signal from the OBD2 connector that’s been mandated since 1996? Time to experiment. ELM327 based OBD2 dongles are dirt cheap, like less than $10. There are numerous examples of connecting one to a RPI via Bluetooth or USB on the web. The ELM327 datasheet is available and describes how to communicate with it in great detail. Sounds like a plan.

With a bit coding to create an test application that connects to the ELM327 and pulls various sensor data, we’re ready to experiment. It looks like the VSS signal is not available, at least not through the standard PID’s. But the vehicle speed (in kph) is available. Tracking the vehicle speed over a very short period of time can provide distance data. But is the speed data accurate enough and can the ECU be queried quick enough to make this a practical plug-n-play solution? The test application has been able to pull speed data at approximately once every .6 seconds. The speed data is in integer kph and ranges between 0 and 255kph (0 -159mph).

The next step will be hook up the GUI app to the ELM327 and run some real-world tests to see how it behaves when the vehicle is driven normally. To do this, the RPI will need some type of local display and input. There’s a nice 800×480 7” touch screen display available for $65 that seems perfect for the job.

If this works, it will be nice plug-n-play solution that should work with almost any vehicle 1996 or newer and it can all be powered from a USB port in the car. Total cost:

RPI model 3 - $40
7” display - $65
ELM327 - $10
Total = $115

Monday, July 11, 2016

Cabinetry 101

With the knee wall trim work mostly finished, it’s time to start building and installing the “cabinetry” that will make up the storage solutions. The back bedroom will have two open dog “cubbies”, two doors, two drawer units, and 6 tip out drawers.

If you start looking for tip out drawers, most of the information you find is for converting the under sink panels in kitchens and baths to tip out trays. You might also find some information on tip out bins for things like recycling or trash. What we want is a tip out drawer that is somewhere in between those two. Since these will be at the top of the knee wall, they won’t hold much, but we do want to make the best use of that space that we can. Rev-A-Shelf makes some soft close hinges for tip out trays that looked like they would work, but would they handle the weight of a tip out drawer plus contents? We ordered a couple to try out and then built a couple of tip out drawers to test them on.

IMG_1817_595.jpg

Looks like they’ll work, but the installation is a bit tricky. Luckily we did this in stages and that resulted in a process that worked. First we cut and fit the drawer fronts. Then we mounted the hinges to the drawer fronts, placed them in the openings and mounted the hinges to the frame. Removed the drawer face from the hinges, built the the drawer part, painted and re-installed. With the drawer fully built, there would not be any way to attach the hinges to the frames while attached to the frame while still being attached to the drawer. So with the first two tip out drawers a success, it’s time to order more hinges.

Having a woodworking shop at home, it only makes sense to build the cabinet doors there. We built the two doors from poplar and made them a bit over-sized so that final trimming could take place on-site. With a little bit of fine tuning, the doors fit nice in the opening.

IMG_1812_595.jpg

However, that’s when the problems started. While the face of the knee wall is fairly flat and plumb, the inside edges for the door opening are a little less, what’s the word … precise. It looks like there may be a slight twist in the side which make the top and bottom hinge angle slightly different, resulting in the top and bottom outside edge of the door being off by quite a bit more. The worse door was over 3/4” difference between the top and bottom. Looks like we’ll need to shim the hinges to get the angles matching. If the hinges were mounted to the face frame, this would not have been a problem, but someone thought it would look a bit nicer if the inside of the door opening was a bit more finished looking.

A lot of filling, sanding, and painting has most of the knee wall looking pretty nice.

We also built one of the bottom drawer boxes to see how it would fit and validate the design. The design seems to work (but the box is too big to fit in the back of the SUV, good thing we have roof rack!). The next challenge will be sourcing drawer slides that will work for the extra large drawer. The current design has the bottom drawers at about 35” deep x 41.5” wide x 10 or 11” high. Not a slide you can go down to your local big box store and pick up. The rest of the drawer boxes (and probably drawer’s too) will be transported unassembled and assembled on site, lesson learned.

Back bedroom

  1. Dog cubby baseboard
  2. Dog cubby outside trim
  3. Figure out knee wall design — getting close
  4. Knee wall door trim
  5. Build/install bookcase
  6. Install hangers for clothes
  7. Install drawer carcasses
  8. Install drawer boxes
  9. Install drawer trim
  10. Install baseboard
  11. Trim wall to ceiling corners
  12. Install conduit for ceiling fan
  13. Build new ceiling fan mount
  14. Install new ceiling fan

Front bedroom

  1. Paint balcony door
  2. Frame knee walls
  3. Trim knee walls
  4. Door for closet
  5. Drawers and doors for knee walls
  6. Install baseboard
  7. Install wall to ceiling corner trim
  8. Install conduit for ceiling fan
  9. Build new ceiling fan mount
  10. Install new ceiling fan
  11. Install grill cover for vent fan
  12. Install window blind