Tuesday, July 15, 2025

Brain transplant of a dumb pokemon clock

My son loves pokemon, and fell in love with this charmander alarm clock. To be honest, I find it expensive for what it does. Things to note :

  • It has a very nice looking nightligth in charmander body, 
  • The screen is an antique LCD,
  • You have to set the time,
  • It doesn't retain time when unpowered,
  • It works on 3xAAA batteries
  • You can plug a 5V adapter to prevent draining batteries

After some months, excessive use by my children has worn out the external power source connector, and as the nightligth doesn't turn off, even on batterie, this clock became a battery eater, and because it doesn't retain time, a pure nigthmare to set time at each battery change.

I tried to resolder the connector, but it didn't fix the issue that after each powerloss, you have to set time, and that my children don't care if nightlight is on and not connected to power source.  

Before surgery

One evening, as I was changing the batteries yet again, I thought to myself: ‘If only it could fetch the time from the internet…’ Then I paused — ‘Wait a minute, I’ve got a stash of ESP32s!

That’s where it all started. I might as well have titled this article ‘How I Overengineered a Pokémon Alarm Clock’. Here is the story

The screen

Has i said before, I've already opened the case to resolder the power source, and it turns out that the case is quite empty. There are 2 PCBs, one to deal with buttons, and the second for the "brain" (aka radio, screen, temperature, and light). Screen is connected to the PCB using kind of pogo-pins, there are no soldering, so, I guess that the brain is also the LCD driver. 

So, I measure the screen diameter : 32mm. I started browsing on aliexpress, and I could hardly believe my eyes : a 1.28" round LCD screen for less than 5€

I've ordered two screens and started working on the software.

The software

I've done multiple project using C++ with arduino and esp8266, and for christmas, a friend of mine gave me an ESP32-C6, simply because I wouldn’t stop talking to him about running Rust on RISC-V. Because I also wanted to learn it, I chose rust.

Then I had multiple choices : Rust std or no_stdLVGL or slint-ui ? On ESP32, std relies on esp-idf, and, if I understood correctly a few months ago, rust will act as a esp-idf configuration tool for esp-idf, and you have to rely on bindings with C code for a lot of esp features (wifi, mqtt, ...). The same applies for LVGL, it's only a binding to C code.

Because I wanted to learn rust, I chose rust no-std and slint-ui, although there was only a few examples (back in january 2025) on how to create a backend on microcontrollers and more specifically on ESP32.

In my work, I use scala with cats-effect, so, I used to asynchronous code, and, I heard that rust had this kind of features. While I was browsing internet to understand what tools I need to do the same, I encountered embassy. I felt right at home.

Because I was waiting my round screen, I started on a square ST7789 screen. 

It took me almost one week, working on evenings, and I successfully ran a demo



Then i quickly continue to work on code, and managed to insert my data inside slint UI and made slint render loop working asynchronous with embassy. In this phase, things worked but I found my software architecture fragile. I was still learning rust, which is a thing, especially the borrow checker and lifetime.

After reading a release changelog of slint, I saw that there was an example with mcu and embassy. I felt like a student who’d just been handed the answer sheet (Thanks you ninjasource !). I quickly refactored my code to conform to this example, and also added the simulator as in example. This helped me working faster, as I didn't need to upload my code, and also I could speed-up the time to check that transitions where working flawlessly.

At this time, things started to go faster, I had a lot of ideas and suggestions made by people I spoke with the project, but, first thing was to make a design. I started in many directions (genAI, algorithm to pixelate an image, because I wanted pixelart, ...) and finally, I wasn't satisfied by them: 

  • It looks like pixel art, but when scaled down, its not.
  • It's very difficult to make it consistent between prompts (I wanted to have multiple version of the landscape, to deal with different weathers) 

Finnaly, I found an artist on twitter Woostarpixels, and ask him if I can use one of his drawing in my project, sent him some of my demos, etc. He allowed me to share my project, so, many thanks to him, and don't hesitate to check out his work !

I loaded artwork in gimp and layered it, made a night version, ...) Here is the result: 




I then start working on the sky and transitions between day and night. Thanks to the simulator, it's easy to check result.


 

My wife has a fascination for the moon, then, I added a library to handle moon phases and generate an image of it.



And last, I added a small countdown timer with a button click on the original case.


At this point, I chose to declare the software finished, since my ESP32-C6 is at 99.6% of the 4MB flash memory, and RAM is to small to generate things in memory (with 512KB, an image of 240x240 with alpha layer is 45% of the memory).

The case and assembly

