dave windymiller Posted January 14, 2021 Author Share Posted January 14, 2021 Thanks to Steve J’s comments ive been playing with a ESP32 processor and managed to adapt the two screens ive done thus far onto it. These processors are a bit of a faf to get set up within the arduino IDE program but once sorted, almost as easy as the arduinos. Different librarys are needed and some instructions needed altering to get them to work. It takes longer to compile being a 32 bit dual core processors but the compile also appears to compress the programs/memory requirements at the same time! Once compiled and running, it quickly became clear that these chips are in a different league performance wise. I also played with the size of the bitmap image and it happily copes with the weather now occupying a full 240x240 and still has memory room for graphics on top. I have an stm32 on order to play with and this looks to be a similar size to the arduino but similarly a lot more powerful! Quote Link to comment Share on other sites More sharing options...
dave windymiller Posted January 14, 2021 Author Share Posted January 14, 2021 Whilst playing I also came across code snippets from a clock program that useful for drawing tick marks on a curve which could be easily adapted. // Draw 12 lines for(int i = 0; i<360; i+= 30) { // (360/30 = 12! sx = cos((i-90)*0.0174532925); // 0.01745.... is 1 degree in radians sy = sin((i-90)*0.0174532925); // -90 starts drawing at 12oclock. 0 = 3 oclock ! x0 = sx*114+120; // 120 is x and y centre of 240 screen yy0 = sy*114+120; // 114 is outer radius from centre of tick x1 = sx*100+120; // 100 is inner radius from centre of start of tick yy1 = sy*100+120; // 100 – 114 (=14!) is length of tick tft.drawLine(x0, yy0, x1, yy1, GREEN) // colour is declared earlier in program Similar simpler version for dots:- // Draw 60 dots for(int i = 0; i<360; i+= 6) { sx = cos((i-90)*0.0174532925); sy = sin((i-90)*0.0174532925); x0 = sx*102+120; yy0 = sy*102+120; // Draw minute markers tft.drawPixel(x0, yy0, WHITE); // Draw main quadrant dots if(i==0 || i==180) tft.fillCircle(x0, yy0, 2, WHITE); if(i==90 || i==270) tft.fillCircle(x0, yy0, 2, WHITE); There are various number to play with here to create the right screen ! Hopefully some of this will be of help/interest to someone! Cheers Dave Edited By dave windymiller on 14/01/2021 16:30:26 Quote Link to comment Share on other sites More sharing options...
dave windymiller Posted January 22, 2021 Author Share Posted January 22, 2021 This thread has certainly been an education for me! I recently took delivery of two “Blue pill” STM32F103C8T6 processors. At first I couldn’t get them to work which turned out to be an error on the board with R3 being 100kohms and not 10kohms (well done Google for the answer). All that high tech and a stupid fault stops them working!!! Got them from Banggood whose site photos shows the correct size resistor! Anyhow, new resistors inserted and away they went. One web site suggest just shorting the resistor out with solder (didnt try that). You need an ftdi board (search ebay) to program it but you can also upload a bootloader which then allows you to program it via its own usb port just like an arduino. These two sites gave the info i used:- https://www.electronics-lab.com/project/programming-stm32-based-boards-arduino-ide/ https://create.arduino.cc/projecthub/akarsh98/using-a-stm32-like-an-arduino-tutorial-stm32f103c8-1073cb These boards totally outperform arduinos and have much larger memory. They also have two SPI bus connections who’s pins can be relocated too. As such, it is possible to have 2 displays from one chip. This was done using sp1 only but redefining its pins after one screen was drawn. It features a larger bitmap of the weather too. This approach takes a noticeable time to swap from one display to another so probably best to have a static display on screen 1 then an animated one on the second screen rather than keep swapping back & forth? Alternatively you could in theory use spi2 at the same time as spi1 but ive not sussed that yet!! Next post a simple example. Edited By dave windymiller on 22/01/2021 22:10:41 Quote Link to comment Share on other sites More sharing options...
dave windymiller Posted January 22, 2021 Author Share Posted January 22, 2021 This program draws a red plane on screen one and a yellow plane on screen 2 /* STM32F103C8T6 & two ST7789 240x240 displays #01 GND -> GND #02 VCC -> VCC 3.3v (5V is brighter but use at own risk!!!) #03 SCL -> display1 PA5/SCK display2 PB3/SCK #04 SDA -> display1 PA7/MOSI display2 PB5/MOSI #05 RES -> display1 PA0 display2 PA2 #06 DC -> display1 PA1 display2 PA3 #07 BLK -> NC */ #define TFT_RST1 PA0 // dc and rst pins for display1 #define TFT_DC1 PA1 #define TFT_RST2 PA2 // dc and rst pins for display2 #define TFT_DC2 PA3 #define SCR_WD 240 #define SCR_HT 240 #include #include Arduino_ST7789 tft = Arduino_ST7789(TFT_DC1, TFT_RST1); void setup(void) { // draw RED plane ON SCREEN1 tft.init(SCR_WD, SCR_HT); tft.fillScreen(BLACK); tft.fillRoundRect(110, 210, 22, 2, 0, RED); tft.fillRoundRect(120, 205, 2, 22, 0, RED); tft.fillRoundRect(115, 222, 12, 2, 0, RED); // remap SPI1 to new pins Arduino_ST7789 tft = Arduino_ST7789(TFT_DC2, TFT_RST2); afio_remap(AFIO_REMAP_SPI1); gpio_set_mode (GPIOB, 3, GPIO_AF_OUTPUT_PP); gpio_set_mode (GPIOB, 5, GPIO_AF_OUTPUT_PP); // draw YELLOW plane ON SCREEN2 tft.init(SCR_WD, SCR_HT); tft.fillScreen(BLACK); tft.fillRoundRect(110, 210, 22, 2, 0, YELLOW); tft.fillRoundRect(120, 205, 2, 22, 0, YELLOW); tft.fillRoundRect(115, 222, 12, 2, 0, YELLOW); } void loop() { } The above code needs the following library to work Arduino_ST7789_STM.h I can send the files for the twin cockpit displays on request. I think ive taken this as far as i can so thats all folks. Cheers Dave Edited By dave windymiller on 22/01/2021 22:00:34 Quote Link to comment Share on other sites More sharing options...
grandbourgueul Posted April 7, 2023 Share Posted April 7, 2023 Hello, would it be possible to have the files & part lists & schematic to manufacture the same for my RC plane ? Quote Link to comment Share on other sites More sharing options...
dave windymiller Posted April 8, 2023 Author Share Posted April 8, 2023 (edited) https://www.ebay.co.uk/itm/313603433594 https://www.ebay.co.uk/itm/155175349887 I would suggest the single processor for a single display approach as its easier to do. You would need 2 of each above. horizon.zip weather.zip Edited April 8, 2023 by dave windymiller Quote Link to comment Share on other sites More sharing options...
FlyinFlynn Posted April 9, 2023 Share Posted April 9, 2023 12 hours ago, dave windymiller said: https://www.ebay.co.uk/itm/313603433594 https://www.ebay.co.uk/itm/155175349887 I would suggest the single processor for a single display approach as its easier to do. You would need 2 of each above. horizon.zip 2.74 kB · 0 downloads weather.zip 34.32 kB · 0 downloads Let's see how long it takes Aliexpress to come up with this work offered for sale from an 'open source' . Well done Dave for the interesting work. PM sent Dave. Quote Link to comment Share on other sites More sharing options...
dave windymiller Posted April 9, 2023 Author Share Posted April 9, 2023 True, my contribution to the world! Ive had my share of free from various sources over the years so i dont lose sleep! I am in discussion re a 1/4 scale cockpit display array which would be in a different league compared to these! Quote Link to comment Share on other sites More sharing options...
Mike735 Posted September 22, 2023 Share Posted September 22, 2023 2 dave windymiller Thank you very much for the topic. I repeated it and it worked. Question, is it possible to make the radar beam move across the screen? Quote Link to comment Share on other sites More sharing options...
dave windymiller Posted September 23, 2023 Author Share Posted September 23, 2023 Glad it worked for you. The radar screen i did doesn't scan on the screen in true life I believe. I'm sure others would correct me if wrong. I would have to see a display functioning and have the time, need & desire to replicate it (which i dont!). Its very possible but not by me as i want to get on with my other long suffering projects! Its a good way to learn by trying different approaches and start simple before adding the bells and whistles. (try having a line that moves in a scanning motion on its own, no other detail!). There are many examples on the web of watch screens with hands that move. You could try one of these then simplify it to gain understanding of the method and perhaps alter it to suit? An animation on these screens sizes would probably be acceptable if there were say only 10 discrete lines stepping across the screen(?). The line could be yellow (say) and when the next line is to be drawn, draw lines over the old yellow line with colours that match what should be underneath. I believe some approaches can read the colours (colour codes) along a path and save them to redraw it again later? I suspect you would have to use one of the faster processors so it can update the screen seamlessly. Best of luck Dave Quote Link to comment Share on other sites More sharing options...
Mike735 Posted September 23, 2023 Share Posted September 23, 2023 Ok. Thank you. Quote Link to comment Share on other sites More sharing options...
Martian Posted September 28, 2023 Share Posted September 28, 2023 hi Dave have sent you a message Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.