Author Topic: The Living PCB Design Thread  (Read 384567 times)

0 Members and 1 Guest are viewing this topic.

Offline bpiphany

  • Posts: 1033
  • Location: Stockholm, Sweden
  • bpiph is a special type of crazy. //mkawa
Re: The Living PCB Design Thread
« Reply #800 on: Thu, 03 January 2019, 16:41:16 »
Hi,
I'm currently trying to build my own full size keyboard with a custom layout. After reading through the whole thread (I actually just made an account so subscribe to this thread  ^-^) I still have some questions:

  • I've read that you should not place traces below the oscillator and surround it by a ground plane. Is that only specific to that layer or should I keep the traces on all layers away from the crystal?
  • I want to use a ceramic resonator. Do these even have the same issues with interference as crystals?
  • Originally I wanted to add LED backlighting but now I'm unsure: At >100 LEDs in parallel, drawing 20mA each, thats more than 2A (and therefore more than the 500/900mA USB provides and way more than the 20/100mA the Atmega32u4 can drain). What are the tricks to get low power LED backlighting?

Thanks a lot.

1. The surrounding ground would be to shield off the crystal. Preferably a plane underneath it, and a ring off GND around it.
2. Ceramic oscillators may not be stable enough to work properly with USB.
3. You don't want 100 LEDs driven at 20mA each continuously at the same time. You would be blind. A few mA probably is enough, but you would still need to be careful in the design to meet the current limits.

Offline kuerb

  • Posts: 4
Re: The Living PCB Design Thread
« Reply #801 on: Fri, 04 January 2019, 08:53:10 »
 Thank you for the response.

@1&2) I designed the PCB around the Adafruit Feather 32u4 Bluefruit LE because that already works with QMK. I guess I'll think about switching to a quartz. But then I'd have to retrace a lot of wires for the extra caps and bigger component :eek:

@3) Now I feel stupid about the LEDs ;D I only thought about reducing the duty cycle to keep the overall power consumption low and didn't even think about what would happen if I connected the LEDs to a low current power supply (resembling the pin).

I just tried a setup of 25 parallel green* LEDs. With 5 mA on the power supply (that should be equal to 100LEDs@20mA) each LED still gets to around 180 uA but the power supply is also lowering the voltage to 2.2V. But at least the LEDs stay visible with artificial lighting. With keycaps on the LEDs, they're only visible in the dark but that might be just enough for a very subtle backlight. Powering the LEDs through a Teensy (LC) was also possible but with a bit of flickering.
*or rather the green parts of RGB LEDs

I might hold back on adding per-key backlighting and just add a few dedicated LEDs instead. I can always upscale for later projects :))

Offline bpiphany

  • Posts: 1033
  • Location: Stockholm, Sweden
  • bpiph is a special type of crazy. //mkawa
Re: The Living PCB Design Thread
« Reply #802 on: Sat, 05 January 2019, 14:35:51 »
1&2. I haven't looked too hard but I couldn't find out what the part used actually is. According to the datasheet the 32u4 should have an internal oscillator that's supposedly possible to trim to make it good enough for USB But there's very much not a promise in there that a resonator will be good enough in general.

3. It's not a fantastic idea to just parallel up LEDs, google for thermal runaway. And you'd probably want to drive them through something else than the micro, a dedicated LED driver or simply with transistors.

3++. Using a switching regulator to lower the voltage for the LEDs can save a lot of the power consumption. You should probably still really have a current limiting resistor in series with the LED. but you can shift more of the power to be dropped actually producing light.

Offline kuerb

  • Posts: 4
Re: The Living PCB Design Thread
« Reply #803 on: Wed, 09 January 2019, 08:14:32 »
@3) I know that parallel LEDs weren't the best idea, I just wanted to test the output before scrapping the idea of LED backlighting. But in the end I removed all of the backlight LEDs from my PCB and opted for four dedicated LEDs instead.


I want to add support for multiple layouts. But then I'll get holes overlapping pads (as well as overlapping holes) like in the picture. Can someone recommend a manufacturer who will produce it that way?
I asked support at JLCPCB (the people behind EasyEDA) and they told me that they can't produce it (although I'm not 100% sure that my question was understood correctly).

Offline bpiphany

  • Posts: 1033
  • Location: Stockholm, Sweden
  • bpiph is a special type of crazy. //mkawa
Re: The Living PCB Design Thread
« Reply #804 on: Thu, 10 January 2019, 14:44:49 »
It's probaby going to depend on their process and tooling, if they are willing to do it at all or at the price point. I think you'd generally not want to overlap holes by too much when drilling. A bottom cutting end mill may be able to do more awkward cuts, but be more expansive and not doing it as fast as a drill bit. You want to have enough wall for the bit not to snap into the previous hole and break.

I've had this made https://geekhack.org/index.php?topic=67713 with overlapping holes just like your design.

Another option is to actually make the overlapping holes into a single slot, which will be milled instead. Like on the phantom https://deskthority.net/w/images/3/3e/Phantom_PCB-Small.jpg

