KlipperTV, poorman Klipper system ready2go for Android Tvbox

For: S905X3; Allwinner H6 CPU and RK3318 CPU

but at today the BEST SOLUTION IS: Allwinner H6 CPU TVBOX

you use this guide and do everything only on your responsibility, I do not take any responsibility for any malfunctions and damages

KLIPPER TV ON all amlogic S905X3 CPU: (tested on X96 Max plus -> 4/32 gigs TVBOX)

about them: ALL LCD TESTED: Waweshare 5” (800×480 dpi) and waweshare 7” (1024×600 dpi)

S905X3: all works, HDMI touch on 5/7 ” screens; wifi (dual band, 2.4 and 5 Ghz)

*

*

*

*

*

RK3318/RK3328: works well wifi (dual mode), doesn’t work HDMI on low resolution screens (works well on 20” full HD LCD)

*

*

*

*

*

allwinner H6:

all works completelly, internal wifi and also Remote KlipperScreen, using RPC

Allwinner H6 CPU TVBOX model listed are:

T95 Mini

Q+ (Q plus)

T95 MAX

*

*

*

T95 Mini

*

*

*

Q Plus

*

*

*

T95 MAX

*

*

*

*

TANIX TX6

*

*

*

*

on all TVBOX works well instead: klipperscreen on old android phone/tablet

IMPORTANT NOTE: above of all, check status of python2 on your klippertv box:

from shell, as you can, type:

python2 – -version

if an error appear, like:

*python2 not found, but can be installed with:

sudo apt install python2-minimal

only ha ve to type in terminal:

sudo apt install python2-minimal

this error can occours for example, if you have to trasform robin nano 1.2 klipper.bin to Robin_nano35.bin, py script won’t execute…..

you can download S905X3 CPU ready2go system HERE:

(rebuilt from this original github)

to flash my system into S905X3 tvbox, you can follow this guide

follow guide only to: boot/flash armbian into tvbox (“insert dull toothpick into the AV hole…..“) and follow guide how to reinstall android distro on it if have troubbles to flash armbian (“insert dull toothpick into the AV hole…..”), nothing to edit (no config file to edit, nothing to fix, no bootloader to download, no firmware to apply, all is in my readt2go system), nothing to do more, all is ready to work, when you finally boot by armbian from microsd.

*

if armbian stucks on boot logo, download this release of android and flash on tvbox, then you can flash armbian with no pronlem:

here

and follow all steps of this guide:

here from step 1!

*

When you booted by microsd, you have to:

connect hdmi screen and usb keybord, and login with pi user

(username: pi)

(password: pi)

then write:

sudo armbian-install [ENTER]

choice 501 from the list that appear (if your TVBOX is a X96 MAX Plus or follow list for your own TVBOX Model! and write correspondig code) and continue, choice then EXT4 (1) and confirm, wait some minutes the copy on emmc (arounf 5 minutes…)

when finished, you have to: remove microsd, unplug and replug power cable from tvbox.

after 1st boot, if cannot see an IP address on tvbox (you have to login into…), perform a reboot (appened to me…)

you have system ready and working on internal emmc.

now you can digit by shell:

sudo armbian-swap 1 [ENTER], wait, ok, you have enlarged to 1 Gb the Swap partition.

to continue, follow this guide from here after the string: “Let’s begin”

KlipperTV in RK3318 CPU TvBox

So, here all works, also internal WIFI, but….

Troubbles ok RK 3318 CPU TVBOX:

(I’ve tested X88 Pro 10 2Gb RAM / 16Gb EMMC)

  • KlipperScreen doesn’t work with low resolution touch HDMI LCD, but on HD sceeen all works well (if somone has an idea to fix that problem, leave a comment about, I’ve tried a lot of fixes, nothing worked!)
  • Webcam seems to change /dev/video ID every time I turn OFF/ON TvBox, so or leave it ever ON, or try to fix device with this guide… in details, you can check into folder: /dev/v4l/by-id/, I’ve found 2 files, one is: usb-_Webcam_C170-video-index0 , so I’ve replaced into /home/pi/klipper_config/webcam.txt the line:

