6 - Electronics Design

Summary
This week we learned how to test circuit board as well as design one from scratch.
Approach / idea / acknowledgements
Electronics are a largely new topic for me, therefore I decided to focus on that part this week, and not the creativity. The idea is to keep the functionality of the board simple and really focus on the schematics and printed circuit board (PCB) design. To stay close to my final project I decide to work with public transport data, as it has similarities to satellite data and my final project.
Assignment
- Group assignment:
- Use the test equipment in your lab to observe the operation of an embedded microcontroller
- Individual assignment:
- Use an EDA tool to design an embedded microcontroller system using parts from the inventory, and check its design rules for fabrication
- extra credit: simulate a circuit
- extra credit: try another design workflow
- extra credit: design a case
Group assignment
Our local lesson about electronics was taught by former Waag Fab Academy student, now instructor, Erwin Kooi this week. He talked us through the basic concepts of electronics, a bunch of components, different tools for measuring and designing with KiCad. Afterwards he gave us an assignments which would satisfy our group assignment for this week: use different tools to find out what a mystery Arduino does.

Multimeter
Erwin and Henk show us a demo of two different multimeters, one automatic, one manual. of a specific point in a circuit relative to a reference (usually ground) at that exact moment in time. Where the manual one instantly shows a reading, the automatic one takes some time to figure out what it's doing and show a measurement; good to be aware of this if you expect a signal to fluctuate. For our group assignments we would like to see if and how the voltage changes over time so we won't be using a multimeter.
Oscilloscope
First up we use the oscilloscope to check what the voltage is on each pin of the Arduino. Oscilloscopes show you how the voltage at a specific point in a circuit changes over time, revealing the full waveform instead of just a single momentary value. To get the waveform displayed in a way that you can read you need to set the scale of the x and y axis. This can be done either by the autoset button or by turning two knobs on the machine until you're satisfied. The reading of the pins goes smoothly until we notice our previous measurements no longer seem accurate, on some of the pins the behavior has changed while on others it didn't. We scratched our heads and looked to Erwin for help. Erwin explains the Arduino probably crashed, but PWM is still running, since that is a hardware not software operation. After restarting the Arduino we manage to get all the measurements and move on to the logic analyzer to see if we get the same result.

Logic Analyzer
Henk shows us how to use the logic analyzer on his brand new laptop with really cool screensaver. A logic analyzer shows you the digital states (high or low) of multiple signals over time through a piece of software run on your device. We could use this to observe multiple pins at once and confirm the behavior we saw with the oscilloscope. One fun detail was that we had determined the period of a cycle was around 650ms, with the logical analyzer we could see Erwin had actually coded this one to have a period of 666, so devilish.

After doing our group assignment Henk asked if anyone had the QPAD-Xiao from week 4 with us, which I did. Henk hooked up the SDA and SCL pins to the logic analyzer and this was the first time I could actually see the physics of my own code, I thought that was pretty cool.
Individual assignment
To get inspiration for my own PCB design I decide to turn my house upside down and look for my more than 10 years old Arduino kit. After I find it I run the blink test to see if everything still works, and it works fine. It's pretty cool to notice how there has been so much digital innovation done in the past decade, but the basic components are still the same. I try out some more circuits and make sure I understand the components in them.

I also find an old Smart Citizen Kit, developed by Fab Lab Barcelona which we used at my job 10 years ago. This was the first time I learned about Fab Labs and doing Fab Academy now it feels like a long time coming. While browsing the components in my kit the little Piezo buzzer reminds me of a game invented by my friends where they try to get the bus in front of my house to honk. I take my inspiration from this and come up with a little board that tells me how far away the bus is through a RGB LED and a buzzer.

The idea is pretty similar to my final project idea, make some output devices display information about a passing object based on the current time. For my final project it's satellites, for today it's busses. Both run on a pretty predictable schedule and have real time data available. Both have the same challenge: hard coding a schedule seems pretty doable, but how does my microcontroller know what time it is?
MVP
Since we're doing spiral development I decide the minimal viable version of my PCB can have hard-coded starting time. It will be in the hands of the user to turn it on at the right moment. That means we can start counting time on boot and compare that to a fixed schedule. This would be the most bare version with in theory the cheapest hardware. To challenge myself I also decide to use USB for power only and pick a microcontroller that requires a Unified Program and Debug Interface (UPDI) to be programmed, unlike the Xiao we used in week 4. The microcontroller I settle on after looking through some options suggested by ChatGPT based on my specifications is the ATtiny1614.
To start drawing the schematics for this board I use KiCad which we installed during the student bootcamp. I also instal the Fab Lab component library and get to work.

After I have place my elements and it looks acceptable to me I run the 'Electrical Rules Checker' it gives me two errors.

I ask ChatGPT how to solve this issue and it suggest adding a 'PWR_FLAG' to both 'VCC' and 'GND'. It works, but I don't fully understand why. I look for a source online and find the following explanation in the KiCad documentation.
In this case, KiCad reports "Input Power pin not driven by any Output Power pins" for both the VCC and GND nets. This is a common KiCad ERC error. Power symbols are set up to require a power output pin, such as the output of a voltage regulator, on the same net; otherwise KiCad thinks the net is undriven. To a human, it is obvious that VCC and GND are driven by the battery, but it’s necessary to explicitly show that in the schematic.
Real time clock
Next up I decide to look for a simple way to keep tell time on a microcontroller, without adding networking options like Bluetooth or WiFi. While browsing through components I come across a Real Time Clock (RTC) which requires a small battery to keep time while the board is not connected to power. I decide to give this a try, to make it a bit easier on myself I also look for a microcontroller that support USB and settle on the Xiao-SAMD21. This time I also decide to use labels instead of drawing the wires in the circuit, as well as split up the schematics into different type of components, like inputs and outputs.

Connected
Finally the most extensive and easy way to keep track of time is to use Bluetooth or WiFi. This also has the benefit of being able to work with real time data, instead of a hard-coded schedule allowing seasonal changes or delays. For this I pick the Xiao-ESP32S3 and update my schematics.

Last two designs I only drew up the schematics, this time I also draw up a PCB design. Henk also suggested I use stacking headers so I can reuse the Xiao in later projects in stead of soldering it on my board directly. In the lab we don't have the 7 pin headers needed for the Xiao so I combine a 2 and 5 pin one, I add place them on the same footprint as the Xiao and delete the Xiao footprint after.

I run the 'Design Rules Checker' which give me a warning about the cordyards of the pinheaders overlapping, but these can't be space further and still line up with the Xiao footprint. There's also a warning about silkscreen overlap, that I believe, but don't think is relevant for this week, so I decide to ignore the warnings for now.

Not all the components I used have a 3D model in the library, but it's still fun to see the 3D render. When exporting to use in 3D modeling software it's good to be aware of this.

Simulate a circuit
To simulate my circuit I've used both my Arduino kit and the online ESP32 simulator Wokwi.

Files & resources
Leftovers previous week
- leftovers week 5
- week 5 one question for henk (search for TODO in documentation)
- week 5 take better pictures
- fix encoding on all videos pre week 5 (aaaaaah)
- check which weeks can be marked as done
Further exploration
- out of scope nice to have