Need help with circuit

Discussion in 'The Projects Forum' started by karaandnick, Dec 19, 2012.

  1. karaandnick

    Thread Starter New Member

    Dec 19, 2012
    18
    0
    I am working on a circuit that will control the selections on a arcade pcb. Basically I have a 6-in-1 arcade pcb switcher (a board that holds 6 individual jamma boards), when you press a button on a wireless remote it switches to each of the boards. The wireless interface to the pcb board is very simple and has already been figured out by someone else. The main PCB has a wireless daughter board attached that connects via 6 pins, +5, and negative. Each of the 6 pins controls which of the boards is active by going high. Currently people are putting a rotary switch in place of the wireless board on the main board. I want to do something different so that the machine looks totally stock. I want to make it where you push both "start" buttons at the same time and the game switches. I currently have a cd4017 decade counter wired up as shown in the figure below. My question is how do I control the chip with the two "start" buttons? I can't wire + on one button and neg on the other or they will ground when you push each of them individually. I have been trying to figure out how to use a 555 to control the 4017 but am stuck. Also I am not married to the cd4017 so if there is a better way please let me know. I am very electronics illiterate but can read circuit diagrams. Basically I need a digital rotary switch. Any help would be greatly appreciated and thanks in advance.
     
  2. karaandnick

    Thread Starter New Member

    Dec 19, 2012
    18
    0
    Also I would like it to remember and stay on the selected setting when powered down and then back up.




    I currently have the circuit built and attached to the board which switches just fine, I just cannot control the switching by pressing both "start" buttons at the same time. Both "start" switches are wired high and low sharing a common ground, if this helps. Also if it helps the "start" buttons are 3 terminal, +5, "-", and Normally closed "-". ​
     
    Last edited: Dec 19, 2012
  3. Dodgydave

    Distinguished Member

    Jun 22, 2012
    4,980
    744
    Use diodes or a dual pole switch, transistor slave , relays, any of these can be used can you post a diagram of what your trying to achieve?
     
  4. elec_mech

    Senior Member

    Nov 12, 2008
    1,513
    193
    Using the two start buttons to feed the clock signal to the CD4017 should be possible, but I have no idea how your switches work. Three contacts and both + and - connections? If you could post a wiring diagram of the switch, we can make some suggestions.

    If the switches cannot be wired in series, then you could feed the outputs to an AND or NOR gate so when both are pushed, a clock signal goes to the CD4017.

    I don't see a need for a 555 unless you need a time delay of some sort.

    I don't know of a way of keeping the memory of the CD4017 so the same selection is present between power cycles unless you just keep the 4017 powered.
     
  5. Dodgydave

    Distinguished Member

    Jun 22, 2012
    4,980
    744
    To freeze the outputs, take pin 13 high.
     
  6. karaandnick

    Thread Starter New Member

    Dec 19, 2012
    18
    0
    Thanks to everyone who replied. Using all the information I have done some more research and added a NOR gate to hopefully make this thing work. At the bottom you can see the player 1 & 2 buttons that will hopefully cause the game to switch when pressed simultaneously. I have a couple more questions.

    1. Do I need to debounce both the buttons? If so, how should I do it? Remember that both "start" buttons are already wired to a PCB to control the game. Maybe they are debounced on that board and I can just splice into them?

    2. Should I add pull-UP resistors to the grounds of the buttons? Again they are connected to a separate PCB that is independent of this board.

    3. Does anyone know right off hand if the inputs on the 7402 should be wired constantly high or low in this application.

    4. Does anyone see any problems with the circuit, in general?

    Again thank you in advance and I appreciate everyones help.


    *EDIT - After looking at the pinout of the 7402 it looks like pins 2 & 3 should be wired high and brought low to make pin 1 go high (causing pin 14 on the 4017 to go high) to switch between the output pins on the 4017.
    [​IMG]
     
    Last edited: Dec 24, 2012
  7. elec_mech

    Senior Member

    Nov 12, 2008
    1,513
    193
    First, you need to figure out how the switches are currently wired. One side is probably connected directly to power, the other side is connected to power through a resistor. With the arcade board powered off, I suggest using a meter and checking the resistance between +5VDC and each side of the switch. Repeat for GND.

    One side of each switch should show close to zero ohms - this means a direct connection. The other side should show a moderate resistance, probably 5k-100kΩ. You want to use the side of the switch with high resistance to connect to the input of the logic gate.

    If the high resistance is between the switch and +5VDC, then you'll use the 7402 (NOR gate). When both switches are pushed, they will each output a low signal, so a NOR gate will be needed.

    If the high resistance is between GND and the switch, you'll want to use a 7408 (AND gate). When both switches are pushed, they will each output a high signal, so an AND gate will be needed.

    If the switches are not connected to anything, you can use the schematic you posted with a 7408 (AND gate), but add a resistor, say 10kΩ, between each switch and GND, otherwise you'll end up with a short whenever the switches are pushed. These are called pulldown resistors because they are connected to GND and "pull" the signal down whenever the switch is not pressed.

    Alternately, use the 7402, but add a resistor between +5VDC and one side of the switch. This side will be connected to the input of the 7402. The other side of the switch will be connected directly to GND.

    You can try the circuit without a debounce and see how it performs. You can use a resistor and capacitor combo as a form of debounce, but for a solid debounce action, I suggest a 4093 along with a 10kΩ and a 0.1uf capacitor. I can post a schematic if you'd like.

    Add a 0.1uF ceramic cap as physically close to Vcc and GND of the 4017 as possible - this is important to do for each and every CMOS IC used. CMOS ICs generate noise and these caps help prevent this noise from affecting other ICs.

    If using the 7402, the inputs should be pulled high when the switch is off for the reasons you mentioned. Again, using the 7402 depends on how the switches are currently connected in the existing circuit.
     
  8. karaandnick

    Thread Starter New Member

    Dec 19, 2012
    18
    0
    Thank you elec_mech for the responses. I think I almost have it but have a couple of little problems.

    The switches have three terminals but only two of them are used. Its a standard arcade push button on a microswitch. One is a +5 and the other one is connected (in series) to all of the buttons on the control panel and then grounds to the chassis. So I should connect the +5 to the input? For some reason when I connect everything up all the pins on the 7402 go high, I have verified voltage at the 2 & 3 pins. Is the pinout on these chips always the same? I have been assuming when looking down from the component side that pin 1 is to the left of the indentation, or is it when looking down from the solder side?

    Here are a couple of pics I found online of the buttons. Maybe they will help.

    [​IMG]

    [​IMG]
     
    Last edited: Dec 24, 2012
  9. elec_mech

    Senior Member

    Nov 12, 2008
    1,513
    193
    You correct - if looking from the top of the IC (pins facing downward), orient the IC so the side with the indentation is facing up. Pin 1 is then the topmost pin on the left.

    Before going further, we need to understand how the switches are currently wired. The pictures are helpful, but I still don't know how they are wired. The COM pin of all switches are tied together? If yes, then they are all connected to GND? If yes, they are probably wired in parallel, not series.

    Which of the two remaining pins is connected to +5VDC, N.C. or N.O.?

    With the power off, follow the directions in the attachment and let me know the resistances for questions 1, 2, and 3. It is unlikely each pin on the switch is directly connected to power (directly to GND and directly to +5VDC). More likely, one is connected in series with a resistor to act as a pullup or pulldown. We need to determine which one it is before connecting to the logic ICs.
     
  10. karaandnick

    Thread Starter New Member

    Dec 19, 2012
    18
    0
    Wouldn't you know that my batteries died in my multi-meter, I will have to get batteries after it stops snowing. For now I have provided a picture of the part of the board where the +5 connects to the PCB. It goes through one of the green resistors. I can't believe I didn't think of it sooner :confused:, but I have schematics of the entire cabinet and boards so I have also attached a pic of the PCB schematics showing how the "start" button is wired. Also to answer your question the +5 connects to the switch to the "NO" terminal (the NC is left empty on all switches). Thank you for helping me with this, I would have thrown in the towel already.

    Resistors Gold-Red-Purple-Yellow

    [​IMG]

    [​IMG]
     
  11. WBahn

    Moderator

    Mar 31, 2012
    17,737
    4,789
    Since the NC terminals are not used, there is effectively no distinction between the common and the NO terminals, meaning that the two connections can go to either terminal.

    The resistor pack at the top of the schematic has its common pin wired to +5V. That means that the switch needs to pull down in order to change the logic state, which in turn means that one side of the switch needs to be connected to the 470 resistor and the other end tied to ground. With the resistor pack being 4.7kΩ resistor, this should bring the voltage at the IC inputs down to about 0.5V.

    Are you sure that one side of the switch is going to +5V and not GND?

    Also, the resistor colors you give are backward and I think the band you are saying is red is probably really brown. The colors Yellow-Violet-Brown-Gold would indicated a 5% tolerance 470Ω resistor, which matches the schematic.

    As for the capacitors, at 100pF they would appear to me to be too small to provide any significant switch debouncing (only a 0.5μs time constant for pullup and 50ns for pulldown).
     
  12. elec_mech

    Senior Member

    Nov 12, 2008
    1,513
    193
    Okay, this helps immensely. If the COM pins are all tied together and tied to GND, then the N.O. pin is pulled high by the RN11 resistor network. The Start_1 N.O. pin is debounced by R100 and C134. I'd keep things simple and do the following:

    1. Refer to your 4017 schematic and remove all connections going to pins 2 and 3 of the 7402.
    2. Make a connection between N.O. of the Start_1 switch and pin 2 of the 7402.
    3. Make a connection between N.O. of the Start_2 switch and pin 3 of the 7402.
    4. Add a 0.1uF ceramic capacitor across Vcc and GND of the 4017.
    5. Test.
    The inputs (pins 2 and 3) of the 7402 should both be high (+5VDC) when the start buttons are not pressed. The output (pin 3) of the 7402 should be low (GND).

    The output should continue to be low (GND) if one switch is pressed but the other is not. Test this for both switches.

    The output should be high when both switches are pressed. When the output is high, the output of the 4017 should change. I haven't double-checked the 4017, so if the output is high (pin 3 of the 7402) but the 4017 output does not change, let me know.

    Good luck!
     
  13. karaandnick

    Thread Starter New Member

    Dec 19, 2012
    18
    0
    Ok I will give it a try and let you know. Just out of curiosity (and since I am trying to learn along the way) what does the capacitor on the ground do? Thanks, Nick
     
  14. karaandnick

    Thread Starter New Member

    Dec 19, 2012
    18
    0
    Ok I made the connections and the 7402 functions properly, that is both start buttons must be pushed to make pin 1 go high. The problem is with the 4017. I have pin 14 of the 4017 connected directly to pin 1 of the 7402 (no grounding or any other components). I have hooked an led to one of the outputs of the 4017 but when I cycle through the button presses the light will just flash and then go off, if I hold the start buttons at the time it flashes it will stay lit but then will go out after I release the buttons. Also there is no pattern to when they light, it is just random. The exact chip I am using is a mc14017bcp. Does the clock need to be grounded until it goes high? For the ceramic capacitor I used one that says MP 102K 1KV. I am not sure how to read these I have several other ones but not sure which one to use.
     
  15. WBahn

    Moderator

    Mar 31, 2012
    17,737
    4,789
    Are you using current limiting resistors in series with the LEDs you are connecting to the 4017 outputs? Use something in the 330Ω range.

    What you are probably seeing is switch bouncing. When you press the buttons you get multiple up/down transitions, though what you are describing does not jive perfectly with what I would expect to see from bouncing.
     
  16. karaandnick

    Thread Starter New Member

    Dec 19, 2012
    18
    0
    I have 100k ohm resistors in series, the led will not light when connected to these resistors but only when connected directly to one of the outputs on the 4017. When they do light up it is only for as long as I have the buttons pressed. Do you think adding the 330 resistors could fix this? Does the clock need to be grounded low when it is not high with a resistor as in the first diagram that I posted? Also how crucial is the 0.1uf capacitor? I don't have that exact value right now but I can get it tomorrow.
     
  17. karaandnick

    Thread Starter New Member

    Dec 19, 2012
    18
    0
    I put the correct resistor inline with the LED and also found and placed the correct ceramic resistor but am still getting the same results. When I put my meter on the 4017 I am getting 5 volts at the Vcc, 2.5 volts on all pins even the ground. This is the same results as with the 7402. For some reason the 7402 seems to function properly since when an led is connected to the output pin and to ground and both buttons are pushed the led lights up (even when showing a constant 2.5 volts in the low state). I'm thinking maybe I need to go ahead and connect all the outputs of the 4017 that I plan on using to LED's to make it more stable, that's what I read online anyway. Something I read said to connect even the output pins on the 4017 that I don't plan on using to ground to make it more stable, does this sound correct?
     
  18. elec_mech

    Senior Member

    Nov 12, 2008
    1,513
    193
    Okay, first and foremost, post a schematic of how you have everything wired.

    When both start buttons are pushed, the output of the 7402 (pin 1) as well as the input to the 4017 (pin 14) should go high. The signal will stay high until you release one or both start switches. This is normal.

    You can test this by connecting the anode of an LED to pin 1 of the 7402 and connect the cathode in series to a resistor (150 to 330Ω) then connect the resistor to GND.

    The 4017 changes state (moves from one output to the next) on a high clock transistion. This means the output will change as soon as the clock goes high - as soon as both switches are pressed - no matter how long you hold both switches down.

    Yes, but the 7402 outputs a low signal when one or both buttons are not pressed. No need to add a pull down resistor to the clock pin of the 4017.

    Sounds a bit overkill - the 1KV refers to 1000V rating. No harm, but probably big. A 16VDC or higher rating would be fine. Not sure if the 102K means 0.001uF (this is what 102 refers to) or 1uF with the K.

    Okay, something sounds off. Got to see a schematic of how you've wired this with resistor values. The GND connection, pin 8 of the 4017, should show 0V if you are placing the black probe on the circuit GND and the red probe on pin 8. Same for pin 7 on the 7402. If not, something is not connected correctly.

    Definitely, how else will you know if the circuit is working properly?

    No. For CMOS ICs, you connect any unused INPUT pins to either GND or Vcc because they are suspectible to noise and can affect the operation of the IC. The outputs do not affect the operation of the IC, so for any outputs you are not using, simply leave them unconnected.
     
  19. karaandnick

    Thread Starter New Member

    Dec 19, 2012
    18
    0
    Frustratingly enough.............It works!!!!!!!!!!!!!!!!!! I am embarrassed to admit why I was having so much trouble. I ended up going to radio shack and purchasing a breadboard, I had been using a project board and soldering everything as I go. I was still getting voltage on my ground so I started unplugging everything to isolate the issue and that's when I found out there was no ground at all! Come to find out it was my ground test wire (alligator clips on both ends) did not have continuity. The ic's weren't behaving properly without ground and must have been letting voltage run free. Had I checked this sooner I know this project would already be done. Thanks to everyone who replied and helped me throughout the project. Thanks especially to you elec_mech, your extra details and easy to understand responses kept me going and got this done. What a great website and group of people!!!

    Unfortunately, I have two remaining questions.

    1. It looks like I need a debounce, how would I implement this with two buttons?

    2. How do you have a circuit board printed, would it be very expensive to make 1 or maybe 10?

    Thanks in advance. I can post a video of this thing in action when I get it installed in the arcade, if anyone cares to see it.
     
  20. elec_mech

    Senior Member

    Nov 12, 2008
    1,513
    193
    Don't feel too bad. All of us have had hair-pulling troubleshooting problems from time to time. It seems the more frustrating the problem, the simplier the solution ends up being. You now know why one of the first questions a computer tech support person asks is "Is the power cord plugged in?".

    Number of ways to do this. Personally, I like using a Schmitt trigger such as the 4093 with a cap and resistor. Look at the last circuit shown here: http://www.zen22142.zen.co.uk/Design/debounce.htm. I like this because it uses few parts and a Schmitt trigger is the best way, IMHO, to debounce a switch. The 4093 has four NAND gates, so you can debounce up to four switches with one IC (one resistor/capacitor pair per switch).

    A 7414 should work as well. If these aren't handy, you can use the good old 555. Read the second paragraph under counters: http://www.kpsec.freeuk.com/counting.htm#counters then look at the monostable mode: http://www.kpsec.freeuk.com/555timer.htm#monostable.

    Alternately, you could just use a resistor and capacitor. This will be better than nothing, but may not be enough to do the job.

    More info here: http://forum.allaboutcircuits.com/showthread.php?t=41137&page=2. Take a look at post #17 and #20. t06afre posts an excellent link with more info on the subject: http://www.ikalogic.com/de-bouncing-circuits/.

    You're going open a can of worms here. Several options:
    1) Use a premade protoboard along with wire to make your circuit.
    2) Design a board in a CAD program and make it yourself. Bill has an excellent write-up on this: http://forum.allaboutcircuits.com/showthread.php?t=47681&highlight=bill+marsden
    3) Same as 2), but you send the board out to be made.

    If you're only making one or two, I strongly recommend option 1). RadioShack sells these. If you don't have a RadioShack, let me know who you use to order electronic parts from, e.g., Digikey, Farnell, Maplin, Jaycar, etc. and I can find some to recommend.

    If you need 3 or more, labor will likely dictate using method 2) or 3), although this isn't a very big circuit. Personally, between those two, I like 3) because method 2) requires chemicals and more work than I care to put into it, but that's entirely up to you.

    If you opt for 3), these are a number of programs and board houses you can use. Again, siding on laziness, I like using ExpressPCB (free) to make my board then using Futurelec.com. Futurelec can take a month to get, but I loved the boards I had done and they costed less than using ExpressPCB for the size and quantity I needed. Many people here have used ExpressPCB to have their boards made and have been very happy - they tend to cost more, but they get them done fast.

    ExpressPCB CAD program is real easy to use, but the file can only be sent to ExpressPCB or Futurelec. You can use another program such as Diptrace or KiCAD (both free to my knowledge) - these are more involved and take longer to learn (not grossly, just more things you have to learn and set up before sending the file to a board house), but the file can then be sent to anyone allowing you to shop for the best price.

    Would love to see it in action. Few things are as rewarding as seeing the finished project of someone you helped.
     
Loading...