1.44" 128x128 pi zero hat

Got an idea for a project? Found a cool project you want to share? Post it here!
User avatar
JamesW
Posts: 36
Joined: Wed Sep 27, 2017 4:45 pm
Has thanked: 12 times
Been thanked: 22 times

Re: 1.44" 128x128 pi zero hat

Post by JamesW » Sat Mar 10, 2018 5:38 pm

Here are the things I changed to get the screen and buttons working.

/etc/modprobe.d/fbtft.conf

Code: Select all

# /etc/modprobe.d/fbtft.conf
options fbtft_device name=adafruit18_green gpios=reset:27,dc:25,cs:8,led:24 speed=40000000 bgr=1 fps=60 custom=1 height=128 width=128 rotate=180
/boot/config.txt

Code: Select all

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=-5
#overscan_right=16
#overscan_top=16
#overscan_bottom=-5

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=off
#dtparam=i2s=on
dtparam=spi=on

# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on
gpu_mem_256=128
gpu_mem_512=256
gpu_mem_1024=256
#overscan_scale=1

dtoverlay=pwm-2chan,pin=18,func=2,pin2=13,func2=4
hdmi_force_hotplug=1
hdmi_cvt=128 128 60 1 0 0 0
hdmi_group=2
hdmi_mode=1
hdmi_mode=87
display_rotate=1

#disable uart to boost boot speed
enable_uart=0
start_x=0
/boot/retrogame.cfg

Code: Select all

# Sample configuration file for retrogame.
# Really minimal syntax, typically two elements per line w/space delimiter:
# 1) a key name (from keyTable.h; shortened from /usr/include/linux/input.h).
# 2) a GPIO pin number; when grounded, will simulate corresponding keypress.
# Uses Broadcom pin numbers for GPIO.
# If first element is GND, the corresponding pin (or pins, multiple can be
# given) is a LOW-level output; an extra ground pin for connecting buttons.
# A '#' character indicates a comment to end-of-line.
# File can be edited "live," no need to restart retrogame!

# Here's a pin configuration for the PiGRRL 2 project:

LEFT       5  # Joypad left
RIGHT     26  # Joypad right
UP         6  # Joypad up
DOWN      19  # Joypad down
X         20  # 'A' button
z         16  # 'B' button
#Z        27  # 'X' button
#X        22  # 'Y' button
SPACE     21  # 'Select' button
ENTER     13  # 'Start' button
#A        12  # Left shoulder button
#S        13  # Right shoulder button
#ESC      17  # Exit ROM; PiTFT Button 1
#1        22  # PiTFT Button 2
#2        23  # PiTFT Button 3
#3        27  # PiTFT Button 4

# For configurations with few buttons (e.g. Cupcade), a key can be followed
# by multiple pin numbers.  When those pins are all held for a few seconds,
# this will generate the corresponding keypress (e.g. ESC to exit ROM).
# Only ONE such combo is supported within the file though; later entries
# will override earlier.
/opt/retropie/configs/all/retroarch.cfg (PARTIAL)

Code: Select all

# Keyboard input. Will recognize letters ("a" to "z") and the following special keys (where "kp_"
# is for keypad keys):
#
#   left, right, up, down, enter, kp_enter, tab, insert, del, end, home,
#   rshift, shift, ctrl, alt, space, escape, add, subtract, kp_plus, kp_minus,
#   f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12,
#   num0, num1, num2, num3, num4, num5, num6, num7, num8, num9, pageup, pagedown,
#   keypad0, keypad1, keypad2, keypad3, keypad4, keypad5, keypad6, keypad7, keypad8, keypad9,
#   period, capslock, numlock, backspace, multiply, divide, print_screen, scroll_lock,
#   tilde, backquote, pause, quote, comma, minus, slash, semicolon, equals, leftbracket,
#   backslash, rightbracket, kp_period, kp_equals, rctrl, ralt
#
# Keyboard input, Joypad and Joyaxis will all obey the "nul" bind, which disables the bind completely,
# rather than relying on a default.
input_player1_a = "x"
input_player1_b = "z"
input_player1_y = "a"
input_player1_x = "s"
input_player1_start = "enter"
input_player1_select = "space"
#input_player1_l = "alt"
#input_player1_r = "ctrl"
input_player1_left = "left"
input_player1_right = "right"
input_player1_up = "up"
input_player1_down = "down"
# input_player1_l2 =
# input_player1_r2 =
# input_player1_l3 =
# input_player1_r3 =

HerrOttesen
Posts: 2
Joined: Sat Mar 10, 2018 7:44 am
Has thanked: 1 time
Been thanked: 1 time

Re: 1.44" 128x128 pi zero hat

Post by HerrOttesen » Sun Mar 11, 2018 1:54 am

VideoToGif_GIF.GIF
VideoToGif_GIF.GIF (3.93 MiB) Viewed 3258 times
Thank you SO much!!!

egrojselarom
Posts: 1
Joined: Thu May 17, 2018 9:55 pm

Re: 1.44" 128x128 pi zero hat

Post by egrojselarom » Thu May 17, 2018 9:58 pm

plase
you could share you .img