After receiving my screen, I started working on a small adapter to mount screen inside the original case. 


 



 I made a great spaghetti of dupont wire, and finally managed to mount everything in the case



It is reflashable !




Conclusion

This project was one of the biggest thing I build, and it learned me a lot. 3D print, designing UI, rust, ... And it lacks a lot of thing I would have liked, but time is limited. But I see a bright future for slint-ui, as it is very efficient and smooth.

This project also gave me a newfound admiration for the video game developers of the 80s and 90s. After pushing my hardware to its limits and ending up with results that didn’t come close to what real video games achieved back then, I realized just how impressive their work was 

All the code is available on my Github

Monday, May 27, 2013

DIY Pipolino with Sugru

My cats are overweight. When I give them dry food, they eat everything in 5 minutes. A well-known cat owner problem. Pipolino might be the solution, but it cost about 25€ ! Because it is dead simple, I decided to make my own with some sugru and a tennis ball box found in garbage. It is handy because it have a lid, and it is made of plastic.

I made a first version without sugru (Yes, a box with hole :)), but it was too noisy and my downstairs neighbour complained about it. With the sugru, that was better, and because of the small gap between the box and the floor, it works well !

Let's make a little slug...
Make it longer, about the size of the box circumference
Start rolling the rod arround the box
And here it is !

Now, you just have to drill a hole in the box ! And you have a pipolino ! With the sugru, it's less noisy, but it is still too noisy for my neighbours... :( I use it on the balcony !

Pipolino DIY avec de la Sugru

Mes chats sont un peu en surpoids. Quand on leur donne à manger, la gamelle se vide en 5 minutes, ils se jettent littéralement dessus ! Un problème bien connu des propriétaires de chats d'appartement. Pipolino est sensé être une solution à ce problème, mais à 25€ le tuyau de plastique, non merci ! J'ai donc décidé d'en fabriquer un moi-même, en utilisant une boite de balles de tennis trouvée dans la poubelle de l'immeuble et un peu sugru. La boite a l'énorme avantage d'être munie d'un couvercle et en plastique.

J'ai fait une première version en utilisant uniquement la boite de balles de tennis, mais malheureusement, celle-ci était bruyante. A tel point que la voisine du dessous est venue s'en plaindre. J'ai donc utilisé de la sugru pour "amortir" les chocs. Et l'avantage associé est qu'il y a désormais un petit écart qui permet aux croquettes de mieux tomber.

On commence par faire une petite limace...
On l'agrandit jusqu'à la circonférence de la boite
Puis on roule la boite autour du boudin de sugru
Et voila !

Il ne reste plus qu'à percer un trou de la taille des croquettes avec, par exemple, un briquet. Malheureusement, malgré ce système, le pipolino est toujours trop bruyant, la voisine est revenue se plaindre... Je l'utilise désormais sur le balcon !

Peut-être qu'en tapissant l'intérieur de la boite avec un caoutchouc, je réussirai à réduire le bruit... Suite au prochain épisode !

Saturday, May 18, 2013

DIY Cat feeder v2.0

Bingo, I just finished my cat feeder v2.0 ! No more cereal dispenser, I built everything myself ! I had the choice between different systems, but i chose an archimedes' screw. I had several prerequisites:

  • An accuracy of 5grs
  • Dispense food in two bowls
  • Easily get feedback

So I chose the Archimedes' screw, but I still had to supply it with dry food. So I get my saw and medium to build the box. I had set a size constraint : do not exceed the formwork of the radiator in the kitchen, or 11cm. In addition, I wanted to hang it on the wall and paint it in the color of the kitchen, in order to make it less visible.

The box is 11cm x 30cm x 32cm, and is made mostly from 8mm and 12mm medium. (It is almost my stock of wood scrap that determined the thickness).

The system is simple : It's a funnel for the dry food fall into the Archimedes' screw. I had some trouble with biscuits blocked in the hole (causing empty distribution). I solved the problem with some dremel sanding to cut the holes. I then have no worry with it.

When the biscuits reach the bottom of the tank, the Archimedes' screw, which is inside a 4cm diameter PVC pipe, moves the dry food to the two holes.

On this intermediate release, you can see the various components i used : an Arduino, a proto-shield, a DS1307 based RTC board, and a relay board with the IKEA screwdriver motor (FIXA 3.6V).
To attach the motor to the wood, i used polymorph. The binding is very strong and stable, I did not notice any vibration at startup. Pretty awesome.

