All things moose, and, then some.
RSS icon Email icon Home icon
  • Improving a Kinetic bike trainer

    The Kinetic bike trainer is generally a great device. It allows a bike to be attached easily for indoor training, and it is portable enough to hauled around to be used for pre-race warm-up. My biggest gripe with the unit that I have is that the only way to adjust the tension is to turn the knob at the back. This means that it can’t be adjusted while riding. Since it often takes several fine adjustments to get the right tension, it means getting off and on the bike to make each adjustment. Also, there is no way to change the adjustment during a workout without dismounting.

    Kinetic Trainer

    Here's the unmodified unit. Note the 5-winged adjustment knob.

    There are models that have a remote tension lever that attaches the the handlebar, but, I don’t have one of those. Thus was born the idea of using a motor controlled by an Arduino board to turn the knob by pushing buttons mounted on the handlebars. The real trick though was to hook up a motor to the knob. I wanted to avoid modifying the unit, and that included not wanting to drill mounting holes, or use glue on the knob. I tried using Vex robotic parts at first, this worked well enough to prove that the motor was powerful enough to turn the knob, but it was a wobbly contraption, not suitable for more than a proof-of-concept. I searched around for various things at the hardware store. Among them were hex nuts that matched the thread of the adjustment screw. I thought maybe I could use these to create a knob that could be easier to work with than the knob the came with the Kinetic trainer.

    Linkage in Place

    Notches in the PVC fit over the knob nicely. The back of the PVC adaptor has enough flat surface to screw the motor coupling plate in place.

    The item that  offered the most promise was a PVC adaptor. The part is intended to match a 1 3/4″ pipe to a 1/2″ pipe. What interested me is that the thought that the large end could be notched to fit over the knob, and that the small end had flat surfaces that might be sufficient to drill holes for the motor mounting plate. A Dremel tool and file were all I needed to notch the PVC adaptor so that it fit snugly over the knob. As I had hoped, there was enough flat surface to mount the motor securely. One thing I had to do, that I hadn’t planned was to drill a hole through the side to allow access to the set screw on the motor shaft collar that is on the inside of the tube. With a couple of pieces of flexible metal strap and twine I got the motor unit and PVC adaptor to press against the knob with sufficient pressure. Yes, I said twine. This is still a prototype after all. Imagine if you will . . .yadda,yadda, yadda.

    Everything in Place

    The motor is driven by an Arduino board. Cat5 cable runs to the handlebars for the control buttons.

    The electronics were the easy part. Arduino has sever digital ports that can drive a PWM controlled-motor. The Vex motor units I have are free running servos that can be driven very easily with the Arduino by using the Servo module. By using a value of approximately 90 in the Servo::write() method, the motor will be stationary. A value of 0-89 will cause the motor to turn in one direction. A value between 91 and 128 will cause it to turn in the opposite direction. Wiring is pretty standard. The black wire from the motor goes to ground. The red wire goes to the motor supply voltage. The white wire goes to the signal port, in this case the digital port 9 on my Arduino board. Controlling the motor is done with two button switches attached to digital ports 5 and 7. Each port is tied to ground with a 10K resistor. Each switch then is tied to the Arduino 5V supply. When pressed, the digital port is pulled up to make the digitalRead(portNumber) method return TRUE.

    Motor control buttons

    The left button decreases the tension. The right button increases it.

    The Arduino code is very simple. The main loop looks for one of 3 conditions–left button pressed, right button pressed, or no buttons pressed. If the left button is pressed, then the motor is turned in a direction to decrease the tension (allow the wheel to spin more freely). If the right button is pressed, the motor, spins the opposite direction, increasing tension (making it harder to pedal). If neither button is pushed, then the motor is held stationary.

    There are several things that I would change about the code. First, there is no need to continuing writing the motor direction control during the whole button push. It can be done once, when the button is first pressed. The code runs fine as it is, but it is wasting time with continuous writes that do nothing useful. There should also be some sort of debouncing for each switch. Finally, it would be useful to have have some safety limits built in to prevent excessive tightening and loosening. This would likely require a third switch to put put the unit into a calibration mode. Once the calibration mode is turned off, then the unite would only allow a set number of turns in either direction.

    Here is the code.

    #include <Servo.h>

    // myservo will later be attached to an Arduino PWM port.
    Servo myservo;

    // Use these digital ports for the motor control buttons.
    int inc_tension_button = 7;
    int dec_tension_button = 5;

    // In a perfect world, the stop value would be 90.
    int motor_stop = 95;
    int inc_tension = 140;
    int dec_tension = 50;

    // Store the last state of the motor each time it is changed.
    // TODO – still needs to be implemented.
    int current_dir = motor_stop;

    void setup() {
      // Port 9 is a PWM port, so it is suitable for Servo module use.
      myservo.attach(9);
      // We are going to read these ports to detect a button press.
      pinMode(inc_tension, INPUT);
      pinMode(dec_tension, INPUT);
    }

    void loop() {

      // TODO – Only issue each motor_control once when state changes.
     
      if ( digitalRead(dec_tension_button) ) {
        motor_control(dec_tension);
      }
     
      else if ( digitalRead(inc_tension_button) ) {
        motor_control(inc_tension);
      }
     
      else {
        motor_control(motor_stop);
      }
    }

    void motor_control(int direction) {
      myservo.write(direction);
    }

  • An airbag saved my life but scared the crap out of me

    I’m not going to knock airbags. I’m convinced that the airbag in my car saved my life, allowing me to sit here and write this. What I hope to convey is some sense of what happens when an airbag deploys. It startled me. For a moment I thought my car was on fire. I contemplated abandoning my car and taking my chances with the oncoming traffic on the highway.

    totalled volvo

    Sitting at the Lehman's lot in South Minneapolis

    Here is my car after it was towed to the body shop. At first glance, it may not look that bad. but this is a Volvo XC70, a car built like a tank. I suppose the design and durability of the car deserve some credit for my survival as well, but I still hate to think what would have happened if I had hit my head on the steering column, as I most certainly would have without the airbag.

    The accident is a swirl of vague memories. I was driving on the highway, and a rain storm had just ended. The storm came quickly and dropped incredible amounts of rain in a short time. With little warning, I hit a patch of standing water and the car hydroplaned. I tried my best to steer the car, and for a moment, I almost felt like I had it under control. But then, the car went into a spin. I’m sure it went around at least one full time before slamming into the concrete barrier in the middle of the freeway.

    I don’t remember the airbag popping out. What I remember is seeing a flash, and then flames shooting from the dash. I heard a whooshing sound, and the passenger compartment filled with smoke. The car continued to spin and finally came to a rest in the left lane, facing the oncoming traffic.

    Still dazed, and watching the oncoming cars swerve to miss me, I began to wonder if the car was on fire and whether I should abandon it immediately. I looked for sign of fire coming through the dashboard, but didn’t see any. I was perplexed by this and didn’t know yet the source of the flames I saw. The smoke in the car was still thick, and I was coughing, but I began to think that I could take some time to wait for the traffic to slow (as congestion began to build up). I think that was the correct decision, as abandoning my car earlier in a panic could have put me in the path of an oncoming car.

    It took a while before I began to understand what happened. My right wrist had what I had at first thought to be a bruise, but later, while riding in the tow truck, the driver looked over and said, “looks like you got an airbag burn.” I said I thought it was a bruise but he seemed convinced it was a burn. He explained that air bags are inflated with, as he called it, rocket fuel, and that as the bag deflates, hot gases and smoke escape through small holes in the back.

    That started to make sense. I looked it up online, and sure enough the propellent for airbags is similar to the solid-fuel propellent used for model rockets. When an accident happens, a sensor ignites the propellent, and with luck the airbag is fully inflated by the time your face hits it. As your face presses forward, the gas escapes through a couple of quarter sized holes in the back. It’s not uncommon for the escaping gas, still hot, to cause burns.

    If you have ever watched a model rocket launch, the sounds and smells are very much the same. Thrilling to be sure when part of a rocket launch, but frightening during an accident, when you don’t understand what is going on. Oddly, just a couple days after the accident, I watched a movie that had a scene where airbags deployed in an accident. It was a comedy, and the bags popped out and deflated, and everyone was stunned but OK. At least that part was accurate. But the air in the passenger compartment was pristine. Nobody was coughing. Nobody got burned. Nobody ran from the car as though it were on fire.

    I don’t think I’ve ever seen a depiction of an airbag deployment that matched what I remember. Up until shortly after my accident, I thought airbags inflated with compressed air. Now I know better. I hope that by sharing this, I can help spare someone else the anxiety and fear I felt because I was unprepared.

  • Happy to have lost a night’s sleep

    We often work best under pressure and the things we accomplish under such conditions often make for the most enduring, meaningful memories.

    I spent over a full day working with 12 other teammates to create a new website for the non-profit organization, DesignWise Medical. In 24 hours we put together a site that, in my experience as a Web developer, could easily have taken weeks, if not months, to produce. Pending approval of some of the content, the site will be live within a week.

    The Challenge is a yearly event organized by Nerdery Interactive Labs. The goal is to match teams of developers and designers with non-profits eager to revamp, or start, their Web presence.

    The assembled nerds, or last most of them

    Our team, Full Court Press, was made up of 10 developers and designers, and 3 members from Designwise Medical. None of us had worked together previously, though many of us knew each other from the WordPress user group to which many us belong, or from other user groups.

    Throughout the following 24 plus hours, with little to no sleep, we worked together, each chipping in where we could to help others on our team. Arguments were few, and unless I was just not paying attention, never heated.

    We shared a cramped area defined by our square of four tables. A rat’s nest of cables and power cords in the center of the tables threatened to ensnare anyone who entered. As the hours wore on, and cans of Red Bull piled up, we went through waves of enthusiasm, slap-happiness, and flagging energy. The countdown clock, projected on two giant screens, constantly reminded us of the coming deadline of 9:00 AM.

    Some took cat naps in the sleeping room, or sought rejuvenation from the oxygen bar. Hours ticked by in what seemed like minutes. Lunch, dinner, dinner 2.0 (at midnight), and finally, breakfast, blurred together in a parade of sandwiches, chicken wings, burritos, pizza, and bagels. Caffeinated beverages flowed all day and night.

    There were moments of goofiness – the kind that often crop up during such times. Impromptu guitar sessions, a human pyramid, whoops and hollers when a Web page actually rendered without crashing.

    When we were done,we all had a great sense of pride in what we had accomplished. I am so grateful for the chance to work with such a talented group of people. Thanks also to the organizers and sponsors of this event. Hope to see you all at next year’s Challenge.