Author Topic: Moving a Teensy-based custom PCB to use an ATmega 32u4?  (Read 4528 times)

0 Members and 1 Guest are viewing this topic.

Offline ngaalex

  • Thread Starter
  • Posts: 8
  • Location: Australia
Moving a Teensy-based custom PCB to use an ATmega 32u4?
« on: Fri, 08 April 2016, 00:35:10 »
I've designed a custom Teensy-based PCB for a 9-key (3x3) chording keyboard prototype, and in an effort to reduce size and learn more I've moved the ATmega 32u4 from the Teensy to the PCB, along with (I hope) everything else needed to get it to operate as a keyboard - working from Teensy and Arudino designs that use the 32u4.

In terms of bootloaders, is there generally a default for the 32u4 or will I need to flash one via ISP?
And if there's anyone experienced reading this, how would you assemble it (solder it yourself vs. spend the extra money to get it assembled) and would you be able to check my KiCad PCB/schematic design to verify that it's all there?

My plan is to use this keyboard as a learning experience and eventually fully design a PCB that's usable for everyday use, so I'm definitely open to any pointers or anything that'll help me towards that.
« Last Edit: Fri, 08 April 2016, 07:22:14 by ngaalex »

Offline MOZ

  • KING OF THE NEWBIES
  • * Maker
  • Posts: 3981
  • Location: Jo'burg
  • Busy making stuff
