18dec to 5bin converter

pyrohaz

Oct 28, 2012
33
Joined
Oct 28, 2012
Messages
33
Hey guys, I've successfully designed a converter from 0-18dec to 0-11111bin using only diodes and resistors (cheap!) but I was wondering if there is a more efficient way of doing this?

In the attached schematic, it requires 38 diodes and 5 resistors!

Imagine the L's (logic input) to the left of the schematic to be low impedance voltage sources at 5v and the L's at the right (logic output) to be very high impedance (input of non-inverting schmitt trigger), worst case scenario will be 2 diode drops into 1Meg, in 100% efficient diode conditions, maximum current will be 5uA, therefore, using standard 1n4148 diodes, gonna expect a maximum voltage drop over 2 diodes to be around 1.2v (minimum stated value on the datasheet is 5mA). This is within specification of high being >(+V/2) and low being <(+V/2)

But to the point, is there any more efficient ways, chips that can do this for me?

Thanks, Harris
 

Attachments

  • 18dec to bin converter.png
    18dec to bin converter.png
    21.7 KB · Views: 116

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Depends on what you mean by efficient. Speed, power, component count, board area, which is it?

Bob
 

pyrohaz

Oct 28, 2012
33
Joined
Oct 28, 2012
Messages
33
Preferable component count and board area, are there any better ways to do this than just using steering diodes? Speed is not essential.
 

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
A single 28-40ish pin micro, overkill in MANY ways but still cheap (about $1) and very low board real estate if you go with a small SMD package...
 

pyrohaz

Oct 28, 2012
33
Joined
Oct 28, 2012
Messages
33
Well the thing is, i'm using it to input 18 switches into an arduino using as little pins as possible, i considered using an 18 part potential divider and analog reading but doing a direct port read is much more time efficient than analogread so unfortunately, using an extra IC seems a tad pointless! Any other suggestions?
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Well, that is a different problem than you originally posted. Your circuit will not work If more than one switch in on.

Are you talking about 18 switches, which can all be in either state at any time? Or are you talking about a keypad where you expect one key to be pressed at a time?

If the latter, you can arrange them in a 4x5 matrix and you would need 9 pins on the micro to read them.

Bob
 

pyrohaz

Oct 28, 2012
33
Joined
Oct 28, 2012
Messages
33
1 Switch at a time is no problem! Also, if they're not high, they will be in a high impedance state (unconnected to either rail). Getting significant data out of switch combinations is not a big deal, I just need to know which switch is on at what time. This is where I will just do a direct port read of the 5 bits and at any instantaneous time, get the result of which of the 18 switches is high.
Cheers!
 

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
using an extra IC seems a tad pointless!

Why? You listed your primary concerns as board space and parts count, based on that criteria your original solution is the one that is a tad pointless... There is always a give and take on all solutions weigh your options based on your criteria, a matrix input as Bob suggested is generally the best choice...
 
Last edited:

pyrohaz

Oct 28, 2012
33
Joined
Oct 28, 2012
Messages
33
Very true! Apologies for my ignorance. I shall be more specific next time I post questions.

What I should ask then is:
Based on my above diagram, can I achieve the same results using less components BUT sticking to discreet components?

Sorry about that one guys!
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Based on my above diagram, can I achieve the same results using less components BUT sticking to discreet components?

Yes, you have 11 diodes you don't need. (All the ones pointing from left to right in the first "column".
 

pyrohaz

Oct 28, 2012
33
Joined
Oct 28, 2012
Messages
33
Brilliant! I've now omitted the unneccessary diodes, Thanks for the help guys :)
 
Top