Digital Cable Length Measurement

I bought an Olimex dev board on Sparkfun to help a friend on a car project.  I never ended up using it but saw an ad on Craigslist for some freelance engineering work so I made it into a encoder based wire counter.  The goal was to have a wire pulled off a reel and pinched on to a wheel so if someone pulled the wire or had some unwinder, the wheel would spin and an encoder would give feedback to a device that calculates the feet and inches.  Well after making the product things kinda fell through in a crappy way so I am posting build info up here.

 

The dev board has 6 buttons, several inputs, an LCD, buzzer, relay, and assorted other IO.  I ended up using the DALLAS input with an added cap from R8 on the micro side as a low pass filter to help with bouncing.  I used all the buttons, left/right changes the Pulses Per Inch (PPI), up/down changes the inches and feet offset, the center button resets to the setpoints, and the lower left button stores the values to EEPROM.  If you hit the center button upon power up, the EEPROM values are set to 0ft,0in,10ppi. I removed the Relay and Buzzer and tied into the relays terminal block for the encoder to plug into more conveniently.

 

You set PPI by finding your encoder Pulses per revolution, and then finding the circumference to find your inches per revolution, combine those (divide pulses by inches) to get pulses per inch.

Offset is used if you have to thread the wire so far before pulling, then you can keep track of that wire.

 

The code contains two interrupts, one for calculating adding and subtracting values for PPI and Offset adjustment.  If you hold the button long enough the speed of the change increases.  The second interrupt is INT0 as is connected to the encoder.  Every rising edge a pulse is added, inches are added based on PPI and feet are added at 12inches and inches are reset.  The main loop does all the button reading and lcd updating.  LCD updates when a button is pressed or when an onscreen value is changed.  I ended up using 99.2% of the flash and like 5% of the EEPROM.  I had to make my own printf function because I did not have enough space for the standard library.  Readbuttons is a routine that does all the I/O changes and matrix reading to do the button reading.

 

And that’s about it.  Here is a video of me showing it off with my raspy sick voice.  Not the greatest video, I  have a video camera but not a battery charger or stand so I used my phone.  Eventually I’ll get the better camera up and running.

I might put this thing in a box, I can tie in some better panel mount buttons, mount the screen, and maybe find a buyer.  If you have any questions about this build or want it, leave me a comment or email.

 

That’s it for now!

Footpedal Hardware Finished

Finished my gaming foot pedal I was working on

Added the pushbutton on the side for resetting so it can be programmed without opening, and also added a light for when a button is hit.  I tried to do Sugru strain reliefs, but I tried them thinking I could shape them, pull them out of the case, and then finish the case.  Well sugru is very sticky and it didn’t work out as well as planned.  It will still keep the cord from pulling out though as each cord has a plug of sugru inside the enclosure as well bigger than the hold.  I think it looks pretty good.

On the software side I will eventually make a program that lets you change what keys are pressed, but it will just modify the c file and recompile.  Then you can hit the side button and use the teensy programming program to update the firmware.

Gaming Footpedal

I’ve been wanting a gaming footpedal for awhile.  I’ve been playing Counterstrike for many years and recently I’ve been sick of my keyboard/mouse settings for my talk and walk buttons.  When I am steadily aiming at a wall, waiting for someone to round the corner for that headshot I don’t want to hit a button on my mouse to talk to the team and tense up my hand and possibly throw off my aim.  Also, if I am in the middle of a firefight I don’t want to have to hit a keyboard button to talk because it would mess up my moving/crouching/jumping etc.  This goes the same with the walk button, but less so.

 

Well recently we were cleaning out upstairs at work and I found an old controller with a footpedal.  It was getting thrown out so I got my hands on it and took it a part with the purpose of using it as my walk/talk buttons.

I took it a part and the cable had five wires.

 

Green wire was chassis ground on the pedal, Red was the NO connection for both pedals, Blue was the NC connection for both pedals, and Yellow and Black were signal wires for the pedals.  A friend from Sector67 turned me on to Teensy boards, which are USB Atmel AVR’s, they are small and can be programmed through USB.  These are often used for HID Keyboard hacks, here is the one I am using

http://www.pjrc.com/store/teensy.html

 

I stripped the foot pedal wires and connected them to the board.  I connected the NO connection to ground, and both signal wires to pins on PORTB.  PORTB is set up to internally pullup to VCC.  I then edited some sample Teensy code and tossed it on the board to press the 7 and 8 buttons on the numpad for each pedal.

(Code was lost in website upgrade, examples for HID keyboards here)

Works great, here is the semi finished product

 

Next steps are to add a status LED, secure the board in place, and to use Sugru to add good looking strain reliefs to the cables.

 

I’m also thinking of adding a pushbutton and making the controller configurable using a windows based program communicating over the USB port.  You could press the button, open up the program, and change what keys the pedals are bound to.

Sample :

78787877777777777777778888888777777777777777777788888