Re: Moving an ATmega 32u4 from a Teensy to a custom PCB?
« Reply #1 on: Fri, 08 April 2016, 04:48:20 »
Few points of correction:
- Schematic:
--- It's best to put a no-connect on all unused pins
--- Connect VBUS to VCC
--- Leave the AREF pin floating (No-connect)
--- A 1uF capacitor close to the USB port is highly recommended
--- 4 0.1uF capacitors between the VCC/AVCC and GND pairs is highly recommended. The four pairs are 14-15, 34-35, 44-43, 23-24.
--- Pull the rest pin high via a 100kOhm resistor
--- Have a debug LED (Preferably on PD6 as it's the one used on the Teensy as well). This can be very handy at times.

- PCB:
--- It's best to not have any traces under the crystal, on the layer it is mounted as well as all other layers underneath.
--- The 4 0.1uF capacitorsshould be placed as close to the atmega as possible.
--- Why the the extra space up top, it's entirely possible to have the components in between the switches, just have to get a bit creative, unless of course if your designs asks for it, then it's all cool.


The atmega32U4 ships with Atmel's DFU bootloader. No need to flash any other bootloader, it works fine via FLIP or dfu-programmer.

From the components you have, the MCY would be the hardest to solder, but that too is not too hard, as the pins are spaced out comfortably. See some YouTube videos on soldering QFP packages, just use solder sparingly and flux liberally.

Offline Findecanor

  • Posts: 5036
  • Location: Koriko
Re: Moving an ATmega 32u4 from a Teensy to a custom PCB?
« Reply #2 on: Fri, 08 April 2016, 06:51:30 »
If you moved it from a Teensy then it should still have the Halfkay bootloader.

Offline MOZ

  • KING OF THE NEWBIES
  • * Maker
  • Posts: 3981
  • Location: Jo'burg
  • Busy making stuff
Re: Moving an ATmega 32u4 from a Teensy to a custom PCB?
« Reply #3 on: Fri, 08 April 2016, 07:10:25 »
If you moved it from a Teensy then it should still have the Halfkay bootloader.

Moving one from Teensy would be quite hard if you don't have a hot-air station. I wouldn't really recommend it, IMO, Teensy's work great for debugging, testing, turn it into a programmer if need be, etc. So, why waste it by taking the MCU out, a new one is available for ~$7.

I will admit, reading the title, I did think the OP wanted to remove the 32U4 from the Teensy and place it on a custom PCB.

Offline ngaalex

  • Thread Starter
  • Posts: 8
  • Location: Australia
Re: Moving an ATmega 32u4 from a Teensy to a custom PCB?
« Reply #4 on: Fri, 08 April 2016, 07:21:15 »
Few points of correction:
- Schematic:
--- It's best to put a no-connect on all unused pins
--- Connect VBUS to VCC
--- Leave the AREF pin floating (No-connect)
--- A 1uF capacitor close to the USB port is highly recommended
--- 4 0.1uF capacitors between the VCC/AVCC and GND pairs is highly recommended. The four pairs are 14-15, 34-35, 44-43, 23-24.
--- Pull the rest pin high via a 100kOhm resistor
--- Have a debug LED (Preferably on PD6 as it's the one used on the Teensy as well). This can be very handy at times.

- PCB:
--- It's best to not have any traces under the crystal, on the layer it is mounted as well as all other layers underneath.
--- The 4 0.1uF capacitorsshould be placed as close to the atmega as possible.
--- Why the the extra space up top, it's entirely possible to have the components in between the switches, just have to get a bit creative, unless of course if your designs asks for it, then it's all cool.


The atmega32U4 ships with Atmel's DFU bootloader. No need to flash any other bootloader, it works fine via FLIP or dfu-programmer.

From the components you have, the MCY would be the hardest to solder, but that too is not too hard, as the pins are spaced out comfortably. See some YouTube videos on soldering QFP packages, just use solder sparingly and flux liberally.

Thanks for the help!
I designed the board to have a Teensy mounted above the switches at first, which is why the ATmega circuitry is up there - I'll try to move it to between the switches/on the back of the PCB.

With the stock bootloader being okay, I'd also be fine if I got rid of the ISP connector, correct?

And in regards to crystal & capacitor placement - would the best way to do that be having them both close to the controller on a part of the board without any other traces? (I'm thinking this would be between switches on the backside of the PCB.)

Thanks again for the help.

Offline ngaalex

  • Thread Starter
  • Posts: 8
  • Location: Australia
Re: Moving an ATmega 32u4 from a Teensy to a custom PCB?
« Reply #5 on: Fri, 08 April 2016, 07:22:40 »
If you moved it from a Teensy then it should still have the Halfkay bootloader.

Sorry for the title confusion. Fixed it.

Offline MOZ

  • KING OF THE NEWBIES
  • * Maker
  • Posts: 3981
  • Location: Jo'burg
  • Busy making stuff
Re: Moving a Teensy-based custom PCB to use an ATmega 32u4?
« Reply #6 on: Fri, 08 April 2016, 07:43:57 »
With the stock bootloader being okay, I'd also be fine if I got rid of the ISP connector, correct?

And in regards to crystal & capacitor placement - would the best way to do that be having them both close to the controller on a part of the board without any other traces? (I'm thinking this would be between switches on the backside of the PCB.)

I would personally recommend keeping the ISP connector if possible, or at least some sort of ISP headers, even a row of 0.1" pitch header pins is fine. You never know if something goes wrong and you have to flash a new bootloader.

Best way to mount the crystal is close to the MCU, with the crystals for it, besides it. No traces underneath the crystal only, you can have traces under the caps and MCU, no problem. Have a look at the GH60, GHPad, SAMPad PCBs for ideas.

Offline ngaalex

  • Thread Starter
  • Posts: 8
  • Location: Australia
Re: Moving a Teensy-based custom PCB to use an ATmega 32u4?
« Reply #7 on: Tue, 12 April 2016, 23:49:30 »
I would personally recommend keeping the ISP connector if possible, or at least some sort of ISP headers, even a row of 0.1" pitch header pins is fine. You never know if something goes wrong and you have to flash a new bootloader.

Best way to mount the crystal is close to the MCU, with the crystals for it, besides it. No traces underneath the crystal only, you can have traces under the caps and MCU, no problem. Have a look at the GH60, GHPad, SAMPad PCBs for ideas.

I've started the PCB again from scratch with what you said in mind, does this look good? I've moved the ATmega 32u4 to under the switches on the other side of the PCB, and only used extra room at the top where the PCB would be sticking out anyway due to the USB port. Thanks again, appreciate your help.

Offline vvp

  • Posts: 887
Re: Moving a Teensy-based custom PCB to use an ATmega 32u4?
« Reply #8 on: Wed, 13 April 2016, 03:25:03 »
If you want to understand a bit more about crystal placement then read e.g. this:
http://www.st.com/web/en/resource/technical/document/application_note/CD00221665.pdf
There should exist something like this for ATmega too but the principle will be the same.

Or use rather some MCU which does not need crystal for USB functionality. E.g. ATXmega or STM32F0x2. This option of course requires you to know something about programming so that you can adjust firmware. But if you are designing your own board you probably will need some firmware adjustment anyway.

Offline MOZ

  • KING OF THE NEWBIES
  • * Maker
  • Posts: 3981
  • Location: Jo'burg
  • Busy making stuff
Re: Moving a Teensy-based custom PCB to use an ATmega 32u4?
« Reply #9 on: Wed, 13 April 2016, 04:02:25 »
Looks, good, two minor things:
1. Have a current control resistor on the debug LED.
2. A 1uF cap between VCC and GND near the USB is recommended
3. On the PCB, place the crystal as close to the MCU as possible.

Offline ngaalex

  • Thread Starter
  • Posts: 8
  • Location: Australia
Re: Moving a Teensy-based custom PCB to use an ATmega 32u4?
« Reply #10 on: Wed, 13 April 2016, 05:56:20 »
Looks, good, two minor things:
1. Have a current control resistor on the debug LED.
2. A 1uF cap between VCC and GND near the USB is recommended
3. On the PCB, place the crystal as close to the MCU as possible.

Fixed those up - hopefully the crystal is close enough.

Thanks again for your help.

Offline MOZ

  • KING OF THE NEWBIES
  • * Maker
  • Posts: 3981
  • Location: Jo'burg
  • Busy making stuff
Re: Moving a Teensy-based custom PCB to use an ATmega 32u4?
« Reply #11 on: Wed, 13 April 2016, 06:15:53 »
Fixed those up - hopefully the crystal is close enough.

Thanks again for your help.

The schematic is not there in the zip.

Offline ngaalex

  • Thread Starter
  • Posts: 8
  • Location: Australia
Re: Moving a Teensy-based custom PCB to use an ATmega 32u4?
« Reply #12 on: Wed, 13 April 2016, 06:17:21 »
The schematic is not there in the zip.

Whoops - sorry. Should be fixed now  :p

Offline MOZ

  • KING OF THE NEWBIES
  • * Maker
  • Posts: 3981
  • Location: Jo'burg
  • Busy making stuff
Re: Moving a Teensy-based custom PCB to use an ATmega 32u4?
« Reply #13 on: Wed, 13 April 2016, 06:25:54 »
Looks good! :thumb:

Although, if you want to further reduce space, you could put the USB connector on the back, and the PCB size would be dictated by your switches only.

Offline ngaalex

  • Thread Starter
  • Posts: 8
  • Location: Australia
Re: Moving a Teensy-based custom PCB to use an ATmega 32u4?
« Reply #14 on: Wed, 13 April 2016, 06:48:53 »
Thanks for all your help! I'll order the PCB and switches in the next few days, and start designing the layout for my complete board...