So we're back with some more advanced PCB stuff, I highly recommend watching my previous Kicad videos before this if you haven't already. Keyboard Matrixes: czcams.com/video/7LyziNdFlew/video.html Kicad for Keyboards: czcams.com/video/8WXpGTIbxlQ/video.html
Fiiiine I'll open up my stupid KiCAD so I can make another stupid keyboard so I can throw my stupid money at my stupid screen! You made me do this Joe! Great video, learned a ton!
Good stuff. Some notes: Decoupling caps should be as “manufacturably” close to the VDD pins as possible, bulk cap is more forgiving. Typically you would do Via, bulk cap , decoupling cap then vdd pin. Also take into account your power planes and reference planes depending on how many layers you have . It is better to have a solid ground layers and use copper pours for power connections for better impedance but at the expense off potential increased capacitance. USB is harder to impedance match on 2 layers because of the distance of the ground plane to the diff pairs for 90 Ohms but if the distance is really short and not close to other tracks, you can usually get away with it. Low speed GPIO won’t be as susceptible to crosstalk but it is usually better to fan out your tracks after leaving the ICs pads.
Thanks for the feedback, I've had a few people reach out about some design choices here and I'm nearly ready to release V2. It should follow better practices and be more reliable: github.com/joe-scotto/scottokeebs/pull/18
Some interesting comments. Awesome video I was thinking of designing a keyboard myself and doing research on that matter. I was watching from a perspective of someone who designs PCB for a living. Feedback from me (explaining some concepts in as simple words as I can but there is much more depth to it then stated here): 1. Decoupling Capacitors are important and they act as a power well or reserve when the MCU needs a boots in power so placement is crucial (i.e. its performing some tasks and the needed current rises above what it typically needs so the decoupling caps provide it with a small boost until the power supply catches up), also it acts as a filter for noise and damper (think of the power you getting from the power supply in this case USB, its not a perfectly straight line. There are ripples within the voltage levels and the caps damp these ripples to create a smoother voltage level per say.) You need a decoupling capacitor per power input into the MCU so in your case I think 5 from what I can see in your MCU symbol assuming its correct. 2. Use thicker traces for power, provided multiple benefits. 3. You dont need to use a via the way you did when routing the differential pair from the USB C end. You can move the VBUS trace further back and then route one of the pairs behind it creating a better continuous trace without the need for a via. 4. Return paths for your traces. It seems like you are using a 2 layer board which could cause issues in regards to return paths if its not done properly and introduce a lot of noise into your system. One example i can see is your Data line from USB C it has a voltage trace running above/underneath it and the data line has no unbroken return path under it introducing a possibility of noise into that trace
Thank you for the feedback, I actually ended up releasing a V2 that overwrites what I show in the video. The main fixes were for the ESD/Fuse routing and decoupling caps. I also swapped to a 4 layer PCB for better ground/EMI isolation. It still uses the same concept as shown here with just 4 traces between modules but overall should be much more robust. It's on the repo now :)
@@joe_scotto Pretty awesome V2, just had a look at it. I am curious as to why you don't have a ground pour over top and bottom layer? Normally you would keep those in order to reduce manufacturing cost and have balanced copper across the board. Also helps with EMI issues, stitch the ground together for it. Curious hence I ask Just another note, not sure if you implemented it but did you do differential pair routing at 90 Ohms? if the traces are not too long it should not effect it too much but your one is a distance away and its good habit to implement it regardless. I know JLCPCB have a calculator that helps with the calculation, in your case its co-planner differential pair
Great video, few things: 1. You probably want to provide a more powerful voltage stabilizer. Some people might want to add LEDs, and other perioherals which might draw extra power that the current one wont be able to provide. I recommend an LM317M. Its super widely available, been produced for ages, and can supply up to 500mA. 2. Its not bad to spread the decoupling caps out for the STM32 a little bit, this will improve solderability of the board in case something goes wrong and you have to fix it by hand. 3. Watch out for acid traps. While most modern PCB manufacturers arent affected, it is still considered good etiquette to avoid them. 4. The BOOT0 pin on the STM32 does nothing but select wether to jump to the standard bootloader or application code. This feature is seldom used on most boards, however if you don't plan on using an external debugger, this will suffice. 5. The STM32F072 is not the most common chip. A much more common and widely available one is an STM32F103, there are also a lot of clones, making this chip available basically everywhere. 6. Good etiquette is also naming the global labels that youre using on an STM32 to the respective rows and columns on the switch matrix
This is priceless... I have been looking for a straightforward tutorial about making integrated mcu boards for a while now, mainly because I wanted to slim down my pcbs and keyboards (for wrist placement and health). Can't wait for the rp2040 tutorial as I've grown quite fond of those. Thank you for the video... much appreciated!
When the MCU is switching (doing logic), it causes sudden current draws. The caps are there to provide a source of current, so the voltage can stay stable (drawing too much current causes noise)
you should do a guide on kicad footprint and symbol library guide. covering import and exporting. good places to find footprints. you have good guides and i would love to have one of these guides done by you.
Hello, nice video. I have a single comment regarding the ESD protection, the input and the output of the ESD should not be the same net, and as such should not be directly connected. That negates the protection. Example from what I know: D+, D- from usb c conector are a differential pair that goes to the protection And then you should create another differential pair (DM and DP) that goes from the protection to the MCU. Hope this helped
I'm curious about how you chose the fuse. I cannot find the power draw of the STM32, so did you just go "Meh, 500mA is good enough ?" or did you have some other information like measured power draw of other similar keyboards ?
Decoupling capacitors placement IS IMPORTANT, a bad placement or just ignore them and don't set them nearby your MCU can cause lots of noise. Your keyboard is just gonna be an easy target for EMI and the voltage supply to the MCU is gonna fluctuate.
This was very informative as always, Thanks :) Any chance you can make another video about how to program a board like this? By 'program' I mean how do you load the compiled firmware from a PC to the newly assembled PCB? (PCB with an STM32 MCU) More specifically: Do you connect a USB cable to program it? With what programming software? Does it depend on the bootloader? What bootloader does the MCU come with? I was able to find many tutorials on how to do it with an arduino but I'm having a hard time answering these questions when I'm comes to designing a PCB with a standalone MCU.
The STM32 I use here just works basically. When you get the board, you hold the boot button when plugging it in and you’ll be able to flash with QMK toolbox.
Very informative, unfortunately this MCU is not easily available in my country, if looking for an alternative what parameters should I be checking for it to work as a kb usb controller.
So we're back with some more advanced PCB stuff, I highly recommend watching my previous Kicad videos before this if you haven't already.
Keyboard Matrixes: czcams.com/video/7LyziNdFlew/video.html
Kicad for Keyboards: czcams.com/video/8WXpGTIbxlQ/video.html
Fiiiine I'll open up my stupid KiCAD so I can make another stupid keyboard so I can throw my stupid money at my stupid screen! You made me do this Joe!
Great video, learned a ton!
Good stuff. Some notes:
Decoupling caps should be as “manufacturably” close to the VDD pins as possible, bulk cap is more forgiving. Typically you would do Via, bulk cap , decoupling cap then vdd pin. Also take into account your power planes and reference planes depending on how many layers you have . It is better to have a solid ground layers and use copper pours for power connections for better impedance but at the expense off potential increased capacitance.
USB is harder to impedance match on 2 layers because of the distance of the ground plane to the diff pairs for 90 Ohms but if the distance is really short and not close to other tracks, you can usually get away with it.
Low speed GPIO won’t be as susceptible to crosstalk but it is usually better to fan out your tracks after leaving the ICs pads.
Thanks for the feedback, I've had a few people reach out about some design choices here and I'm nearly ready to release V2. It should follow better practices and be more reliable: github.com/joe-scotto/scottokeebs/pull/18
If I am not mistaken the resistors on CC1 and CC2 are to be able to use USB-C to USB-C cables, otherwise you can only use USB-A to USB-C.
Finallllyyyy!!! I have been waiting for this for so long. Thanks joe!
An absolute masterpiece of a guide. Thanks a ton for putting this out.
Some interesting comments. Awesome video I was thinking of designing a keyboard myself and doing research on that matter. I was watching from a perspective of someone who designs PCB for a living. Feedback from me (explaining some concepts in as simple words as I can but there is much more depth to it then stated here):
1. Decoupling Capacitors are important and they act as a power well or reserve when the MCU needs a boots in power so placement is crucial (i.e. its performing some tasks and the needed current rises above what it typically needs so the decoupling caps provide it with a small boost until the power supply catches up), also it acts as a filter for noise and damper (think of the power you getting from the power supply in this case USB, its not a perfectly straight line. There are ripples within the voltage levels and the caps damp these ripples to create a smoother voltage level per say.) You need a decoupling capacitor per power input into the MCU so in your case I think 5 from what I can see in your MCU symbol assuming its correct.
2. Use thicker traces for power, provided multiple benefits.
3. You dont need to use a via the way you did when routing the differential pair from the USB C end. You can move the VBUS trace further back and then route one of the pairs behind it creating a better continuous trace without the need for a via.
4. Return paths for your traces. It seems like you are using a 2 layer board which could cause issues in regards to return paths if its not done properly and introduce a lot of noise into your system. One example i can see is your Data line from USB C it has a voltage trace running above/underneath it and the data line has no unbroken return path under it introducing a possibility of noise into that trace
Thank you for the feedback, I actually ended up releasing a V2 that overwrites what I show in the video. The main fixes were for the ESD/Fuse routing and decoupling caps. I also swapped to a 4 layer PCB for better ground/EMI isolation. It still uses the same concept as shown here with just 4 traces between modules but overall should be much more robust. It's on the repo now :)
@@joe_scotto Pretty awesome V2, just had a look at it. I am curious as to why you don't have a ground pour over top and bottom layer? Normally you would keep those in order to reduce manufacturing cost and have balanced copper across the board. Also helps with EMI issues, stitch the ground together for it. Curious hence I ask
Just another note, not sure if you implemented it but did you do differential pair routing at 90 Ohms? if the traces are not too long it should not effect it too much but your one is a distance away and its good habit to implement it regardless. I know JLCPCB have a calculator that helps with the calculation, in your case its co-planner differential pair
Great video, few things:
1. You probably want to provide a more powerful voltage stabilizer. Some people might want to add LEDs, and other perioherals which might draw extra power that the current one wont be able to provide. I recommend an LM317M. Its super widely available, been produced for ages, and can supply up to 500mA.
2. Its not bad to spread the decoupling caps out for the STM32 a little bit, this will improve solderability of the board in case something goes wrong and you have to fix it by hand.
3. Watch out for acid traps. While most modern PCB manufacturers arent affected, it is still considered good etiquette to avoid them.
4. The BOOT0 pin on the STM32 does nothing but select wether to jump to the standard bootloader or application code. This feature is seldom used on most boards, however if you don't plan on using an external debugger, this will suffice.
5. The STM32F072 is not the most common chip. A much more common and widely available one is an STM32F103, there are also a lot of clones, making this chip available basically everywhere.
6. Good etiquette is also naming the global labels that youre using on an STM32 to the respective rows and columns on the switch matrix
This is priceless... I have been looking for a straightforward tutorial about making integrated mcu boards for a while now, mainly because I wanted to slim down my pcbs and keyboards (for wrist placement and health). Can't wait for the rp2040 tutorial as I've grown quite fond of those.
Thank you for the video... much appreciated!
When the MCU is switching (doing logic), it causes sudden current draws. The caps are there to provide a source of current, so the voltage can stay stable (drawing too much current causes noise)
you should do a guide on kicad footprint and symbol library guide. covering import and exporting. good places to find footprints. you have good guides and i would love to have one of these guides done by you.
Can't wait to see your rp2040 module.
I needed this when i actually prefered pcbs but it could be useful later 😅😅😅
This is awesome work. I'm really looking forward to your RP2040 module version.
Hello, nice video. I have a single comment regarding the ESD protection, the input and the output of the ESD should not be the same net, and as such should not be directly connected. That negates the protection.
Example from what I know:
D+, D- from usb c conector are a differential pair that goes to the protection
And then you should create another differential pair (DM and DP) that goes from the protection to the MCU.
Hope this helped
Yup, updated on V2 :)
You should probably stop using global nets as there well... global.
fantastic stuff super super helpful. mant thanks for sharing this.
looking forward to rp2040 and atmega 32u4 chip based design as well.
Yesssss! Finally!!!
I'm curious about how you chose the fuse. I cannot find the power draw of the STM32, so did you just go "Meh, 500mA is good enough ?" or did you have some other information like measured power draw of other similar keyboards ?
Decoupling capacitors placement IS IMPORTANT, a bad placement or just ignore them and don't set them nearby your MCU can cause lots of noise. Your keyboard is just gonna be an easy target for EMI and the voltage supply to the MCU is gonna fluctuate.
Yes, fixing this in V2. Video coming out in a few days.
This was very informative as always, Thanks :)
Any chance you can make another video about how to program a board like this?
By 'program' I mean how do you load the compiled firmware from a PC to the newly assembled PCB? (PCB with an STM32 MCU)
More specifically: Do you connect a USB cable to program it? With what programming software? Does it depend on the bootloader? What bootloader does the MCU come with?
I was able to find many tutorials on how to do it with an arduino but I'm having a hard time answering these questions when I'm comes to designing a PCB with a standalone MCU.
The STM32 I use here just works basically. When you get the board, you hold the boot button when plugging it in and you’ll be able to flash with QMK toolbox.
Nice.. can you make a detailed tutorial about making a case and plate?
Can you upload a video about how flash qmk with this stm 32 ❤
For not being an electrical engineer, you sound a lot like an electrical engineer. :)
No. He has misinformation about some things
Very informative, unfortunately this MCU is not easily available in my country, if looking for an alternative what parameters should I be checking for it to work as a kb usb controller.
Enough pin ports, frequency, USB communication, programming tools.
Any STM32 or PIC24 can handle this task.
The stm32f411re could be a good option.
can you show how to make gasket mounted pcb keyboard
Hey uh using KICAD (8.0) when i tried using scottokeeb footprints it didn't show anything could you uh explain to me how to fix it?
Don’t search for them, manually scroll in the selection window to find the library. It’s another bug in Kicad 8+ where search doesn’t show everything.
i see you have fallen down the 3d printer rabbit hole as well
i'm fink people need mirror keyboard to working like bodybuilder asymmetry of brain. i fink about two keyboard in one