View Full Version : [Question(s)] Axon Digital I/O Questions (Buttons and LEDs)?

02-20-2009, 03:19 PM
I would like to use a digital I/O port (in output mode) on my Axon to light a LED. My low-level electronics knowledge is rusty, at best, so I need some help.

My current plan is to use a NPN transistor with the 'base' wired to a resistor that is wired to the Axon's 'signal' pin, and the 'emitter' wired to the Axon's 'ground' pin. Then have an LED with the anode connected to the Axon's 'voltage' pin, the cathode wired to an appropriate resistor, and the resistor then wired to the transistors collector. (Similar to this circuit diagram, where the 'load' is the LED: http://www.kpsec.freeuk.com/images/trswinpn.gif, which I found on this page: http://www.kpsec.freeuk.com/trancirc.htm)

Would this work? Is there a simpler solution (seems like there should be)? Is there an appropriate IC that can be used for this (to control 8+ LED's from digital I/O for example)?

Also, when using the digital I/O as 'input', would you wire a button between the signal pin and the ground pin to detect a button press?

02-20-2009, 03:57 PM
It appears the Axon IO pins can support 20 mA, at a 5 volt logic level. Take the LEDs forward voltage, probably about 0.7 or so, subtract it from 5 volts, leaving 4.3 volts. Ohms law re-arranged gives V/I = R, so 4.3 volts divided by 0.02 A = 215 ohms, so bump up to a 270 ohm 10% resistor in series with the LED, tied directly to the IO that is to be used. That value will limit the current to what the IO pin can deliver, if the LED forward voltage is the same.

Missed the 8 LED part. In that case, something like a ULN2803 driver could be used, or even a 74HC138 3 to 8 decoder could be used to control 8 LEDs with 3 IO pins.

Last part, yes, a switch can be wired to ground to be used as input. It is usually good practice to "pull-up" the input with a 1k or so resistor, rather than depend on the micros' internal pull-ups.

02-20-2009, 04:38 PM
Thanks for the reply. I wasn't sure if it would be safe driving an LED directly off the pin (hence the crazy circuit).

I really like the ULN2803 IC, though. It looks like I could basically switch 8 different circuits at up to 500ma each. Sounds perfect for the LED's, and the other equipment I had planned (which I was originally going to use multiple solid-state relays for).