This Clock is using a 320X240 ILI9341 tft lcd connected over SPI. Also the Blupill does have a 32Khz crystal for RTC and a backup CR2032 battery will keep the clock running and the battery backed up RAM with all the settings up and running even when the power is off. A GPS module is used to set the clock and display the QTH locator.
BOM: Bluepill module with 128K flash, even a clone SRM32 will work. 320X240 ILI9341 TFT LCD any size with a 14 pin connector, tested with 2.8' and 3.2 displays'. Neo 6M or 8M GPS module with antenna/ external antenna. Depending on the local conditions and building you may need an external antenna to get a good GPS fix. I will suggest a neo-8M with a full-size patch antenna or external antenna if that will not work inside. DS18B20 temperature sensor with F/C temperature display. 3 push buttons to control the clock and a piezo buzzer for alarm.
The clock has a menu with many options in order to set the time, date, 2 alarms, DST settings and multiple clock faces - Analog, Digital, BCD, GPS details - see attached pictures, display backlight will automatically adjust day/night.
Github link:
https://github.com/Express1/STM32TFTClock
Picture link:
https://github.com/Express1/STM32TFTClo ... SClock.jpg
Bluepill TFT LCD GPS Clock
Re: Bluepill TFT LCD GPS Clock
Very nice! A complete project with STL and documentation.
Thanks for sharing!!
Thanks for sharing!!
Re: Bluepill TFT LCD GPS Clock
Is the TFT LCD that is not ILI9341 also applicable?
Can I also use your program if I have another 320x240 TFT LCD?
Can I also use your program if I have another 320x240 TFT LCD?
Re: Bluepill TFT LCD GPS Clock
Will work if you modify the code as necessary and the display library does support it. The simple answer is no, will not work with another display controller.
-
- Posts: 13
- Joined: Sun Jan 09, 2022 2:56 am
- Location: LaGrange, GA
Re: Bluepill TFT LCD GPS Clock
Hey @raduc, nice implementation! I am building something similar, using Bruce Hall's design at https://www.universal-solder.ca/downloa ... 20Hall.pdf, which uses a WWVB receiver module instead of GPS. I have the WWVB time, display, touch control, and battery backup of RTC & date registers working. It is using the TFT_eSPI library for the display. My next step is to see if I can get the ILI9341 backlight to adjust. I have a 'TFT 2.8 inch red board' that I got from Amazon. I have not had much luck getting information from the manufacturer (or seller) about backlight control, but I do have the ILI9341 datasheet which shows eight backlight control registers. I have to say the power of these new VLSI chips (STM32F family, ILI9341) is amazing!This Clock is using a 320X240 ILI9341 tft lcd connected over SPI. Also the Blupill does have a 32Khz crystal for RTC and a backup CR2032 battery will keep the clock running and the battery backed up RAM with all the settings up and running even when the power is off. A GPS module is used to set the clock and display the QTH locator.
I have examined the TFT_eSPI.h file, and don't see any function definitions that look backlight related, although there appear to be some register control functions that could be used.
Before I download your project from github, I wanted to ask you, are you using the TFT_eSPI library, direct HAL control, or something else for your backlight control? At this point I just want to try a simple test program to see if the board was built to support the ILI9341 backlight control.
Once I get this all figured out, I plan to upload code & pictures to github to share this additional clock project so anyone can build one.
Thanks for your time.
Last edited by pwrgreg007 on Sat Feb 26, 2022 4:02 pm, edited 1 time in total.
Re: Bluepill TFT LCD GPS Clock
Display brightness is controlled by a pwm signal, display pin 8, led backlight.
-
- Posts: 13
- Joined: Sun Jan 09, 2022 2:56 am
- Location: LaGrange, GA
Re: Bluepill TFT LCD GPS Clock
@raduc Thanks for your feedback. After searching for a couple days, I found many references to PWM code for Arduino and Blue Pill. One youTube video shows using pwmWrite() function, but STM32 core library doesn't seem to support it: I get 'not declared in this scope'. What I'm trying to do (simple explanation) is use a photocell on an analog input, and output a corresponding brightness to the TFT LED backlight. My TFT board does appear to support this (on pin 8), and I would say it is transistor controlled, since the pin sinks only 2.6 mA when connected to 3.3 v. The PWM signal does not need to be super-precise, as long as it's consistent when set. And it doesn't have to be fast, only enough to overcome persistence-of-vision sensitivity to flickering, so 100 Hz (give or take) would be fine. I'm lazy so I'm looking for the simplest way to do this (if there is such a thing).
I see a function analogWrite() in the Arduino reference, which sounds like it'd work, but STM32 isn't in the boards list.
In the Arduino (using 1.8.19 on Windows) library manager are "STM32_PWM" and "STM_Slow_PWM." Are either of these good to use for my application? Is there something better? Do I need to use a timer? I am using SPI already for TFT, and TIM3 for a periodic interrupt. There's so much conflicting information out there, I will have to rely on forum members to help me out. I'd like to use the latest builds if possible. I am using STM core library 2.2.0. A pointer to sample code for Blue Pill would be awesome.
Thanks - Greg
I see a function analogWrite() in the Arduino reference, which sounds like it'd work, but STM32 isn't in the boards list.
In the Arduino (using 1.8.19 on Windows) library manager are "STM32_PWM" and "STM_Slow_PWM." Are either of these good to use for my application? Is there something better? Do I need to use a timer? I am using SPI already for TFT, and TIM3 for a periodic interrupt. There's so much conflicting information out there, I will have to rely on forum members to help me out. I'd like to use the latest builds if possible. I am using STM core library 2.2.0. A pointer to sample code for Blue Pill would be awesome.
Thanks - Greg
Re: Bluepill TFT LCD GPS Clock
@pwrgreg007
Use standard Arduino function analogWrite(). You won't find any non-Arduino boards in Arduino reference.
e.g: for 50% duty cycle
Default frequency is 1kH but you can change by calling analogWriteFrequency() before analogWrite(), e.g:
Use standard Arduino function analogWrite(). You won't find any non-Arduino boards in Arduino reference.
e.g: for 50% duty cycle
Code: Select all
analogWrite(PA3,127);
Default frequency is 1kH but you can change by calling analogWriteFrequency() before analogWrite(), e.g:
Code: Select all
analogWriteFrequency(250);
analogWrite(PA3,127);
-
- Posts: 13
- Joined: Sun Jan 09, 2022 2:56 am
- Location: LaGrange, GA
Re: Bluepill TFT LCD GPS Clock
@GonzoG Thanks, that works!