The manufacturer may also be reluctant milling into copper pads, especially plated through holes. It can tear the copper and cause shorts, and they may still do it at your risk.

3+++) There are different (probably more than you can count) LED drivers that will drive any number of LEDs you'd ask for through any serial interface you'd ask for (probably). They can often do constant current delivery to simplify your BOM, and life in general.
« Last Edit: Thu, 10 January 2019, 14:50:45 by bpiphany »

Offline kuerb

  • Posts: 4
Re: The Living PCB Design Thread
« Reply #805 on: Fri, 08 February 2019, 02:29:35 »
I ended up ordering at JLC and have received a board with overlapping holes/pads without any extra fees.

Unfortunately the USB connector doesn't fit. I guess I should have created a smaller test PCB with a single key to test all the components and software first, but well, at least I'm learning. Everything else was soldered and running a simple program to blink one of the LEDs (uploaded via ISP) so I've tried soldering a cable directly to the USB lines but can't get the chip to be recognised.

My guess was that this had something to do with the resonator so after trying different fuses (mainly switching CKSEL and CKDIV8) and uploading the dfu-bootloader again and again I still have no idea how to fix this. So I resoldered the resonator and ended up frying my 32u4. I guess I'm going to make that test PCB after all :D.

I know this isn't directly "PCB Design" but what are the correct steps in order to get USB working out of a blank 32u4?
Is it just supposed to work out of box (the datasheet mentions USB will work with the internal resonator when powered >3.4V)?
Do I have to disable CKDIV8 (as it would give me 8 MHz/8 = 1 MHz, which is lower than the 1.5 MHz in Low Speed USB) or does that not matter for the communication part?




Offline bpiphany

  • Posts: 1033
  • Location: Stockholm, Sweden
  • bpiph is a special type of crazy. //mkawa
Re: The Living PCB Design Thread
« Reply #806 on: Fri, 15 February 2019, 13:51:47 »
If you didn't get the 32U4RC it should pop up as a USB device, _if_ you have a 16MHz crystal hooked up the correct way. And use a crystal. Also this is only true as long as you didn't already erase the bootloader with your ISP programmer.

Changing fuses you can set the chip to run from the internal oscillator, without any need of an external clock signal. It's not guaranteed to work out of the box though. It may be a good way to reach the blinky level with a minimum number of parameters.

Here's the app note on using USB with the built in resonator
https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=2ahUKEwjIvazFwL7gAhWgwMQBHfwLBtIQFjAAegQIChAC&url=http%3A%2F%2Fww1.microchip.com%2Fdownloads%2Fen%2FAppNotes%2Fdoc8384.pdf&usg=AOvVaw1nqlVSHuKhP1LCT5U4thL6

Offline rickylago2

  • Posts: 1
Re: The Living PCB Design Thread
« Reply #807 on: Wed, 20 February 2019, 15:42:16 »
I've just stumbled on this thread via google search, and I've got to say reading through it has been massively helpful. Lots of good information here!

I'd like to get some verification from anyone who might be more knowlegable than myself. I've got a lot of experience in hardware modification, but as far as designing my own goes, this is basically my first project. My main goal here is to make a 25 key macro keyboard with an analog joystick on the thumb and per-key RGB lighting using APA102-2020 mounted under RGB cherry switches all connected via Type-C. I've pieced together information from about a million sources online, and I think (or hope  :p) I've set everything up correctly in my schematic. A few specific questions I have about my design so far though:

1) Am I correct in assuming that to use analog signal with the AT90USB1286 I need to have a capacitor on both the AVCC and AREF pins? The datasheet seems to have said this, I mainly just want to make sure I understood it correctly.
2) I know that power over USB can be a concern with the addressable LED like I've chosen. It looks like each runs at 20mA at full brightness, which would max out the 500mA available over USB. If I simply run them at half brightness or so, would this cause power issues still?
3) I've set up my decoupling separate from the chip, similarly to how it is done in the github tutorial that a lot of people reference. I've seen this done a few different ways in this thread and other projects. Should I be setting this up differently to make things easier?
4) In my Type-C wiring, I've connected the CC1 and CC2 pins via 5.1k resistor to ground. I've seen it done this way and with both pins having their own resistors. Is how I currently have it set up sufficient? 213365-0

Thanks in advance for any help. like I said, I have some experience physically modifying existing things, and I have plenty of CAD experience, but PCB design is still pretty fresh to me.

Offline No_joke

  • Posts: 12
Re: The Living PCB Design Thread
« Reply #808 on: Sat, 30 March 2019, 11:20:48 »
Hey everyone!

Would love to get some critique on a new (actually, the first) design I'm working on.
It's meant to be a small, two octave digital synthesizer, based on mechanical switches and a Teensy 3.2 with the audio shield.

