Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Guide]Use a Wavehare 3.5In SPI TFT Screen #124

Closed
jetbalsa opened this issue Oct 3, 2019 · 28 comments
Closed

[Guide]Use a Wavehare 3.5In SPI TFT Screen #124

jetbalsa opened this issue Oct 3, 2019 · 28 comments
Assignees
Labels
doc documentation related stuff enhancement New feature or request
Milestone

Comments

@jetbalsa
Copy link
Contributor

jetbalsa commented Oct 3, 2019

  • First, SSH into your pwnagotchi, and give it some internet! Don't forget to check your default gateway and apt-get update
  • Follow Guide here: https://www.waveshare.com/wiki/3.5inch_RPi_LCD_(A)#Method_1._Driver_installation
  • At the step with ./LCD35-show add lite to the command prompt (./LCD35-show lite)
  • Reboot
  • as root, make three symlinks, cd ~; ln -s pwnagotchi.png pwnagotchi_1.png; ln -s pwnagotchi.png pwnagotchi_2.png; ln -s pwnagotchi.png pwnagotchi_3.png;
  • apt install fbi
  • change display type to "inky" in config.yml
  • add "modules-load=dwc2,g_ether" to your kernel command line ( /boot/cmdline.txt ) or it will break!
  • Also must add "dtoverlay=dwc2" to the bottom of ( /boot/config.txt )
  • edit /etc/rc.local and add
    fbi -T 1 -a -noverbose -t 15 -cachemem 0 /root/pwnagotchi_1.png /root/pwnagotchi_2.png /root/pwnagotchi_3.png &

reboot and you should be good, some of this guide will work with other framebuffer based displays!

@evilsocket
Copy link
Owner

@hexwaxwing mind adding this to the docs?

@evilsocket evilsocket added doc documentation related stuff enhancement New feature or request labels Oct 5, 2019
@evilsocket evilsocket added this to the 1.0.0 milestone Oct 5, 2019
@hexwaxwing
Copy link
Contributor

Derek assign: hexwaxwing

hexwaxwing added a commit to hexwaxwing/pwnagotchi that referenced this issue Oct 5, 2019
evilsocket added a commit that referenced this issue Oct 5, 2019
added Hacks.md; fixed typo; put official links into a table #124
@evilsocket
Copy link
Owner

closed by @hexwaxwing

@michelep
Copy link
Contributor

michelep commented Oct 18, 2019

Following this guide LCD displays phwagotchi just for few seconds before login prompt: i've solved using the autologin features (use raspi-config) and changing the line to add to /etc/rc.local as follow:

ln -s /root/pwnagotchi.png /tmp/pwnagotchi_1.png; ln -s /root/pwnagotchi.png /tmp/pwnagotchi_2.png; ln -s /root/pwnagotchi.png /tmp/pwnagotchi_3.png;

on /etc/profile i've added, at the end:

. /home/pi/pwnagotchi.sh

and /home/pi/pwnagotchi.sh contains:

#!/bin/bash
sudo fbi -T 1 -a -noverbose -t 15 -cachemem 0 /tmp/pwnagotchi_1.png /tmp/pwnagotchi_2.png /tmp/pwnagotchi_3.png &

Just remember to chmod +x pwnagotchi.sh !

dadav pushed a commit to dadav/pwnagotchi that referenced this issue Oct 20, 2019
dadav pushed a commit to dadav/pwnagotchi that referenced this issue Oct 20, 2019
added Hacks.md; fixed typo; put official links into a table evilsocket#124
@moty66
Copy link

moty66 commented Oct 28, 2019

This hack is really working bad and not clear at all

I suggest to execute this code from in rc.local or from /etc/profile or where ever you want:

PID=0
while true; do
        PID=$(pidof fbi)
        fbi -d /dev/fb1 -T 1 -noverbose -a /root/pwnagotchi.png  > /dev/null
        sleep 1
        if ps -p $PID > /dev/null
        then 
                kill $PID
        fi
done

I didn't load any kernel modules, I didn't edit the /boot/config.txt file, I only installed the driver as described in https://www.waveshare.com/wiki/3.5inch_RPi_LCD_(A)#Method_1._Driver_installation!

@michelep
Copy link
Contributor

I've worked to a more stable solution, adding support for Waveshare 2,4" LCD display (could be adapted to 3,5") directly in pwnagotchi code. Take a look here: https://www.zerozone.it/tecnologia-e-sicurezza/fatgotchi-pwnagotchi-on-a-24inch-spotpear-display/16589

@evilsocket
Copy link
Owner

the "more stable solution" does exactly what the on_frame configuration already does @michelep ... you literally call the fbi binary exactly as the on_frame does

@b0n3zx
Copy link

b0n3zx commented Nov 4, 2019

have any of you got a better refresh rate working on the TFT 3.5 screens yet?

@MoJo2600
Copy link

MoJo2600 commented Nov 4, 2019

@b0n3zx you can change the -t 15 parameter. Currently it is refreshing every 15 seconds. Mine is set to -t 1 an thus refreshing every second.

