Quinetin

gitlab link

In week 1, Neil showed us the the novelty of a quine! Over the subsequent few weeks Quentin and I spent our free time noodling on the topic, and we identified a path to success, but first, what is a quine?

A quine, named for Willard Van Orman Quine is a piece of code that replicates itself in its entirety. Initially we saw many parallels to conventions in biology, namely the method by which bacteriophages use a cells molecular machinery to replicate copies of itself, and horizontal gene transfer via bacterial conjugation.

Fairly quickly, we realized that the MicroPython interpreter on a microcontroller, could easily assimilate new code sent via a serial port, by contrast a typical microcontroller requires compilation prior to flashing.

As a platform to validate our quine, we elected to build a simple board that has an internal power source, a XIAO RP2040, and a speaker. The RP2040 was chosen as it has an REPL accessible serial port split out on both the USB interface and the UART interface. The RP2040 via a 3.3V power supply typically consumes about 30mA, although this can be reduced by turning off non-essential components, this presents a challenge.

For the first board we attempted to power the XIAO RP2040 from a CR2032, but this had significant limitations due to high voltage sag. CR2032, although it has up to 240mAh of battery life, can only provide up to about 6mA of current before experiencing significant voltage sag.

V1.0 Hexcell

V1.0 Hexcell
We used a MCP16251 boost regulator which performed very well, and was able to discharge the battery to its 0.82V cut-off threshold. Due to voltage sag this would take place on the order of minutes. After letting the device sit, the battery would cool down recuperate to a reasonable voltage level. This behavior was undesirable, so we redesigned the board around a LiPo battery.

V1.1 Hexcell
V1.1 Hexcell
V1.1 Hexcell

After a late night of assembly, we were succesful! Quentin wrote a short quine and loaded it onto a microcontroller.
V1.1 Hexcell
V1.1 Hexcell + Programmer Board

All 3 boards were able to flash each other without any extra intervention nor loss of original functionality! We even played a small fugue! V1.1 Hexcell + V1.1 Hexcell + V1.1 Hexcell
V1.1 Hexcell + V1.1 Hexcell + V1.1 Hexcell