camera_usb_options=”-r 640×480 -f 25 -d /dev/video2 -q 100″

with:

camera_usb_options=”-r 640×480 -f 25 -d /dev/v4l/by-id/usb-_Webcam_C170-video-index0 -q 100″

and all worked, webcam was fixed, also if I change its usb port, turn OFF/ON TvBox…

download rk3318 Multitool image, extract with winrar and flash image on a (>= 8Gb) microSD, with Balenaetcher, insert microSD into RK3318 TVBOX

now in SDCARD there is a folder called Images, put Klippertv_RK3318.img.gz image file

I’ve built it from github armbian sources here

(you can download Klippertv_RK3318.img.gz here)

like in this image:

put ready2go Klippertv_RK3318.img.gz image into that folder

whe copied, insert microSD into TVBOX and turn it ON, multitool starts, and after some confirmation by USB Keyboard vonnected, you can do some operation, like:

erase internal flash, backup system and finally, you can Burn image to (TVBOX EMMC) flash image into TVBOX

9, shutdown when finished

 restart, and EMMC after you copied intere system on it, may have wrong free space, so use the following command:


sudo /etc/init.d/resize2fs start [ENTER]
(a message appears, press again [ENTER]) wait, confirm with [ENTER]
and restart the tvbox when done! instead to give more size to the logs: write:
sudo nano /etc/default/armbian-ramlog
from: SIZE = 50M to: from: SIZE = 128M
(ctrl + o to save the file, then [ENTER] to confirm, then ctrl + x to close);
sudo reboot [ENTER] (to restart tvbox)

extract sdcard fromTVBOX and restart (Power ON) it, from now, you can follow original KlipperTV guide

KlipperTV poormen Klipper system.

KlipperTV for Allwinner H6 CPU


plug & play system for TVBOX Android 9 with Allwinner H6 CPU.

What is it: KlippeTV is like minsailOS, but for Android TV Box (Cost: 30 euros with 2Giga RAM and 16 Giga on emmc 40 euros with 4/32 Giga), is the
to be used as an alternative to Rapberry for klipper:

the original github from I built the klippertv image is here:


https://github.com/smlinux/armbian-tanix-tx6


Download KlipperTV Image

NEW RELEASE! 17.03.2023

KlipperTV-H6-V3.2.6.img.gz

*

*

*

new:

KlipperTV-H6-V23.02.0_V2

based on new:
————
OS: Armbian (23.02.0-trunk) aarch64
Kernel: 6.1.11-sunxi64

based on UBUNTU Jammy

all working as V3.2.6, but more now also leds: red on reboot/shutdown, blue when booted! plus if connected to local network, led is blue, while, if not connected for strange reasons, led falshed red/blue, until connected again (fixed blue led!)

(to see local klipper IP on your LAN, in this new v23.02.0 release, to start klipperscreen on HDMI LCD, on ssh window write:

sudo systemctl enable KlipperScreen

sudo systemctl restart KlipperScreen

to see its own IP, within Klipperscreen:

tap on klipperscreen ‘settings’ icon, and then on ‘net’ icon (wifi icon), and you can see its own IP, btw, on PC browser you could type: klippertv.local to connect to it by mainsail.)

(updated to: 17.04.2023), all working, all working, also internal wifi, and remote KlipperScreen by RPC (remote desktop), KlipperScreen on HDMI and KlipperScreen for Android in wifi mode!, remember klipperscreen for android, you can use internal phone retro camera as klipper webcam, all explained below!)

I switched from mjpg-streamer to newest “crowsnest” for webcam(s), all infos here

and, plus, FROM version 3.2.1 are enabled the Kernel Drivers for CANBUS Modules, so now you can use canbus modules connected on Klippertv Box USB PORT like theese:

or

you will already have:

klipper

mainsail & fluidd (on port 81)

klipperscreen & klipperscreen for Android (you can have one or both!)

