2
\$\begingroup\$

In my project I need to use

7x tact switches

6x LEDs

3x 7 led segments

1 arduino uno board

my prof says we can use any ICs but arduino uno's pins cannot accomodate all those needed values. I need to manipulate all the tact switches and the 6 LEDs so the only thing that can be reduced is the issue with 7 led segment.

Can you suggest a way that I can reduce the number of pins needed to be used in arduino uno?

\$\endgroup\$
10
  • \$\begingroup\$ Have you done any research on multiplexing seven segment displays? Or how a keyboard/switch matrix works? \$\endgroup\$ – DiBosco Nov 30 '17 at 13:15
  • \$\begingroup\$ First thing i see is to interpret 6 LEDs as a fourth 7-segment indicator and use multiplexing as DiBosco says in comment. \$\endgroup\$ – Alexander Nov 30 '17 at 13:21
  • \$\begingroup\$ I've only seen multiplexing but haven't found a good explanation how to use them. \$\endgroup\$ – MonkeyD Nov 30 '17 at 13:21
  • \$\begingroup\$ Not wishing to be rude, but you've not looked very hard. The first hit on a Google search for "multiplexing a seven segment display" has a great page on it. An Embedded Lab article. \$\endgroup\$ – DiBosco Nov 30 '17 at 13:28
  • \$\begingroup\$ ok I'll try again :) \$\endgroup\$ – MonkeyD Nov 30 '17 at 13:29
0
\$\begingroup\$

For 7 switches , MM74HC164M SHIFT REG 8BIT PISO 14-SOIC
For 6 LEDs and 2 LED digits , (3) SIPO's MM74HCT164MX SHIFT REG 8BIT 14SOIC
For (3) LED digits choose LEDs with BCD to 7seg decoder integrated.
The clk & data lines are shared but a chip selector is needed,.

\$\endgroup\$
3
\$\begingroup\$

You can probably reduce the GPIOs usage as follow :

  • Instead of using 7 GPIOs for 7 x tact switches, you can use a 3x3 matrix for 9 switches : 6 GPIOs
    (you can add 2 more tact switches)

  • Instead of using 6 GPIOs for 6 x leds you can use a 2x3 matrix for 6 leds : 5 GPIOs

  • Instead of using 21 GPIOS for 3 x 7segment you can put it on a 7 bits bus, and use 3 more pin to control the 7-segment : 10 GPIOs

enter image description here

For switches you need to scan the matrix rows and to know what tact is pushed, and for the led and 7segment you need to refresh quickly, because of eyes afterglow (remanence) the user could not see the flickering/blinking, user think light is fixed on this different leds.

Before : 34 GPIOs
After : 21 GPIOs (With 2 more switches)

You can also consider the 6 leds as a "fake 7segment" ans reuse your 7 bits bus to control them, you only need 1 GPIO to select this "fake 7 segment".

Before : 34 GPIOs
After : 17 GPIOs (With 2 more switches)

\$\endgroup\$
1
\$\begingroup\$

Use 'Charlieplexing':
- 6 LEDs can be driven by 3 PINs - see link here
- 7 (up to 12) switches with 4 PINs - see this link, chapter named "Charlieplexing also to interface buttons"
- For 7-segment display I would recommend I2C driven 4-digit LED display (2 PINs - SDA and SCL) - to see available options drop a "7-segment display i2c" line into google.

Total: 3 + 4 + 2 = 9 PINs.

\$\endgroup\$
1
\$\begingroup\$

3 x 7 segments and 6 LEDs can be multiplexed with 7 + 4 = 11 pins, in a 4 x 7 arrangement (wire the LEDs as if they were a 4th digit).

If you use 6 diodes with the 6 switches you can share the segment pins of the LED segments, and use one shared input pin (with pull-up) to read the switches.

So a total of 12 pins will be sufficient for a simple (no extra chips required) approach.

Using shift registers or I/O extenders you need even less pins. An MPC23017 for instance requires 2 (I2C) pins and gives you 16 GPIO pins, which is more than sufficient to do everything you asked for. But some programming is required....

\$\endgroup\$
3
  • \$\begingroup\$ +1 Unless I misread, you mentioned the obvious (to me) of muxing the switches on the same lines as used for muxing the LED display segments. Just wanted to add that I've seen it done in commercial equipment without diodes. It was just another scan line, so to speak (a short muxed moment added in with the other three display device mux timing.) \$\endgroup\$ – jonk Nov 30 '17 at 18:03
  • \$\begingroup\$ You read correct. A problem with omitting the diodes is that simultaneous keypresses can mess up the display. But if one can live with that the diodes can indeed be omitted. \$\endgroup\$ – Wouter van Ooijen Nov 30 '17 at 19:59
  • \$\begingroup\$ Yup. Glad to see you mention this, though. I was reading and hoping... and reading and hoping... and then I saw your answer! Nice to see it mentioned. I hope the OP takes it seriously. It's not hard work for big benefits. (And yes, I take your point about the diodes and keypresses, of course.) \$\endgroup\$ – jonk Nov 30 '17 at 20:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.