### Author Topic: Is there a simple spst switching with number display thing?  (Read 20961 times)

#### mth5044

##### Is there a simple spst switching with number display thing?
« on: June 02, 2009, 07:41:02 PM »
I don't even know what to call it, so I have no idea what to search for. I'm hoping my explaination will atleast get me a name of what I'm supposed to look for. This is also my first time posting in the Digital forum.. so hopefully I'm in the right place.

Anyway, the FV1 chip, with the reverb and all that jazz has it's 7 or so effects selectable by three switches, which are either on or off. The comination of these switches determines what program its on. Instead of having three toggle switches to do the job, I wanted to have some kind of control that has an up and down and a number display on a seven segment number LED thing. The up and down would flip through different switch combinations and then have a number displayed as to what combination the switches are in (i.e. what effect is on).

For example, when the number 1 is displayed, the switches could be on on on, then when the up button is pushed the number 2 is displayed and the switches are in on on off. Just an example.

Is this going to be rough? I don't have any programming knowledge, which is probably going to be the biggest downfall. I'm just not sure if this has a name I can look up, or if there are some IC's I could buy and use.

Thanks dudes!

#### R O Tiree

##### Re: Is there a simple spst switching with number display thing?
« Reply #1 on: June 03, 2009, 06:37:06 AM »
Probably better to have it displaying by means of simple LEDs. You could convert into numbers, but you'd have to mentally convert back into binary to decide what's on and what's not. For example, effects 1 and 3 on would be displayed as "5", which is 101 in binary. So, in this case, 101 translates instantly as "1 on, 2 off, 3 on".

CD4053 would do for the switches - each one contains 3 SPDT switches and a pair of these chips would provide 3 for the effects and 3 for the LEDs. Or just one and do the Millenium LED switching trick on the other pole of each switch?

CD4029 will be ideal for the up/down counting. This very clever chip will either output in binary if pin 9 is held high or base 10 if pin 9 is grounded. So, we want it to count in binary, so hold it high. It has 4 output pins, Q1 - Q4 which can be used to drive the CD4053.

The other clever thing it does is provide what the datasheet calls "jam inputs" together with a "preset enable" pin. This means that you can force it to be at a particular number when you raise the preset enable high. So, when you want to cycle from 7 (Q1-Q3 all on - binary 111) to 0 (Q1-Q3 all off - binary 000) the chip will try to go to 8. So, when Q4 goes high, you have a simple little series of gates to (a) preset enable high and (b) J1-J4 all zero and all the lights go off. Going the other way is just as easy - you are looking for the condition when Q1-Q4 are all off and it receives a "down" selection to result in (a) preset enable high and (b) J1-J3 high and (c) J4 low.

Another couple of NAND chips and maybe a NOT chip to provide the roll-over logic for the jam inputs and we're done.

Give me a couple of hours and I'll have a completed circuit for you.
...you fritter and waste the hours in an off-hand way...

#### R O Tiree