working webcam (may needs some config edit!)

Shell GCode

kiauh (if you want to install something else, like telegram bot i.e.!)


to access kiauh from shell , enter as pi user and type:
cd kiauh (enter)
bash kiauh.sh (enter)


necessary tools:

WinSCP: to connect in ssh to the tvbox as if it were an explorer

Putty: SSH client

Balenaetcher: to write the system on a microSD (at least 8 Giga)
1 USB keyboard to connect to the tvbox for the first config
1 HDMI touch screen for early setups and KlipperScreen
An old android phone/tablet for KlipeprScreen for android
What else? I do not know….

Let’s begin:


buy an android TVBOX with H6 CPU among the many I recommend: T95 mini(2/16 giga) or T95 MAX (4/32 or 4/64 Giga)

for the T95 MAX or equivalen tvbox, the kernel can see only 3 gigs of RAM also if the tvbox has 4gigs, is a kernel limit (but 3 is even better than 2!) also if to have klipper full working 2/16Gigs, are good (think that tons of people use a raspberry 3 that has only 1Giga of RAM…)

if you want 5G wifi instead of 2.4 Ghz internal one, or if internal doesn’t work, for unknown reasons you can use one of theese external usb/wifi adapter:

RTL8811CU (2.4 and 5 Ghz wifi at 10 euros)

or

RTL8188EUS chipset (like :TL-WN725N device only 2.4 Ghz wifi at 5/6 euros)


download klipperTV image, download and install balenaetcher,
format a microSD (>=8 Gigs) in NTFS Format;
run balenaetcher, and load the KlipperTV.img.gz file, select the microsd (already inserted in the pc’ USB) and write the system.
what inside? All, as shown in image,
Once done insert the microsd in the TVBOX, connect it to an HDMI screen, a keyboard and a LAN cable Turn on the tvbox, after the classic linux boot (maybe reboots itself once, and it can stop for some time during second boot ), it asks you to login.

TAKE CARE: 1st BOOT CAN TAKE UNTIL 10 MINUTES…so WAIT…

If after 10 minutes cannot see login shell, unplug and replug power on TVBOX and WAIT…

You have 2 users: root (root password) and pi (pi password)
to use the kiauh tool, login with user pi, and write:
cd kiauh
bash kiauh.sh
and you will see:

some link referred what contains KlipperTV:


kiauh:
https://github.com/th33xitus/kiauh


klipper:
https://github.com/Klipper3d/klipper


moonraker:
https://github.com/Arksine/moonraker


mainsail:
https://github.com/mainsail-crew/mainsail


fluidd: (on port: 81 – http://klippertv.local:81)
https://github.com/fluidd-core/fluidd


KlipperScreen:
https://github.com/jordanruthe/KlipperScreen


Klipperscreen Android:
https://github.com/naruhaxor/AndroidKlipperScreen

klipperscreen on RPC (Remote Desktop)

https://klipper.discourse.group/t/how-to-klipperscreen-and-rdp-for-ios-android-pc-mac/1717


G-Code shell command:
https://github.com/th33xitus/kiauh/blob/master/docs/gcode_shell_command.md

Timelapse:

https://github.com/mainsail-crew/moonraker-timelapse

for webcams: crowsnest

https://github.com/mainsail-crew/crowsnest

.

.

.

bluetooth is actived

now….

to set static IP address you have to use armbian-config tool, how:

write:
sudo armbian-config

(if you want WIFI, insert usb/wifi module and choice:)

Network menu-> Wifi (manage….)->select preferred wifi SSID confirm, insert password and you are on wifi now! )


to move: up / down arrows, to scroll through the items, [SPACE] to select acheckbox, [TAB] toto go to [OK]/[CANCEL], [Enter] to Accept the selection) .

and…
select and…
continue…
…and finally…

Now you will have to transfer the system to emmc (if tvbox had any, the tvboxQ Plus for example had NAND Flash , not compatible). Go to armbian-configSelect item 1 (System): , then:

and finally:

select item ne 2 (not 5..)
select EXT4 file system and confirm with [ok] , wait until ask you to shutdown system.

now:

power off tvbox, remove microSD from its slot (cos you have installed system on internal EMMC!) wait some second and power ON
left HDMI connected, (if iet connected to your touch screen, otherwise, connect your HDMI touchscreen to the TVBOX ) and reboot KlipperTV
in shell write:
sudo reboot [ENTER]
to see klipperscreen on HDMI
you have to enable KlipperScreen service, disabled by Default, so write:
sudo systemctl enable KlipperScreen [Enter]
and then:
sudo systemctl restart KlipperScreen [Enter]
wait 10 seconds and your screen will show KlipperScreen working.
for touch screen

If issues:
sudo mv /etc/X11/xorg.conf.d/50-fbturbo.conf /etc/X11/xorg.conf.d/50-fbturbo.conf.bak
sudo service KlipperScreen restart

to see klipperscreen on remote pc you have to install some other packages:

P.S.: On last Allwinner H6 release is iet installed and working remote KlipperScreen, only have to write on PC search “remote desktop”, run it and insert KlipperTV IP, then username and password (in my case: pi as username and pi as password!) and connect to see remotelly KlipperScreen!

for other releases (RK3318 and Amlogic S905X3) you have to install below modules as described!

sudo apt install xrdp
and
sudo apt install xorgxrdp
nano /home/pi/.xsession

Paste this 2 lines:

cd /home/pi/KlipperScreen 
exec /home/pi/.KlipperScreen-env/bin/python /home/pi/KlipperScreen/screen.py

Reboot the pi and connect with your username and password in your RDP app of choice.


I’ve tested on 5” HDMI touch screen and all worked well,both klipperscreen and touches!
if you have troubbles on your own touch screen you can:
run calibrator, in shell write:
sudo DISPLAY=:0 xinput_calibrator [ENTER]
now you can calibrate your touchscreen in the 4 corners, wait and klipperscreen appears again, check if touch works well.
to use ever same calibration write:
sudo nano /usr/share/X11/xorg.conf.d/99-calibration.conf
copy/paste the shell output, in my case:

Section "InputClass"

Identifier "calibration" MatchProduct "WaveShare ws170120"
Option "Calibration" "196 3973 240 3914"
Option "SwapAxes" "0"

EndSection


[ctrl+o to save [ENTER] to confirm, ctrl+x to close file]
(this is my own touchscreen model: "WaveShare ws170120", maybe your will be different:)
if you need to swap axis, replace:
Option "SwapAxes" "0"
with
Option "SwapAxes" "1"
if need to invert axes next line (under Option "SwapAxes" "1") :
Option "InvertX" "0" ### or "1"
Option "InvertY" "0" ### or "1"
(you can run calibrator to get correct x,y positions.)
in shell write:

xinput_calibrator --output-type xinput [ENTER])

TO ROTATE SCREEN ON KLIPPERSCREEN:

digit this command:

sudo nano /etc/X11/xorg.conf.d/01-armbian-defaults.conf

and insert inside:

(or replace existing ‘Section’ with)
Section "Monitor"
        Identifier "HDMI-1"
        Option "Rotate" "right"
EndSection

#####normal(0)/right(90)/inverted(180)/left(270)

[ctrl+o] to save, [ENTER] to confirm and [ctrl+x] to close

(to rotate startup screen as root in shell write:)

(echo 1 > /sys/class/graphics/fbcon/rotate)

IMPORTANT NOTE: above of all, check status of python2 on your klippertv box:

from shell, as you can, type:

python2 --version

if an error appear, like:

***python2 not found, but can be installed with: sudo apt install python2-minimal***

only ha ve to type in terminal:

sudo apt install python2-minimal

this error can occours for example, if you have to trasform robin nano 1.2 klipper.bin to Robin_nano35.bin, py script won’t execute…..

.

.

and….

.

.

if you have error on intalling tvbox as second mcu, try using:

