8. Electronics Design

This week we discussed electronics design. I was excited to dive into the topic because although I have a vague recollection of some theoretical concepts of circuits from a couple of classes in college and have attempted to work with arduino dev boards 1-2 times since I graduated, I never really got past making some LEDs blink. My background did prove helpful in recognizing some high level ideas, but I've always wanted to know how electronics are actually designed, how specific components are decided on, and how their values are calculated. The intuition behind these things has always been mysterious yet extremely powerful. Although I still don't really know much about this alchemy, I do feel this week has helped me peer through the looking glass and gain the smallest bit of insight into how it's done.

Onto the task of the week

My board idea

My goal was to create a portable (programmable) game console. This includes both

I knew the 2nd portion was ambitious but planned to work on that beyond this week once the board is working. This fits the task of the week because it will allow peripheral pins to be programmed in the future. It also allows for game development. For the hardware immediately thought of simple controls, like Gameboy's, with a D-pad (essentially 4 buttons- up, down, left, right) and 2 action buttons (a and b). An LCD screen would also be absolutely necessary. For testing purposes I planned to reuse the LCD TFT screen I used in embedded programming week for the clay sensor. I also wanted to give some user feedback for when a button was pressed. At first I designed it to have a button for each button but this was insane. After a few iterations I dumbed it down to one "feedback" button. Kul. I chose the esp-wroom-32E initially as my microcontroller. That was a mistake that would set me back lifetimes. More on that later.

All Hail King Kicad

To develop our schematics and PCB designs we used a tool called Kicad. It offers a whole array of component libraries that you can use while in your design process and allows you to add more from other sources as well. We began by adding the electronic components available at the fab labs. Those footprints and symbols can be found here!

I would say our PCB design process can be broken into 3-4 major parts. Lets get into it.

Schematic Design

First things first, we get started designing our schematic. The schematic is where we make logical connections between components we will use. This is done before we actually consider where those components will go in relation to each other. I felt this was very useful because you could gain a strong idea of how the circuit would be interconnected and function without worrying about the physical details of where each component goes and the wiring between them, which is a real puzzle in itself.

Shhh, my master plans

Shortcut keys in kicad's schematic design were also very useful.

PCB Design

This is where you start to see your ideas actually take shape and see what it'll actually look like IRL. Be not deceived though, getting the wiring and pieces aligned all without any unintended connections is no joke. I definitely found myself lost many times in the PCB abyss which did lead me to rethink and simplify my design. Placing your voltage/power supply strategically is a good first step in keeping things open and organized for your board. Put it in the wrong place and you'll have a VCC line more insurmountable than the northern wall in Game of Thrones

Hodor, cuz why not

I had a lot of switches for the gaming buttons and all of them had VCC connections. After an initial design an idea sprang into my head to actually make them connected to ground and take advantage of ESP32s internal pull-up resistors, which would set the pins high until a button was pushed and receive a low signal. This meant my yes's were nos and nos were yes's which can be a bit confusing but the nice thing is I avoided wrapping my VCC line around my board to get to my numerous buttons. Kul. Finally I exported my circuit design as a black and white SVG file.

A down to earth design
SVG Output from Kicad
Settings for kicad holes, vias, and wires
Useful shortcuts were

Ink[I wish I could e]scape

In week 4 we were given the PNGs all set to work with the milling software for the Quentorres board and didn't have to worry about this step much. But this week we had to actually do this ourselves. Here are some post-processing steps we had to do. In this case I used Inkscape to do them but it can be done with any image editor (like illustrator or probably kicad itself)

Mods Mods Mods

This was already covered in week 04. We used the website once again to create the milling files. This time though after cutting the board I noticed the esp32 needs a copperless space right above it so its antenna can work properly. I would potentially have to manually remove that with a cutting knife. That didnt sound fun. I ended up preparing one more PNG and subsequent milling job where I used the 1/32 inch mill to remove the block of copper in this space.

Antenna PNG...just a block
Mods workflow

That definitely saved me a lot of future time and effort. Finally I outputted the files for the mill to read and put them on the iaac cloud filesystem.

Mill Baby Mill

Finally, let's get physical. I milled my first board and all looked well.

It mills
First board complete

I still had to scratch off some copper for the antenna because I wasn't super precise on where it was on the first go. I also accidentally drilled out the copper around the holes by accident. This must've happened when I went into the heart of darkess that is Inkscape the first time. Along with being a double sided copper board, this wasn't an ideal situation. My board was primed for short circuiting. I decided to reprint, this time with a one sided copper board, better holes and better antenna space coverage.

Second is the best...they say
Living the dream
With components
Pongy

I was really pleased with how my second board turned out! Everything was improved. Now that I had my milled board I would be able to start adding my components to it, starting with the microcontro....but darn we don't have the ESP32 model I chose to use...I had to go back and rewire everything with one we did actually have in stock. I also had to import the symbols and footprints here (for the s3-wroom-1). That was definitely sad times. Now I would reprint for the 3rd time

After several failures and a rewiring required I was left a bit demoralized by the day. I knew I had to do somethng about it. I stuffed myself silly that night to fill the void

A tasty consolation prize

Things learned

Kicad Files

Kicad files can be found here