Connect with us

Seeking schematics/plans for decimal to binary (microswitch/relay)selector/controller

Discussion in 'Electronic Components' started by [email protected], Jan 25, 2008.

Scroll to continue with content
  1. Guest

    I am interested in building a "selector" gadget for devices that take
    to select a program, such as this game cartridge where you have 5
    to select program #0-31 (the jumpers represent the binary number): (4).JPG (12).JPG

    The selector would have two 7-segment LEDs that display the currently
    selected program number (0-31), and a couple pushbuttons (+/-) that
    let you
    increase/decrease the program #. The device translates the number
    binary and turns on/off the appropriate switches or relays which are
    attached to the jumpers on the device (ie the above game cartridge).

    Or I would even like to build a kind of analog to digital converter
    device which has a potentiometer (for example 100k) which gets
    into an 8-bit number (0-255) and 8 switches get opened/closed that
    represent the value of the pot. Adding three 7-segment LEDs to
    the current value in decimal would be cool and then it could be used
    as a "selector" as well.

    Does anyone know of any plans or schematics out on the Web to
    something like these? (For now I just wire switches to the jumpers.)

  2. linnix

    linnix Guest

    Yes, an AVR should work. Your requirements are very similar to our
    project: Two or Four buttons, 3 digits LCD, 4 channels A2D, runtime
    current 2mA, power down current 50uA. A button cell battery (CR2032)
    would last 6 months in power down.

  3. John Fields

    John Fields Guest

    If you want to do it in hardware you could use a couple of 74XX193's
    feeding an EEPROM with a lookup table burned into it as described

    You'd also want to decode 32 and 128 (overflow for your setup and
    underflow for the counter) and use those decodes to generate a reset
    pulse which would send the counter and the displays back to zero.
    Bad idea.

    If you want a resolution of one part in 255 out of a single turn pot
    with a rotation angle of (say) 330° degrees from stop-to-stop that
    translates into a granularity of about 1.3°, which means you'd be
    hard-pressed to select one value out of 255 (if only because of
    stiction) no matter how much you diddled the pot.

    However, if you used only the 5 MSBs, that's 330°/31 steps, which
    will get you 10.6° per step, which is eminently doable.

    The displays are easy, too, since all you need to do is program an
    EPROM with the following truth table:

    0000000 0000 0000 00
    0000001 0000 0001 01
    0000010 0000 0010 02
    0000011 0000 0011 03
    0000100 0000 0100 04
    0000101 0000 0101 05
    0000110 0000 0110 06
    0000111 0000 0111 07
    0001000 0000 1000 08
    0001001 0000 1001 09
    0001010 0001 0000 10
    0001011 0001 0001 11
    0001100 0001 0010 12
    0001101 0001 0011 13
    0001110 0001 0100 14
    0001111 0001 0101 15
    0010000 0001 0110 16
    0010001 0001 0111 17
    0010010 0001 1000 18
    0010011 0001 1001 19
    0010100 0010 0000 20
    0010101 0010 0001 21
    0010110 0010 0010 22
    0010111 0010 0011 23
    0011000 0010 0100 24
    0011001 0010 0101 25
    0011010 0010 0110 26
    0011011 0000 0111 27
    0011100 0000 1000 28
    0011101 0000 0001 29
    0011110 0011 0000 30
    0011111 0011 0001 31

    and then connect the outputs to a couple of BCD to seven-segment
  4. Guest


    Why don't you just use a rotary switch which opens and closes four
    outputs. You can get binary coded decimal or hexadecimal - if you use
    a hex switch your users have to understand the the sequence

    Farnell stocks both kinds of switch in a variety of formats, and there
    must be other broad-line distributors who cater to the segment of the

    It's a lot easier and cheaper than programming a PIVC and wiring up 7-
    segment displays.
  5. John Fields

    John Fields Guest

    What, no "C"? ;)

    You still have to wire up seven-segment displays, and you still have
    to wire up them up to BCD to seven-segment decoder-drivers, and you
    have to wire the inputs of the decoder-drivers to pulled-up or
    pulled-down switch contacts, so the only advantage is not having to
    use logic to drive the decoder inputs.

    Which, when you look at the price of BCD encoded rotary switches
    turns out to be a serious _dis_ advantage.

    Go to:

    and filter on "BCD" and "Panel Mount" for a shock.

    I'm sure that there are cheaper versions out there, but If I was
    going to do it that way I'd use a cheap mechanical quadrature shaft
  6. Guest

    Oops. That should have been 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F. Sorry.
    Hexadecimal rotary switches have a pointer on the rotating bit which
    points to the appropriate number out of the 16 printed on the front of
    the part - you see the numbers and the pointer by virtue of the light
    reflected from them. Wasting time and effort duplicating this with a
    seven segment display may play well in Texas, but in areas where
    congenital stupidity is not part of the birthright it would be seen as
    a bit odd.
    You can pay of the order of $20 (if the U.S. dollar hasn't completely
    collapsed since I looked at this evening paper) for a fancy
    hexadecimal switch intended to end up on the front panel of
    "professional" gear, or you can pay a couple of dollars for a part in
    a dual-in-line package intended to be soldered into a board.

    Even Texas now has minimum wage legislation, so spending a couple of
    hours wiring up several unnecessary seven segment display would chew
    up rather more money than you'd need to spend even on a professional
    rotary switch.
    My Digi-Key paper catalogue offers RTE DIL parts for around $3.00 each
    - the catalogue does date back before the last Republican assault on
    the U.S. economy, so current prices may be higher.
    And a couple of expensive 7-segment displays to tell you how far you'd
    rotated the shaft?
  7. Hal Murray

    Hal Murray Guest

    What's the term for the kind of switch/knob/input-device that
    is just a knob on the front with some sort of spring loaded
    positioning at detents. There are several/many detent positions
    per rotation but no numbers on the front panel.

    They are used for things like uProc controlled scopes where the
    sweep speed has a zillion settings. You give the knob a spin
    to get to the right range then fiddle a bit to get to the exact
    setting you want.

    Inside, I assume they have a 2 bit optical encoder and a set
    of magnets to make the detents.
  8. John Fields

    John Fields Guest

    Not always, and why are you going on about a 16 state hexadecimal
    switch which can only switch between 16 channels when the OP said
    he's looking for a BCD display and the ability to switch between 32

    You do know how BCD works, don't you?
    Well, since I wasn't born in Texas that little tirade doesn't apply
    to me, so I guess your bashing is just you venting your resentment
    at Texans in general because of your being supported by the
    doctorate that your wife took (and the rules she had to follow in
    order to win it) at the University of Texas.

    Besides, the OP stated that he wanted to use seven-segment displays
    so, unlike you, who wants to shove his "solutions" down everybody's
    throats I prefer to give 'em what they ask for.

    If he wants to use an UP/DOWN pushbutton scheme, or a pot and an
    ADC, that's fine with me and I enjoy the exercise of executing the
    design, while it seems all you enjoy is trying to execute the
    Ah, but if the application calls for a front panel, then the panel
    mounted rotary switch (or the ON/OFF pushbuttons, or the pot and
    ADC, or the rotary encoder, or thumbwheel switches, etc, etc.) could
    be used to good advantage, especially if the front panel was
    screened with numerical switch position/channel legends.
    Several hours???

    I guess you've never heard of PCB mount seven-segment displays.

    You really do have trouble staying on track and you never miss a
    chance to spew vitriol, do you?
    And in which direction. Of course, if that's what the client
    wanted. You, however, would deride your client's wishes and insist
    on doing it your way, and in the process lose friend and fee.

    Fucking myopic idiot, you are.
  9. John Fields

    John Fields Guest

    On Fri, 25 Jan 2008 23:30:13 -0600,
  10. Guest

    Sure. But what the client asks for, what the client wants, and what
    the client needs are three different things.
    You get satisfied customers by giving them what they need at minimum
    expense. If they really need a BCD display, that's what you give them,
    but if they can settle for two parallel octal rotary switches
    displaying all the octal numbers from 00 to 37 or one hex rotary
    switch plus a toggle switch the circuit can be much simpler and
    appreciably cheaper

    I prefer to give them what they want, rather than what they ask for.
    Getting them to understand what they actually want can take a while
    and requires some diplomacy - not one of my strong points and not a
    skill user groups offer the space to exercise.
    One of the marks of a good designer is that capacity to step back and
    see what the client wants done - this does require some understanding
    of what the client might be trying to achieve, and can frequently
    avoid a great deal of unnecessary elaboration.
    Silk-screened front panels cost money - for prototype work we just
    used Letraset transfers onto brushed aluminium to create the legends
    and protected them with a layer or two of polyurethane varnish.
    Cheaper and a great deal quicker.

    Laying out a board to create a single protoptype can be worth the
    effort for very high speed electronics. For this sort of work a one-
    off prototype is usually hand-soldered onto perforated prototyping
    boards. You can wire-wrap the connections but I've not seen it done in
    recent years. If you've got access to a printed circuit layout program
    that can do auto-routing, creating a printed circuit layout can be the
    quickest way to get to a working board, but going from gerbers to
    etched boards takes a certain amount of organisation which a
    mad.scientist might not be able to access.

    In case you hadn't noticed, the defects in your banking system
    recently produced dramatic falls in every stock market around the
    world. That gave everybody a lot more trouble than any comment I could
    possibly make.
    Try and vote for somebody with an ounce of sense in the next set of
    presidential elections.

    What the client thought they wanted, not knowing what alternatives
    were available.
    While your approach might be described as the electronic equivalent of
    the vanity publisher. Flattering for the client, but scarcely offering
    them the kind of service they ought to be able to expect from someone
    skilled in the art.
    Myopic I am - in one eye. The other one has mild astigmatism, which is
    why I've still got binocular vision. Whether I'm an idiot or not is
    not a subject on which you are equipped to express a useful opinion.
    Yesterday's job interview went well enough to show I don't look like
    an idiot to people who do know something about electronics, but then
    again I've always done well with the engineers at Philips - it has
    always been the personnel department that has been unhappy with my
  11. Bob Monsen

    Bob Monsen Guest


    You could use a multi-turn potentiometer. A 10 turn pot would make it much
    easier, since a selection would then be 14°, which would be much more
    manageable. Using a 'heavy' knob, which would keep spinning due to angular
    momentum would make it less tedious to dial from 0 to 255.

    One issue with this approach is that it might change if it is near the
    cutoff point, or worse, oscillate between two due to vibration.

    Another issue has to do with my microwave (that I just dumped today because
    of terrible interference problem with cordless phones) which had a a
    spinning knob to select the cook time. It was a free spinning dial, which
    would change more quickly depending on the velocity of the dial. It was very
    tedious to use, so while the interface might seem like a good idea, it
    probably isn't.

    (The uWave was a Panasonic 1300W oven, for those who wish to avoid
    interference. I even went out and bought a 5Gig phone to avoid it, and it
    actually interfered with the new phone. I'm surprised it passed FCC testing.
    It must have been spraying EM all over the airwaves to interfere with a 5Gig

    Bob Monsen
  12. John Fields

    John Fields Guest

    And you, of course, are the one who will determine what the client

    Reminds me of the joke where this guy goes into a brothel and asks
    the madam if she runs a union shop. The madam says no, and the guy
    asks how she splits up the take. She replies, "Well, out of every
    $100 we take in the girl gets $40, the house gets $40, and I get

    Outraged, the guy leaves and goes to another brothel which he finds
    _is_ a union shop and that the girl gets $60 and the house gets $40,
    out of which the madam takes her cut. "That's more like it," he
    says, "I'd like Lily, over there."

    "I'm sure you would," replies the madam, "but you'll take Emma; she
    has seniority."
    What a horse's ass you are.

    One gets satisfied customers by giving them what they want, and
    second guessing them by telling them that what they really need and
    what you'll provide them with is the Stilton you've selected for
    them instead of the Roquefort they really want isn't going to get
    you many happy campers.

    Or, BTW, many employment offers.
    No, you prefer to give them what you think they should have.
    I think the problem isn't one of their being able to determine what
    they want, it more like your _not_ being able to determine what they
    want and trying to force your decision of what they need down their
    Yes, and you certainly proved that you had no clue that the OP
    _wanted_ to be able to switch 31 channels and get a decimal
    representation of the hot channel decimally when you unnecessarily
    elaborated on that totally useless hexadecimal implementation.
    Yes, and I've used Dymo labels. So what?

    The point isn't that some panel marking methods are cheaper than
    others, it's that, basically, your hex "solution" won't yield the
    results the OP asked for.
    Oh, well...

    If I don't go directly from schematic to PCB that's exactly how I do
    my prototypes and one-offs. Vector T-44 terminals hot-pressed into
    FR-4 perfboard with 0.025" diameter holes on a 0.1" rectangular

    Components are mounted on the forked side of the terminal and the
    connections wire-wrapped on the other side of the board. For
    high-frequency stuff I use single or double sided copper clad
    perfboard and spot-face a 0.1" diameter space around the terminals.

    Works great.
    Again you digress.
    This is supposed to be a technical discussion, not an outlet for
    your anti-American garbage. You really do have trouble staying on
    track and you never miss a chance to spew vitriol, do you?
    You grasp at straws, Sloman.

    The client described what he wanted to achieve and presented a
    couple of ways he thought would get him where he wanted to be.

    Your cockamamie hex rotary switch "solution", LOL, cannot by itself
    a decimal display make.
    LOL, I'm prepared to provide the OP with schematics for either or
    both of the two 32 channel switch systems he earlier showed interest
    in, (one of which I critiqued in order to show him a better way)
    while all you're prepared to do is flap your gums about how he
    should settle for hex switching and learn to interpret a,b,...
    In my opinion, your opinion as to whether or not I'm equipped to
    express a useful opinion is flawed.
    Too bad you're so easily outwitted and made to stand outside the
    gates, cap in hand, by the morons in the personnel department.
    Seems like after all these years, if you were any good, you'd at
    least have _some_ internal engineering contacts who were aware of
    your massive talents, wanted you on board, and could lean on
    personnel in your behalf.
  13. Fred Bloggs

    Fred Bloggs Guest

    Sounds like a bad seal implementation, hard to get more than 1uW/cm^2
    even right on top of the panel or door. Interference that bad could only
    be caused by insufficient or severely imbalanced tightening of the
    'tron' bolts and gasket.. or it may have been something awry with the
    input filter on that crummy little 36KHz inverter, if it had one of those.
  14. I use Comcast (I know, but it's what's available) and I see only a few
    spam posts a day here, mostly cheap shoes and that damned islamospammer,
    with the odd update on the old chain letter.
  15. John Fields

    John Fields Guest

    I guess you missed this part about using a single-turn pot and an

    "However, if you used only the 5 MSBs, that's 330°/31 steps, which
    will get you 10.6° per step, which is eminently doable." :)

    That would also get rid of the tedium of getting to a distant
    channel and the expense of the 10 turn pot.
  16. John Fields

    John Fields Guest

    So the reason you have binocular vision is _because_ you have myopia
    in one eye and mild astigmatism in the other?
  17. MooseFET

    MooseFET Guest

    A sort of cute trick for making a front pannel on a breadboard /proto
    version is:

    Draw up you suggested pannel with a CAD package. Print it on the
    Laser printer. Take the 3M transfer tape and put the glue down on the
    metal panel. Stick down the printed version. Punch the holes to line
    up and install the controls.

    You can add the 3M sticky Mylar to make the panel stay looking good
    for a while.

    This works fairly well for a "it will be kind of like this" version.
    It also works OK for making quick test jigs.

    I use;keywords=capital
    to make things up to about 100MHz. With a bit of creative use of
    tinsnips, you can cut them down for what is needed.
  18. Guest

    This would be an easy project using a 8-pin picmiro (12f508,12F629...)
    pic12f508 cost about a buck at
    You could use a simple momentary-switch to step through from 0-31
    If you already have one of the pic progammers found on the web,
    here's some code to get you started.


    clrf count


    btfsc GPIO,3 ;loop until switch is cleared
    goto main
    incf count,f ;increment count by 1
    movf count,w ;copy count to Working Register
    movwf GPIO ;Send Data to OUTput ports
    xorlw .31 ;check to see if count is 31
    btfss status,z ;If so reset back to Init
    goto Init ;reset count to zero
    goto main ;if count is not 31 then to main
  19. John Fields

    John Fields Guest

    What I like to use for stuff like that is a sticky-back repro film
    like Rayven 420, a polyester film with an adhesive backing so you
    don't have to use transfer tape.

    The part that's nice about using transfer tape, though, is that you
    can print the mirror image of the panel on the film and then stick
    it to the panel toner side down. That makes the image right-side up
    and puts the film between the outside world and the toner, keeping
    it from getting scuffed up.
  20. Guest

    Yes - one eye was active for close work and the other when looking
    farther away so neither one went "lazy".
    Apparently there was distance where both gave much the same
    information and I got to use binocular vision enough that it was still
    there when I finally got spectacles, despite the opthalmologists
    idiotic objections to spectacles for kids.

    You comfort yourself with the thought that anything you can't
    understand is idiocy.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day