0
\$\begingroup\$

I hope somebody can help me assist and check on my first proper PCB design.

This is my first PCB design with an actual microprocessor and all. I have designed simple boards in the past using an Arduino, but I wanted to make something more professional. To get me on the right track, I followed this youtube tutorial and made my own changes. I will first explain what I want to achieve and show what I have done. I will ask the questions at the bottom.

I'm making my own sim racing steering wheels. The steering wheel I'm making now needs the following functions:

  • 17x LEDs (light up individually)
  • 10x push buttons
  • 4x rotary encoders
  • 2x pedal shifters (same functions as push button)
  • 1x Nextion 4.3" display
  • 1x GX16-4 for usb connection

To power the board I followed the exact steps from the tutorial. I'm using the STM32F103CBT6 microprocessor. enter image description here

I made two power regulators, one for 3.3V and one for 5V. I am not sure if the 5V is needed because the USB output is already 5V.

enter image description here

I used the multiplexing solution for connecting the push buttons, encoders and shifter input. Those are directly connected to the microprocessor. I used this exact solution when I worked with an Arduino.

enter image description here

I used the charlieplexing solution for my LED connection. The LEDs need to light up individually as they will replicate an RPM bar. As you can see, I used a 51 ohm resistor for each line. I use [this][6] LED. enter image description here

My questions:

  1. Is my basic power circuit to power the microprocessor correct?
  2. In the tutorial he used 1k5 resistors, are they 1.5k resistors like [these][8]?
  3. Do I need a 5V regulator? Because the power voltage coming in is already 5v?
  4. Should my multiplex work like this? Directly connected to the IO pins without anything between the buttons and the microprocessor.
  5. Should my charlieplex solution work like this, so that every LED can work individually?
  6. Are the five resistors I used for the LEDs correct in terms of ohms (51 ohm)?

Please, if you see any mistake, or if you think I could do something different, please let me know.

EDIT:

Updated version of the mcu power circuit: enter image description here

Updated version of charlieplexing: enter image description here

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Don't have time to comment on the whole thing. But the AMS1117 is a linear Voltage regulator, which means the input V must be greater than the output V for the regulator to work. So the 5V regulator will not be within its operating specification, and probably won't work. \$\endgroup\$
    – pgvoorhees
    Oct 18, 2022 at 11:54
  • 1
    \$\begingroup\$ Schematic review questions are very open-ended. How do you decide if something is an opinion based suggestion or hard error which must be fixed? There's also not one way of doing things. \$\endgroup\$
    – Justme
    Oct 18, 2022 at 12:15
  • \$\begingroup\$ Please do not update your question with answers (below) you have now changed the question and that could invalidate the answers(already posted). \$\endgroup\$
    – Tyler
    Oct 18, 2022 at 15:24
  • \$\begingroup\$ @Tyler In the current version with the new schematic labelled as an Edit I think it's ok and helps the interested reader to get to the right conclusion. I think he did it in the most sensible manner available here with the tools at hand. \$\endgroup\$
    – kruemi
    Oct 20, 2022 at 5:01

3 Answers 3

2
\$\begingroup\$
  1. No, for many reasons. Using USB 5V and trying to input that to regulator which is supposed to output 5V won't work. Also the capacitance on USB 5V line far exceeds limits given in USB specifications.

  2. 1k5 equals 1.5k. But we don't know which tutorial you mean and for what purpose. You mean the USB pull-up? There is one problem setting it to permanently 3.3V, if the MCU is not immediately ready for enumeration the PC will give a error about failing USB device.

  3. For what you would need it? USB is 5V but within some tolerance. What tolerance you accept is up to your design.

  4. It can work, but it depends again how you want it to work. If you want to be able to press more than 2 buttons simultaneously, not possible.

  5. No, all the LED matrix pins are directly connected to 5V, and they all have 51 ohms to ground. The MCU can't control them, and if 5V is on IO pin that is not 5V tolerant, the MCU burns up.

  6. All resistors have power supply directly applied to them. They heat up wasting power. It makes no sense.