I also improved the interface by adding a LCD screen, and a serial interface to allow modification of parameters (RTC time, number of distributions per day, reset the last fooding date) and dispense a dose, by sending command throught serial link : h to print help, + to increase the daily distributions...

And finally, here is the LCD display when a distribution occurs. It's a HD77480 LCD screen I bought on ebay for 5€. I used the classical 4-bits interface and the LiquidCrystal library available with the Arduino IDE. I create some custom characters to draw a small clock on the second line.
The first line print the current time and the number of distribution per day, the second the remaining time before the distribution.

Here is a test-run of 24 distributions :

All the code is available on my github

Distributeur de croquettes, v2.0

Ca y est, j'ai fini mon distributeur v2.0 ! Cette fois-ci, pas de distributeur de céréales, pas de bricolo-bricolette, j'ai tout construit moi-même. Plusieurs systèmes se sont présentés à moi, mais j'ai choisi la vis d'archimède. J'avais plusieurs pré-requis :

  • Être précis à 5grs près
  • Distribuer dans deux gamelles
  • Avoir facilement un feedback

J'ai donc choisi la vis d'archimède, mais encore fallait-il l'alimenter en croquettes. J'ai donc sorti ma scie et mon MDF pour construire la "boite". J'avais une contrainte de taille fixée : ne pas dépasser du coffrage du radiateur de la cuisine, soit 11cm. De plus, je voulais pouvoir l'accrocher au mur, et, le peindre dans la couleur de la cuisine, afin de le rendre peu visible.

La boite fait donc 11cm x 30cm x 32cm, et est faite en majorité de MDF de 8mm et 12mm d'épaisseur (C'est surtout les chutes qui me restaient qui ont déterminé l'épaisseur).

Le système est simple : il s'agit d'un entonnoir pour que les croquettes tombent au niveau de la vis d'archimède. J'ai eu quelques problèmes de blocage de croquettes au niveau du trou (provoquant une distribution à vide), mais j'ai résolu en passant à la dremel le trou afin d'arrondir les angles. Depuis, je n'ai plus eu de souci.

Une fois que les croquettes atteignent le bas de la réserve, la vis d'archimède qui est à l'intérieur du tube de PVC (4cm de diamètre) permet de déplacer les croquettes vers les deux trous.

Sur cette version intermédiaire, on peut voir les différents composants utilisés : Arduino, un proto-shield, la carte à base de DS1307, une carte à relais ainsi que le moteur de FIXA 3.6V.
Pour fixer le moteur sur le bois, j'ai utilisé du polymorph. La fixation est très stable, je ne remarque aucune vibration au démarrage - le rêve -.

J'ai aussi amélioré l'interface en ajoutant un écran LCD, ainsi qu'une liaison série permettant de modifier certains paramètres (heure du RTC, nombre de distributions par jour, réinitialiser la dernière distribution, et distribuer une dose), en envoyant sur la liaison série différentes commandes : h pour afficher l'aide, + pour augmenter les distributions quotidiennes...

Et enfin, voici l'affichage au moment où une distribution a lieu. Il s'agit d'un écran HD77480 que j'ai eu pour quelques euros sur ebay. J'ai utilisé l’interfaçage classique sur 4 bits ainsi que la librairie LiquidCrystal disponible en standard sur Arduino. J'ai pu construire des caractères personnalisés pour dessiner une petite pendule sur la deuxième ligne.

Un essai de 24 distributions pour calibrer le total :

Vous pouvez trouver le code sur mon github

Friday, April 19, 2013

The Awesomeness of Plastic

For many years, I'am looking for THE ultimate tool to build something. I looked at CNC-router (but they are expensive, cumbersome, and they make a lot of dust), 3D printers (very expensive, cumbersome and weak material), and conventional wood working tools. All of these tools don't satisfy me : I live in a parisian flat, and I miss time to learn wood-working.

One day, I ran accross Sugru. I hoped that the search for my Grail was over. I bought a 8-pack and started to hacked my things. I used it on my keys to make them nicer to handle. I repaired many things. I protected my Mac chargers. But nothing big, because i'd need more than 5g of Sugru !

My needs

I'm currently working on the 2nd version of my Cat-feeder (in french). This first version's portion is quite inaccurate. The distribution unit is the volume contained in one of the distribution wheel separation. And because I have no position feedback on the wheel, I turn the wheel for 200ms, which is almost a 1/6 turn. But i would like to be more accurate with 5g portions.

We see the axially spaced compartments. 1 compartment is the unit.