sudo dpkg -i --force-overwrite /var/cache/apt/archives/linux-libc-dev_22.08.6_arm64.deb

and

sudo dpkg -i --force-overwrite /var/cache/apt/archives/linux-libc-dev_22.11.1_arm64.deb

to fix that error


Well done! now you can connect to it in remote, unplug USB Keyoard
to connect from your PC with SSH (explorer and shell)
, you have to install putty; and WinCSP. run winCSP and when ask for new connection, you only enter:

yout KlipperTV IP, username (pi) and password (pi), click on connect:

left TAB is you PC (you can select a specific folder to see content),
right TAB is KlipperTV you can select a specific folder to see content)
in top/left corner, you can see [2 pc] icon, click on that icon and you open a SSH shell (you had installed Putty, before….)
(it asks for pi use password… you know it…)
so, connect with SSH Shell:
you can change root and pi passwords, write:
sudo passwd root
[ENTER] (to change root user password!)
write twice the new root user password
and:
sudo passwd pi
[ENTER]
…as before….
info: if the system is on NAND you can expand the system on the microsd (or maybe also on EMMC after you copied intere system on it) with the following command:


sudo /etc/init.d/resize2fs start [ENTER]
(a message appears, press again [ENTER]) wait, confirm with [ENTER]
and restart the tvbox when done! instead to give more size to the logs: write:
sudo nano /etc/default/armbian-ramlog
from: SIZE = 50M to: from: SIZE = 128M
(ctrl + o to save the file, then [ENTER] to confirm, then ctrl + x to close);
sudo reboot [ENTER] (to restart tvbox)

to install minimal python 2 (yes is deprecated from years, but for robin nano 1.2, to build firmware, you need it!)

write in shell:

sudo apt install python2-minimal [ENTER]


well, now you Know how….
let’s go on android phone to enable klipper screen on it
you’ll have to


1) Enable developer settings:
2) Enable usb debugging
3) Install the server to view klipperscreen. let’s begin


1:

ITA
a. Tocca Impostazioni.
b. Tocca Info sul telefono.
c. Tocca il campo Numero build 7 volte.

ENG:
a. tap on settings.
b. tap on phone Info .
c. tap on build number 7 times.


Exit, you will now have a new item in the menus [developer options]
2: developer options, open that, go to the entry: USB DEBUG, enable it, finished
3: if you have an active google account on your phone from play store write:xserver XSDL
If you don’t have google account, by a web browser (like chrome) browse here:https://www.apkfollow.com/app/it/xserverxsdl/ x.org.server/ Download
and install (the apk icon is this … do not install anything else by mistake 🙂

this icon is from the right apk, not other ones!

start that app installed on your phone, [CHANGE DEVICE CONFIGURATION] appears at the top of it, If doen’t appears close the server (cellphone app) and restart it
If it still appears, close the server, connect the phone to the TVBOX on usb and restart the server from the phone, tap on it ([CHANGE DEVICECONFIGURATION])
Then scroll down the list to: [Mouse Emulation] Then again: [MouseEmulation Mode] And finally select the item: [Desktop, No Emulation] Scroll down and tap on [OK] (or CLOSE I don’t remember) Still [OK].
A blue screen with your mobile phone’s IP address appears.
(To have a static IP the procedure is similar to the one above for the TVBOX Ok…)
Let’s go to WINCSP Go to the tvbox /home/pi/KlipperScreen/ Folder and open(double click on) the file: launch_klipperscreen.sh
Change IP from: DISPLAY = 192.168.1.58: 0 /home/pi/.KlipperScreenenv/bin/python3 /home/pi/KlipperScreen/screen.py
to:
DISPLAY = PHONE IP:0 /home/pi/.KlipperScreenenv/ bin/python3/home/pi/KlipperScreen/screen.py
So from: (example) 192.168.1.58:0 to 192.168.129:1 And you will have: DISPLAY= 192.168.1.129:1 /home/pi/.KlipperScreenenv/ bin/python3/home/pi/KlipperScreen/screen.py
Save and close the file.
If not already connected, connect or reconnect the phone on USB to theTVBOX, leave connected Restart the TVBOX from shell write: sudo reboot[ENTER]
enter the password of user pi (which is: pi) sending when you restart you willhave the klipperscreen screen on the phone, now you can also disconnect the usb that connects it to the tvbox and take it for a walk in the range of the WIFI with klipperscreen on the screen!
WEBCAM SECTION: run the following SSH shell commands: install from SSHshell, by typing:
sudo apt-get install ffmpeg v4l-utils [ENTER]
(in the latest release of the KlipperTV system it may already be installed) then write on shell:
v4l2-ctl --list-devices (and press [ENTER])
(shell output:)
allwinner,sun50i-h6-vpu-g2-dec (platform: hantro-vpu):
/dev/video2
cedrus (platform:cedrus):
/dev/video0
sun50i-di (platform:sun50i-di):
/dev/video1
Webcam C170: Webcam C170 (usb-5101000.usb-1):
/dev/video3
/dev/video4

and here (Webcam C170: Webcam C170) we have to try:
video3? or video4? or something else ????
open with WinCSP the file:
/home/pi/klipper_config/
webcam.txt (double click on it.)
edit this line:
camera_usb_options="-r 640x480 -f 25 -d /dev/video2 -q 100"
1)
change from camera_usb_options = "- r 640x480 -f 25 -d /dev/video2 -q100"
to:
camera_usb_options = "- r 640x480 -f 25 -d /dev/video3 -q 100"

while to check rela supported resolution (– r 640×480 in the example) insert webcam USB into a PC a and open this site

so change: 640×480 with 1920×1080 (supported in my case)
then reboot the webcamd service by writing from shell:
sudo systemctl restart webcamd [ENTER]
from browser (chrome for example) write: http://TvBox_IP/webcam/?action=stream
example:
http://192.168.1.44/webcam/?action=stream
if you see webcam, ok, otherwise try another input
(video3 or video4 or etc) same from point 1
webcam will work on own video device.

WEBCAM from Android camera (same device that you used for KlipperScreen)

intere guide here:

you can download and install this apk on your anndroid device:

https://play.google.com/store/apps/details?id=com.pas.webcam&hl=en_US&gl=US

or here:

https://ip-webcam.it.uptodown.com/android

or here

https://www.mediafire.com/file/co011w8af79hqfr/ip-webcam-1-16-6-783-multiarch.apk/file

and on mainsail you have only add new webcam as in picture:

so, string is:

http://ip_of_your_android_phone:8080/video

in both stream and snapshot and all will work!

so, you have now old android phone/tablet that works with klipperscreen on, and as printer webcam! 😉


the guide to use a Raspberry PICO /clones that are good, working like original ones but less expensive, so I suggest raspberry PICO CLONE, connected by USB to KlipperTV TvBox and an adxl345 to make inputshaping tests
, but also to have 40 free pin like raspberry pi 3/4 have.

the use of raspberry pico clone (less than 10 euros), depends if you have or not a SPI connector on your printer’s motherboard (usually EXP1 is a SPI port; SDCARD expansion is a SPI port), if present, you can use that connected drectly to adxl345 accelerometer, not need necessarily a raspberry pico!

now you can use also i2c protocol, as in thi image, with waweshare RP2040 (raspberry pico clone) and i2c accelerometer, like: GY-521 Modulo MPU-6050

*

*

*

now, to compile Klipper firmware for your own printer’s motherboard and install that firmware on it, follow official guide go

here:

if moonraker cannot connect to klipper (usually after updates…)

Check klipper.env file in the printer_data/systemd

For some reason you can end up with serial connection. This needs to be changed back to UDS. It should look like this to work:

KLIPPER_ARGS="/home/pi/klipper/klippy/klippy.py /home/pi/printer_data/config/printer.cfg -l /home/pi/printer_data/logs/klippy.log -a /tmp/klippy_uds"

if you want you can buy me a coffee!

pappicio@gmail.com