Wiznet makers

jaden

Published September 20, 2023 ©

72 UCC

13 WCC

49 VAR

0 Contests

0 Followers

0 Following

Let's control the ILI9341 LCD using TCP communication!

RP2040 + ILI9341 LCD control through W5100S

COMPONENTS Hardware components

WIZnet - W5100S-EVB-Pico

x 1


HiLetGo - 2.2 inch SPI TFT LCD Display Module 240x320

x 1


PROJECT DESCRIPTION

Hello!

This project involves TCP data transmission and LCD control using a 2.2" ili9341 TFT LCD and W5100S-EVB-PICO.

The wiring between the 2.2" ili9341 TFT LCD and the W5100S-EVB-PICO is as follows:

                 LCD              |              W5100S-EVB-PICO

                MISO            |                          GP11

                MOSI            |                          GP12

                 SCK             |                           GP10

                RESET          |                          GP14

                   CS              |                          GP13

                DC/RS          |                          GP15

To account for situations where the power supply from the W5100S-EVB-PICO to the LCD might be insufficient, we powered the LCD using a 5V to 3V3 LDO. The LED pin is connected to 3V3 through a 100-ohm resistor.

For the LCD library, I used a pretty well organized library on Github.
(Shout out to Shawn Hyam for this one!)

 

While most projects based on the RP2040 utilize only one of its cores, this project maximizes performance by leveraging both cores offered by the RP2040 chipset. Core0 handles TCP communication with the server using the W5100S-EVB-PICO, while Core1 controls the 2.2" ili9341 TFT LCD.

Below are the demonstration video and a description of its features:

Upon booting, the IP and PORT set on the W5100S-EVB-PICO are displayed on the LCD.

Once connected to the Server, it displays the message "Server connected".

After the connection, data sent from the server is displayed on the LCD.

When the "help" command is sent from the server, the LCD displays the usage instructions for commands that can change the text color and background color on the display.

There are a total of 16 colors available, which can be applied to both text and its background:
BLACK, BROWN, RED, BLUSH, GRAY, DESERT, ORANGE, YELLOW, WHITE, MIDNIGHT, DARK_SLATE_GRAY, GREEN, YELLOW_GREEN, BLUE, PICTON_BLUE, PALE_BLUE


ex)

The command to change the text color to BLACK is set_fg_BLACK, and the command to change the text background color to RED is set_bg_RED.

In the demonstration video, you can observe the text and background colors changing according to the commands.

 

Additionally, if the connection with the server is lost, it displays "Lost connection". Upon reconnection, it displays "Server Connected" just like the initial connection.

This project elevates a basic TCP Client by allowing it to display server-transmitted data on the LCD and adds command functionality to change the LCD text color. With its C implementation using a third-party LCD library, structured with a CMakeList in VSCode, this project can serve as a valuable reference for users with similar setups using PICO and W5100S-EVB-PICO.


안녕하세요!

이번 프로젝트는 2.2" ili9341 TFT LCD와 W5100S-EVB-PICO를 사용한 TCP 데이터 전송 및 LCD 제어입니다.

 2.2" ili9341 TFT LCD와 W5100S-EVB-PICO의 결선은 아래와 같습니다.

                 LCD              |              W5100S-EVB-PICO

                MISO            |                          GP11

                MOSI            |                          GP12

                 SCK             |                           GP10

                RESET          |                          GP14

                   CS              |                          GP13

                DC/RS          |                          GP15

LCD의 전원은 W5100S-EVB-PICO의 전원이 부족할 상황을 대비하여 5V to 3V3 LDO를 사용하여 공급하였고 LED 핀은 100옴을 통해 3V3과 연결됩니다.

LCD 라이브러리는 Github에서 꽤 잘 정리된 라이브러리를 사용했습니다.
(Shawn Hyam에게 감사의 인사 드립니다!)

 

대부분의 RP2040 기반 프로젝트는 하나의 코어만을 활용하며 제작되지만, 이 프로젝트는  RP2040 칩셋에서 제공하는 두 개의 코어를 전부 활용하여 성능을 극대화하였습니다. Core0에서는 W5100S-EVB-PICO를 이용해 서버와 TCP 통신을 처리하며, Core1에서는 2.2" ili9341 TFT LCD를 제어합니다.

아래는 동작 영상과 기능에 대한 설명입니다.

부팅시 W5100S-EVB-PICO에 설정된 IP와 PORT가 LCD에 출력됩니다.

이후에 Server에 연결되면 "Server connected" 문구를 출력합니다.

연결된 후에는 서버에서 보내는 데이터를 LCD에 출력하게 됩니다.

"help" 를 서버에서 보내면 LCD에 표시되는 문자의 색상과 문자 배경색을 변경할 수 있는 커멘드 사용법을 출력합니다.

 

색상은 총 16가지이며 이 색상들은 문자 배경과 문자 색상에 적용할 수 있습니다.
BLACK
BROWN
RED
BLUSH
GRAY
DESERT
ORANGE
YELLOW
WHITE
MIDNIGHT
DARK_SLATE_GRAY
GREEN
YELLOW_GREEN
BLUE
PICTON_BLUE
PALE_BLUE

문자 색상을 BLACK로 변경하는 커멘드는 **set_fg_BLACK** 이고
문자 배경 색상을 RED로 변경하는 커멘드는 **set_bg_RED** 입니다.

동작 영상에서 커멘드에 맞게 문자 색상과 문자 배경 색상이 바뀌는 것을 확인할 수 있습니다.

 

이외에 서버와 연결이 끊기면 Lost connection을 출력하고 다시 연결될 때에도 처음 서버와 연결되었을 때와 동일하게 Server Connected가 출력됩니다.

 

본 프로젝트는 단순한 TCP Clinet에 서버에서 전송하는 데이터를 LCD에 표시하는 기능에 커멘드를 추가하여 LCD 문자 색상을 변경할 수 있도록 하였고, VScode에서 CMakelist를 작성하여 제3자의 LCD 라이브러리를 사용해 C로 구현된 점에서 동일한 환경의 PICO 및 W5100S-EVB-PICO 유저들에게 많은 레퍼런스가 될 수 있는 프로젝트입니다.

Documents
  • Code

Comments Write