23-24 Week of 10/16 – 10/20

Another week gone in October, bringing us one step closer to November. A lot of great stuff happening in the shop this week. To begin with, we will look at Sophomore Scott Campbell’s work on coding. He writes on his blog:

Getting GPIO on Adafruit Py QT Working

Getting the GPIO working on the Adafruit Py QT has been a challenge. This week I was finally able to do it using the Arduino IDE.

I learned I had been using the wrong documentation for the board. It uses a SEEED Xiao footprint, but it is not compatible with the software.

I was able to find the documentation made specifically for the Adafruit Py QT and it made the process much smoother.

Arduino

The Adafruit documentation has a guide for setting up both CircutPython and Arduino.

The long and short of the Arduino guide, is you need the Expressif ESP32-S2 board installed in the Arduino IDE. The SEEED Xiao board does not work for the Adafruit Py QT even though the product description says they are compatible.

Once I downloaded the board I tested making a GPIO pin output high for half a second, then output low for another half second. It worked and I have had sucess in minipulating all the pins.

Note on ESP32-S2 Bootloader

The bootloader for the Adafruit Py QT and ESP32-S2 chips in general are not write protected. You need to reinstall the bootloader using esptool after running Arduino code on the board.

Setting Up Communication on the Board

I have been researching different methods of storing and sending data from the microcontroller back to the surface station. Currently I am planning on using Websockets for communication and EEPROM for storage.

I chose Websockets over sockets for communication because of the libraries available and the microcontroller I am using. From my very light research I did, it seems the Websockets library is much more complete and user friendly than the sockets library.

I am using the Adafruit Py QT for the project has a 240MHz clock cycle, 2MB of PSRAM, and 4MB of flash which gives more than enough overhead for WebSockets over sockets.

EEProm allows you to store information in ROM (its a misnomer, you can write to it) on Arduinos without needing an entire file system. I am going to need to store the depth measurements in 5 second intervals, so a full filesystem is really not necessary.

Auditing the Websockets Library

I like to do some light auditing of any library that I am using. I want to make sure the code I am writing is not doomed from the start, and I see it as my way of contributing to the open source community.

I took a look at the code for the Websockets library and was very pleased to see that, unlike the radio library I used earlier, it properly sizes buffers and stops buffer overflows.

The code overall in the ArduinoWebsockets library, and by extension the TinyWebsockets library, is very well written, understandable, and as far as I can tell secure.

Antivirus Research

On my free time at home I have been testing how Windows Defender remembers malware on a given machine. I have found that once the malware is detected by Windows defender it only stores a hash of the file, and flipping one bit stops it from remembering that.

Flipping a bit in an executable seemed like it would be an issue to me at first, but windows gives a lovely buffer in each .exe file that lets people running it in DOS mode know that it will not work.

You can change the text in this buffer and it does not effect the execution of the program unless you were to actually run it in DOS mode.

Since it is such an obvious place to establish polymorphism, I assumed that it would flag antivirus to change that section of the binary. In my testing however it does not. I am surprised this is not used more often because writing code to edit that part of the binary is extraordinarily simple.

He includes some nice images about his work on his website, so I suggest you check it out to help better understand the text description. Click here.

Senior Shubh Patel has been working on the coding side of things as well on his project for a 2D plotter. He writes on his blog:

This week I worked adding the code that add the logo Gcode file to main current Gcode file, This small is necessary for my plotter because I have paper rolling mechanism which takes sensor input to roll new sheet of paper.

I also switch to new pdf to svg library because this one have more options like changing the size of pdf like A3,A4 and much more. It also have better performance in timewise.

See more about his projects on his website, click here.

This week the sophomore class continued on their coding work. Several have completed all the coding guides required to build the LED Light Box, and have started to work on building their own DIY Arduino board. So great to see how far these students have come in such a short period of time.