I studied some possibilities :

  • Increase the axis size to reduce the compartment volume. I could use Sugru for that.
  • Use a servo to create horizontal movement and push a 5g portion.
  • And my favorite : Use a double archimede screw with inverted screw thread to push biscuit to two ends (One end by cat)

Problem

Have you ever search on ebay a 4cm archimed screw, with 4cm thread ? They exist but in an industrial flavor : only 1500$ the 3m stainless steel screw ! But the plastic version of 20cm for DIYers, you're wasting your time. I looked for epoxy resin, but that causes an allergic reaction on skin. Because I am aware of my cat health, I prefer not poison them. And one day i was deperate, I search in google : "DIY plastic". On the first page, I found DIY Material Guide : A Polymorph Plastic. You can almost make everything. Here is a guide to help you starting modeling polymorph. With a little training, it's easy to obtain simple forms. And you can try a lot, because you only need to heat it, and retry.

I found mine on ebay (BLRTronic), less than 15€ for 500g. To give you an idea of the price, my archimede screw weight about 20 grams... I will use it for axis, motor fixation, and electronic case .

I'm a big fan of polymorph, i think i found the grail, and my archimede screw is almost done !

PS : The axis of my polymorph screw is an Aluminum rod.

Saturday, February 23, 2013

Le plastique, c'est fantastique !

Depuis plusieurs années, je suis à la recherche de l'outil ultime pour construire quelque chose. J'ai cherché du coté des CNC (Cher, encombrant, et usage incompatible avec la vie en appartement du fait de la poussière !), des imprimantes 3D (Beaucoup trop cher, encombrant, et matériau trop fragile), des outils en tout genre pour le bois. Cette liste à la Prévert ne me convient pas : j'habite un appartement parisien et je n'ai pas le temps de faire un CAP/BP menuiserie/ébenisterie.

Un jour, je suis tombé sur Sugru. J'y ai mis beaucoup d'espoir : peut-être était-ce mon graal ? J'en ai donc acheté, j'ai utilisé les 8 packs de 5 grammes. J'ai rendu mes clefs plus agréables à prendre en main. J'ai réparé quelques petits objets. J'ai fait la protection pour les chargeurs Mac. Réparé un éclat du plan de travail de la cuisine. Mais rien d'énorme, et pour cause : 5g de Sugru, c'est tout petit.

Le besoin

Je travaille depuis quelques mois sur la version 2 de mon distributeur de croquettes pour chats. En effet, la version actuelle n'est pas très précise sur la quantité distribuée. L'unité de distribution est le volume contenu dans une des séparation de la roue à "aubes". Et comme je n'ai pas intégré de feedback sur la position de la roue, la distribution est faite globalement pour un temps donné : 200ms, ce qui correspond à peu près à 1/6 de tour. Mais j'aimerais pouvoir distribuer à 5g près.

On voit bien ici la portion minimale

J'ai donc étudié diverses possibilités :

  • Augmenter la taille de l'axe pour réduire le volume d'une séparation. J'imaginais utiliser de la Sugru pour ça.
  • Utiliser un servo pour pousser une portion de croquette.
  • Et ma préférée : utiliser une vis d'archimède double avec un filetage dans chaque sens pour déplacer les croquettes vers 2 sorties (une par chat)

Le problème

Avez-vous déjà cherché sur ebay une vis d'archimède d'environ 4cm de diamètre, et de pas 4cm ? Elles existent, mais en version industrielle : comptez 1500$ les 3m en acier. Mais en version plastique aux dimensions de mon distributeur (environ 20cm de longueur), c'est peine perdue. J'ai cherché du coté des résines époxy, mais leur contact avec la peau peut provoquer des réactions allergiques, étant attentif à la santé des chats, je préfère ne pas les intoxiquer. Et puis un jour, désespéré, je tape dans google : "plastic diy". Sur la première page, je trouve : DIY Material Guide : A Polymorph Plastic. Les utilisations sont infinies, je vous laisse constater. On trouve des guides un peu partout. Cela demande un peu d'entrainement, mais le fait de pouvoir refondre et recommencer laisse le temps de bien apprivoiser la chose !

J'ai trouvé le mien sur ebay chez BLRTronic, pour un peu moins de 15€ les 500g. Pour vous donner une idée, ma vis d'archimède pèse environ 40g... Je vais m'en servir pour faire les roulements d'axe, les fixations moteur et le boitier de l'électronique.

Bref : je suis fan, j'ai enfin trouvé le Graal, et j'ai presque fini ma vis d'archimède !

PS : j'ai fixé le polymorph sur une tige en alu de section carrée 7,5mm.