I am almost finished with the new PCB for the rotary encoders. It has been a while since I did PCB design so it has been a little slow since I am trying to refresh my brain on things to and not to do. I’ve gone through three revisions so far and I think I am “happy enough” with the current design.
The design process has been interesting. First, I planned to have the board simply provide a substrate to mount the encoders and take care of the peripheral resistors and capacitors with the board providing direct lines to the STM32. As I began to get more into the design process, I realized that this was not a good design. First, the STM32 has a limited number of external interrupts and they can only be on certain pins. With 6 encoders + switches, that was 18 lines that needed to be routed. This was making it hard to route the traces neatly on the main PCB that has the STM32 on it. And, it meant expensive cables and connectors to connect everything. I looked into different ways to decode the encoder including flip flops and binary counters. But, I could not find the right parts I needed and it after a quick cost-benefit analysis, I realized it was not cost effective. But, I also realized that I could use a cheap ATmega328 in a TQFP package and it could handle all the encoder/switch decoding. So, I decided to incorporate a secondary controller to handle the encoders and switches and it can pass along the data to the STM32 via I2C.
Incorporating the Atmega328 was pretty straightforward, but I am definitely experiencing uncertainty about whether my design is sufficient or not. Deep down, I think that it is. But, part of my process requires me to pore over every detail of the PCB to make sure that I got it right. I will say that the one thing that I am not happy with is that I did the ground plane on the top layer and I think I would prefer it on the bottom layer now. But, I think it is good enough and I would rather not do the design again. I’ve posted the design below. And, I have just finished putting together the BOM and making sure all the footprints are going to be okay. This is my first SMD board and I am kind of excited. Now, to just work up the courage to actually order the board.