Numeric keypad with touch screen

Numeric keypad with touch screen Usually, each key of such a keyboard is assigned to perform its own task. One keystroke launches a macro, speeding up the workflow.
This is very convenient if you need to switch between tasks.
Tools and materials: -Raspberry Pi Pico; -LCD module with a touch panel; -Soldering iron; -Preparation devices wires; -3D-printer;
< img class = "aligncenter" alt = "Numeric keypad with touch screen" src = ""/> Numeric keypad with touch screen Step one: scheme
There are several installation options. A breadboard can be used, or a PCB can be ordered specifically to connect the ILI9488 + touch to the Pi Pico. Of course, it is more practical to make a board.
The screen operates at 3.3 V.
The connection is as follows:
Pi Pico – & gt; TFT:
3.3V – & gt; VCC and LED
GND – & gt; GND
GP20 – & gt; CS
GP21 – & gt; RESET
GP22 – & gt; DC/RS
GP3 – & gt; SDI (MOSI) and T_DIN
GP2 – & gt; SCK and T_CLK
GP14 – & gt; T_CS
GP0 – & gt; T_DO
GP15 – & gt; T_IRQ
SDO (MISO) is not used for the TFT screen, so there is one unconnected contact on the TFT module.
Numeric keypad with touch screen Numeric keyboard with touch screen Numeric keypad with touch screen Numeric keyboard with touch screen Step two: case
After assembling the circuit, the master designs the device case. In principle, any convenient plastic box can be adapted for the case. If the user decides to print the corpus, the file can be downloaded here.
Numeric keypad with touch screen  Numeric keypad with touch screen Numeric keypad with touch screen Step Three: Installing Arduino IDE Libraries
This assembly uses the arduino-pico core. < br> Go to Arduino – & gt; Preferences and click the Board Managers icon. Copy and paste the following link:

 https & # 58; //  

Confirm twice (OK). Go to Tools – & gt; Board: – & gt; Board Manager and find “pico”. Install the latest “Raspberry Pi Pico/RP2040” and click “Close”.
At the time of this writing, Pi Pico support in TFT_eSPI is not available through the Library Manager. But the installation is very simple.
Go to, click “Code” and “Download .ZIP”. In Arduino IDE go to Sketch – & gt; Include Library – & gt; Add .ZIP library. Find the library you just loaded and click “Choose”.
Numeric keypad with touch screen Numeric keypad with touch screen Step four: download sketch
A sketch of a simple macro keyboard can be downloaded here.
For this sketch to work with the Pi Pico, you need to configure the TFT_eSPI library. To do this, open the file in a text editor: /Documents/Arduino/libraries/TFT_eSPI/User_Setup.h
Select the text and delete it. Copy the below code and paste it into User_Setup.h file:

 //Stripped down User_Setup.h version for the Pico-Matrix-Touch-Keyboard //& lt; br & gt; #define ILI9488_DRIVER //WARNING & # 58; Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high) #define TFT_MISO 0 #define TFT_MOSI 3 #define TFT_SCLK 2 #define TFT_CS 20 //Chip select control pin #define TFT_DC 22 //Data Command control pin #define TFT_RST 21 //Reset pin (could connect to Arduino RESET pin) #define TOUCH_CS 14 //Chip select pin (T_CS) of touch screen #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 & # 58; -. Apm #define LOAD_FONT7 //Font 7. 7 segment 48 pixel font, needs ~ 2438 bytes in FLASH, only characters 1234567890 & # 58; -. #define LOAD_FONT8 //Font 8. Large 75 pixel font needs ~ 3256 bytes in FLASH, only characters 1234567890 & # 58; -. //# 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 # define SPI_FREQUENCY 70000000 //Optional reduced SPI frequency for reading TFT #define SPI_READ_FREQUENCY 20000000 //The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here & # 58; #define SPI_TOUCH_FREQUENCY 2500000  

Save the file.
Numeric keypad with touch screen Step five: Pico firmware
Opening “Pico-Martix-Touch-Keyboard.ino”, go to “Tools” – & gt; “Boards” and select “Raspberry Pi Pico”.
Here you can leave all the default settings, except for “Flash Size”. The keyboard sketch needs a small amount of file system storage to store the calibration data that is generated the first time it is run. So, in the “Flash Size” section, select “2 MB”.
Before flashing, you need to edit the code and install, you need functions that will run when you press the keys.
Values ​​are set in the buttonpress () function. The wizard provides some examples below.
To send will assign ALT, CTRL, Shift, etc.: ();
To assign letters or numbers:
Keyboard.print ();
For Enter, escape, F1, etc.:
Keyboard.write ();
To upload a thumbnail of the keyboard, just click “Upload”. The device should turn on and the calibration screen will open. The calibration is only done the first time you run the sketch, but you can always repeat it later by setting “#define REPEAT_CAL false” to true.
After the calibration is complete, your computer should recognize that a new USB keyboard is connected to it.
Numeric keyboard with touch screen  Numeric keypad with touch screen Everything is ready. You can assign the launch of any programs, functions, actions to the keyboard.
In the video below you can watch the assembly, programming and operation of the device.


Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button