This is
Sungi's HTMAA Journal

Eleventh Week

November 22, 2023

This was
The 11th Project

Network

You get an SDCard, You get an SD Card, EVERYONE GETS AN SD CARD~!

Summary:

Today, we will be catching up with week 10 (missed due to illness) as well as continuing building into our final project - the egg learning device.

Tools

Software
  • VSCode (had errors pushing to PicoW)
  • Thonny
  • Fusion360 (EDA update)
  • PyCharm - for file transfer testing
Hardware
  • Pico W - with attachments - SD Card, LEDs, etc.
  • 1x jumper wire
  • greater than 128MB microSD card (we used 2GB)
  • Wires + Solder + Testing Board

Design - EDA Update


We will be building on our previous board model. However, the only difference is we will be pushing an additional stack for our SPI headers - this will serve as our SD card reader. Additionally, we pushed a few more connections to include our button headers, rotated our speaker, and increased our hole diameters (for mounting). We changed the landing pad (see EDA week) to a through hole. This was great until we poked out the backside of our wire. Note: this is extremely annoying to place if you go short, but if you go too long, they will poke out the backside:

Image of New Design

Changes shown in green

Image of new Board

Lessons Learned

Electrical tape fixes alot of problems... alot of them

Coding

In order to setup the code, we must first delcare our variables. In this case, we will be using a SDCard via SPI protocol

Note, we are using other than default SPI pins.
After about 4-5 hours of trouble shooting, we finally got our pin orientation right. Our SPI peripheral was set to 1...... The based on the diagram SPI device is SPI 0.....We changed the code to machine.SPI(1,........ to machine.SPI(0,...... We then were able to read and write to our SD Card. Our wiring diagram looked like this below:

We then ran a time counter on our SD card into a text file. This was very straightforward (A += function in our main while loop)

We realized that we needed JSON and CSV files. In order to get the table "formatted" so the CSV file opens in Excel/Spreadsheets, we use the character combination "\n" in order to denote the next line. Additionally, we will use the MOD function "%" in order to get the reaminder, this will allow us to seperate every 1000 lines using the logic that Number# % 1000 == 0. We then pulled our SD card and read the file straight from Excel - showing the below ouput:

Final Code

Note: we did not show the above codes where we defined some of the functions. This week the above functions are not relevant, just the libraries called earlier and initial declaration of variables