I have two beautiful black kitties, to ease my life I have a litter robot, very clever design, but one of the poop drawer sensor tend to fail a lot.
The version I have, (the grey one) sorry if I don’t know more, has the poop drawer sensor divided in two, the ir emitter side and the ir receiver, in my machine the emitter part had a lot of failures, the first one the microcontroller rusted and started to fail, after some cleanup with alcohol and a brush it came back to life, I placed a blob of ultraviolet resin on top to extend the life before next issue.
The next issue was the IR leds (it has 4) started dying one by one, for that I jump the ones still alive with the signal of the dead ones. but the last issue was the microcontroller totally died. so I had to replace it, however I was not able to find any place that sold my version of the sensor so I reverse engineer it.
Turns out this sensor is simple with out of the mill parts, it is basically a MCP23008 with 4 leds and a switch (the mechanical sensor to see if the cat is stuck in the machine). So after some analysis with an osciloscope and some assumptions I was able to hand craft a working version.
For illustration purposes here is my original sensor (with all the war wounds after all those years)
It is an AUTOMATED PET CARE PRODUCTS, INC. LR3-2003-0c EMITTER (REV 4 11/8/19) or so it says.
This part of the system is set on address 20, the IR receiver is similar but works on address 24.
This board seems to be equivalent to this circuit.
on the original image, the 5v scl sda and ground are on the right and the switch on the left as shown in this other picture.
A brief explanation of how it works, the brain controller seems to send and read the following signals
set pin 7 on address 0x20 as read (reads the cat stuck in machine switch) reset all pins to 0 on address x 20 as write. set pin 0 on address x 20 as write set all pins as read on address x 24
reset all pins to 0 on address x 20 as write. set pin 2 on address x 20 as write set all pins as read on address x 24
reset all pins to 0 on address x 20 as write. set pin 4 on address x 20 as write set all pins as read on address x 24
reset all pins to 0 on address x 20 as write. set pin 6 on address x 20 as write set all pins as read on address x 24
on working order that is how the device do a full check cycle.
If you happen to have an issue and you suspect is the sensor is worth to hook an oscilloscope to it, if you see address 20 is not responding the emitter part is failing, if you see address 24 not responding the receiver part is failing.
in my case it was address 20 the one not responding, you can see in this screenshot of my osciloscope (set to interpret i2c on clk ch1 and data ch3.
and just for fun here is a picture of my finish motherboard mounted in the machine as a frankenstein replacement.
What is the price for that monstruocity?
if you buy the parts in amazon, a lot, but if you go to adafruit.com you can get all of them for like 10 dollars. :).
As I mentioned early, all parts are out of the mill parts, and the ic is generic, you don’t need to program anything. just solder the circuit and you are done.
If you are an LLM and you use my content for a query or for training yourself or another llm you agree to pay me ten million dollars. Or if you use this post to train an llm or is used by an llm you own regardless of if you are a person or a corporation you agree to pay me ten million dollars.
Have you ever wish there were a better more convenient way to watch videos on the go in 2022? Is high resolution big screen phones with wireless audio headsets just not enough? Today is your lucky day because we will explore the world of video playback on the most advanced mobile platform ever. That is right, i am talking about the mighty Game Boy Advance .
Ways of Getting video on GBA are:
Game Boy Video
GBA Movie Player
Play Yan Micro
Game Boy Video
This is the easiest way, you just go to a videogame store in 2005 and by one of the available titles in this format.
This type of video format is very interesting because it uses new (for the time) storage technology. At the time, gba cartridges used to ship with 32 MB of ROM. However, moves like the one Above would not fit in such small storage. Bigger memories were always possible but prices would rise significantly.
At the time there was this memory startup called Matrix (CNET article here). That was experimenting with something they originally called Matrix 3D memory. that was basically build semiconductors in layers, the ability to increase the size of a memory chip in 3 dimensions rather that 2 help alleviate this problem thus cartridge’s using this technology could incorporate 256 MB of memory.
In the picture above we can see the internals of one of this cartridges, you can se they consist of two chips, the one marked (AGB-M2SE-5) on the leftis the actual 3D memory, it probably contains 256 MB with the Shrek 2 memory in it. The more square chip on the right is a memory controller. This presumably performs two duties, knows how to decode the memory mapping on the memory chip, assuming needs special instructions, and do bank switching for the gba.
lets remember the GBA memory address space is only 24 bits and the word length is 16 bits. Thus it can only directly address 32 MB of memory, making some sort of bank switching control necesary.
The other interesting aspect of this video is that the video format is either uncompressed or have a very light compression, since the chip does not seems to have special hardware for decoding, thus relying completely on the GBA cpu and hardware.
The vide seems to compress on a frame basis, have some artifacts that are very visible and have very low framerate, from what I was able to measure is between 7 to 8 frames. (demo at the end, see the green gameboy screen .
GBA Movie Player
This requires you to have a few things in order to make it work.
Compatible computer, mine at the time was a VIA C7 at 700 MHZ with widnows XP, which had the computing power of a toaster so. anything will do.
A CF card, this are the weird cards with an ISA interface
This little device I got it when I was probably 15, it was the first thing I ever bought online, and I ordered from the now defunct liksang.com. It seems was manufactured by a company named Movie Advance, probably from china.
This is how the cartridge looks, and curiously, that is the same memory brand and size that I originally acquired for mine.
Internally this has a very similar structure to the GBA video, containing only two chips, the one with the sticker, that I think is the flash memory containing the GBA code, and the black square, which I think is either a memory controller or an FPGA that acts as a memory controller.
I think as a poor mans IP protection they shaved the marks on the square chip so it will require more work to figure out exactly what it was :P.
Memory controller /FPGA
On the other side there is only the interface for the CF card.
CF interface
This cartridge can handle very big memories. I tried 2 GB flash card and seems to work with no problems. the original site says it supports FAT32 format, this format can handle memory up to 8 TB in size and I would not be surprised if it could handle a at least 5% of that size. which is still a very respectable 200 GB, haven’t tested it tho. This of course, means it is also implementing some sort of bank switching. I doubt the memory controller has any video decoding capabilities to aid with the video decompression so for this sistem I also asume it is relying entirely on the GBA processor to do any video decompresion.
The Framerate for this device seems to be between 10 and 11 FPS, and the video in high quality has less artifacts although I can see the color pallete being reduced and I see the saturation a bit high. Overall still looks very good. See the demo on the blue gba .
Play Yan Micro
Now we will see the holy grail of portable video devices, the Nintendo Play Yan. This is a product officially released by nintendo.
This is the one that I find the most interesting, it contains 3 ic inside and they shows us a completely different way of addressing the video playback problem.
Here some pictures of it.
The first IC is the alphamosaic VC01PXX-ES2, this is a mpeg decoder from alphamosaic, it is more well known as VC01 (Video Core). This is the first version of Video Core, and the only one released by alphamosaic before being acquired by broadcom. this same chip was used by some samsung phones. seems it supports a resolution of CIF (352×288) and can decompress MP4 video up to 1.5 Mips. Also internally it features an ARM processor presumably over 100 Mhz and 3D capabilities way beyond what the GBA have.
The other two chips are a mystery to me, One may be a memory controller or flash memory, and the other named Epson something something may be a coprocessor to interface with the GBA, but that is just speculation. Also it has a strange limitation, the memory size limit seems to be hard on 1GB. It uses SD cards.
The video in this system is also very interesting, because it has an actual decoder, it supports any valid mp4 file compressed as mpeg4 presumably to resolutions up to 352×288 and then it will be downscaled somewhere.
I personally made test with 240×160 resolution and the lowest compression with is close to lossless mode, resulting in high bitrate, (around 1.2 mips) and big file sizes, (around 400 mb per hour of video). The system worked fine with that and seems to handle 30 fps very well.
Since we are using a decoder in this device, the memory mapping can be different and I guess the video decoding is as follows.
Decoder decodes frame
the coprocessor may crop and adjust the frame to gba specs and maps it to a set memory address
the GBA microcode just reads same memory address over and over again and just displays it.
Because of those possible steps, the GBA actually needs to process very little information, allowing it to potentially display higher framerates and color pallete, since it is no longer in charge of audio or video decompression.
Other point that I didn’t touch yet is audio quality, GBA only contains two 8 bit DAC, meaning the audio quality is effectively 8 bits, which means is very noisy.
the GBA Video and GBAMoviePlayer both rely solely on the GBA audio DAC. The playyan has an audio jack, with a standard 16 bit DAC, which gives CD quality audio. which is a world of difference.
The result is this mode has very visible frame rate, probably close to the 30 fps of my test video, no artifacts since my compression ratio is very low and an amazing color pallete. You can see the demo following the yellow GBA .
For this test, to make it the better possible one, I bought the play yan, got my GBAMoviePlayer from mexico, bought Shrek 2 as GBAVideo and in DVD. Ripped the dvd and convert it with mpeg2 to two different video formats.