-
Goodbye
09/11/2023 at 16:05 • 0 commentsI decided to stop pretending I will ever finish this project, and put it out of its misery.
I still believe it's generally possible to get the exact hardware I used to display animated GIF that you can easily upload to an USB drive. However, it would require a bit of work to write the firmware that does it, and I find that I no longer am interested in doing that work.
While I was procrastinating, CircuitPython grew a gifio library, that displays animated GIFs straight from the filesystem. It's as simple to use as:
import board import gifio import displayio import time import struct display = board.DISPLAY odg = gifio.OnDiskGif('sample.gif') start = time.monotonic() next_delay = odg.next_frame() # Load the first frame end = time.monotonic() overhead = end - start display.auto_refresh = False display_bus = display.bus while True: time.sleep(max(0, next_delay - overhead)) next_delay = odg.next_frame() display_bus.send(42, struct.pack(">hh", 0, odg.bitmap.width - 1)) display_bus.send(43, struct.pack(">hh", 0, odg.bitmap.height - 1)) display_bus.send(44, odg.bitmap)
That's it. It works. But of course not on the SAMD21, which has way too little flash and memory to fit it all. I have built a custom version of CircuitPython that has almost everything disabled to fit gifio, and it kinda works, except of course:
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable. code.py output: Traceback (most recent call last): File "code.py", line 9, in MemoryError: memory allocation failed, allocating 24024 bytes Code done running. Press any key to enter the REPL. Use CTRL-D to reload.
I'm sure I could tweak the gifio library to make it use smaller buffers and make it fit in that RAM. But I don't want to.
I also don't want to write the whole thing in C, using tinyUSB and a gif library. It just feels too much like work, and very little like fun exploration.
Note that I will probably get back to the idea of a pendant with a display showing animated GIFs. Especially since it's now literally just a few lines of code in CircuitPython. But I will probably use a different displays and definitely a more powerful microcontroller. And I will possibly just use a ready development board, such as the Seeedstudio Xiao, because there is very little I would gain doing a bare chip thing from scratch at this point (and because I got spoiled by SAMD21's minimal component count, and any other microcontroller feels like too much work now).
-
Where Are We?
11/01/2022 at 22:11 • 0 commentsHardware-wise, I think I'm reasonably happy with what I have – at least it's more than sufficient as a prototype for testing. What I need now is the software. I have tested the device with CircuitPython – I have even written a GIF decoding library in pure Python specially for this – and I'm confident this can work, but not with CircuitPython. So the next step is to get the the firmware for this working.
I can use the TinyUSB library to expose the filesystem over USB – it's the same library that CircuitPython is using, in fact. And I can use a super-optimized GIF library written by @Larry Bank. That should get me the minimal functionality. I can then also experiment with sleep modes and touch and all that stuff.
The problem I am facing right now is setting up an environment for development for the SAMD21. I will probably start with Arduino, because that is already mostly ready out of the box, but there is still some work with that, that I currently just can't get myself started on. So until I get that going, the project is on hold.
-
Ressurected
08/12/2020 at 20:21 • 0 commentsI'm bringing this project back from the dead, now that I have learned a bit and got new ideas for it. I already wrote about a solution for the battery problem — have the battery on the other side of the wires, on your neck. I'm going to go with that, but since the #Electronic Barrette Hub is not ready yet, I will use a regular battery holder.
The other innovation is using a thin PCB, and a PCB USB socket — that lets me make it really thin.
I slapped together a PCB design with those ideas incorporated, and it arrived today, so I assembled it:
It's flashed an ready to be programmed. Next step is to compile a version of CircuitPython prepared for it.
The last innovation I have is software: I no longer need to use BMP files, as I wrote a Python library for reading GIF files. It's probably not fast enough, but there is one more possibility — perhaps I could include a C library that was recently created for SAMD21 for playing animated GIFs as a CircuitPython C module — then they should play at native speed.
-
Barrette as the Base Station
08/26/2018 at 10:50 • 0 commentsConsidering the latest redesign idea, I'm not aiming at a very small pendant with just the microcontroller, connected to the #Electronic Barrette Hub for power. The hub will also be used for programming the display over the USB, this way I can use a very small and nice-looking connector on it, which won't interfere with the eventual resin casting.
That means that the PCB design will be greatly simplified, but I have to wait for it until the design of connectors for the barrette is finalized.
-
Redesign
08/02/2018 at 16:59 • 1 commentI have been showing off the prototype of this pendant in different places, and during the poster session on EuroPython a person who I can't now remember (sorry) suggested a really great solution to the problems of small battery and large thickness of the device. It looks something like this:
(The wire length is not to scale.)
Basically, they proposed to put the battery, together with the charging electronics and power switch on a separate device, that would be located on the neck or back, and that could be pretty much any reasonable size. The power would be transmitted to the device through a pair of soft wires that replace the string on which the pendant hangs. The pendant itself then only needs the actual screen, the microcontroller and the USB port for data transfer — all relatively small elements, with the USB socket being the largest. This lets me make it really thin, and since there are no mechanical parts, it can be embedded in resin easily (USB port can be problematic, but I have some ideas).
There are still some problems to be solved. How to prevent the heavy battery from sliding down the back of the wearer and pulling the pendant up? Maybe some kind of a clip for the collar? How prevent electronics from irritating the sensitive skin on the back of the neck? We will see how all that works.
That means that I won't be assembling the PCB that just arrived from OSHPark. And good, because due to my laziness it misses the cutout for the sunken USB socket:
But that also means that now I need to design two new PCBs. No rest for the wicked.
-
Touchy Power Switch
07/14/2018 at 12:31 • 0 commentsOne more version of the pendant, this time with the mechanical power switch replaced with an AT42QT1012 chip. This thing is tiny — about 2mm on a side — and I had to make a custom footprint for it. Of course Fritzing decided to not cooperate and rolled out all of its SVG parsing bugs. I got it to a state where it should probably work, but it's not pretty.
I actually ordered this version, we will see in a few weeks how it works.
-
Sunken Components
07/04/2018 at 21:11 • 0 commentsI have the promised design of the pendant using a QFN package of the SAMD21. I'm also experimenting with reducing the thickness of the whole device, by making holes for the battery, USB socket and power switch, and mounting them inside those holes. I'm curious how this will work.
In the mean time, I dropped the touch pads, so no touch sensing in this version. But it's probably not going to be final, I still have to experiment with getting rid of the mechanical switch and using something else in its place, so that I could drown the whole thing in resin. I wonder if I could keep the USB socket, but fill it with something like wax before casting.
-
Ready for More Prototypes
06/14/2018 at 09:11 • 0 commentsMore displays just arrived:
I now have three goals:
- write a GIF decoder in C and include it in the firmware, so that animated GIFs can be displayed,
- redesign the PCB with a QFN package of the chip, and try to make it all thinner,
- figure a way to get rid of the physical switch, so the whole thing can be cast in resin or something similar.
For the second point, I'm considering making a hole for the battery in the PCB, and moving the microusb port and the charger electronics to a charging station.
For the third point, I guess I would need to add a mosfet on the backlight, figure out the sleep modes of the MCU, and make it wake up on touch or add an accelerometer for waking up (and also for some interactive animations).
However, for now the first point has priority.
-
First Picture
06/13/2018 at 19:46 • 0 commentsI finally sat down, compiled the firmware, adapted the ST7735 driver to the new dimensions, and quickly hacked some code for displaying a 16-color BMP (because I already had similar code for the #µGame). The result:
The colors are a bit funny because it's dark in here and the display doesn't have good viewing angles either. But I think it's pretty nice.
-
This Never Gets Old
06/13/2018 at 09:06 • 1 commentThe batteries arrived, and a quick test revealed why it didn't work with the CR battery: of course I swapped the terminals of the battery holder. Fortunately the voltage regulator I'm using has reverse voltage protection, so nothing burned. A quick desolder, removal of the plastic numbs that key the holder in the right position, and re-solder in opposite position fixed it.
Though I still need to compile the firmware for it.
I fixed the PCB, but I still want to rework it to use a QFN version of the chip — that should free some space on it too.