- 1.5k
- 2
- 11
- 20
My problem is, which diodes to use and also why this type (andor why it does not matter).
Solution: 1N4148 diode
generally if you want connect diode to Arduino pin, use this one as it would be OK under nearly any normal use
75 V reverse voltage
1 V forward voltage at 10 mA
10 mA recommended current (destroys at 1 A 1 sec pulse) (and you do not want more then 10 mA anyway)
usable to some hundreds kHz (so using digitalRead/digitalWrite and some logic you are probably a way slower anyway)
super extra common for long time (even 10 years ago was considered "classical") and still actual (so when you get old, it would still be here)
dirty cheap (buy few hundreds just now and you do not need care anymore)
(OLD) More details:
So I probably cannot use simply INPUT_PULLUP
(as it may work by luck, but is not guaranted by specs) but I need to use INPUT
and set some higher pullup there to "burn" more volts on it to compensate for the diode.
The pullup then could go as high as ((5 V - 0.1 V - Vf)/0.1 mA ) - 500 Ω If the forward voltage would be 1 V (wild guess) it would go to something like 38.5 kΩ pullup and 1.15 V on input. The maximal Vf forward voltage would be like 1.35 V (at 0.1 mA), pullup 35 kΩ and 1.5 V on input.
My problem is, that many online Arduino schemes works just because Arduino usually work good even in way out-of-spec situations, and suggested values cames from what the author just randomly had at hands and it worked by pure luck and maybe another hidden factors, as parasite capacity of breadboard or so. So I want to uderstand, why I should choose some parts and how to came to such conclusions by myself.
I want to make reliable projects, not just projects, which works most of the time and fail only occasionally.
My problem is, which diodes to use (and why).
Solution: 1N4148 diode
generally if you want connect diode to Arduino pin, use this one as it would be OK under nearly any normal use
75 V reverse voltage
1 V forward voltage at 10 mA
10 mA recommended current (destroys at 1 A 1 sec pulse) (and you do not want more then 10 mA anyway)
usable to some hundreds kHz (so using digitalRead/digitalWrite and some logic you are probably a way slower anyway)
super extra common for long time (even 10 years ago was considered "classical") and still actual (so when you get old, it would still be here)
dirty cheap (buy few hundreds just now and you do not need care anymore)
(OLD) More details:
So I probably cannot use simply INPUT_PULLUP
but I need to use INPUT
and set some higher pullup there to "burn" more volts on it to compensate for the diode.
The pullup then could go as high as ((5 V - 0.1 V - Vf)/0.1 mA ) - 500 Ω If the forward voltage would be 1 V (wild guess) it would go to something like 38.5 kΩ pullup and 1.15 V on input. The maximal Vf forward voltage would be like 1.35 V (at 0.1 mA), pullup 35 kΩ and 1.5 V on input.
My problem is, which diodes to use and also why this type (or why it does not matter).
More details:
So I probably cannot use simply INPUT_PULLUP
(as it may work by luck, but is not guaranted by specs) but I need to use INPUT
and set some higher pullup there to "burn" more volts on it to compensate for the diode.
The pullup then could go as high as ((5 V - 0.1 V - Vf)/0.1 mA ) - 500 Ω If the forward voltage would be 1 V (wild guess) it would go to something like 38.5 kΩ pullup and 1.15 V on input. The maximal Vf forward voltage would be like 1.35 V (at 0.1 mA), pullup 35 kΩ and 1.5 V on input.
My problem is, that many online Arduino schemes works just because Arduino usually work good even in way out-of-spec situations, and suggested values cames from what the author just randomly had at hands and it worked by pure luck and maybe another hidden factors, as parasite capacity of breadboard or so. So I want to uderstand, why I should choose some parts and how to came to such conclusions by myself.
I want to make reliable projects, not just projects, which works most of the time and fail only occasionally.
- 3.2k
- 7
- 36
- 48
Which kind of diodes I should use in buttons/keys matrix input? (Making gaming keyboard)(SOLVED)
generally if you want connect diode to Arduino pin, use this one as it would be OK under nearly any normal use
75V75 V reverse voltage
1V1 V forward voltage at 10mA10 mA
10 mA recomended mA recommended current (destroys at 1A 1sec1 A 1 sec pulse) (and you do not want more then 10 mA mA anyway)
usable to some hundreds kHz (so using digitalRead/digitalWrite and some logic you are probably a way slower anyway)
super extra common for long time (even 10 years ago was considered "classical") and still actual (so when you get old, it would still be here)
dirty cheap (buy few hundreds just now and you do not need care anymore)
I would use 5V arduino5 V Arduino (Atmega32U4ATmega32U4), datasheet states for input low voltage max 0.3 Vcc3Vcc, which is 1.5V5 V and minimal high input voltage 0.7Vcc = 3.5V5 V and pullups at least 1.5 kOhm kΩ (Vcc-0.4V4 V / 3mA3 mA)
I would like to use 74HC138 3-to-8 decoder for addressing, which makes one of 8 outputs Low (max 0.1V1 V), while other 7 High (min 4.5V5 V) and drive the Arduino inputs Low, if button is pressed.
To be on safe side, I would like also add resistors on each pin to make sure, that bad programming (make some input pin OUTPUT and HIGH and pressing key connect it to LOW output on other side) could not damage the circuits, so it looks like 5V5 V/20mA20 mA = 250 Ohm Ω (and I will hope it would not hit more pins, so I would not consider total port/chip limitations).
In typical case it would be 5V5 V - 1.5 kOhm kΩ pullup - input - 250 Ohm Ω - wires and button - diode - 250 Ohm Ω - 0.1V1 V for selected line.
If the diode would be theoretical and ideal, then there is (in the worse case) promised to be max 1.2V2 V on Input, which is slightly less then "maximal low" voltage (1.5V5 V) and like 5V/2 kOhm kΩ = 2.5 mA mA current.
So I probabelyprobably cannot use simply INPUT_PULLUPINPUT_PULLUP
but I need to use INPUTINPUT
and set some higher pullup there to "burn" more volts on it to compenzatecompensate for the diode.
The Input Current for each pin is 10 uA μA (in or out) and I heard some recomendationrecommendation, that on resistor divider should be the total current 10x more, then the input current, so it would mean 100 uA μA = 0.1 mA mA
The pullup then could go as high as ((5V5 V - 0.1V1 V - Vf)/0.1mA1 mA ) - 500 Ohm Ω If the forward voltage would be 1V1 V (wild quessguess) it would go to something like 38.5 kOhm kΩ pullup and 1.15V15 V on input. The maximal Vf forward voltage would be like 1.35V35 V (at 0.1mA1 mA), pullup 35 kOhm kΩ and 1.5V5 V on input.
- It is the right path, how to compute it or did I some mistake?
- I want use scanning frequency at least 800 Hz Hz (8 lines and results 100x per second) or more (like 10 kHz kHz to be done fast and to have more time to spend with other tasks, like sending USB packets, computing macros, managing light effects etc)
- which common and cheap SMD diodes I should buy?
- reverse voltage over 5 V V, current over 100mA100 mA, switch frequency over 10kHz10 kHz, forvardforward voltage under 1.3V3 V at 0.1 mA mA (rather much less to have safe gap from limits)
- really common cheap model, so everybody would know it and so I could use it everywhere in similar settings without thinking ( or even computing like in previous section)
- preferably what you (and everyone else and his dog too) use for such cases
- I would like to order from AliexpressAliExpress, so rather higher margin for guarantedguaranteed values
- preferably to fit on 0.1 inch spaced universal PCB (0805 smd ledsSMD LEDs are really easy to solder there (so rather not smalersmaller than that), but it may be twice the size too or something like that)
- I would buy like some hundreds of such diodes to have them ready on hands and I will probably make more similar projects over time for me and my friends
Thanks for all comments and sugestionssuggestions
Which kind of diodes I should use in buttons/keys matrix input? (Making gaming keyboard)(SOLVED)
generally if you want connect diode to Arduino pin, use this one as it would be OK under nearly any normal use
75V reverse voltage
1V forward voltage at 10mA
10 mA recomended current (destroys at 1A 1sec pulse) (and you do not want more then 10 mA anyway)
usable to some hundreds kHz (so using digitalRead/digitalWrite and some logic you are probably a way slower anyway)
super extra common for long time (even 10 years ago was considered "classical") and still actual (so when you get old, it would still be here)
dirty cheap (buy few hundreds just now and you do not need care anymore)
I would use 5V arduino (Atmega32U4), datasheet states for input low voltage max 0.3 Vcc, which is 1.5V and minimal high input voltage 0.7Vcc = 3.5V and pullups at least 1.5 kOhm (Vcc-0.4V / 3mA)
I would like to use 74HC138 3-to-8 decoder for addressing, which makes one of 8 outputs Low (max 0.1V), while other 7 High (min 4.5V) and drive the Arduino inputs Low, if button is pressed.
To be on safe side, I would like also add resistors on each pin to make sure, that bad programming (make some input pin OUTPUT and HIGH and pressing key connect it to LOW output on other side) could not damage the circuits, so it looks like 5V/20mA = 250 Ohm (and I will hope it would not hit more pins, so I would not consider total port/chip limitations).
In typical case it would be 5V - 1.5 kOhm pullup - input - 250 Ohm - wires and button - diode - 250 Ohm - 0.1V for selected line.
If the diode would be theoretical and ideal, then there is (in the worse case) promised to be max 1.2V on Input, which is slightly less then "maximal low" voltage (1.5V) and like 5V/2 kOhm = 2.5 mA current.
So I probabely cannot use simply INPUT_PULLUP but I need to use INPUT and set some higher pullup there to "burn" more volts on it to compenzate for the diode.
The Input Current for each pin is 10 uA (in or out) and I heard some recomendation, that on resistor divider should be the total current 10x more, then the input current, so it would mean 100 uA = 0.1 mA
The pullup then could go as high as ((5V - 0.1V - Vf)/0.1mA ) - 500 Ohm If the forward voltage would be 1V (wild quess) it would go to something like 38.5 kOhm pullup and 1.15V on input. The maximal Vf forward voltage would be like 1.35V (at 0.1mA), pullup 35 kOhm and 1.5V on input.
- It is the right path, how to compute it or did I some mistake?
- I want use scanning frequency at least 800 Hz (8 lines and results 100x per second) or more (like 10 kHz to be done fast and to have more time to spend with other tasks, like sending USB packets, computing macros, managing light effects etc)
- which common and cheap SMD diodes I should buy?
- reverse voltage over 5 V, current over 100mA, switch frequency over 10kHz, forvard voltage under 1.3V at 0.1 mA (rather much less to have safe gap from limits)
- really common cheap model, so everybody would know it and so I could use it everywhere in similar settings without thinking ( or even computing like in previous section)
- preferably what you (and everyone else and his dog too) use for such cases
- I would like to order from Aliexpress, so rather higher margin for guaranted values
- preferably to fit on 0.1 inch spaced universal PCB (0805 smd leds are really easy to solder there (so rather not smaler than that), but it may be twice the size too or something like that)
- I would buy like some hundreds of such diodes to have them ready on hands and I will probably make more similar projects over time for me and my friends
Thanks for all comments and sugestions
Which kind of diodes I should use in buttons/keys matrix input? (Making gaming keyboard)
generally if you want connect diode to Arduino pin, use this one as it would be OK under nearly any normal use
75 V reverse voltage
1 V forward voltage at 10 mA
10 mA recommended current (destroys at 1 A 1 sec pulse) (and you do not want more then 10 mA anyway)
usable to some hundreds kHz (so using digitalRead/digitalWrite and some logic you are probably a way slower anyway)
super extra common for long time (even 10 years ago was considered "classical") and still actual (so when you get old, it would still be here)
dirty cheap (buy few hundreds just now and you do not need care anymore)
I would use 5 V Arduino (ATmega32U4), datasheet states for input low voltage max 0.3Vcc, which is 1.5 V and minimal high input voltage 0.7Vcc = 3.5 V and pullups at least 1.5 kΩ (Vcc-0.4 V / 3 mA)
I would like to use 74HC138 3-to-8 decoder for addressing, which makes one of 8 outputs Low (max 0.1 V), while other 7 High (min 4.5 V) and drive the Arduino inputs Low, if button is pressed.
To be on safe side, I would like also add resistors on each pin to make sure, that bad programming (make some input pin OUTPUT and HIGH and pressing key connect it to LOW output on other side) could not damage the circuits, so it looks like 5 V/20 mA = 250 Ω (and I will hope it would not hit more pins, so I would not consider total port/chip limitations).
In typical case it would be 5 V - 1.5 kΩ pullup - input - 250 Ω - wires and button - diode - 250 Ω - 0.1 V for selected line.
If the diode would be theoretical and ideal, then there is (in the worse case) promised to be max 1.2 V on Input, which is slightly less then "maximal low" voltage (1.5 V) and like 5V/2 kΩ = 2.5 mA current.
So I probably cannot use simply INPUT_PULLUP
but I need to use INPUT
and set some higher pullup there to "burn" more volts on it to compensate for the diode.
The Input Current for each pin is 10 μA (in or out) and I heard some recommendation, that on resistor divider should be the total current 10x more, then the input current, so it would mean 100 μA = 0.1 mA
The pullup then could go as high as ((5 V - 0.1 V - Vf)/0.1 mA ) - 500 Ω If the forward voltage would be 1 V (wild guess) it would go to something like 38.5 kΩ pullup and 1.15 V on input. The maximal Vf forward voltage would be like 1.35 V (at 0.1 mA), pullup 35 kΩ and 1.5 V on input.
- It is the right path, how to compute it or did I some mistake?
- I want use scanning frequency at least 800 Hz (8 lines and results 100x per second) or more (like 10 kHz to be done fast and to have more time to spend with other tasks, like sending USB packets, computing macros, managing light effects etc)
- which common and cheap SMD diodes I should buy?
- reverse voltage over 5 V, current over 100 mA, switch frequency over 10 kHz, forward voltage under 1.3 V at 0.1 mA (rather much less to have safe gap from limits)
- really common cheap model, so everybody would know it and so I could use it everywhere in similar settings without thinking ( or even computing like in previous section)
- preferably what you (and everyone else and his dog too) use for such cases
- I would like to order from AliExpress, so rather higher margin for guaranteed values
- preferably to fit on 0.1 inch spaced universal PCB (0805 SMD LEDs are really easy to solder there (so rather not smaller than that), but it may be twice the size too or something like that)
- I would buy like some hundreds of such diodes to have them ready on hands and I will probably make more similar projects over time for me and my friends
Thanks for all comments and suggestions
Which kind of diodes I should use in buttons/keys matrix input? (Making gaming keyboard)(SOLVED)
Solution: 1N4148 diode
generally if you want connect diode to Arduino pin, use this one as it would be OK under nearly any normal use
75V reverse voltage
1V forward voltage at 10mA
10 mA recomended current (destroys at 1A 1sec pulse) (and you do not want more then 10 mA anyway)
usable to some hundreds kHz (so using digitalRead/digitalWrite and some logic you are probably a way slower anyway)
super extra common for long time (even 10 years ago was considered "classical") and still actual (so when you get old, it would still be here)
dirty cheap (buy few hundreds just now and you do not need care anymore)
(OLD) More details:
Which kind of diodes I should use in buttons/keys matrix input? (Making gaming keyboard)
More details:
Which kind of diodes I should use in buttons/keys matrix input? (Making gaming keyboard)(SOLVED)
Solution: 1N4148 diode
generally if you want connect diode to Arduino pin, use this one as it would be OK under nearly any normal use
75V reverse voltage
1V forward voltage at 10mA
10 mA recomended current (destroys at 1A 1sec pulse) (and you do not want more then 10 mA anyway)
usable to some hundreds kHz (so using digitalRead/digitalWrite and some logic you are probably a way slower anyway)
super extra common for long time (even 10 years ago was considered "classical") and still actual (so when you get old, it would still be here)
dirty cheap (buy few hundreds just now and you do not need care anymore)
(OLD) More details: