Custom AndroidTV Box With RaspberryPi 4 and Arduino
by ultimoistante in Circuits > Raspberry Pi
2778 Views, 4 Favorites, 0 Comments
Custom AndroidTV Box With RaspberryPi 4 and Arduino
For many years I had a custom RaspberryPi-based mediacenter box running LibreElec attached to my TV (you can see it here: https://ultimoistante.wordpress.com/2015/01/12/guida-realizzazione-mediacenter-raspberrypi-raspbmc/). Now, since I needed some other apps that runs on Android, I decided to build a new box, but this time with a RaspberryPi4 and an Arduino Nano.
Okay... I could have bought a cheap chinese android box, but, since I'm a maker and a developer, and since I'm used to have full control on my devices (I'm a GNU/Linux developer...), my best (and funny!) option was to build it from scratch.
Supplies
- a RaspberryPi4 single board computer;
- a 5V 2.5A switching power module (found on AliExpress);
- an Arduino Nano microcontroller board;
- a small pcb proto board;
- some extra electronic components (transistors, relay, diodes, resistors... you can easily find them on scrap circuits);
- one 5V 40x40mm cooling fan (bought on amazon);
- a plastic case from an old adsl modem (I've used a Technicolor TG582n);
- tools for plastic case modifications (grinder, files, fine grit sand paper, optionally a 3D pen);
- (optionally) spray paint to finish case surface;
Find the Right Case
In one of my boxes of "things that can be reused" I found this nice adsl modem (I think I've found it in local dumpster, some years ago). It's a widespread modem, here in Italy, manufactured by Technicolor, and provided by Telecom Italia. Its dimensions fits perfectly my needs, has a nice design and is full of ventilation holes (RaspberryPi 4 is a cool device, but is the hottest of the family... sorry for the joke...)
Build the PowerControl Circuit
In the picture you can see the simple arduino-based circuit. From left to right: fan control, relay control, thermistor and uart level shifter. The other small breadboard (on the bottom right) represents the circuit section recycled from original modem board. Complete circuit schematics (fritzing file) and arduino code available on github project repository, here: https://github.com/ultimoistante/rpi-androidtv-arduino-powerctl
Arduino PowerController features:
- handles RaspberryPi power via relay;
- does case cooling controlling a fan with PWM, reading temperature with a thermistor;
- since it's connected to RaspberryPi via UART, it can detect when android system is full booted, and can send shutdown command to it when user presses power button. After some seconds, cuts RaspberryPi power deactivating the relay;
- drives the leds on the original modem board using different patterns for standby, booting and shutdown phases (I've reused a slice of the original modem pcb, cut with a grinder, see below);
In the last picture you can see the wires soldered on RaspberryPi test pads, for direct power (TP1: 5V, TP7: GND)
Android on RaspberryPi
You can download LineageOS 18.1 Android TV (Android 11) (by KonstaGANG) from here: https://konstakang.com/devices/rpi4/LineageOS18-ATV/
To install on microsd, follow instructions on the page.
Prepare the Case
This part is relative to this particular modem case. Use your creativity to best fit all needed components in your device case. For my build, I've used a 3D pen to fill unneeded case holes, using transparent filament to simplify the marking of new holes. For new holes you will need a grinder, small files, and some patience.
Finally, use sand paper to smooth the plastic surfaces, and, if you want, spray paint the case. I've used matte black for the case and aluminium grey for the button.
Assemble All
This is the components placement I've used for my box. The fan goes on the top cover. Your mileage may vary if you have a different case.
NOTE: android sleep button is connected to GPIO21/GND on RaspberryPi. Sorry, not shown in photo. See FAQs on konstaGANG page)
Enjoy!
Note: if you connect the box on a TV with CEC feature, you can use your TV remote to control Android TV interface. You can also install the official Android TV remote app ( https://play.google.com/store/apps/details?id=com.google.android.tv.remote.service ) on your android phone, and use it as a remote.