##### Re: Is there a simple spst switching with number display thing?
« Reply #2 on: June 03, 2009, 08:17:14 AM »
It's actually easier than I thought - We don't care about Q4 at all... when you increment from 7 to 8, Q1 - Q3 all turn to zero anyway and when you increment from 15 (all on) to "16", all outputs go off. Similarly, when you decrement from all off, you get "15" (all on, but we don't care about Q4 = 8, remember) and when you decrement from 8 to 7, Q1 - Q3 all turn on again.

You just need one CD4011 Quad 2-Input NAND chip for a quick and dirty solution, but there's the problem of switch-bounce, so you need another one to provide 2 S/R latches. Switches are SPDT momentary contact, so you push it and then just release to get a complete clock cycle:

I've just shown the LED switching, but it wouldn't be hard to add another 4053 ganged to the same inputs to provide the signal switching. Have a look at R.G.'s site (www.geofex.com) for more info about switching systems involving 4053s and how to bias the inputs/outputs.
« Last Edit: June 03, 2009, 08:21:31 AM by R O Tiree »
...you fritter and waste the hours in an off-hand way...

#### mth5044

##### Re: Is there a simple spst switching with number display thing?
« Reply #3 on: June 03, 2009, 09:10:08 PM »
Wow R O Tiree, I really appreciate the information you gave. It's not a real easy reading for me, so I will take some time to digest what you suggest and see if I can wrap my head around it.

The floor is still open to other ideas, if they exist, although the CD4053 looks like it would work beautifuly

#### mth5044

##### Re: Is there a simple spst switching with number display thing?
« Reply #4 on: June 06, 2009, 04:32:41 PM »
I tried to look through RG's site, but for some reason I never have any luck finding the pages I want to there.

Is it possible to just piggy back another 4053B off of Q1,2 and 3 for the 'audio' switching part? I mean, if I had to make that schematic twice, that would be 8 IC's and really limit how small I can make this thing. To make things worse, I still need to work with through hole stuff, never tried SMD

Also, any ideas on how to convert the three LED's into a number display? I found there are IC's that work with them, but I'm not sure how to find the missing link.

Thanks

EDIT: sorry, I've been putting together a layout for this, atleast the LED part, and in your diagram, I am having some trouble identifying some pin numbers. From this data sheet:

I get Q0-3 (or 1-4 like your diagram), P0-3, U/D, B/D, Vss and Vdd, but what about C in, C out and Clock? I read your description, and I won't lie, it's still really confusing, but it is slowly making sense..
« Last Edit: June 06, 2009, 05:49:52 PM by mth5044 »

#### slacker

##### Re: Is there a simple spst switching with number display thing?
« Reply #5 on: June 06, 2009, 04:54:47 PM »
Have a look at the CD4511 that will drive a 7 segment LED display to show your numbers, you can just use that instead of the CD4053.
I'm guessing the outputs of the CD4029 will drive the FV1 directly to choose the program.
« Last Edit: June 06, 2009, 04:59:17 PM by slacker »

#### mth5044

##### Re: Is there a simple spst switching with number display thing?
« Reply #6 on: June 06, 2009, 06:20:18 PM »
Have a look at the CD4511 that will drive a 7 segment LED display to show your numbers, you can just use that instead of the CD4053.
I'm guessing the outputs of the CD4029 will drive the FV1 directly to choose the program.

Thanks Slacker, I'll have to see if I can make any sense of it.

#### R O Tiree

##### Re: Is there a simple spst switching with number display thing?
« Reply #7 on: June 07, 2009, 07:10:00 AM »
I typed "CD4053 geofex" into Google and the first hit was Bypassing and Switching with the CD4053. The coding on the page is a little weird and you'll find some of the text hidden behind some of the pictures, perhaps. You can solve this by dragging the right hand border of the window and making the window narrower. I found that making it a square sorted this out...

The 4511 is a no-brainer if you want to display numbers - but what's the point of logic that works in binary if you display it in base 10 and then have to mentally convert it back into binary again in order to decide what's on and what's off?

Each of these devices' outputs can drive up to 50 other inputs, usually. So there's no problem at all in using the outputs from the 4029 to drive another 4053.

The pinouts on the MC14029B-D chip and the CD4029 from Fairchild are identical. As you correctly identified, the one you linked to labels the jam inputs and the outputs 0-3 instead of 1-4, but it's all the same. My simulator gives some of the pins different names, but here's the breakdown:

Pin   CW Sim   Fairchild Datasheet                 Remarks

1.      LD               Preset Enable                        Must be held at Gnd unless you want to force it to adopt another number via the jam inputs.
2.      Q4               Q4                                       This output denotes "8" in decimal when high. Add it to whichever other outputs are high to get the correct
3.      P4                J4                                        Jam input 4 (. If pin one is high, whichever of these jam-inputs is also high at the time will go forward to its
respective output (Q4 in this case, then).
4.      P1                J1                                        Jam input 1 (1).
5.      EN                Carry In                               Only needed when you're cascading these chips to count to higher numbers. Hold it low in this application.
6.      Q1               Q1                                       Ouput denotes "1" when high. Add to the other Qs.
7.      C                 Carry Out                             Leave this one floating. It sits high unless Q1-4 are all on, when it flips low. We don't need it here.
8.      Not Shown    Vss                                     Connect to circuit ground. Not shown in CW sim in order to keep the diagrams clearer.
9.      B/D               Binary/Decade                     If held high, it counts in binary, if low it counts in decimal. We want it high.
10.    U/D               Up/Down                            If held high the chip counts down by one when the clock is cycled. If held low, it counts upwards.
11.    Q2                Q2                                     Output denotes "2". Add to the others.
12.    P2                 J2                                      Jam input 2 (2).
13.    P3                 J3                                      Jam input 3 (4).
14.    Q3                Q3                                     Output denotes "4". Add to the others.
15.    |>                Clock                                  Chip changes state on the leading edge of the clock pulse going high. Nothing happens when you put this pin low again, except
the chip is now ready for another clock pulse.

Hope all that helps.
...you fritter and waste the hours in an off-hand way...

#### slacker

##### Re: Is there a simple spst switching with number display thing?
« Reply #8 on: June 07, 2009, 10:03:27 AM »
The 4511 is a no-brainer if you want to display numbers - but what's the point of logic that works in binary if you display it in base 10 and then have to mentally convert it back into binary again in order to decide what's on and what's off?

Good point. I was assuming that the 3 inputs on the FV1 were BCD inputs so number 1 from the CD4029, binary 001, would be patch 1 and an input of 001 to the CD4511 would display the number 1, so no mental conversion needed.

I didn't read the original post well enough, if Mike really wants on,on,on (111) to be patch 1 then what I suggested won't be much use.

#### R O Tiree

##### Re: Is there a simple spst switching with number display thing?
« Reply #9 on: June 07, 2009, 02:04:17 PM »
Oops - forgot Pin 16 - Vdd - connect to positive supply.
...you fritter and waste the hours in an off-hand way...

#### mth5044

##### Re: Is there a simple spst switching with number display thing?
« Reply #10 on: June 07, 2009, 02:06:44 PM »
R O Tiree, thanks for that explaination, just what I needed   I've got a layout almost ready for it that I will post up.

I don't really get what you are saying about the point of doing it if you have to convert it back to binary anyway. The reason I want to go this way is for the number to be displayed instead of having to read the number and sequence of LED's then interperate what the combination of LED's mean. If I wanted to just keep it to three LED's, I could just put in three switches with LED's and switch them that way, instead of 5 IC's and two switches. I was thinking of trying to find something to go on the other set of lugs on a DPDT switch that could control the counting and keep it seperate from the switching circuit, but I can't seem to find anything that stays in the parameters of only counting from 0-7 or 1-8.

But, I would like to give the way you say a try, definitly a fun project.

EDIT: I do atleast know the Vdd part  Thanks for the addition though

#### R O Tiree

##### Re: Is there a simple spst switching with number display thing?
« Reply #11 on: June 07, 2009, 06:12:30 PM »

There ya go - now you get a number output. You'll still need the 4053 for the switching (see GEOFex) and you can use the Q1-3 outputs to drive both the 4511 and the 4053. Those switches are not ordinary "latched" SPDT that stay in the new position when you release the plunger - the ones you'll need are "momentary", which means you push, the switch changes state, release and the switch returns to its original state.

Here's what happens when you select the "Down" switch:

You see the logic changes state and "1" is displayed already, but the system needs to reset itself, so you need to release the switch:

« Last Edit: June 07, 2009, 06:18:31 PM by R O Tiree »
...you fritter and waste the hours in an off-hand way...

#### MoltenVoltage

##### Re: Is there a simple spst switching with number display thing?
« Reply #12 on: June 07, 2009, 06:34:37 PM »
This is exactly the kind of thing microcontrollers do best.

This could easily be done with a 14 pin uC - 2 power pins, 7 LED display pins, 3 output pins, 2 input pins

We'd make one, but it appears the total market would be 1-2 chips.
MoltenVoltage.com for PedalSync audio control chips - make programmable and MIDI-controlled analog pedals!

#### R O Tiree

##### Re: Is there a simple spst switching with number display thing?
« Reply #13 on: June 08, 2009, 02:06:36 PM »
Sometimes it's fun to work the logic of these things out the "hard way". Also, if this is the sort of thing you're only going to do once, then hard-wiring is probably the way ahead. If, however, you're going to do this sort of thing a lot, then investing in the hardware and software to "roll-yer-own" becomes viable.
...you fritter and waste the hours in an off-hand way...

#### mth5044

##### Re: Is there a simple spst switching with number display thing?
« Reply #14 on: June 08, 2009, 08:00:46 PM »
R O Tiree, I love you.

Seriously.

You have definitly made my first visit into digital a fun and exciting one. Of course, being hand fed the stuff is an easy way out, but I really appreciate what you did. It's not said enough, but people at this forum put so much time into helping people out, where they won't really get anything out of it, but do it anyway. I wish I knew some of you outside the forum

Back on topic, I got as far as the 4029 chip, so now I'll just split Q1-3 into two parts, going to the 4053B and the 4511B. What do B stand for anyway? Since it's on every chip we've used so far.

MoltenVoltage - I was told by cloudscape, I think is his name on here, (or tape, or sonic crayon, if you recognize any of those names) that ucontrolers would probably be the 'easiest' way. If you ever saw his Hollow Earth v2 pedal on this site, he had done something similar. R O Tiree is right too, atm, it's just for this one pedal. So the ~\$5 worth in chips is easier for me to do right now then the \$80 BASIC AVR environment or whatever it was called.

OTOH, I can't wait to try out your MV52 chip, especially now that you have a new version out w/o the tap problem.

Thanks again for the schematics R O Tiree, I will hopefully give them a try before my summer is over then I'm sure you will see this thread bumped with a happy ending.

#### R O Tiree

##### Re: Is there a simple spst switching with number display thing?
« Reply #15 on: June 09, 2009, 05:41:42 PM »
Thanks, me old. I enjoyed doing it
...you fritter and waste the hours in an off-hand way...

#### mth5044

##### Re: Is there a simple spst switching with number display thing?
« Reply #16 on: June 10, 2009, 09:43:07 PM »
So, here is a layout, the PnP and then some of the connections on the board.

Some notes on the last picture

The orange lines on the SPDT mom. switches are what direction they are usually latched in. I was looking at some DPDT on-off-on switches so I could just have one switch, which could go up or down, but i forgot it needs to switch the 5v signal, which would have to be always on in the one direction if a DPDT on/off/on switch was used (I think)

Red dots are 5v connections (except the one next to the 5v regulator, which is 9v). I forgot to put the 5v to the 4053B, but that will got to pin 16. Since pins 2 and 5 are isolated on the 4053B, I will clip off the leads of the socket to allow other traces to run under there and be exposed on the end of the PCB.

The A's, B's and C's connect together.

The stuff on the top right is a 5v regulator, I forget the name of the componant used, but it's a common part (7805 maybe? I don't remember). Then the 5v is divided in a little hub type thing to the chips.

I checked the layout a few times, caught some mistakes, but I think it's OK now. I'm not sure if it was easier or harder then layouts I'm used to doing (caps, resistors and the like), but it sure was a different experience. I can't wait to get this up and working

#### cloudscapes

##### Re: Is there a simple spst switching with number display thing?
« Reply #17 on: June 13, 2009, 10:45:06 PM »
really clean!
and yes it would be a 7805
~~~~~~~~~~~~~~~~~~~~~~
{DIY blog}
{www.dronecloud.org}

#### kfw

##### Re: Is there a simple spst switching with number display thing?
« Reply #18 on: July 17, 2009, 09:52:17 PM »

The simple one is "yes, there are such switches"
they're called binary or BCD encoders, and the littlest ones are the size of 6-pin ICs with a screwdriver setting 0-7, 0-9, or 0-F, depending on whether you got octal, BCD, or hexidecimal.  They also come looking like standard rotary switches, or as things called thumbwheel switches, which have a mechanical indicator with a little number and either a wheel to turn or up and down buttons.

Google "thumbwheel switch" and select 'images' to see some.  Or "octal switch" or "BCD switch"

But in summary, you could get an 8-position rotary that selected those automatically and indicated with numbers from 0-7 or 1-8.  And you can get them in a variety of appearances.  Try DigiKey or Mouser.

#### TheNixon

##### Re: Is there a simple spst switching with number display thing?
« Reply #19 on: October 21, 2009, 04:10:31 AM »
Hi,

I made my custom switching/looper based on CD4052 and PIC 16f84... Well PIC programmer can be made up of few components (i had some samples of PIC16f84 and i didn't wnat to threw them away)... CD4052 has ability to switch between 4 different routes. So I use 4 pins of PIC to notify when SW(momentary footswitch) has been pressed and FW  of PIC puts the right combination on two out pins (4 possible combination) which are connected to A,B pins of CD4052. PIC has 5V supply, 4052 has bipolar +-9V supply, so this two pins need 9V to make changes in 4052 (5V wont work, it is to low), so I add transistors (common collector) to drive 9V to pins of 4052. I tried to to replace PIC16f84 with some logic and I made some milley and moore automats but I soon realize that it woudl be easier to use PIC and made only simple PIC programmer (RS232 based). For FW programimg I used PIC simulator IDE which offers you simple basic language compiler and simulation and overview of pins of PIC. I made up whole thing within 30mins. SW compiles *.hex and with any programmer you can donwload it to device. Everything works nice for me.

Br,
nix