China USB Footswitch: IR to Push button - Page 1
Forum section: electronics / beginners

author: DOCa Cola
author_rank: Contributor
timestamp: May 13, 2013, 02:01:18 pm
content: Hi!This is probably a simple question for you guys.I have bought a real cheap china USB footswitch from ebay. This is to emulate a keyboard key when you press the footswitch. I ordered it with the intent on modifying it to use a more high quality foot switch and just use the board they use. To my suprise however, they are not using some kind of microswitch but an IR sender and receiver to register the press of the footswitch.The IR transmitter diode is constantly powered. When the footswitch is pressed, the line of sight to the receiver gets obstructed.Now, i assume it shouldn't be too hard to modify it to just work with a simple push button switch, but what interests me too, is how the current switching is done. I assume this is a very basic circuit. I am obviously not interested on what the chip under the epoxy does. Just the logic on the board.Photos:Front:Back of the board with the diodes:Obviously red is 5V, black is groundThe other interesting thing to note is, that they seem to also use this board in the 3-switch version of the footswitch. Hence those 2 unpopulated connectors on the board. Interestingly they can also be programmed in their provided software. It is likely that these can also be utilizied.Footswitch i got:http://www.pcsensor.com/index.php?_a=product&product_id=23 pedal switch:http://www.pcsensor.com/index.php?_a=product&product_id=3Now what would be great if someone could explain how that current IR receiver registers the switching so i can understand how to modify this board for a simple push button switch.Again, i do not just want to do the modification. I want to understand how the switching with the IR receiver works and if that is good how they have done it. Just out of curiosity. That is why i am asking here in the eevblog and not somewhere else

author: bilko
author_rank: Frequent Contributor
timestamp: May 13, 2013, 02:31:56 pm
content: Couldn't you have just stripped the guts from a USB mouse and detected mouse clicks instead ?

author: mariush
author_rank: Super Contributor
timestamp: May 13, 2013, 02:35:55 pm
content: Under the blob you have a simple microcontroller with a usb option (to show the thing as a generic input device like a keyboard or whatever) or a basic keyboard chip with usb.5v goes through R8 to the led to light it up, and also goes through R2 to the trace that goes back to the microcontroller and the fotosensor.When the fotosensor no longer sees the light or when the light touches the sensor (i forget now exactly which one is, basically read as "changing state") you basically get a direct connect to ground (see the other pin of the sensor) so the microcontroller/chip no longer sees 5v on that trace and knows the pedal is pushed down or released.

author: DOCa Cola
author_rank: Contributor
timestamp: May 13, 2013, 02:44:09 pm
content: Quote from: bilko on May 13, 2013, 02:31:56 pmno, a simple mouse wouldn't have done it. You can program this footpedal to any keyboard key, mouse clicks/movement you like. Without the use of a software driver. It acts as 'real' usb keyboard and mouse. A mouse (of course) only can do mouse clicksI wanted to emulate keyboard keys.Quote from: mariush on May 13, 2013, 02:35:55 pmAh, thanks. Much simpler than i thought. What is the purpose of that capacitor c9? It seems to be connected between ground and that 5V line that goes to the receiving diode and microcontroller pin.

author: Rufus
author_rank: Super Contributor
timestamp: May 13, 2013, 02:48:29 pm
content: It just looks like an IR LED shining on a photo transistor with the cathode of the LED and photo transistor emitter grounded.The photo transistor collector is pulled up to +5v via R2. When the light path is blocked the photo transistor collector voltage will rise close to +5v, when the light path is unblocked the photo transistor will turn on pulling the collector close to ground.The photo transistor could easily be replaced by a mechanical switch. The switch probably needs to open when the foot switch is pressed because the light beam is probably blocked by pressing the foot switch.The current in the switch will be low (0.5mA) so for long term reliability the switch needs to have appropriate (gold) contacts or a mechanical self cleaning action. If the switch isn't good for low currents upping the current through it to a few mA by reducing the value of R2 might help.

author: mariush
author_rank: Super Contributor
timestamp: May 13, 2013, 03:37:32 pm
content: What is the purpose of that capacitor c9? It seems to be connected between ground and that 5V line that goes to the receiving diode and microcontroller pin.I would guess it has a role of smoothing/filtering out the transition between on and off, so that the microcontroller won't send on off on on etc when you're pressing... just like with push buttons

author: DOCa Cola
author_rank: Contributor
timestamp: May 13, 2013, 03:52:39 pm
content: Now it makes sense.Thanks a lot for your help!

author: pickle9000
author_rank: Super Contributor
timestamp: May 13, 2013, 04:45:35 pm
content: You may want to check the shape of the panel (shadowboard) blocking the light, if it's L shaped or has a hole in in the the switch logic will be inverse and you will need an Normally Closed switch instead of an Normally Open switch.

author: DOCa Cola
author_rank: Contributor
timestamp: May 13, 2013, 05:40:16 pm
content: yes. I have put a normally closed switch in place of the receiving diode and it works just as described

author: DOCa Cola
author_rank: Contributor
timestamp: May 20, 2013, 11:37:47 am
content: I wonder, what would be required to modify this circuit to work with a normally open switch?

author: DOCa Cola
author_rank: Contributor
timestamp: May 21, 2013, 12:53:49 pm
content: sorry for bumping this thread.i guess i could use a relais or photomos, but can anyone think of a simpler way to change the circuit to use a normally open switch?i could also post some better photos if required.

author: Rufus
author_rank: Super Contributor
timestamp: May 21, 2013, 12:59:57 pm
content: Quote from: DOCa Cola on May 21, 2013, 12:53:49 pmPut the photo transistor back in and short out the LED with the switch.

author: kfitch42
author_rank: Frequent Contributor
timestamp: May 21, 2013, 07:59:06 pm
content: If you end up needing a bit more flexibility, this guy seems like it could do what you need:http://www.frank-zhao.com/usnoobie/

author: C
author_rank: Super Contributor
timestamp: May 21, 2013, 08:57:59 pm
content: I have to ask, Why would you want to replace an optical switch with a mechanical switch that will have contact bounce, not last as long and is unreliable?C

author: DOCa Cola
author_rank: Contributor
timestamp: May 21, 2013, 10:18:32 pm
content: yes, i have a separate sustain pedal with a 6,3mm jack. Now, I have bought this cheapo china plastic footswitch to use this pedal on my computer via USB.Actually i can select between normally open and normally closed on that sustain pedal footswitch. I am more asking out of curiosity how that modification could be accomplished.

author: DOCa Cola
author_rank: Contributor
timestamp: October 14, 2013, 02:42:22 pm
content: So, i want to revisit that topicAs suggested i could easily replace that photo transistor with a normally-closed switch. That works wonderful.I am however still curious if it would be possible to use a normally-open switch to do the triggering.I guess i could use a normally-closed optocoupler to achieve that. Are there other viable options when facing such a problem?