I am graduating in a month and I want to make an installation with 80 apple homebuttons which are connected to a stepper motor. The idea is that each button that is pressed, turns the stepper motor the same amount of degrees each time. Also, each button is connected to an LED which must stay on, even if the button is pressed again and the motor too must not react. Once all 80 buttons have been pressed, the installation should switch off after a minute or so.

I am not sure how to connect 80 inputs to the arduino. Does anyone have any idea?

  • Start small and figure out exactly what your program should do. Most keyboards (and comparable devices) with more than a few keys use matrix scanning, which need not match their physical layout. May 31 '16 at 0:19
  • Why on earth would you use an Apple homebutton? That'll become unnecessary expensive. All the LED's should be controlled at the same time? Or should it be possible to control them individually?
    – Paul
    May 31 '16 at 6:34
  • There are input shift registers, however I have no idea what an "apple homebutton" is. I'm going to close this question. Feel free to edit it with new information. Thanks for your understanding and cooperation!
    – Nick Gammon
    Jun 4 '16 at 5:50

Why Apple home buttons?

Finding out how to get input/output from these things and wiring them in a reliable way may cost you some time (and quite some money). I don't see how they would have other features than regular buttons.

(You won't get the fingerprint-scanning thing working, I'm afraid.)

Start small

It'll be quite a project to do in one month (especially when you're new to Arduino).

If you start out with 80 buttons and stuff, it will probably end up in a mess, and you'll be unable to show your prof anything.

You should however, order the 80 push-buttons (I shouldn't order the Apple ones, if you don't already know how they work) and LED's. Since they might take some shipping time.

Get yourself a solder-less breadboard, maybe 3 buttons, some LED's and a stepper (if you don't have one already). Depending on your type of stepper, you may need something to drive it.

Start project

Use two buttons or so, if you press one, it would go clockwise, if you press the other, it would go counter clockwise.

Make sure you pull up or down the button inputs, to be sure that they are not floating when the button is not pressed.

Find a way to drive the steppers, you'll most likely use Arduino libraries for this.

Code will be something like:


Scaling up - alternative

You could use the 80 buttons for each angle of the stepper. But you could also use a keypad and LCD (or 3x 7segment display) to display a value typed in, and then send it to the motor.

Scaling up

In the case of the 80 buttons. You could use 10 outputs in combination with 8 inputs.

With each output, you can energize a row of buttons, and with each input you read the columns. This way you only need 18 pins to read all keys.

I'm not sure if you want to control all LED's at the same time, or individually.

Or use shift registers or I/O expanders (JayEye).

  • Hi Paul. I will only be using the glass top of the buttons! These have a plate which you can click on top of an Arduino button. I am not using the iPhone 6 buttons with the Touch Id, but just want them for aesthetic reasons. Thanks so much for the advice!
    – Missy Skae
    May 31 '16 at 21:17
  • Ah, good, I guess, as long as it's not making your project too expensive or too difficult ;) but I think you'll manage that. Do you still have any questions/doubts?
    – Paul
    May 31 '16 at 21:55
  • You see I wasn't sure whether a Raspberry Pi or an Arduino would be the best option. Now I guess my best option is to go with the Rasperry. I wanted to know where to start and then I can always find ways to get where I want to be, but as you say yourself - I don't want it to become expensive, so I need all the help I can get. I will definitely be back with further questions once I have the right equipment. Thanks so much!
    – Missy Skae
    May 31 '16 at 23:28
  • Paul, jij zit gewoon op de HAN! Ik op ArtEZ
    – Missy Skae
    Jun 1 '16 at 8:08
  • @MissySkae (Klopt ;) ) Hmm, About the Raspberry Pi, there is no actual need to make it any more complicated than it is. You can, however, use processing on the Raspberry Pi to control the GPIO pins of the raspberry. You could even make a fancy "Graphical user interface", since a Raspberry has HDMI output. If you're familiar with the Raspberry Pi, then why not, if you're not familiar, you'll need to learn a new "trick" which is a good thing, but you're really going to have to look at whatever time you have left.
    – Paul
    Jun 1 '16 at 10:02

If you follow JayEye's approach (ie, use five MCP23017 units to connect 80 switches, and five more to connect 80 LEDs) the wiring and the software should be fairly simple. But dealing with all the wires will be a problem unless you use a custom printed circuit board to mount all the switches, LEDs, wiring traces, and connectors. If you have experience with and hands-on access to printed circuit manufacturing equipment, and fast access to the parts you need, that approach should be ok.

A worthwhile alternative is to scale the project back slightly – say to 64 switches and LEDs instead of 80 – and use two Arduino Mega2650's, one to connect to switches, and another to connect to LEDs. Or you could use one Mega to handle the first 32 switch-and-LED pairs, and another, identically-wired, to handle the other 32. The two Mega's could communicate by I²C or via RxD-TxD connections (Arduino Mega's have four hardware serials ports, IIRC). If you plan to wire stuff up with jumpers and breadboards, this probably would be among the simpler, faster, and cheaper approaches. The modularity of building two identical units (except that only one of them will have the stepper driver attached) improves reliability and ease of debugging. You could also use four or five identically-wired Uno or Nano boards.

Note, however, that you are likely to have serious reliability problems if you connect up 80 switches and 80 LEDs via breadboards and jumper wires. As Chris Stratton suggested, start small. For example, wire up a dozen or two dozen switches and LEDs on a single Mega. This will let you see how much of a mess the wiring will be, and whether the original scale is practical. It will also allow tracking down software bugs on a hardware system that is small enough to allow some confidence that the hardware is working. If you build an 80-unit system before debugging the software, you are likely to run into problems where hours or days go by while you try to sort out whether the problem is due to a software error, a wiring error, or some combination of both.

Note that use of Charlieplexed connections or matrix connections would let you get by with about 10-20% as many IO lines as the direct-connect methods listed above. However, unless you have used Charlieplexed or multiplexed LED displays and matrix-connected switches successfully in previous projects, and have experience with building and driving circuit boards, the likelihood of getting the project done on time is rather lower than for the other methods mentioned above.

  • Thanks! I am well aware that it is a lot. There is expertise at school to help out, I just wondered what the options are. I have already made a circuit with one home button, an LED and a 9v battery. I am going to make my own custom circuits and solder everything together, so that has been thought about. Thanks so much for helping me!
    – Missy Skae
    May 31 '16 at 21:13
  • Sure. Note, please upvote any of these answers that you find useful. Jun 1 '16 at 2:40

I have no idea what an apple homebutton is, but the easiest way to add more GPIO pins is to use something like an MCP23017; it connects over I2C and gives you 16 GPIO pins. Use five of them and you have your solution.

  • Why not shift registers? :\ But the MCP23017 is indeed a viable/nice solution.
    – Paul
    May 31 '16 at 6:36
  • Thanks! I will definitely try this out! The home button is the button which belongs to the iPhone. I have made a simple circuit with on button, an LED and a 9v battery and that works perfectly, so now I just need 80 buttons which send a signal to the Arduino and the stepper.
    – Missy Skae
    May 31 '16 at 21:09

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