Yet Another Pi Zero Portable!!
-
its easy done. there are so many screens and variations of them, its a minefield!!
I used the information from here
http://marcosgildavid.blogspot.co.uk/2014/02/getting-ili9341-spi-screen-working-on.htmlthen used a little reference image to trace things
https://www.element14.com/community/servlet/JiveServlet/previewBody/73950-102-10-339300/pi3_gpio.png
I was managing to get the thing working with the command
sudo modprobe fbtft_device pitft22 (i think, im working from memory here)
then i could mirror the terminal by typing
con2fbmap 1 1
but i was struggling to get things to activate at boot. Doing a bit of googling, i managed to find a video on youtube that had the solution to my problem. The problem is now, i am unable to find the video :( I will have to ssh onto my zero and use the command history and see how i fixed it
-
so now i may also be able to add PCB design to my skillset
https://oshpark.com/shared_projects/BP9tGKag
in theory you can solder a 2.2" ili9341 screen direct to that board, then add wires from there to the pi
the 2.4" and 2.8" screens have an extra 4 pins on the connector, but thats just for the touch, so they could just be snipped off the ribbon (hopefully)
The resister on there is just for the backlight, you can change it to alter the backlight brightness, and it means there is one less pin needed from the pi (so i can use pin#18 for audio)
its the first PCB i have designed, so it may not be perfect, and it is untested, so it could burst int flames, who knows!!
-
@moosepr said in Yet Another Pi Zero Portable!!:
sudo modprobe fbtft_device pitft22
Ah thanks. That's already in the latest kernels, so it can be enabled by adding to config.txt;
dtparam=spi=on
dtoverlay=pitft22
in theory you can solder a 2.2" ili9341 screen direct to that board, then add wires from there to the pi
Haha. Nice little board. But wait! We can ditch the original red pcb and just solder screen ribbon wired direct to the zer0's gpios?
Here is the 2.2" tft without touch screen, just the 9 pins but there's that cap and resistor plus u1, q1, j1 which is not needed?
edit: seems like u1 is a 65z5 +voltage regulator chip which doesn't seem to be present on the 14 pin touch versions.
-
@senkun yeah my board might be a little too minimal, but it's only costing me $2.20 for 3, so it's worth a punt. The only down side is the wait.
If it does work, I'm planning on making a custom board that will will link it all together into one. 2.2 screen on the front, some buttons on the button in a DMG-01 layout.
-
@moosepr said in Yet Another Pi Zero Portable!!:
@senkun yeah my board might be a little too minimal, but it's only costing me $2.20 for 3, so it's worth a punt. The only down side is the wait.
If it does work, I'm planning on making a custom board that will will link it all together into one. 2.2 screen on the front, some buttons on the button in a DMG-01 layout.
Apparently these screens will not work unless they're getting a strict 3.3V hence that 65Z5 regulator on board.
I'd say you need to regulate power to it somehow. Take it from the Zer0's 3.3V? You've ordered the boards so it'd be interesting to see if and how well it tolerates fluctuating power directly off a Lipo (from 4.2V max ~ 3V safe cutoff).
While the Zer0 can and has been tested to boot from as low as 2.8V (very unsafe if Lipo) and run unless there are 5v usb peripherals. But you have that charger/protector module (I think that cuts at 3.2V) and you've tested it running from just the Lipo with memory sticks and wi-fi dongle. So everything should still work if the screen is tolerant.
-
@senkun
I am running my screen from the 3.3v line on my zero anyway, so I'm assuming everything will be OK without regulation.Your brave ordering my boards! I couldn't find a proper connector in fritzing so i had to hand build one from the normal pads. There are some things quite close together, so it will need to be tested for shorts.
-
hey how's it going?
So I finally got hold of them Ilitek screens, one of each size! Been playing around with them, I couldn't find an existing overlay that I could just pop in (thought pitft22 would work but nope). So yeah, probably gonna compile my own dt blob, but went back to fbtft and modprobe to mess around first. Still using gpio 18 for led but gonna reassign and use that for pwm audio out.
The screens are pretty zippy. with buffer throughput set to 32k, stable at 48000kHz and probably getting more than 30fps, no flicker, some slight tears only when large blocks are dumped quickly. But the viewing angles in horizontal orientation are terrible! Really bad unless looking straight on. They're all originally used for low end cellphones and designed for vertical viewing, but still good bang for the buck I guess.
All three of my screens seem pretty dark though, how's the backlight levels on yours? Did you play around with different resistors for the leds?
-
Hey man, I'm still watching the door, waiting for a tiny parcel filled with PCB's. I did get a notification the other day that it had been despatched, so it can't be much longer now.
I have noticed the tearing in fast and full screen changes, but there is nothing major. I have only used gpio 18 for the backlight, that seems to use a transistor and a few little resistors, so is pretty much 3.3v going in there. The screens don't have brilliant viewing angles yeah, but I guess you get what you pay for eh? The best in my option is oled. Viewing angles are always amazing because of the way they work, but they are hard to find and expensive.
-
Haha if it's from OSH all the tiny pcbs are gonna be floating loose in an envelope. I was thinking of soldering directly to the ribbon but I see now why you did the pcbs.
-
@senkun yeah i think hand soldering cables to 0.8mm pitch flex cables is a bit of a push :P
-
How did you use the microcontroller as a power switch?
Did you use a mosfet?
Can you please share the code?Also, I noticed you didn't use a power boost module or a regulator, can the screen run directly from the battery voltage which is under 5V?
Thank you
-
@pikgoggle i used a little board from DFRobot called uHex http://www.dfrobot.com/index.php?route=product/product&product_id=1266
it is basically an arduino, with a little MOSFET built in, and you can use its library to make it sleep/wake and when it is asleep, the 6 power ports are off. The code is a little basic at the moment, and is not without its flaws. the wake interrupt fires instantly, and the pi starts to boot before the code has chance to check for a long press. Also as soon as the board gets power, the pi will also start to boot, so if the battery protection kicks in, its hard to get it all to actually charge (gets stuck in a loop of charge/protect) I also planned on adding a neopixel in there, so i could get power metering, and adding connection to the pi to check for the pi being on/ and offering safe shut down. I did start adding that into the code, but never got to finishing it. You can have a butchers at it here https://drive.google.com/file/d/0B8-rbOfCiqw0MkRiYnFqbU1MWk0/view?usp=sharing
@senkun the post man came today!! Although i have some family moving in with me soon, so im not sure when i will have the time :(
-
@moosepr if you just want a power switch, if your mechanical switch can't handle the current, you can use this circuit:
http://www.falstad.com/circuit/circuitjs.html?cct=$+1+0.000005+10.20027730826997+50+5+43 s+160+112+224+112+0+1+false r+384+112+384+256+0+10000000 g+384+256+384+288+0 v+160+240+160+112+0+0+40+5+0+0+0.5 g+160+240+160+304+0 w+464+128+464+208+0 w+160+112+160+32+0 w+160+32+464+32+0 w+464+32+464+96+0 w+464+208+464+272+0 r+464+272+464+336+0+100 g+464+336+464+384+0 w+384+112+224+112+0 f+384+112+464+112+1+1.5+0.02 o+10+64+0+35+5+0.05+0+-1the PMOS transistor is used to drive the high current, while the mechanical switch only activates the gate with a low current.
The 100ohm resistance represents the load.
It can be done with NMOS too. -
@pikgoggle I will look at that, thanks
I think the problem i have with the uHex board is that the switching happens within the library, so you are not able to wake the board then decide if you want to activate the outputs or not. dfRobot claim that it can switch up to 2A
-
@moosepr I looked at the uhex schematic and the power switch is connected to PD7 of the Atmega328P.
It is the same pin as analog 1 (A1).
You can try setting the PORTD register by the following code:
// in setup, set pd7 to output
DDRD|=B10000000to turn off the power output use this:
//set pd7 low
PORTD&=B01111111when you ready to power on this will activate power:
//set pd7 high
PORTD|=B10000000I couldn't find in the library that PD7 is changed, so tell me if it works.
-
@moosepr said in Yet Another Pi Zero Portable!!:
the post man came today!! Although i have some family moving in with me soon, so im not sure when i will have the time :(
I love when Santa the postman brings toys! It's a quick desolder/solder job, 30 mins tops, use plenty of flux when you wipe! Do it now, haha I can't wait to see your panel stripped off the board! Just one thing to note, make sure you have a resistor to the backlight LED.
-
I just ordered one of those 2.2" displays from eBay. Were drivers for it already in the RetroPie image, or did you end up downloading them from somewhere else? Apologies for the noob question, I'm new to this hardware stuff.
-
@obsidianspider said in Yet Another Pi Zero Portable!!:
I just ordered one of those 2.2" displays from eBay. Were drivers for it already in the RetroPie image, or did you end up downloading them from somewhere else? Apologies for the noob question, I'm new to this hardware stuff.
Best bang for the buck generic screens. Besides the fixed SPI connections, the other GPIO connections (led, rst, dc, etc.) can be hooked up any which way you choose, so there really aren't any specific drivers built into the kernel. But Notro has drivers provided for some named brand screens which use the same controller, which would work if we dig through the overlay sources and check for the specified connections to hook up our screens accordingly. That sort of limits the flexibility.
I'm still playing about setting up my screen and seeing if I can get enough free pins for GPIO controls, or give up and use USB. And then will make my own dt blob specific for my setup. So in the meantime, we're using fbtft by manually loading the module.
Have a read here;
http://marcosgildavid.blogspot.tw/2014/02/getting-ili9341-spi-screen-working-on.html -
Thanks, that gives me something to look through while I wait the week or so that eBay says it will take for the screen to get here. I want to use this small screen to display an image of the game's art when I start a game with EmulationStation. (I saw in another post some info about using runcommand to run something when you start or exit a game.) I want the main game video to output to HDMI, so that's a whole other thing to figure out.
-
@obsidianspider the drivers for the screen are already included in RetroPie (as long as the screen uses the ili9341 driver). it basically uses the same screen as early adafruit 2.2" tft screens https://github.com/notro/fbtft/wiki/LCD-Modules#adafruit-22
If i remember right, you need to go into the raspiconfig, and enable spi, disable overscan, and enable device tree, then you should be able to run the command "sudo modprobe fbtft_device pitft22" to actually get the screen active (the backlight should light). You can test it with the command "con2fbmap 1 1" which should pop your terminal session onto the tft screen (run "con2fbmap 1 0" to get it back)
There is then an app you need to download and build which basically copies the output of the normal screen onto the tft. There is an adafruit guide here, https://learn.adafruit.com/running-opengl-based-games-and-emulators-on-adafruit-pitft-displays/pitft-setup basically replace the adafruit-28 with adafruit-22 and you should get somewhere near
@pikgoggle i will investigate that, i never thought to check the schematic to see whats actually connected where. Im planning on maybe making a custom PCB for it all, so i might replace the uHex with an atTiny85 and a MOSFET and do it all myself (if i ever get round to it)
@senkun thats one of the links i used too!!! Im having to sort the spare room and stuff, so time is very limited at the moment :( wont be forever though. I used the 'Adafruit -Retrogame' for the controls. https://learn.adafruit.com/running-opengl-based-games-and-emulators-on-adafruit-pitft-displays/adding-controls i figured i could squeeze about 14 gpio pins out of it, if you make sure you disable the I2C and serial, you can make use of those pins there
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.