Recently, I have felt the weather changing from hot to cold, and my weight changing frequently too, but there are no thermometers and weight scales in the company.
Hi everyone, after learning that many simple sensors, such as temperature sensors and weight sensors, can convert the measurement results into voltage output, I want to make a thermometer and a weight scale using some sensors and an ESP32 board. In addition, for easier viewing of results, I want to display the results on the screen.
So, today, I will share how I display the voltage change on the screen.
The Arc value changed when I move the lever of Mabee_Slide Potentiometer, this is a good sign, I think I will get my thermometer and my weight scale in the near future.
However, except for thermometer and weight scale, I think the 1.28 inch screen with ADC can be used for more interesting creation. So, do you have any better ideas?
The "TFT_eSPI" library was created created when Squareline exports the project file, we need to modify the "Users_Setup.h" file of it, because every development board has different screen drivers IC, The ESP32-S3 1.28" use the GC9A01 as drivers IC, So define this driver.
Define GC9A01_DRIVER, and define the pixel width and height in portrait orientation for GC9A01
Then set the drive pin according to the schematic diagram
#define TFT_MOSI 13 // In some display driver board, it might be written as "SDA" and so on.#define TFT_SCLK 14#define TFT_CS 15 // Chip select control pin#define TFT_DC 21 // Data Command control pin#define TFT_RST 11 // Reset pin (could connect to Arduino RESET pin)#define TFT_BL 45 // LED back-light
In Section 3. Define the fonts that are to be used here. We chose a variety of fonts to prevent them from being used without initializing them
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded// this will save ~20kbytes of FLASH#define SMOOTH_FONT
The touch panel driver is CST816S, so it need to call the touch function of CST816S.
Choose the Arduino and enter in parameters. According to the features of MaTouch_ESP32-S3 Round SPI TFT with Touch 1.28", the resolution is 240*240, the shape is a circle, and the color depth is 16-bit.
Design the screen
Add the images to assets, and then it allows you to select them and widget components to design the scenes. After, clicking the widget of the list on the Hierarchy panel, you can modify the parameters of the select widget on the Inspector panel, all is determined by your preference.