Holocron
Posts: 2
Joined: Tue Sep 25, 2018 9:08 am

Re: 1.44" 128x128 pi zero hat

Post by Holocron » Tue Sep 25, 2018 9:10 am

I'm a complete noob at these kinds of things, and I really need your help. Where and how do you enter all this code?

ptitneo
Posts: 10
Joined: Fri Jun 17, 2016 4:53 pm
Has thanked: 5 times
Been thanked: 1 time

Re: 1.44" 128x128 pi zero hat

Post by ptitneo » Sun Sep 30, 2018 3:31 pm

Hello,

First off, thanks a ton @JamesW for the details.

However, I have a problem with this 1.44" LCD Hat on a Pi Zero W. The color flickers..



It's like some of the signal got lost, as if color depth was dropping sporadically. It's particularly frequent in Retropie (ES and retroarch).

I tried both a fresh raspbian lite + these instructions and a TinyPi image with JamesW's changes above. This glitch occurs in both cases.
Could it be related to system activity? For example, in console this occurs much less often than in Retropie, but I can still trigger that glitch by just opening a text file, or connecting over ssh. It also happens noticeably when starting a video with omxplayer or a gif with FBpyGIF.

I thought, maybe this LCD is defective somehow, or maybe the power supply isn't good, but I tried with a Pi 2B using the the same SD card, same power supply and power cable: it works perfectly despite the additional power draw of the Pi2 vs the Pi Zero.

Then I thought okay, then it has to be the WiFi or BT causing some noise; but I disabled both to no avail. Heck, I even soldered headers on a Pi Zero 1.3 (no W), put the hat and the SD in it, and got the exact same result. I also updated the firmware on both Zeroes.

Would somebody here know what could cause this glitch in the Pi Zero (W or otherwise) ?

User avatar
moosepr
Posts: 513
Joined: Wed Jan 25, 2017 6:18 am
Has thanked: 69 times
Been thanked: 238 times
Contact:

Re: 1.44" 128x128 pi zero hat

Post by moosepr » Mon Oct 01, 2018 5:11 am

My first thought is to check the speed, you might has a screen that doesnt like the speed you are using
Get a small cheep LCD in your project https://www.sudomod.com/forum/viewtopic.php?f=22&t=2312
Wrap it all round a battery https://www.sudomod.com/forum/viewtopic.php?f=13&t=2292
Or use a custom PCB to make it really small https://www.sudomod.com/forum/viewtopic.php?f=13&t=2512
or make it really really really really tiny!! https://www.sudomod.com/forum/viewtopic.php?f=13&t=2919

ptitneo
Posts: 10
Joined: Fri Jun 17, 2016 4:53 pm
Has thanked: 5 times
Been thanked: 1 time

Re: 1.44" 128x128 pi zero hat

Post by ptitneo » Mon Oct 01, 2018 6:16 am

moosepr wrote:
Mon Oct 01, 2018 5:11 am
My first thought is to check the speed, you might has a screen that doesnt like the speed you are using
Thanks for the advice. I assume you are referring to the speed in /etc/modprobe.d/fbtft.conf. I used the param from this thread (speed=40000000) which also matches the one given in waveshare's blog post. I have no idea what other values to try though (or what impact to expect).

Edit: I randomly tried speed=20000000 and it works! Thanks a lot moosepr!

User avatar
moosepr
Posts: 513
Joined: Wed Jan 25, 2017 6:18 am
Has thanked: 69 times
Been thanked: 238 times
Contact:

Re: 1.44" 128x128 pi zero hat

Post by moosepr » Tue Oct 02, 2018 7:30 am

awesome news!! you could try playing with the value. It will impact the speed of the comunication if its low, stopping you being able to get a good fps.

The number is used to calculate the multiplier that gets used in the actual communication speed, so it is actually impacted by the cpu clock speed. If you have any overclocking in place, the multiplier doesnt change, so you will end up with a higher speed comunication and thus upsetting the screen, so you may need a lower speed value

if that makes any sense :P
Get a small cheep LCD in your project https://www.sudomod.com/forum/viewtopic.php?f=22&t=2312
Wrap it all round a battery https://www.sudomod.com/forum/viewtopic.php?f=13&t=2292
Or use a custom PCB to make it really small https://www.sudomod.com/forum/viewtopic.php?f=13&t=2512
or make it really really really really tiny!! https://www.sudomod.com/forum/viewtopic.php?f=13&t=2919

ptitneo
Posts: 10
Joined: Fri Jun 17, 2016 4:53 pm
Has thanked: 5 times
Been thanked: 1 time

Re: 1.44" 128x128 pi zero hat

Post by ptitneo » Tue Oct 02, 2018 10:47 am

Very interesting. thanks for the insights, I will keep that in mind.

Holocron
Posts: 2
Joined: Tue Sep 25, 2018 9:08 am

Re: 1.44" 128x128 pi zero hat

Post by Holocron » Tue Oct 09, 2018 11:43 am

Mr.Moosepr, I keep on having touble actually downloading the tinipi image. Even with my normal retropie installed, I still cant seem to figure out how to get the gpio pins set up properly.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests