This week's assignment was difficult mainly due to logistics. I left Cambridge to go to Harvard-Yale on Friday and then had a flight back to San Francisco on Sunday. That didn't leave a ton of time to work on the machine in the lab.
The machine that the Harvard section decided to build was sort of like a pen plotter except that one of the axis moved radially. With 2 degrees of control (one rotational and one linear) it should be possible to draw any arbitrary image of x
, y
coordinates.
I opted to write some software for it which I could work on over break.
My goal was to convert a bitmap image into a radial sketch. I decided to use p5.js, a port of Processing for Javascript.
https://stackoverflow.com/questions/44695766/a-photo-to-vector-scribbled-line-algorithm
I also spent a lot of my break working on my final project.
After a few failed attempts at interfacing with the microSD card, I realized that I had made a mistake when designing the board.
Unlike the Niel's examples, I am not using SPI to interface with the SD card. Because I am trying to write raw audio, write operations need to be as fast as possible. Instead, I am using SMMC to write 4 bits at a time. This should give me a much faster write speed.
I started working on this during the week on networking and thought I had to figure out the schematic. I added resisters between the GPIO pins on the ESP32 and the microSD card adaptor. These should have been pull-up resisters — connecting the signal line to VCC.
I felt pretty silly when I realized that I didn't know what pull-up resisters were. Now I do!
But this meant I had to rewire the board significantly. Luckily, I was able to route the more complicated traces without increasing the overall size of the board!
I remilled the board as soon as I got back to Boston. I am getting pretty good at DIY reflow soldering!
In order to put the ESP32 into UART download mode, both GPIO0 and GPIO2 have to be pulled low. Unfortunately, GPIO2 is also used by the SDMMC driver and needs to be pull high with a pull-up resister.
Note that GPIO12 also technically conflicts, however an internal pull-up is enough to get the SD card working, so no need to do anything special.
To put the ESP32 into download mode, I created a jumper between GPIO0 and GPIO2.
I tried to connect and it didn't work. After a while, I realized that I was pulling down the wrong bootstrapping pin — GPIO1 rather GPIO2. Switched this around and was able to flash code to the device.
I used the the example SDMMC code from Espressif to check if my board was working.
It was not.
After a lot of debugging, I pulled out the multimeter and found that there was a short between one of the pins used by the microSD card and ground. I fixed that and everything worked.
It was 2:21AM and I was very excited.