Skip to content

Week 06: Electronics Design

This page is referenced in the class schedule Electronics Design

My understanding of electricity:

electricity-lunch-comic

KiCad 9 tutorials suggested by Tom.

Tutorials Suggested from the Class

How to use the logic analyzer from Adrian

KICAD playlist

Group Assignment

  • use the test equipment in your lab to observe the operation of an embedded microcontroller

We all took part in testing, observing, and explaining what was happening when using a multimeter, and oscilloscope.

See our group page for more details.

Individual Assignment:

  • simulate a circuit
  • use an EDA tool to design an embedded microcontroller system using parts from the inventory, and check its design rules for fabrication
  • extra credit: try another design workflow
  • extra credit: design a case

This week I once again spent more time than allotted on figuring out what is being asked of me, and how to do the basic requirements. I spent Wednesday night testing the circuits with the group. Thursday I worked a few hours during in the evening after my Girlscout troop meeting finished watching and attempting KiCad tutorials, and thinking of a circuit design.

I started by downloading KiCad onto my computer, and installing the KiCad Fablib, the Fab Academy symbol library referenced in today's class. There were instructions in the link.

Install KiCad FabLib

I created a new file called Test1, and opened the schematic editor.

I then clicked on the place symbols button on the right menu bar. It looks like a triangle with a minus and plus, and 3 legs.

From there I searched for the components I wanted to use in my circuit. The XIAO RP2040, an led, a switch

I am finding it difficult to use the search, because I do not know the correct terms to search for. I was hoping if I typed "switch" there would be a few options. There are options, but their names do not make sense to me. I continued the KiCad youtube tutorials, and tried to figure out what to do next.

I tried thinking of what I would like to do with my board. My son's birthday is this coming week, and he wants a tank cake. Last year I made a Mario Rainbow Road cake, but I didn't know how to program leds. I bought cheap ones that changed color, but I was disappointed because they didn't blink like in the game. My son was very happy, and told me it was still awesome.

I wanted to make a circuit that consisted of an led, the necessary resistors, a light sensor, a switch, 2 stepper motors and 2 sets of wires that would produce a spark. My plan was to use this design to power my son's Tank birthday cake. I was going to put the turret on a ball bearing lazy susan with a hollow tube supporting it. Another tube preferably 3d printed, but likely made from sturdy straws would branch from the center hollow out of the cake as the interior of the cannon. I would feed the wires through the center to the circuit board. The stepper motors would be attached some how to the lazy susan and hopefully the cannon. The light sensor would be placed by the candle. The switch would be in the off position until we were ready. When the candle is lit, I would start the program by pressing the button. When the candle is blown out after happy birthday is sung, the tank top will rotate left then right slowly, then the cannon would tilt up. Then a spark would be sent through the wires through the tube in the cake, igniting the flash cotton, BANG! And sparkles. After a short delay, 2 seconds, the other wires would spark setting off a secondary charge of flash cotton on the second tank that the first aimed at. I hoped I could map out and test the circuit in a breadboard, and use it for the cake as a way to physically see how the circuit worked. I find just using the computer difficult.

Saturday morning I was hesitant on how to use a stepper motor, having never used one before. And I was waffling over what was the best way to produce a spark.

Here is my test in case you were wondering.

I was told to make an Arduino like device using all the pins of the microcontroller. This was very intimidating since I do not know the majority of input or output devices that connect to the microprocessors or how to connect them, but I took Rico Kanthanthm's advice, and attempted to make a "Dorino", my own Arduino. I will start with the XIAO RP2040 microcontroller that I learned about in week 4, and create a PCB board that will allow me to easily connect to it in the future.

Rico also suggested this book, Getting Started in Electronics by Forrest M. Mims, III.

I have printed myself a copy, and flagged quite a few circuits I would love to add to my final project.

I used the XIAO RP2040 pinout diagram to determine what connections are needed. I also wanted to incorporate elements that make breadboards useful for beginners.

I would like it to be a testing board that will help me troubleshoot inevitable problems.

The breadboard has many connections to ground, and connections that allow for multiple components to connect. The squares of the breadboard are easy to push a wire into.

Design features:

  • easy connectors to the pins associated with the XIAO RP2040
  • an led to show my board has power
  • the XIAO RP2040 has a green led in its board already. Pin 25 when programming, but it has inverted logic
  • a testing circuit for 2 components (led and resistor)
  • with a switch for testing a component in series, and large contact areas for multimeter probe testing
  • all pins accessible for future projects, preferably in easy to use way
  • interesting, not rectangular design
  • switch for input on one pin
  • Use components found in the Fab Lab inventory, linked here.

I had my XIAO RP2040 pinout diagram out to help with placement of the components.

XIAO RP2040 pinout

I decided to use my sticker design from week 03, since I had designed it to be a circuit.

