0

I'm a beginner and I'm currently working on simple PCB with LEDS and Multi-Directional Switch in EasyEDA.

The Switch is Korean Hroparts Elec K1-1505UA-01
https://www.lcsc.com/product-detail/Multi-Directional-Switches_Korean-Hroparts-Elec-K1-1505UA-01_C145912.html
Datasheet: https://datasheet.lcsc.com/lcsc/2108131730_Korean-Hroparts-Elec-K1-1505UA-01_C145912.pdf

LED is MEIHUA MHP1016WDT
https://www.lcsc.com/product-detail/Light-Emitting-Diodes-LED_MEIHUA-MHP1016WDT_C409775.html

Can you help me with the connection ? How to connect the Switch to battery and Switch to LEDs.

I am a little confused with the datasheet of the switch

Switch datasheet

Switch sheet

My Sheet in EasyEDA

enter image description here

  • what are you confused about? – jsotola Mar 09 '22 at 05:25
  • `how to connect multi-directional switch?` ... to do what? – jsotola Mar 09 '22 at 05:41
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Mar 09 '22 at 05:59
  • 7 is the common. If you move the switch up, then pins 1and 2 connect to pin 7. Down is pins 1 and 4 connect to 7 and so on. All the info you need is there. – Kartman Mar 09 '22 at 06:30
  • @Kartman How to connect the switch to the LEDs and how to connect Battery to switch. As I said I am beginner without any knowledge. Studying from videos, ect. If I push the lever up, the (UP-A) battery should light up. It would help me a lot. – Jirka Martinec Mar 09 '22 at 23:01
  • "battery should light up" * i mean LED should light up – Jirka Martinec Mar 09 '22 at 23:23
  • You have a switch, a led, a battery. Now you need a resistor. There are plenty of tutorials on how to use leds. I suggest you seek these out first. Then armed with that knowlege you can solve your problem. Otherwise if I simply answer the question, you’ll be none the wiser. Jumping straight to doing a pcb is quite a leap. Work through each problem step by step and you’ll be more confident of the solution and less likely to waste $20 or so on dud pcbs and just contribute to the scrap heap. – Kartman Mar 10 '22 at 01:24
  • @Kartman Thanks for hints, I took LEDs that require 3.7 V so I don't need a resistor, I quess. For clarification could you attach a schema of what such a circuit would look like if anyone else here wants to know the answer ? I still can't figure out how to wire the LEDs using the Circuit Diagram. Thank you, and thanks for your time. – Jirka Martinec Mar 10 '22 at 20:05
  • 1
    I think what you are asking is "How do I decode the 7 connections from the switch so that the correct LED lights when the switch is moved to one of its 5 possible positions" I don't think you can do this directly without some additional logic. In particular the "E" position. All you've got is contacts 5 and 6 connected, something that happens with EVERY switch position. The difference being that, for "E", there are no other contact connections. You say you've picked 3.7V LEDs that will require no resistor. What are these? Can we have a link to their specification please? – Peter Jennings Mar 11 '22 at 18:32
  • @PeterJennings Hi, yes exactly what you type I'm asking is it. The LED datasheet is included in comment, you can find the the datasheet on the website (https://datasheet.lcsc.com/lcsc/1912111437_MEIHUA-MHP1016WDT_C409775.pdf). What additional logic you think I would need to connect the switch to the leds ? I thought It would be easier ... :D – Jirka Martinec Mar 12 '22 at 12:30
  • 1
    Unfortunately you have picked project that is not quite as simple as it seems. To do justice to an answer, assuming you have no prior knowledge, would require much of a 1st year undergraduate course on digital logic and electronics (or maybe the A-Level syllabus covers it now). How to get usable signals out of the switch. How to decode them. Which type(s) of logic to use. And then how to drive the LEDs from the logic. – Peter Jennings Mar 12 '22 at 14:56
  • Thanks, but you didn't answered how do wire it, can you explain it ? @PeterJennings – Jirka Martinec Mar 13 '22 at 20:47
  • @JirkaMartinec - Hi, You commented: "*I took LEDs that require 3.7 V so I don't need a resistor*". I believe that conclusion is not correct. The diode Vf is rated in the [datasheet](https://datasheet.lcsc.com/lcsc/1912111437_MEIHUA-MHP1016WDT_C409775.pdf) as a range of 2.9 V to 3.7 V (@ 30 mA). For several reasons, that spec does not match an LED with a built-in resistor. Even if you disagree, I recommend you plan that an appropriate resistor may be needed (because IMHO it will be needed :-) ). If I'm wrong, you can always fit a zero ohm link. (Also there's no such thing as a 3.7 V battery!) – SamGibson Mar 15 '22 at 02:13

1 Answers1

1

Unfortunately you have picked project that is not quite as simple as it seems.

The outputs from the switch cannot be used to directly drive the LEDs, they need some decoding. In other words you need to use logical combinations of the 7 terminals to light only the correct LED and no other.

The contacts fall into 2 groups. 1,2,3,4&7 and 5&6

5&6 are connected whenever the switch is operated in any of its 5 positions and can be considered as an enable signal - if they are not connected then no LED lights.

1,2,3&4 all get connected (or not) to 7 in various combinations depending on which of the 5 positions the switch is operated. Note if 1 is connected then 3 is not and vice versa. Similarly 2 and 4 are inverses of each other.

But you are not going to be able to do this without additional logic. If we use the convention 1 is logically TRUE to indicate that terminal 1 is connected to terminal 7 and 0 or FALSE if it is not connected. We have already observed that 1 = NOT 3 and 2 = NOT 4, So you have all the logical signals you need to decode the switch plus 5-6 for enable.

A = 1 AND 2, B = 2 AND 3, C = 3 AND 4, D = 1 AND 4, E = (NOT 1) AND (NOT 2) AND (NOT 3) AND (NOT 4)

We now have to get into the topic of digital logic. How are you going to generate logical signals (TRUE and FALSE, 1 and 0) from the switch? First you need the concept of pull-up and pull-down resistors. There is a good article on them here.

{pause answer while you read the article - the rest of this answer will assume you have done so and understand most of it}

Now consider switch terminal 7. We have 2 options:

  1. Connect terminal 7 to Vcc and have pull-down resistors from 1,2,3&4 to ground. This has the advantage that, with the switch not operated, all of 1-4 will be near 0V via their pull-down resistors and this can be considered logical 0 (FALSE) and when the switch is operated some combination will be pulled up to near Vcc or logical 1 (TRUE). The values of these resistors depend on the type of logic that follows.

  2. Connect terminal 7 to ground and have separate pull-up resistors from 1 - 4 to Vcc. From the article value of these resistors is less critical.

I would say that (2) is a better solution (see article). However it does invert the logic. TRUE becomes 0V and FALSE is close to Vcc. If you are familiar with logic, this shouldn't bother you, if not have a look at this article followed by this one. Terminals 5 and 6 can be treated the same to produce the enable signal or in this case, switch on the power to the LEDs.

schematic

simulate this circuit – Schematic created using CircuitLab

Inverting the logic inverts everything, so A = NOT (NOT 1 OR NOT 2) = NOT (3 OR 4) = 3 NOR 4 and so on.

You now have to decide what type of logic you want to employ. There are numerous choices.

  1. You can use discrete logic such as the 74nnn series ICs some of which could probably do the entire decode / LED drive process in one chip such as the 74156. There are hundreds of different logic functions available in this series. These come on two basic sub-versions TTL and CMOS each of which has its advantages. On top of this, each sub-version comes in several different speed / power combinations. Their pros and cons warranted a whole answer of their own on this board here. Please read it.

  2. You could use a microprocessor such as an Arduino.

  3. You could burn your own decoder using a programmable memory chip.

  4. I'm sure other contributors could come up with several other viable methods.

Assuming that you are going to decode the switch using basic 74nnn gates rather then the more complex functions you will need 4 off 2 input NOR gates to decode A - D and one 4 input AND gate for E (all 4 switch signals need to be 1 to light LED E). This will give you the following logic (Note AND1 gate should be a 4 input AND, but Circuit Lab doesn't appear to provide this symbol.)

schematic

simulate this circuit

You now have 5 logic signals , A - E representing the 5 states of the switch. All that remains to do is drive the LEDs from these signals. Some LED / logic IC combinations may be able to do this directly, other combinations will need an additional driver or transistor.
The following circuit could be repeated 5 times to complete the project. The values of R1 needs to be adjusted to give reasonable current through the LED.

schematic

simulate this circuit

Peter Jennings
  • 2,460
  • 1
  • 5
  • 15
  • Peter - Hi, I didn't read it all yet, but thanks for trying to answer. However when I reviewed the switch datasheet yesterday, I noticed that your statement: "*5&6 are connected whenever the switch is operated in any of its 5 positions*" seems to be wrong :-( Look at the side views of the switch. It shows that action "E" is a z-axis "press down" on the switch actuator. My experience with a similar switch is that you can push the actuator sideways in any direction and you *could* (but don't have to) press down at the same time, hence why action "E" is an *option* for "A" - "D". See what I mean? – SamGibson Mar 14 '22 at 23:58
  • @SamGibson Hi Sam, My reading of the truth table , upper right diagram in the OP's question is that it shows which of the 7 terminals make contact with each other when the switch is operated in any one of its 5 positions. When it is pushed down, operation "E", Z-axis, I see 5&6 connected but no other connections made between pins 1-4 & 7. In any of the other 4 operations, 5&6 are also shown connected and simultaneously some combination of 1-4 are connected to 7 . Where can we see the truth table for your switch? – Peter Jennings Mar 15 '22 at 00:34
  • Hi Peter, I see that we agree up to a point. Here is where I have a different view, after working with a similar switch. You said: "*In any of the other 4 operations, 5&6 are also shown connected*" I agree it could be interpreted that way, but IMHO the datasheet is actually trying to say that the 5-6 connection *could* also occur when pushing (for example) towards "A", if the user *also* pushes down. In other words, the 5-6 connection (action "E") means user is pushing down. If 1,2 & 7 are connected, user pushed towards "A". So connections 1-2-7 *and* 5-6 means push towards A *and* down IMHO. – SamGibson Mar 15 '22 at 00:43
  • (Just to be clear, I admire your tenacity trying to produce a full answer for the OP. I just fear that the (IMHO ambiguous) datasheet has misled you. Feel free to ignore me, as I can't prove that my interpretation of the datasheet is correct - it's just based on a similar switch that I had experience with several years ago, which has a specific "push" set of contacts, that "made" when pushed down in the "default" central position *or* when the actuator was optionally pushed down, while also being pushed to any sideways direction. I will see if I can find info on "my" old switch...) – SamGibson Mar 15 '22 at 00:47
  • Hi Peter, FYI, [this datasheet](http://data.leocom.kr/datasheets/211259_19452.pdf) is for the TPA-511 tact switch we used. You can see (page 2) that this switch's contacts are much simpler that the OP's switch - each *sideways* push connects a common pin (either 1 or 2) to just one other pin. The centre "push down" contact connects pins 5 & 1 as shown, and that can be done with (i.e. added to) any sideways movement. It's the fact that the "push down" could be added to any sideways movement, which made me interpret the OP's switch datasheet that way. If the OP has a switch, could they test it? – SamGibson Mar 15 '22 at 01:48
  • 1
    @SamGibson Hi Sam, you may well be right. Without actually seeing the switch and putting a multimeter on it, who knows what it does. If I'm wrong in my interpretation then it's an exercise for the student to put it right. Thanks for your appreciation of my answer, it took me quite a few hours research to put it together, trying to condense a first year undergraduate course and my 40 years experience as an EE into an answer. I only hope it gets more widely appreciated!! – Peter Jennings Mar 15 '22 at 01:51
  • 1
    @SamGibson Thanks Sam, I see what you mean about your switch. You may well be right. Maybe the OP will enlighten us as the data sheet is, as you say, ambiguous. I'm still not happy about the use of a 3.7V supply with 3.7V LEDs, but I let that slide. It's 2AM here in the UK and I'm off to bed! – Peter Jennings Mar 15 '22 at 02:06