\$\endgroup\$
8
  • \$\begingroup\$ About the switch matrix: I'm pretty sure that if he uses Groep1..4 as outputs (and after the other) and Groep5..8 as inputs, he can detect every possible combination of switches active. \$\endgroup\$
    – kruemi
    Oct 18, 2022 at 12:40
  • \$\begingroup\$ 1. clear, i will make a change in that as kruemi suggested. 2. Okay, good point! What would you advice me to do instead? 3. I need 5v for powering the led's and powering the Nextion display 4. Only 1 button at a time should be needed to pressed. But on my other pcb's i used the same multiplexing system and that worked pressing more at once. 5. I have changed that as you can read in my new reaction 6. Also changed. \$\endgroup\$
    – Djowwie
    Oct 18, 2022 at 13:21
  • \$\begingroup\$ @kruemi as long as you accept getting up to 2 simultaneous presses. Any more and you hit the fundamental limit of switch marices as there are no diodes anywhere. \$\endgroup\$
    – Justme
    Oct 18, 2022 at 13:26
  • 1
    \$\begingroup\$ @kruemi Not true. Push any three switches that are corners of a square. Even if you don't press the fourth button, the row and column of fourth button are shorted via the three other buttons. Button matrixes simply can't read more than 2 buttons reliably, unless you put diodes to each button after which you can read as many simultaneous buttons as you like. \$\endgroup\$
    – Justme
    Oct 20, 2022 at 13:06
  • 1
    \$\begingroup\$ @kruemi I wrote my answer before knowing how many simultaneous presses need to be detected. Turned out only one is needed. \$\endgroup\$
    – Justme
    Oct 21, 2022 at 7:29
2
\$\begingroup\$

Goede dag

Ok, a quick glance revealed some stuff that seems odd to me.

  • I did not check your connections to the MCU. I assume you checked that those are in the right place to work.
  • Your 5V regulation won't give you 5V but probably something around 4V. Linear regulators have a minimum dropoff voltage. You won't need that regulator. Put a coil and a capacitor in for filtering.
  • The input multiplexing can work
  • Your "charlieplexing" will probably destroy your MCU
    • You need to remove the connections to +5V and GND and put the resistors in series with the I/O Pins.
    • Are the inputs and outputs of your MCU 5V tolerant? (It's in the datasheet, PAx are not 5V Tolerant! Check Page 28ff in the datasheet If column "I/O Level" has FT in it, the I/O is 5V tolerant)
    • Can the outputs of the MCU sink 160mA (100mA from the resistor attached to 5V and 60mA trough the LED, It's in the datasheet page 66)
    • 51 Ohm is way too low. You probably want at least 470 Ohms maybe even 4.7kOhm

Sorry if I sound harsh, that's definitely not the meaning. But I car for poor semiconductors releasing magic smoke :)

\$\endgroup\$
6
  • 1
    \$\begingroup\$ You don't sound harsh at all! I appreciate the fact you are taking some time to help me understand schematics better! 1. I have checked via stm32CubeIDE that all push buttons and encoders i/o pins are on the correct input pins. I have changed some now because of the led 5v I/o's The rest is copied from the tutorial, so i assume this would be correct. 2. Thanks for that tip! I will look in to that, i already thought it would not work. 3. Good to hear! 4. Sorry, that seems logic it doesn't need to connect to ground. I will change the resistors place to I/O pin -> Resitor -> led? \$\endgroup\$
    – Djowwie
    Oct 18, 2022 at 13:26
  • 1
    \$\begingroup\$ 5. Good one, no the pins used for the led's in the pictures are not 5v supported. I will change them to pins that are 5v capable. PB2/PB3/PB4/PB6/PB7 6. No, i see in the datasheet one I/O pin can sunk max 25mA. Should i use a transistor between the pins and the led's? 7. I already thought that yeah, i used a calculator and it said resistor value 46.667 \$\endgroup\$
    – Djowwie
    Oct 18, 2022 at 13:26
  • 1
    \$\begingroup\$ @Djowwie IO pin can't sink/source 25mA. 25mA is the absolute maximum rating which must not be exceeded. Under normal operation the output is specified to 20mA. \$\endgroup\$
    – Justme
    Oct 18, 2022 at 13:44
  • \$\begingroup\$ @justme thanks for the explanation. Can you tell me what to do about this? Is it right i need to use a transistor between the I/O and the resistors? \$\endgroup\$
    – Djowwie
    Oct 18, 2022 at 13:54
  • \$\begingroup\$ @Djowwie It depends how much current you want out from MCU. You have not specified that. \$\endgroup\$
    – Justme
    Oct 18, 2022 at 14:28
0
\$\begingroup\$

Charlieplex is ok for same LEDs as long as your tri-states are coded OK for just R/Y colours, otherwise dedicated Rs vs shared Rs are required.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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