The connectors labeled as "controls" will be hooked up to linear potentiometers, and those labeled as "LED" to ws2812b LED strips.
On the right of the board you can see a micro USB connector and an audio jack (both connected via cable to the Teensy/audio shield respectively).

Are there any problems with the design?
Do you have any tips/ideas for improvements (both logical and visual)?
Are the via sizes (1mm), trace widths (0.4mm), and clearances (0.2mm) suitable for manufacturing?

216306-0

The KiCad project is available here https://github.com/m4ntis/teensynth-pcb.

Thanks! :)

Offline bpiphany

  • Posts: 1033
  • Location: Stockholm, Sweden
  • bpiph is a special type of crazy. //mkawa
Re: The Living PCB Design Thread
« Reply #809 on: Wed, 10 April 2019, 15:35:55 »
Hey everyone!

I can't help to think you should be able to get away with wiring the matrix directly to the Teensy, and do away with the IO-expander. It looks like you have plenty of pins free. You could do some simpler multiplexing for the matrix as well. If you want to keep the 15 column layout you could use a 4-16 decoder to activate one at a time, and 2 inputs to the Teensy for the rows. That's only 6 pins, and no serial protocol.

It looks like you will be connecting the Teensy with a short USB cable soldered to J5. Is J8 on the bottom of the board? I think it's probably going to collide with the USB connector going into the Teensy otherwise.

Your diode footprint looks wrong. I guess it is possible to put an axial part in a vertical position, but there's no reason not to spread out to a 0.4" pitch.

In general with low speed stuff, if it passes the DRC it's going to be fine.

Edit: Perhaps pull-ups on the data channels to the IO-expander? I'm not familiar with using them, but I understand they are sometimes needed, or handy for even more pull-up even if there already are resistors on the Teensy itself.

And the obvious unconnected pins on the expander and multiplexer of course... But the DRC should catch that.
« Last Edit: Wed, 10 April 2019, 15:55:54 by bpiphany »

Offline bpiphany

  • Posts: 1033
  • Location: Stockholm, Sweden
  • bpiph is a special type of crazy. //mkawa
Re: The Living PCB Design Thread
« Reply #810 on: Wed, 10 April 2019, 15:48:57 »
I've just stumbled on this thread via google search, and I've got to say reading through it has been massively helpful. Lots of good information here!

1. I think you need to read up on how the analog stuff works. I've never used the ADC functionality myself, but you still need to supply AVCC with power, just more decoupled than VCC in general. Also AREF needs to be connected to some reference for the analog signal in some way, decoupled with a capacitor (at least) probably.
3. The schematic doesn't really care where you put them. What's important is where you put them in the actual layout. Close to the supply pins (very low impedance) and solidly (low impedance) connected to your power source.

Edit: Apparently (reading the datasheet) you can use wither AVCC or an internal 2.56V reference as Aref, and then use only an external capacitor to GND like in your schematic to make it more noise immune. Or you can use an external reference (also decoupled to GND). But AVCC should always be at VCC+-0.3V maximum.
« Last Edit: Wed, 10 April 2019, 15:56:17 by bpiphany »

Offline tedfs3

  • Posts: 51
    • No Mercy Given
Re: The Living PCB Design Thread
« Reply #811 on: Sun, 14 April 2019, 17:49:29 »
I'm in the same boat as No_Joke and could use some help looking at a design. I honestly have no idea what I'm doing and just learning along the way.
Based off of the Fullsize Custom PCB FIlco Compatible - SaikouType 110 (NKBM-ST110r2) by null but a left handed version. Messed around with Freeroute a bit but
honestly just need some input as to whether the design is correct. Still some aspects I don't understand, like the USB implementation, as there is one connection
with no net. It has a schematic symbol but no footprint.

217263-0

Hope the Github thing was done correctly.
https://github.com/Tedfs3/104LH_v3.3

Offline HeroXLazer

  • Posts: 70
Re: The Living PCB Design Thread
« Reply #812 on: Sat, 27 April 2019, 19:26:40 »
DELETED
« Last Edit: Mon, 29 April 2019, 21:55:50 by HeroXLazer »

Offline HeroXLazer

  • Posts: 70
Re: The Living PCB Design Thread
« Reply #813 on: Mon, 29 April 2019, 21:55:08 »
Do AVCC, AVCC, and AREF need caps as they're for the A/D C?

Offline mythosmann

  • Posts: 24
  • Location: Ohio, USA
  • keyboards aren't even useful
    • My GitHub Page
Re: The Living PCB Design Thread
« Reply #814 on: Sun, 05 May 2019, 20:55:08 »
Howdy all, I've heard this is a good place to go with questions about a pcb.  I've made a few keyboard pcbs before, but it's my first time using onboard components.
I've been working on a pcb replacement for AEK and AEK II keyboards which features a built-in usb hub, rotary encoder support, mx/alps support, and a few other things.  This is what I got so far, I'm guessing it wouldn't work in its current state. You can also find the files on github.
218677-0
218679-1
218681-2
I'm pretty new to this, and I have a feeling I'm missing a bunch of important stuff.  Any feedback is greatly appreciated.