@michelep
Copy link
Contributor

michelep commented Nov 12, 2019

I have definitively solved any refresh issue with a pure python framebuffer memory mapping implementation, that draw directly to fb device without needs of fbi: i got a fps up to 15 without any problem! (it's currently on a pull request)

@agent932
Copy link

@michelep can you write up a guide to get this setup (I have a generic 3.5 & and a Pi 3) have it working with the above guide but the screen refresh crashes after a while.

@michelep
Copy link
Contributor

michelep commented Nov 25, 2019

@michelep can you write up a guide to get this setup (I have a generic 3.5 & and a Pi 3) have it working with the above guide but the screen refresh crashes after a while.

the patch was included in 1.3.0 release and you didn't need fbi anymore.

@michelep
Copy link
Contributor

My Raspberry pi 3 cannot access the internet. Can someone help me?

check iptables/masq rules (http://www.tldp.org/HOWTO/IP-Masquerade-HOWTO/)

@ghost
Copy link

ghost commented Nov 27, 2019

First: SSH into your Pwnagotchi, and give it some internet
apt-get update

sudo raspi-config

Desktop (text console, automatically logged in as "root" user
git clone https://github.com/waveshare/LCD-show.git

cd LCD-show/

chmod +x LCD35-show

./LCD35-show lite

Reboot

cd

ln -s pwnagotchi.png pwnagotchi_1.png

ln -s pwnagotchi.png pwnagotchi_2.png

ln -s pwnagotchi.png pwnagotchi_3.png

apt install fbi

nano /etc/pwnagotchi/config.yml Change display type to inky then save.

Add modules-load=dwc2,g_ether to your kernel command line nano /boot/cmdline.txt then save.

Add dtoverlay=dwc2 to the bottom of nano /boot/config.txt then save.

nano /etc/rc.local

Add ln -s /root/pwnagotchi.png /tmp/pwnagotchi_1.png; ln -s /root/pwnagotchi.png /tmp/pwnagotchi_2.png; ln -s /root/pwnagotchi.png /tmp/pwnagotchi_3.png;
then save.

nano /etc/profile

Add . /home/pi/pwnagotchi.sh at the end, then save.

nano /home/pi/pwnagotchi.sh

Add #!/bin/bash sudo fbi -T 1 -a -noverbose -t 15 -cachemem 0 /tmp/pwnagotchi_1.png /tmp/pwnagotchi_2.png /tmp/pwnagotchi_3.png & then save.

chmod +x pwnagotchi.sh

@elhenro
Copy link

elhenro commented Dec 10, 2019

@michelep thank you! i can confirm that only using your more stable (and cleaner imo) solution, I got it running without issues with the waveshare 3.5 display, with pi zero w and also with pi 3b+.

But somehow the step with sudo raspi-config -> autologin broke my usb connection mode, the network interface does not come up anymore. Any ideas why this happened?

@agent932
Copy link

@michelep can you write up a guide to get this setup (I have a generic 3.5 & and a Pi 3) have it working with the above guide but the screen refresh crashes after a while.

the patch was included in 1.3.0 release and you didn't need fbi anymore.

Is there a way to add the waveshare 3.5 config as a display option in the config without going through all of this, i am not understanding "the patch was included in 1.3.0 release and you didn't need fbi anymore."

@thefunkygibbon
Copy link

does this still need to be done given that i already seem to have FBI installed and also the config.txt/cmdline.txt changes already exist?

@agent932
Copy link

agent932 commented Dec 2, 2020

I spent the day going through all the 3.5 LCD info I could find and none of these are currently working. Is there an updated method?

@h4km4k
Copy link
Contributor

h4km4k commented Jun 21, 2021

i added support for this display, see pull request #1014

@waldeckerthefirst
Copy link

hello when i try the guide i get now that the file or directory does not exist for pwnagotchi.png and i could not find it on the FS

@condor13
Copy link

condor13 commented Nov 4, 2023

i added support for this display, see pull request #1014

Hello,
Sorry kinda noob here... how do I implement this display? All works..web UI works, display works but it doesnt display the UI..
just console. I made it autologin...no luck.
framebuffer tells me png loading failed. No such file and directory. All symlinks created with su.
Any help? Thanks

@h4km4k
Copy link
Contributor

h4km4k commented Nov 4, 2023 via email

@ChrisKincaid
Copy link

I am going a little bit nutso trying to find a V2 or V3 screen. Most sellers, nearly all sellers, are not clear on what they are actually selling. Anyone have a link to a solid seller I can get a screen I can be (somewhat) certain will work for me?

@bicurico
Copy link

It took me 2 days to get this to work.
I am using a Raspberry Pi Zero W with a Waveshare 3.5" screen (A) v3.
Ghost's list is almost perfect, but there were a few hickups:

  1. The pwnagotchi.png is not stored to \tmp but into \var\tmp. These must be corrected:

ln -s /root/pwnagotchi.png /var/tmp/pwnagotchi_1.png; ln -s /root/pwnagotchi.png /var/tmp/pwnagotchi_2.png; ln -s /var/root/pwnagotchi.png /tmp/pwnagotchi_3.png;

  1. You need to set the AUTOLOGIN: sudo raspi-config -> autologin

  2. Where it says:

nano /etc/rc.local

Add ln -s /root/pwnagotchi.png /tmp/pwnagotchi_1.png; ln -s /root/pwnagotchi.png /tmp/pwnagotchi_2.png; ln -s /root/pwnagotchi.png /tmp/pwnagotchi_3.png;
then save.

This must be put BEFORE the exit 0 line, otherwise the links are never created, because the script exists at the exit 0...

I think that was it.

Cheers

@wink05
Copy link

wink05 commented Dec 27, 2023

It took me 2 days to get this to work. I am using a Raspberry Pi Zero W with a Waveshare 3.5" screen (A) v3. Ghost's list is almost perfect, but there were a few hickups:

  1. The pwnagotchi.png is not stored to \tmp but into \var\tmp. These must be corrected:

ln -s /root/pwnagotchi.png /var/tmp/pwnagotchi_1.png; ln -s /root/pwnagotchi.png /var/tmp/pwnagotchi_2.png; ln -s /var/root/pwnagotchi.png /tmp/pwnagotchi_3.png;

  1. You need to set the AUTOLOGIN: sudo raspi-config -> autologin
  2. Where it says:

nano /etc/rc.local

Add ln -s /root/pwnagotchi.png /tmp/pwnagotchi_1.png; ln -s /root/pwnagotchi.png /tmp/pwnagotchi_2.png; ln -s /root/pwnagotchi.png /tmp/pwnagotchi_3.png; then save.

This must be put BEFORE the exit 0 line, otherwise the links are never created, because the script exists at the exit 0...

I think that was it.

Cheers

how you managed to fix issue when you install LCD35-show driver you no longer can ssh into pwnagotchi?

@bicurico
Copy link

bicurico commented Dec 27, 2023 via email

@bicurico
Copy link

bicurico commented Dec 29, 2023

This is my pwnagoshi.sh script:

#!/bin/bash
START=true

while $START
do
  readarray -t PIDS < <(exec pgrep -x fbi)
  if [[ ${#PIDS[@]} -eq 0 ]]; then
    echo "No fbi process was found."
    sudo fbi -T 1 -a -noverbose -t 5 -cachemem 0 /tmp/pwnagotchi_1.png /tmp/pwnagotchi_2.png /tmp/pwnagotchi_3.png
  elif ps -fp "${PIDS[@]}" | fgrep -F '<defunct>' >/dev/null; then
    echo "Defunct fbi process found: ${PIDS[*]}"
    sudo kill -s SIGTERM "${PIDS[@]}"
    sudo kill -s SIGKILL "${PIDS[@]}"
  fi
  sleep 15
done

My rc.local looks like this:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

ln -s /var/tmp/pwnagotchi/pwnagotchi.png /tmp/pwnagotchi_1.png
ln -s /var/tmp/pwnagotchi/pwnagotchi.png /tmp/pwnagotchi_2.png
ln -s /var/tmp/pwnagotchi/pwnagotchi.png /tmp/pwnagotchi_3.png

exit 0

In order to edit stuff as root, it is necessary to do sudo su.

The rest is by the book, as described by Ghost.

@condor13
Copy link

This is my pwnagoshi.sh script:

#!/bin/bash
START=true

while $START
do
  readarray -t PIDS < <(exec pgrep -x fbi)
  if [[ ${#PIDS[@]} -eq 0 ]]; then
    echo "No fbi process was found."
    sudo fbi -T 1 -a -noverbose -t 5 -cachemem 0 /tmp/pwnagotchi_1.png /tmp/pwnagotchi_2.png /tmp/pwnagotchi_3.png
  elif ps -fp "${PIDS[@]}" | fgrep -F '<defunct>' >/dev/null; then
    echo "Defunct fbi process found: ${PIDS[*]}"
    sudo kill -s SIGTERM "${PIDS[@]}"
    sudo kill -s SIGKILL "${PIDS[@]}"
  fi
  sleep 15
done

My rc.local looks like this:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

ln -s /var/tmp/pwnagotchi/pwnagotchi.png /tmp/pwnagotchi_1.png
ln -s /var/tmp/pwnagotchi/pwnagotchi.png /tmp/pwnagotchi_2.png
ln -s /var/tmp/pwnagotchi/pwnagotchi.png /tmp/pwnagotchi_3.png

exit 0

In order to edit stuff as root, it is necessary to do sudo su.

The rest is by the book, as described by Ghost.

Thanks for this. I got it working on a waveshare 3.5inch.
I am testing this with a PI Zero (no wifi no BT) until PI zero W 2 arrives.
This little one doesnt seem to get past the "Generating Keys" :)
So its not a good idea to try this old beast :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc documentation related stuff enhancement New feature or request
Projects
None yet
Development

No branches or pull requests