The first step is to open the keyboard. Take out all of the screws and pull it apart. All we’re really after is the little green circuit board and the attaching wire, so don’t worry if you damage the keyboard casing or lose one of the screws. All that is going in the trash. Also, depending on the origin of the keyboard, beware of the escaping crumbs that will try to pollute your workspace!
If the USB cord isn’t soldered directly to the circuit board, you can pull it out. This just makes it easier to work with while soldering, but some keyboards are cheaply manufactured, so repeatedly plugging and unplugging this little box can eventually damage it. For instance, I’ve once pulled the little red, white, green, and black wires right out of the back of the plastic holding clip.
A bit about how keyboards work: Keyboards use a matrix, usually two sets of contact points on an X and Y axis like above, or in two parallel sets like in the previous photo. A circuit is completed by connecting any two points from either side. For example A1 might be the ‘W’ key, while A2 might be the ‘E’ key.
In this example, (F,10) is the ‘P’ key. To find which key relates to which contact points (aside from trial and error), you’ll want the two sheets as seen in the next photo. These are generally two clear sheets of plastic with conductive tracts laid out that correspond to the key locations on your keyboard. I like to track the ‘P’ key for Pedal. It’s also a good key because it’s usually the closest letter to the circuit board. This means you won’t have to follow the tract as far and you can test the finished product with any word processor: if you see a ‘P’ appear on the screen, it worked! I don’t like using keys from the number pad that rely on num lock being engaged, and random keys like Home, the arrows, and the function keys can sometimes cause unexpected results in various applications.
When I traced the P key, one sheet led me to the 10th contact point along the bottom of the board, and the other led me to the 6th point down on the right. Take your razor blade and scrape off the black stuff on each point, revealing the shiny copper beneath. The solder bonds to this much more readily.
Note: Some older keyboards don’t have contact points like above and instead use spring-like protrusions. These don’t need to be cleaned with a razor and might actually be easier to connect for people with no soldering experience.
Tracing a tract with a marker to find one of the two contact points the ‘P’ key uses. The other sheet would have led me to a contact point in the other group.
Cut two lengths of wire about 5-7 inches each and strip the wire on either side. One wire will be soldered to each of the two contact points you scraped clean. Only strip a short amount; if more wire is exposed, it could cross over to one of the other contacts and send unexpected keystrokes to your computer.
I like to drill a small hole through the wafer just before the contact point to feed the wire up through. I drill another hole by the edge to bring the wire back up. Weaving the wire through the holes like this keeps the tension off the solder joints if you accidentally tug on the wires.
Both wires are soldered into place and fed through a drilled hole so they both come out in the same place.
Testing! Test often. There’s nothing more frustrating than putting something together only to realize it doesn’t work. To test here, plug the USB cable back into the circuit board, plug the UBS jack into your PC, and then touch your two wires together. If you see the letter ‘P’ start appearing, or whatever key you’ve wired up, everything is good so far.
Note: USB ports provide 5 volts, 0.5 amps, not enough to even feel, let alone hurt you, so don’t worry about accidentally touching the exposed wires. There’s a slight chance you could short out the board though, so try not to be overly-handsy with it while plugged in.
Solder the trailing ends of the wires to either end of your reed switch. It doesn’t matter which goes on which side. You can use the wire stripper or any sort of wire cutter or tin snip to cut away the excess leads on the reed switch. Be warned, though. The reed switches I’ve used are extremely delicate and fragile. The switch casing on this one is glass, and bending or applying any torque to the leads will break it.
More testing! Plug your USB cord back in and pass your magnet over the reed switch. If you see letters appear, you’ve now got a working exercise bike interface. All the soldering is done, so you can breathe a sigh of relief if that’s not your talent. Everything past this is optional if you want to just go duct tape this into position, but I like to pretty it up a bit.
Hopefully you have enough room left in the outskirts of the circuit board to drill holes to anchor your poseable wire. This one was getting a bit cramped. I haven’t come up with a really good way of doing this yet, so sometimes the wire will jiggle a bit. To rectify this, I’ll sometimes add some hot glue to where it enters the board. I try to avoid this, as hot glue doesn’t stick to the wafer well, and can short circuit the board if it touches any of the contacts. This one turned out pretty well.
The poseable wire should extend to the bottom of the reed switch casing. I wrapped the tip of it with electrical tape so it can’t come into contact with the leads. The other end doesn’t actually touch any of the tracts on the circuit board, so it shouldn’t matter, but it doesn’t hurt to be safe.
Sheathe the poseable wire and the wires leading to the reed switch in the heat shrink tubing and apply heat.
The PVC pipe will protect the delicate read switch from being damaged. Slide it past the switch, then begin filling it up with hot glue as you slide it back over the switch. I didn’t have enough hands to photograph this process, but the idea is to have the tube as full of glue as possible so that end of the poseable wire can’t exert pressure on the reed switch while positioning the sensor. This can be a bit tricky, so be careful you don’t burn yourself.
The finished sensor at the end of a flexible protrusion. The flex-arm is a little longer than I usually make, but depending on your bike, you might need the extra length. Feel free to test again at this point to make sure you didn’t somehow break something.
I don’t have the facilities to create a housing for the circuit board, so I just wrap it with electrical tape to protect it. You can spray paint the sensor arm to match, but if you spray the electrical tape, the Velcro from the next step will not stick to the controller.
Slap some Velcro to the back of the controller.
Slap the other half of the Velcro to the bike…
…and mount the controller.
Affix the magnet to the crank shaft so that when you pedal it will pass before the sensor. The controller should be positioned so that the magnet can be as close to the end of the shaft as possible. I’ve found that this gives the best results.
Use the flex arm to position the sensor as close to the passing magnet as possible.
Testing with a word processor is fine, but Trial of Trails includes a built-in calibration function at the title screen. The background will change to bright green when the controller is reading the magnet. Pedal some and watch the screen. It should blink once per revolution. If you find that it is missing some of your revolutions, use the flex arm to move the sensor closer, or swap your magnet for one that is stronger. If the screen is flickering twice for each revolution, try moving the magnet further down the edge of the crank shaft (closer to the pedal/further from the axis,) or if that fails, find a weaker magnet.
There are a lot of steps in this guide, but building this controller is actually pretty easy. Hacking a keyboard like this is a common hobby and you can find lots of tutorials online for making cool things. There are also lots of resources on how keyboards work and how circuits work in general if you decide to take a deeper interest. A controller that interfaces with a stationary bike is only the beginning. You could easily wire in an arcade joystick and buttons, or an old game controller to give yourself more options. I chose the simplest design imaginable to keep the entry barrier to Trial of Trails low as possible, but there’s no reason others can’t make something more complex for different software. The sky is the limit!