Offline Blitzschnitzel

  • Posts: 103
Re: The Living PCB Design Thread
« Reply #815 on: Tue, 07 May 2019, 18:15:14 »
Well, I would be careful with putting LED on HWB in series with the original pull down resistor. Forward voltage of LEDs is typically more than 0.9V. It is not a big deal though since LEDs conduct some current even below the forward voltage. But if you are unlucky and some interference kicks in then you may not enter the bootloader when you wanted to. If that happens then you would just press the reset button again and again untill the bootloader is entered. You should eventually get there.

After the MCU boots, there is no problem using HWB pin for GPIO (whether input or output ... it does not really matter). The rest of the circuit just cannot mind the pull down resistor there. Most of the time it does not matter. It only increases the power consumption a tiny bit. I used HWB as GPIO myself. It works without any problems (if the rest of the circuit does not mind the pull down there).

E.g. if your keyboard matrix scanning works with pull downs and shortening through switches to the Vcc (instead of to GND as it is common) then you can perfectly use HWB pin as one of the keyboard matrix scanning pins. You would need the pull down there anyway. This is one of the cases when HWB use does not even increase the power consumption.
In other cases, when the ideal circuit does not use pull up nor pull down then you often can add a pull down. In such a case it only increases the power consumption a bit. If the rest of the circuit requires a pull up there then you course you cannot use HWB pin (and keep the boot loader on reset feature).
Hi Guys,
I am exactly one pin short. would something like this work?
218771-0
Also, I was wondering if I could use a larger capacitor to put a bit of a delay on the reset pin, so that I can use the same switch to pull down reset and HWB? Or are there some kind of delay transistors, so that I don't get over the max capacitance?
Do you know of some opensource boards which use the HWB pin so that I can take a look at how they do it?
« Last Edit: Tue, 07 May 2019, 20:10:36 by Blitzschnitzel »

Offline ErgoMacros

  • Posts: 313
  • Location: SF Bay Area
Re: The Living PCB Design Thread
« Reply #816 on: Tue, 07 May 2019, 18:46:41 »
Quote
I've been working on a pcb replacement for AEK and AEK II keyboards...

Looks like you have a COL21 on the MCU that's not used in the matrix. No harm done.
All the best.
Today's quote: '...“but then the customer successfully broke that.”

Offline Villa

  • Posts: 27
  • Location: AC.
  • Bang.
Pffff, Syke—
« Reply #817 on: Thu, 09 May 2019, 20:53:47 »
Hello. I'm trying to dip my foot into KiCad and keyboard PCB design, but all of the tutorials recommended from these parts are old, outdated, and inapplicable to the current version of KiCad.

I would like to know if anyone can recommend some resources to make this possible.

Thanks for the time.


Got lucky, figured it out.

As I always do...
« Last Edit: Thu, 16 May 2019, 09:33:18 by Villa »

Offline ErgoMacros

  • Posts: 313
  • Location: SF Bay Area
Re: The Living PCB Design Thread
« Reply #818 on: Thu, 09 May 2019, 21:53:56 »
@Blitzschnitzel, re: needing an extra pin... I don't know what the rest of your pins are doing, so maybe these don't apply, but here goes.

1. I came across this while back...
  • 3 LEDs
  • 3 switches
  • only 3 pins required.
   https://www.edn.com/design/systems-design/4433477/3-pins--3-LEDs--3-buttons
Maybe of some use depending on what you other pins are being used for.

2. Also, if you needed 2 switches you can do that with a ADC pin and a couple resistors.
   https://www.edn.com/design/analog/4439796/Read-multiple-switches-using-ADC

3. Another of my favorite HW pages, many ways to read switches. Might be some inspiration...
   http://www.openmusiclabs.com/learning/digital/input-matrix-scanning/index.html

Luck!
Today's quote: '...“but then the customer successfully broke that.”

Offline Amy Worrall

  • Posts: 7
Re: The Living PCB Design Thread
« Reply #819 on: Tue, 04 June 2019, 14:56:26 »


The first PCB I ever designed! It's for a theatre lighting control keyboard.

It's iteration 1 of (probably) many. Currently this PCB only contains the keyboard matrix — the rows and the columns end in headers that I'll connect to my Teensy using wires. I have more ambitions, including RGB LEDs, but those will have to wait for future boards. I realised that I was biting off more than I could chew trying to do all the things on my v1, so I wanted to get something that worked first!

Offline Villa

  • Posts: 27
  • Location: AC.
  • Bang.
Re: The Living PCB Design Thread
« Reply #820 on: Thu, 06 June 2019, 06:57:07 »
Show Image


The first PCB I ever designed! It's for a theatre lighting control keyboard.

It's iteration 1 of (probably) many. Currently this PCB only contains the keyboard matrix — the rows and the columns end in headers that I'll connect to my Teensy using wires. I have more ambitions, including RGB LEDs, but those will have to wait for future boards. I realised that I was biting off more than I could chew trying to do all the things on my v1, so I wanted to get something that worked first!