I like that this circuit would represent the scientific method. 1. an idea - test led that shows current is flowing through the pcb 2. make observations, and collect data - 4 analog input pins set up so their paths make an eye to represent observation, for analog sensor inputs 3. Test your hypothesis - test circuit with a switch to break it for measuring current, and easy access connectors for measuring with multimeter voltage and resistance too 4. share your findings by completing a design.

The problem will be making it a complex circuit with many input/ output options.

I was able to draw it out by hand, but my biggest problem is figuring out how switches work on pcb boards! This seems ridiculously overcomplicated. I am not trying to create a switch for signaling an input. That would be the pull up or pull down resistor with the switch. I will also be using one of those in this design. I want to be able to break a circuit to measure current, and resistance. So pulling the current up or down to set amounts would defeat the purpose. If there is noise, I want to be able to read that. Furthermore, this will be on an output not an input.

I found this guide to switch types in pcb design, which showed me some interesting switch options. I really like the Dual In-line Package (DIP) switch for being able to break multiple circuits for testing with one piece of hardware.

This was helpful in understanding switches as an input. how to connect a push button switch

I also analysed the circuitry of Kai Zhang's week 6 design to see how the switch was used in it. It was used as an input device, with P4 going to a leg of the switch then to a resistor, and ground. Another leg is attached to the 3.3V pin, then to the switch's back leg, then to a photo resistor, then connected at the same point with P2 and a resistor leading to ground. I am not sure what this switch does, it appears to have a pull down resistor, but I'm not sure what the other leg connecting to pin 2 does. In fact it can't do anything, because pin 2 is not an analog input. In the code, pin 2, called D8, is labeled as PR2, but it is not used in the program. This was because of a microprocessor mixup, and was explained in the documentation. The switch did work in the video, but I found this example more confusing than helpful as I'm not sure how the switch would have worked had pin 2 been an analog pin.

After much time spent searching, I finally asked Claude.ai, "when making a pcb board, can i use a switch to break a circuit so that I can test current in series?"

And it told me, "Yes! This is actually a really smart design practice. It's called a current measurement header or test point break."

This was very nice, because I was really needing that affirmation. This is why Claude.ai is becoming my new best friend.

I have drawn out my design, and now I must figure out how to make the board in KiCad. I have watched many different tutorials, and I am still confused on how to choose components. I know I must use components available in the fab lab library, but I don't know what all the names mean.

Idea PCB This is a sketch of my idea pcb.

KiCad tutorial part 3 has choosing parts

great explanation of menu buttons.

Choosing an LED The ending "_SMD" stands for surface mounted, and "_THT" is for through hole soldering.

connect wires

footprint editor

I strategically placed the power arrow to point to the button for the footprint editor. To make the PCB we must choose footprints for our components. Then the software can take our schematic design, and make it a PCB design.

The tutorial suggested a soldering footprint at least 6mm for ease of soldering, 5mm led as a common led, and 6mm button, but he was through hole soldering.

Tom told us in class on Monday to use footprint size 1206 metric SMD, and 2.54 metric for through hole.

Label your parts as you put them out so that you can copy and paste with all the changes saved. This is helpful with resistors, because you need to label them with their resistance.

I used Ohms law to calculate the resistance needed for my led circuit. I wanted a yellow led. Those have a forward voltage of 2V, and a current rating of 0.002A. The pin has an output of 3.3v. Therefore the Resistance needed should be greater than or equal to (3.3v-2v)/(0.002A) = 650 Ohm. Mr. Dubick said A for effort, but a 330 Ohm resistor will be plenty. I thought we wanted to protect the circuit from too much current. To reduce current you increase resistance. However we don't want to dim the circuit.

I had done my calculations based on through hole leds, and it is likely the surface mounted ones have different values. I am going with experience, and the 330 Ohm resistor.

My pull down circuit uses a 10K resistor, because the tutorials said to.

I searched for components other than leds and resistors, but I didn't know what the items I wanted were called. I once again came across this website, sparkfun electronics. This page explains connector basics. I had been looking for connections, and I now know I want pin header connectors.

I took another look at the Adriano to see in what way he connected components. I thought that I should use the same pin layout for grouping pins so that I could easily add components later. I figured he had his board set up with those grouping for a reason, and then my board could connect with some of his other boards like the photoresistor.

I added the I2C pins in line with the UART pins so they could share a 5V and ground. I would have liked to get the I2C pins adjacent, but I couldn't. The 3.3v supply is between them.

I was able to change up my design in KiCad once I realized I could use ports that were connected! It saved a lot of room. I also rearranged so that the I2C have their own area with power and ground, and the UART pins also have their own space.

the IIC pins, they are called "I squared C" or "I2C"

Adrianino labeled

Use the Design Rules Checker on the top menu bar. It looks like a checklist. It will give you red flags for errors and yellow for warnings.

1

Once everything has passed the rules check, open the pcb editor page. In the menu bar at the top there is a button that looks like a pcb with an arrow going into it, or use F8+3 to update PCB from schematic. There is an option to remove labels that are not connected. Use this when you make changes so you don't have old components left on your board.

