Open Rodnehh opened 1 year ago
My code is based on CircuitPython and associated libraries. Are you able to load and run CircuitPython on that board?
If so, then let me know how you have the display wired to it.
I did manage to load circuitpython on it. I've taken all the steps to install and put the files on the board. Ive also edited the code.py file.
Added is the picture if how i wired it up. I tried the screen with an arduino test earlier and it did work with the graphicstest sketch.
Quick look at the wiring it looks like you have pins 3 and 10 swapped, but it is hard to tell. I would expect the brown wire to go to the LED pin on the display and the white wire to go to VCC. The pin naming on the display is I2C not SPI, but I see SPI written there, so I assume that SDA is slave data in for the display. There is no DC pin on the display, so I assume that A0 does the function? Do you have any specs on the display?
The code would need to be updated to drive the right pins. Can you send me code.py? Is there any example code of driving a display with that board we can look at to make sure the right pins are used in the code?
A0 is supposed to be used as DC (has worked on the arduino coding).
I added the manual that i used as an attachment. 1,8 TFT Display_EN (1).pdf
also attached code.py (had to zip it) code.zip
i tried switching pin 3 & 10 but to no avail. The only thing that i thought might be an issue is that in the manual they say that VCC should be 5v. so i have a bidirectional logic shifter on the way to give that a try. With the arduino coding it has worked fine on 3.3v however.
as for the example code; i'm REALLY new to this haha. I have only tried fiddling around with arduino. Is this code fine? graphicstest.zip
Have you ever used MU before? If not, you should probably give it a try with your board connected to your computer so we can make sure the code is running. It has a serial console that will spit out an error as well as the line of code so we can make sure it is not hitting an error even before it tries to display something
I think we will need Mu running and then we can work through any problems that come up. My gut tells me that it is throwing an error before the display init. Regardless though, I think the display init code should be something like this:
Old code: display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=lcd_rst, polarity=spi_pol, phase=spi_phase)
New code: display_bus = displayio.FourWire(spi, command=board.D47, chip_select=board.48, reset=board.D21, polarity=spi_pol, phase=spi_phase)
We will need to work through some combinations of the polarity and phase probably.
i'll give MU a try right away. let me get back to you on that
i'm getting an error stating the following:
code.py output:
Traceback (most recent call last):
file "code.py", rule 111, in
Code done running
Change this line: vbat_voltage = AnalogIn(board.VOLTAGE_MONITOR) # for measuring battery voltage
To this: vbat_voltage = AnalogIn(board.A1)
Then let's see where the next error is
i now have a solid green light on the S3. In Mu it doesnt show any errors anymore. it only says "code stopped by autoreload.reloading soon". Screen is still white though.
OK, did you make this other change?
display_bus = displayio.FourWire(spi, command=board.D47, chip_select=board.48, reset=board.D21, polarity=spi_pol, phase=spi_phase)
i see that for some reason that one reverted to the old one. I changed it back now and now it states
"module does not have attribute D47"
I think you need to change this as well:
Old code: spi = board.SPI()
New code: spi = busio.SPI(clock=board.D12, MOSI=board.D11, MISO=board.D13)
i changed that too. Now it says busio is not defined
Try GP47 or IO47
This is where I need an example of CircuitPython for your board. They don't have any code samples for it? Those labels are board specific, so I'm just guessing at the names
Same thing for all of the other labels like D12, D11, etc.
Add this near the top
import busio
You're amazing friend. it works! Thank you very, very much!
it was the IO.
The images are loading now, but it "flashes" when it changes to the next set of characters. Do you know if there's anything i can do to make it more smooth?
Can you post a video of what the flashing looks like?
I'm thinking it might be related to the refreshrate of the images since they change fairly quickly?
I have not seen that before. The only thing I can think of is try selecting one of these options:
SPI_COM = "Adafruit" # SPI bus polarity=0 and phase=0 for an Adafruit LCD
Comment out the Adafruit one and try one of the Alt ones (one at a time).
unfortunately that does not fix it. The adafruit one, Alt2 and Alt3 all show the lines.
It's unique to that board, probably the graphics library for that board. I have not seen that flash with all of the boards and displays I have tested. BTW the code base you have is older, you can try the V2 I posted a while ago, but it would need to be fixed again to work with your board.
would that be mandoputer v6.zip?
No, that is 2 years old
i tried editing the V2, but i think there needs to be some more editing to that file. for example i have the 1.8" screen. Im gonna stick with the old one for now, thanks a lot!
Send me your code.py again, and I'll integrate the changes into the new code tomorrow. I'm getting my kids to bed, but it should not take me long to integrate tomorrow. Since I do not have your board you'll have to be my tester :)
Do you mean the code we just edited and works now? if so the attached file is the working one.
Thanks for your efforts! working code.zip
Give this a try. Copy all files and replace existing ones. Open with Mu and we can work through the errors. LolinS3-18.zip
You'll need CircuitPython 8 or later on your board
I copied the files onto the board and in Mu the first error is
rule 25: import error: no module with name adafruit_ssd1331
I'm a dumbass, copied the wrong file into the zip. Try this LolinS3-18.zip
haha shit happens. now it says rule 284: runtimeError: Brightness is not adjustable
Just need code.py this time. Give it a shot
rule 311: NameError: name "offset" is not defined
Add a line of code (offset = 6) around line 215:
Old: display = ST7735R(display_bus, rotation=180, width=160, height=128) font = bitmap_font.load_font("mandalor120.bdf") # 128 pixel tall bitmap font
New: display = ST7735R(display_bus, rotation=180, width=160, height=128) font = bitmap_font.load_font("mandalor120.bdf") # 128 pixel tall bitmap font offset = 6
its showing the symbols now, but sizing seems off and theres a prompt on the top of the screen.
Can you send me a picture? Is the orientation correct?
im uploading a video :) one sec.
try offset = 0 instead of offset =6
I think I need to get you a smaller font as well
around line 214 change the font name to this:
font = bitmap_font.load_font("mandalor82.bdf") # 128 pixel tall bitmap font
We'll have to dial in the best sized font for your setup
oof, this one looks distorted haha. i also still have the bar on the top of te screen
Line 213 let's swap the width and height
old: display = ST7735R(display_bus, rotation=180, width=160, height=128)
new: display = ST7735R(display_bus, rotation=180, width=128, height=160)
that seems to have fixed it. The only thing that remains for me is the flicker when it does the sequence. whenever it changes to the next image, theres the flicker. Besides that: working like a charm!
Did you end up with offset = 6 or offset =0?
I'll see if I have a display here that uses the ST7735R driver and see if it has flicker. Can you send me a link to the display? I think this is close to the Adafruit 1.8", but different
Hey Breazile, first of all; thanks for your work, from what i've seen it looks awesome!
I have a question for making my own mandoputer. I'm trying to run it on a "Wemos Lolin s3 pro" with a breakout shield with SD (ST7735) without sd connection. I happened to have these around and wanted to see if i could get it to work. Unfortunately i havent been able to get it running just yet. My screen is connected correctly, but it doesnt show anything. Could this be driver related? I'm not very familiar with microcontrollers.
Thanks in advance!