Would that fit into a console of some kind? A compartment/case?

Also quite interested to know what kind of work you do, Amy.

Offline Amy Worrall

  • Posts: 7
Re: The Living PCB Design Thread
« Reply #821 on: Thu, 06 June 2019, 09:23:18 »

Would that fit into a console of some kind? A compartment/case?

Also quite interested to know what kind of work you do, Amy.

I have an enclosure that looks like this. It'll hold the keyboard-y bit, plus a tiny computer and some DMX output hardware, a couple of small LCD displays, etc.



As for work, for my day job I work for Facebook as a software engineer. This is a side project/hobby :)

Offline Villa

  • Posts: 27
  • Location: AC.
  • Bang.
Re: The Living PCB Design Thread
« Reply #822 on: Mon, 10 June 2019, 14:38:25 »

Would that fit into a console of some kind? A compartment/case?

Also quite interested to know what kind of work you do, Amy.

I have an enclosure that looks like this. It'll hold the keyboard-y bit, plus a tiny computer and some DMX output hardware, a couple of small LCD displays, etc.

Show Image


As for work, for my day job I work for Facebook as a software engineer. This is a side project/hobby :)

Cool biz—

Offline pabile

  • Posts: 158
  • Location: Southeast Asia
    • pabile online
Re: The Living PCB Design Thread
« Reply #823 on: Tue, 05 November 2019, 05:49:14 »
hello gh,

i've been reading and trying to learn for some time now and wanted to seek for your feedback on this pcb i did before i send it to shop/maker. this is my first and i am not sure if i did things correctly. same as my source, contra, i'll be using pro micro as its controller.


Offline psyduck200

  • Posts: 5
Re: The Living PCB Design Thread
« Reply #824 on: Mon, 18 November 2019, 23:32:03 »
hi all, how do you guys decide which micro controller to use in your custom keyboard?

Offline Applet

  • Posts: 487
  • Location: Sweden
Re: The Living PCB Design Thread
« Reply #825 on: Tue, 19 November 2019, 05:59:18 »
hi all, how do you guys decide which micro controller to use in your custom keyboard?
I choose one that already has QMK support and has the number of pins needed for the keyboard matrix and periferals (rgb leds or such).

https://beta.docs.qmk.fm/hardware/compatible_microcontrollers

The AVR-processors are generally prefered and recommended (ATmega32u2 / ATmega32u4 or AT90USB64 / AT90USB128)
« Last Edit: Tue, 19 November 2019, 06:01:03 by Applet »

Offline gipetto

  • Posts: 91
Re: The Living PCB Design Thread
« Reply #826 on: Tue, 19 November 2019, 08:12:51 »
I'm in the same boat as No_Joke and could use some help looking at a design. I honestly have no idea what I'm doing and just learning along the way.
Based off of the Fullsize Custom PCB FIlco Compatible - SaikouType 110 (NKBM-ST110r2) by null but a left handed version. Messed around with Freeroute a bit but
honestly just need some input as to whether the design is correct. Still some aspects I don't understand, like the USB implementation, as there is one connection
with no net. It has a schematic symbol but no footprint.

Hope the Github thing was done correctly.
https://github.com/Tedfs3/104LH_v3.3

I liked your design so I cloned the layout while modifying it for iso, adding macro switches and a backlight. it's a primitive circuit, lacking a led mosfet, and the clever usb port that you have but I wanted something cheap and reliable. I welded the tray case from mild steel in the style of the duck keyboards. It's almost finished, but some parts have disappeared in the post, so it may drag on for months.
https://github.com/itsnoteasy/misc/tree/master/left_110key
« Last Edit: Tue, 19 November 2019, 08:17:55 by gipetto »

Offline sypl

  • Posts: 116
Re: The Living PCB Design Thread
« Reply #827 on: Fri, 29 November 2019, 21:13:41 »
Hi PCB experts. I was hoping one of you could help me verify a schematic. My goal is to update ruiqimao's PCB guide to use a more modern ARM chip. I know a lot of keyboard PCBs nowadays are using them, so I thought it would be good to have a go at making one with the STM32F103 chip.

The aim is the same as the original guide, to make a minimal four key keyboard. To that end I've posted what I think is the right schematic, but before I lay out the PCB and get it sent to fab I wonder if anyone could give it a look and tell me whether I'm on the right path or not.

The proposed schematic is here: https://github.com/ruiqimao/keyboard-pcb-guide/issues/17#issuecomment-558419724

Many thanks in advance!

Offline ErgoMacros

  • Posts: 313
  • Location: SF Bay Area
Re: The Living PCB Design Thread
« Reply #828 on: Sat, 30 November 2019, 11:15:42 »
Thanks for working on this!  :D
Today's quote: '...“but then the customer successfully broke that.”

Offline jstein91

  • Posts: 30
Re: The Living PCB Design Thread
« Reply #829 on: Thu, 05 December 2019, 13:44:49 »
Hello all!

Im working on a custom PCB and could use some help.

I know its best practice to route USB D lines without vias and deferentially. The issue Im running into is how to actually do that.

Here is how I have it now:

231272-0

As you can see I have the traces the same length BUT I had to use vias so the lines dont cross. Ive tried the component on both side of the board and for the lines to not cross it has to be on the top which means I need vias.

Whats the best way to handle this? Should I move the USB to the top also? Then I think I would still need vias to get the trace to the bottom where it can go into the MCU. Am I missing something here? All advise is appreciated.

Offline gipetto

  • Posts: 91
Re: The Living PCB Design Thread
« Reply #830 on: Thu, 05 December 2019, 14:29:38 »
why not do this? tbh, if it was me i'd keep the usb lines straight, and put the port on the left hand side. those crystal lines seem quite long, you could rotate the mcu 90 degrees anticlockwise and have the crystal up top.

Offline jstein91

  • Posts: 30
Re: The Living PCB Design Thread
« Reply #831 on: Fri, 06 December 2019, 08:31:48 »
why not do this? tbh, if it was me i'd keep the usb lines straight, and put the port on the left hand side. those crystal lines seem quite long, you could rotate the mcu 90 degrees anticlockwise and have the crystal up top.

Wow! I dont think it ever would have occurred to me to route it that way! Thats great. Thanks.

RE the crystal lines, Im going to take your advice and rotate. I need to redo the switch matrix anyway so I might as well and it looks like that would also make it eaiser to route the data lines.

Offline theNestruo

  • Posts: 14
Re: The Living PCB Design Thread
« Reply #832 on: Sat, 18 January 2020, 12:22:50 »
Hi!

Newbie here wanting to do his first keyboard (a EM7/Alice-based ISO TKL).

I know very little about electronics; so I was blindly following Ruiqi Mao's guide first, and ai03's guide then. At the same time, I was trying to apply every tip I've read in this thread, and trying to learn something peeking other opensource PCBs (Gondolindrim ones, mainly).

Currently, I think the PCB is mostly right (at least it seems right to me!), but I'm quite confused about some things:
  • The 0.1+0.1+0.1+0.1+4.7uF capacitors vs 0.1+0.1+0.1+10uF capacitors. Still don't know which one is better.
  • The atmega pins. I have a 9x9 matrix, so I need 18 pins. Are all pins "safe" to use? Some Atmega32U4 schematics have double-named pins (MOSI, MISO, SCK...)
  • The VCC/+5V lines: In some PCBs, all VCC goes from "outside" the atmega to the pins; while in others, the VCC pins are connected within the atmega. I think the former is better (so the capacitors do "something" with the signal before going into the atmega)... but again I know very little about electronics so this point confuses me a lot
  • The crystal GND area: I've tried to put a GND area around the Crystal, but it always get merged with the general GND areas. However, I've seen PCBs with a separate area (GNDD)
  • The USB: I've never been able to have the USB exactly as the guides. I always end up with a slightly different schematic and/or footprint. Currently, KiCad complains about "Processing courtyard of “random-keyboard-parts:Molex-0548190589”: Unable to find segment with an endpoint of (162,58 mm, 18,998 mm)"; I really don't know what that means and how can I solve it...
Can someone enlighten me?

I'm attaching the schematics (PDF) and PCB (gerber); if someone can have a look at them and point mistakes/advices that would be really helpful and appreciated!

Thanks in advance!

Offline gipetto

  • Posts: 91
Re: The Living PCB Design Thread
« Reply #833 on: Sat, 18 January 2020, 13:40:18 »
Generally the more capacitors you use the better. They aren't critical and the mcu will usually work without them, they're just insurance against things going wrong. I don't know the real answer, just copy a good quality datasheet and it should work.

all pins are safe to use. mosi etc are for isp programming which requires them to be isolated. This isn't an issue in keyboard matrixes because each unpressed switch on a row or column isolates the connection, and the programming speed is slow enough that capacitance is not an issue either, like it could be on a usb bus. So just run each isp pin to a header, doesn't even have to be the 2x3 header atmel recommends as you will probably be just fine with the default bootloader and never use it.

I think some pcbs route the vcc under the mcu to make routing easier. it will work, but not best practice as there's some rf magic lore that says mcus should have a ground plane underneath, with a load of vias to wick the heat away to the other side of the pcb.

i'm new to crystal grounds myself but atmegas usually work anyway. apparently you're supposed to exclude the ground plane from underneath the crystal to avoid creating capacitance, or conducting rf into other parts of the pcb. maybe that is why the designs you've seen have the ground plane isolated there. anyway, try an exclusion zone instead, they're easy to do.

segment errors tend to result from a broken line. I bet if you use a different usb footprint you will avoid that error.

your pcb looks to be of excellent quality and well laid out. all i would do is add an isp header but it's not needed either as you can just solder straight to the switch contacts.

