Button Box using Arduino Pro Micro

Hello,

I’ve playing Euro Truck Simulator for a while now and I’ve decided to do a button box myself since they are so expensive. I’ve been searching some youtube videos but there aren’t many regarding this and therefore I would like your opinion on a schematic that I’ve done which includes the arduino, a MCP23017 expander and a LCD to display some game information.

I wanted to use momentary buttons, but toggle ON - OFF as well. Also, some encoders, rotary latching and push-pull buttons as well. To organized it all, I am looking to do a PCB but before that I would like to be sure that it is all correct and that is why I would like to read some of your opinions.

Here is the schematic.

  • Give us a link to the module you have selected.
  • How many boards are you going to make ?

  • Here it is
  • 5, why?
  • If you were only needing 1, using a hand soldered and wired prototyping board would work, 5 would require a PCB.

  • If you are making a PCB, suggest you just use a DIP version of the chip.

  • Or SMD.

  • Before commentating on your schematic, we need to see the compete external component hardware.

I’m making 5 boards because that’s the minimum number for PCB manufacturing. I only require one to be honest. And the DIP version was indeed my first idea, however it would require external resistors which i would need to buy and afterwards solder so that is why I decided upon that. But what about the schematic? Any visible errors?

  • 6 resistors, 1 capacitor. Less than a few dollars if that much.

This is a good idea, especially if you use a socket for the DIP.

That is your problem. If you are at all serious about making things with an Arduino, you need components and need to understand how to use them. I would recommend you get some sort of starter kit of components and a list of projects you can practice on.

Also I would make this on strip board, sometimes called Veroboard to make you circuit on.

Well you have nothing identifying the MCP23017 on the schematic that should shown as U2.

But the biggest problem is that while it shows lots of labeled inputs/outputs we know nothing about what these are connected to. For example the rotary encoder just shows four pins with no idea of what these four pins actually are on the rotary encoder itself. Rotary encodes normally have a power and ground along with two signals phase 0 and phase 1. You show all four wires connected to signal pins.

Most of the inputs/outputs from this board have the same sort of fault.

Thanks for trying to make a schematic. But it's terrible. It's like a maze puzzle, and a schematic should be simple and clear. Try to reposition the components to minimise the cross-crossing of wires and use as many V+ and GND symbols as you need to tidy up the schematic.

I see 15 buttons/toggle switches, 3 rotary encoders and an i2c LCD? Is that correct?

I think you may not need the MCP chip if you connect your buttons & switches as a matrix. This will significantly reduce the number of pins needed, hopefully the Pro Micro will have enough.

Yes but once the price for the pre-made expander circuit was cheaper I chose that, but I have changed my ideas now and decided do follow your sugestion. Here is the new circuit, I hope you find it simples and therefore more understandable

Already labed everything and redone the schematic. Here it is, I hope you find it simpler and more understandable. Please comment every thing you might find wrong or less good.

There are now:

  • 6 Toggles ON - OFF (latching)
  • 4 Encoders EC11
  • 1 Rotary switch with 3 positions
  • 10 Button (Momentary)
  • 1 LCD I2C

Here it is the new schematic. I didn’t want to use a matrix of buttons fearing that a toggle that is ON might conflict with momentary buttons that are pressed.

I still can’t understand why you are not supplying 5V to one of the rotary encoder pins. Can you say what rotary encoder you are using please and post a link to it.

I can't see it because of my add blocker. Please post it here on this forum.

This can be overcome with use of some small diodes eg. 1N4148.

Do these have pushbuttons built-in that you want to use? If so, are those included in the 10 pushbuttons or additional?

Rotary encoders supplied pre-soldered to a small PCB have a 5V pin because they have pull-up resistors on the PCB.

But bare encoders don't have a 5V pin. Your circuit must supply pull-up/down resistors. So this gives more flexibility in your circuit design. You can use the Arduino's built-in pull-ups for example. You can also use them as part of a matrix.

However, I'm not sure I would recommend making rotary encoders part of a matrix. It can be difficult to scan the matrix fast enough to avoid missing signals from the encoder when turned quickly. The pushbuttons on the encoders can easily be included in a matrix.

1 Like

Also, most/all? Arduino libraries for encoders won't work if the encoder A&B pins are part of a matrix.

1 Like

Yes they have push buttons, they are labelled as SW, so one goes to a digital pin and the other to GnD

1 Like

I originally had ones with pre soldered PCB but I have since change for bare ones and therefore decided to use the pull ups from the arduino.

That is also one of the reasons I decided not to use the matrix

Thanks for updating that schematic. Much better!

However, I notice you have some rotary encoder A& B pins connected to the MCP chip. I would not recommend that because reading them via i2c may be too slow and will prevent you from using any(?) of the Arduino libraries for encoders. So move these to connect directly to the Arduino and move some ordinary buttons to the MCP instead, for example the pushbuttons of the encoders.

Thinking about my idea to use a matrix to avoid the need for the MCP chip:

Pro Micro has 18 input/output pins. Unlike Uno/Nano/Mega, you can use pins D0 & D1 on Pro Micro as input/output pins. They are not used for uploading code or serial monitor.

Obviously you need to reserve D2 & D3 for your i2c bus for the LCD, leaving you with 16 pins.

As I mentioned before, I'm not sure I would recommend including the encoder A & B pins as part of a matrix. It can work in theory, but scanning the matrix quickly enough can be difficult and prevents use of any (?) Arduino libraries for encoders. So these would require 8 Arduino pins leaving only 8 remaining.

With 8 pins, you can make a matrix with 4 rows and 4 columns for a total of 16 switches/buttons. Unfortunately you have 23 switches & buttons if I count correctly. That would require a 5x5 matrix and 10 Arduino pins.

So my matrix idea might not be so easy. Let me have another think about it.

The number of momentary buttons seems to have increased from 10 in post #11 to 16 in post #16, plus 4 more for the rotary encoder buttons! You are making this harder!