Here is the schematic I first imported into the PCB editor. I made a few changes as I found better parts, or flipped pins to fit my design better. schematic

Once in the PCB editor with your files imported, you can import a png of something you hope to guide you as you shape your pcb. I used a png file so that it would be transparent. Make sure the color of your image is not black, or whatever the background color of your screen is or the colors associated with the different layers. pcb editor with image

The above image shows how the components are dropped into the pcb editor. Good news, if you swap a pin in the schematic, and update the pcb editor, the pins will swap where you placed them. In other words, it doesn't reset to a pile each time you fix something!

I used the "route single track" button on the left menu bar to make connections between components. I also used the Bezier curve and arc tools to make rounded shapes. I found that you could use those tools to connect the components if you labeled the curves in their properties with the proper designation, like a pin, power, or ground. I still have errors on my pcb, so it is possible I am wrong. Claude.ai said you can not use curves in the routing, but that just doesn't make sense.

Once everything is connected, go to the cut layer, and trace a shape around your board. Check everything for errors. I found that I had to move the cut layer in order to see, and fix the pcb.

I was able to reduce the errors significantly, but my testing circuit is causing all sorts of trouble, because it is not hooked up to anything. I was able to get some of that circuit connected once I made all the pins connect to pin 8.

errors without cut

I had many more errors when I brought the cut back on top of my PCB. This is because many wires, or space around the footprints were too tight. Some were from the areas I created for decorative reasons that were net zero.

errors with cut

Use flow button on left from the appearance layer front copper FCU with the clearance of .2mm. This leaves the copper everywhere, but around the lines to save time. I could not get this to work correctly

Angela showed me that I needed to click on the box, and press B to fill the box

I guess I didn't read this tutorial Mr. Dubick gave us very well or I would have remembered to press "B". I recreated it in this file. copper fill tutorial

Also my Edge cut was filled, I needed to go into properties, and unclick the filled box.

Hundreds of errors disappeared when I unfilled my cut layer! most errors gone!

Idea pcb in 3d

Export the glb file.

Lessons Learned in KiCad:

  • Start with a new folder
  • use flags to keep your workspace neat, there are bidirectional flags!
  • power-flag is extremely important, it shows the current flowing through your MCU, you must put one on the power out and ground even though you labeled them with descriptive flags!
  • check all your flags and wires are connected
  • use footprint sizes 1206_SMD and 2.54_THT
  • the pcb editor doesn't like using curved lines for connections, but it is possible. In properties, assign the curve to the pin you are attaching it to.
  • keep the pinout diagram handy, because the numbers of the pins keep changing!
  • in PCB editor make clearances .2mm
  • use flow button on left from the appearance layer front copper FCU with the clearance of .2mm. This leaves the copper everywhere, but around the lines to save time. must press B to fill
  • pressing "option + 3" will pull up a 3d rendering of your pcb
  • Most importantly, I was not alone in my frustration, everyone, the students, the teachers, Reddit people, and AI all had problems with KiCad!

Useful Shortcuts in Schematic Editor:

  • A – Add a new component
  • W – Draw a wire (connect pins)
  • L – Add a label
  • R – Rotate selected item
  • 'Q' - puts X on pins not in use
  • 'P' - add power label
  • Ctrl + E – Edit component properties
  • Shift + Click – Highlight connected net
  • Alt + G – Group select multiple elements
  • F8 - update PCB from schematic
  • option 3 - 3d view of PCB

I spent from 9am to 8pm Monday trying to figure out KiCad, minus 2 hours running errands, having a zoom meeting, and driving to the school. I went to bed by 10, yay! Unfortunately, I tossed and turned all night with an idea for making circuit boards at home with conductive paints made from wire glue and charcoal or copper powder. Could I drill a hole in a small glass jar, insert a plasma lighter to burn wood into circuit designs for my table. Charcoal is pure carbon because it is made from wood burned without oxygen, Using regular ashes or burning the table in air wouldn't work. I could coat my designs in wire glue or acrylic paint or just leave it. I could even make the engraving angled so I could spill salt water into it to make some magic happen.

I was thinking that if a pcb board is just copper coating on an insulator then why not use copper tape, aluminum tape, or conductive paint on cardboard? I could use my cricket machine to cut out a foldable box. The design can be painted or cut like vinyl. There could be a cutout for a usbc, and through hole connectors leading to the outside of the box. The components would all be on the inside! The housing would be the circuit itself. Furthermore, could we use a living hinge on a circuit board? It could fold up or bend. The connections would follow the bridges in the kerf pattern. It would be very cool to have 3d circuit board.

I'm thinking of putting a "Screecher" in a box. Which would be the speaker that turns on when the photo resistor is exposed to light. It is a circuit from the book recommended above. It wouldn't need a microcomputer though.