Offline theNestruo

  • Posts: 14
Re: The Living PCB Design Thread
« Reply #834 on: Sun, 19 January 2020, 07:20:47 »
Hi!

Generally the more capacitors you use the better.
I've added "the missing" capacitor.

all pins are safe to use. mosi etc are for isp programming which requires them to be isolated. This isn't an issue in keyboard matrixes because each unpressed switch on a row or column isolates the connection, and the programming speed is slow enough that capacitance is not an issue either, like it could be on a usb bus. So just run each isp pin to a header, doesn't even have to be the 2x3 header atmel recommends as you will probably be just fine with the default bootloader and never use it.
I've added the header; may remove it later if it complicates the manufacturing of the board* (or use regular vias instead).

I think some pcbs route the vcc under the mcu to make routing easier. it will work, but not best practice as there's some rf magic lore that says mcus should have a ground plane underneath, with a load of vias to wick the heat away to the other side of the pcb.
I had a +5V zone below (after the 10uF capacitor) to power all the +5V pins (through their +5V/GND capacitors)... I've replaced it with a trace, set the zone to be GND, and gruyèred the area.

segment errors tend to result from a broken line. I bet if you use a different usb footprint you will avoid that error.
As you said, I used a different USB footprint and the error dissapeared!

your pcb looks to be of excellent quality and well laid out. all i would do is add an isp header but it's not needed either as you can just solder straight to the switch contacts.
Woah! Thanks!!! I wasn't expecting that! :-O

I've also moved the atmega a little bit and used different pins (to avoid using the ones closer to the crystal), plus a few tweaks in the groups of traces... and it looks a little cleaner :)

Thank you so much for your feedback!!!

Here it is:
233900-0

* I have no solder equiment nor the knowledge/ability to do it... My idea was to use JLCPCB SMT assembly service (or a similar page; haven't checked prices, pieces availability, etc. yet).

Offline theNestruo

  • Posts: 14
Re: The Living PCB Design Thread
« Reply #835 on: Thu, 23 January 2020, 13:57:19 »
Hello, again!

I've been playing around a little with the JLCPCB SMT Parts Library... and found no USB connectors :(

Meanwhile, I found this kind of connectors that looks cheap, "easy" to solder, and have fewer pins that a Teensy or a Pro Micro (less pins to solder):
234169-0

Maybe that's the way to go (for me)! Can I keep both footprints in the PCB (as pictured)? Or will that mess up the D+/D- lines?
234171-1

Thanks again!!

Offline gipetto

  • Posts: 91
Re: The Living PCB Design Thread
« Reply #836 on: Thu, 23 January 2020, 14:10:06 »
it will work fine. layout is not all that critical. In the past I have converted micro usb designs to mini usb, which are available in through hole. There's also the huge usb-B port common on printers and the rarer usb-C through hole part used on the discipline.

Offline theNestruo

  • Posts: 14
Re: The Living PCB Design Thread
« Reply #837 on: Mon, 27 January 2020, 10:50:02 »
Hi (again)! And thank you very much for your feedback, gipetto :)

It seems that JLCPCB has no stock of the ATMEGA32U4... so I've tried to use ATMEGA32U2 instead. The problem is all the guides I've been following use an U4 and, as I have very little knowledge of electronics, reading the U2 datasheets didn't help.
I've removed a capacitor (the U2 has one less VCC pin than the U4)... but I really don't know what I'm doing.

Does anyone has an schematic of a simple keyboard using the U2? Namely: values (for capacitors and resistances), crystal, should I still connect a resistance to the HWB pin? Does the RESET pin requires a resistance? Etc.

Or would it be better to wait for JLCPCB to re-stock the U4?

Thanks!

Offline gipetto

  • Posts: 91
Re: The Living PCB Design Thread
« Reply #838 on: Mon, 27 January 2020, 11:47:11 »
I'd wait for a week or so until the holidays are over for the 32u4, though I understand they have been extended due to corona virus. not sure how that will affect you. a week is nothing with mail order products. i've had packages disappear and turn up 3 months later. it's a common problem to get stuck on an issue and have a project stall as a result so i'm reluctant to do changes myself. if i had experience with other mcus i might have a different opinion.

Offline theNestruo

  • Posts: 14
Re: The Living PCB Design Thread
« Reply #839 on: Mon, 27 January 2020, 13:13:41 »
I can wait :) I'm doing this for fun and learning purposes with a friend... and I'm definitely more comfortable following the atmega32u4-oriented tutorials/guides. Thanks, gipetto!

Offline Applet

  • Posts: 487
  • Location: Sweden
Re: The Living PCB Design Thread
« Reply #840 on: Tue, 28 January 2020, 00:49:19 »
Hi (again)! And thank you very much for your feedback, gipetto :)

It seems that JLCPCB has no stock of the ATMEGA32U4... so I've tried to use ATMEGA32U2 instead. The problem is all the guides I've been following use an U4 and, as I have very little knowledge of electronics, reading the U2 datasheets didn't help.
I've removed a capacitor (the U2 has one less VCC pin than the U4)... but I really don't know what I'm doing.

Does anyone has an schematic of a simple keyboard using the U2? Namely: values (for capacitors and resistances), crystal, should I still connect a resistance to the HWB pin? Does the RESET pin requires a resistance? Etc.

Or would it be better to wait for JLCPCB to re-stock the U4?

Thanks!
Check alps64 by hasu. I like the atmega32u2.

Offline Old_Gold_Hand

  • Posts: 56
  • Location: Richmond, VA
    • American Haptics
Re: The Living PCB Design Thread
« Reply #841 on: Fri, 21 February 2020, 13:28:03 »
I made a simple pcb as a project to work with qmk and rotary encoders. The pcb uses an ATMEGA32u4-AU MCU. I modeled the schematic after the pro micro, and followed ruqimao's tutorial. I have the ability to prototype pcbs fairly quickly, so I can make a new version easily.

When I plug the usb into the computer, I get the error Device Not Found.

Things I have tried:
Grounding HWB pin
Pulling down HWB with 10kresistor
not connecting HWB pin

I have poured many many hours into this project and am losing my mind. When I plug a pro micro in, it shows up as an atmega32u4.

Any help would be greatly appreciated

236187-0
Love yall

Offline gipetto

  • Posts: 91
Re: The Living PCB Design Thread
« Reply #842 on: Fri, 21 February 2020, 17:09:38 »
does the mcu come with a bootloader?(usually do) remember you can't flash them like a dev board, you need to use the appropriate software for atmel-flip.

dfu-programmer atmega32u4 erase --force
dfu-programmer atmega32u4 flash <file.hex>

Offline Old_Gold_Hand

  • Posts: 56
  • Location: Richmond, VA
    • American Haptics
Re: The Living PCB Design Thread
« Reply #843 on: Sat, 22 February 2020, 08:15:26 »
I believe this model does, the ATMEGA32u4 model with the external crystal comes with a bootloader. I downloaded atmel flip, I guess I will play with that as well. Can I do this over USB or do I need to do this over ISP in a socket? feels like I should be able to do it over usb.

Really grateful for your response, Im ready to try anything.
Love yall

Offline gipetto

  • Posts: 91
Re: The Living PCB Design Thread
« Reply #844 on: Sat, 22 February 2020, 11:01:41 »
it should upload fine over usb. isp is really only a last resort, or for a device which doesn't use usb.

Offline bpiphany

  • Posts: 1033
  • Location: Stockholm, Sweden
  • bpiph is a special type of crazy. //mkawa
Re: The Living PCB Design Thread
« Reply #845 on: Mon, 24 February 2020, 02:16:50 »
I believe you have uCap wired up incorrectly. For a "bus powered device" it should connect only to GND through a 1µF capacitor.

section 21.3.1
http://ww1.microchip.com/downloads/en/devicedoc/atmel-7766-8-bit-avr-atmega16u4-32u4_datasheet.pdf

Offline Old_Gold_Hand

  • Posts: 56
  • Location: Richmond, VA
    • American Haptics
Re: The Living PCB Design Thread
« Reply #846 on: Wed, 26 February 2020, 19:32:41 »
Thanks all for chiming in. Going to tinker with this on the weekend, gonna have to jump a pin through a cap to try it. Will report back
Love yall

Offline Zustiur

  • Posts: 235
Re: The Living PCB Design Thread
« Reply #847 on: Sat, 21 March 2020, 02:02:16 »
I'm stuck with my current build. I've managed to program blinky using the ISP pins and AVRDude, and it functions so long as the ISP Programmer is plugged in. When I disconnect that and instead connect the board via USB, nothing happens. No blinking light, no detection noise from Windows.
I've used a multimeter to prove there's a connection between the pins on the USB header and the pins on the ATMega32U4.
At this point I'm stumped and would appreciate any suggestions on how to troubleshoot this further!

Offline gipetto

  • Posts: 91
Re: The Living PCB Design Thread
« Reply #848 on: Sat, 21 March 2020, 05:58:24 »
Need a schematic picture, could have left out termination resistors, or screwed up the usb-c implementation. lots of things that could have went wrong.

Offline Zustiur

  • Posts: 235
Re: The Living PCB Design Thread
« Reply #849 on: Sat, 21 March 2020, 09:38:22 »
Right, the schematic. That would definitely help.  :))
It's overly complicated because I built it with the expectation of having issues like this. Ordered from JLCPCB, so I got 5 copies. I therefore decided to have an option for Teensy or directly wired ATMega32U4. Hence the jumpers to separate the ATMega from the switches. The idea being that I'd prove the layout worked with the teensy then spend as much time as I needed to figure out ISP programming. Turns out I've been unable to desolder my teensy from a previous prototype and ISP programming was a snap.
I'll experiment with USB programming once I actually get USB to function.