Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ jobs:
target: esp32s3
- path: 'components/event_manager/example'
target: esp32
- path: 'components/expressive_eyes/example'
target: esp32s3
- path: 'components/file_system/example'
target: esp32
- path: 'components/filters/example'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/upload_components.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
components/esp-box
components/esp32-timer-cam
components/event_manager
components/expressive_eyes
components/file_system
components/filters
components/format
Expand Down
5 changes: 5 additions & 0 deletions components/expressive_eyes/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
idf_component_register(
INCLUDE_DIRS "include"
SRC_DIRS "src"
REQUIRES base_component
)
45 changes: 45 additions & 0 deletions components/expressive_eyes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Expressive Eyes Component

[![Badge](https://components.espressif.com/components/espp/expressive_eyes/badge.svg)](https://components.espressif.com/components/espp/expressive_eyes)

The `ExpressiveEyes` component provides animated expressive eyes for displays
using simple blob shapes. Eyes can blink, look around, change expression, and
display various emotions with smooth animations.

The component uses a callback-based drawing system, allowing you to implement
custom renderers for different display types and visual styles.

## Features

- Multiple expressions (happy, sad, angry, surprised, neutral, sleepy, wink)
- Smooth eye movement with look_at positioning
- Automatic blinking with configurable intervals
- Optional pupils with physics-based movement
- Eyebrows and cheeks for enhanced expressions
- Customizable colors and sizes
- Frame-based animation system

<table>
<tr>
<td>happy <img alt="image" src="https://github.com/user-attachments/assets/b0cc5477-e0de-446d-bfd4-7f9e1d6d60e2" /></td>
<td>sad <img alt="image" src="https://github.com/user-attachments/assets/12c4acc0-94ee-403b-b557-4062a1596681" /></td>
</tr>
<tr>
<td>angry <img alt="image" src="https://github.com/user-attachments/assets/54059c71-3c0d-4d69-b5de-29e3a55df412" /></td>
<td>surprised <img alt="image" src="https://github.com/user-attachments/assets/78cdbe54-2d7a-41b4-a521-70546af1dec7" /></td>
</tr>
<tr>
<td>looking <img alt="image" src="https://github.com/user-attachments/assets/2fdfebb9-a241-4607-9f96-8b2082d51be1" /></td>
<td>looking <img alt="image" src="https://github.com/user-attachments/assets/3b12cae4-4c89-4d8b-9038-25e3c09a5833" /></td>
</tr>
</table>

Videos:

https://github.com/user-attachments/assets/42f5db22-1b2b-4a66-945f-542e57df55bf

## Example

The [example](./example) demonstrates the expressive eyes component with two
different drawer implementations (full-featured realistic eyes and monochrome
blue eyes) running on various ESP32 display boards.
22 changes: 22 additions & 0 deletions components/expressive_eyes/example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# The following lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.20)

set(ENV{IDF_COMPONENT_MANAGER} "0")
include($ENV{IDF_PATH}/tools/cmake/project.cmake)

# add the component directories that we want to use
set(EXTRA_COMPONENT_DIRS
"../../../components/"
)

set(
COMPONENTS
"main esptool_py expressive_eyes display task esp-box matouch-rotary-display ws-s3-touch"
CACHE STRING
"List of components to include"
)

project(expressive_eyes_example)

set(CMAKE_CXX_STANDARD 20)
165 changes: 165 additions & 0 deletions components/expressive_eyes/example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# Expressive Eyes Example

This example demonstrates animated expressive eyes on various ESP32 display
boards. It showcases different expressions, eye movements, and includes a
continuous random demo mode perfect for a desk display.

<table>
<tr>
<td>happy <img alt="image" src="https://github.com/user-attachments/assets/b0cc5477-e0de-446d-bfd4-7f9e1d6d60e2" /></td>
<td>sad <img alt="image" src="https://github.com/user-attachments/assets/12c4acc0-94ee-403b-b557-4062a1596681" /></td>
</tr>
<tr>
<td>angry <img alt="image" src="https://github.com/user-attachments/assets/54059c71-3c0d-4d69-b5de-29e3a55df412" /></td>
<td>surprised <img alt="image" src="https://github.com/user-attachments/assets/78cdbe54-2d7a-41b4-a521-70546af1dec7" /></td>
</tr>
<tr>
<td>looking <img alt="image" src="https://github.com/user-attachments/assets/2fdfebb9-a241-4607-9f96-8b2082d51be1" /></td>
<td>looking <img alt="image" src="https://github.com/user-attachments/assets/3b12cae4-4c89-4d8b-9038-25e3c09a5833" /></td>
</tr>
</table>

Videos:

https://github.com/user-attachments/assets/42f5db22-1b2b-4a66-945f-542e57df55bf

## How to use example

### Hardware Required

This example can be configured to run on the following dev boards:
- ESP32-S3-BOX / ESP32-S3-BOX-3
- MaTouch Rotary Display
- WS-S3-Touch

### Configure the project

```
idf.py menuconfig
```

Navigate to `Expressive Eyes Example Configuration` to:
- Select your board
- Choose drawing method (Full Featured or Monochrome Blue)

### Build and Flash

Build the project and flash it to the board, then run monitor tool to view serial output:

```
idf.py -p PORT flash monitor
```

(Replace PORT with the name of the serial port to use.)

(To exit the serial monitor, type ``Ctrl-]``.)

See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.

## Example Breakdown

The example has three phases:

### 1. Expression Showcase

Cycles through all available expressions (3 seconds each):
- Neutral
- Happy
- Sad
- Angry
- Surprised

### 2. Look Direction Demo

Demonstrates the look_at functionality by looking in different directions (1.5 seconds each):
- Left
- Right
- Up
- Down
- Center

### 3. Random Demo Mode

Enters continuous random demo mode for engaging desk display:
- **Natural behavior**: Mostly stays neutral with occasional emotional expressions
- **Random looking**: Eyes look in random directions every 2-6 seconds
- **Expression changes**: Randomly changes expression every 5-15 seconds
- 50% neutral (most common)
- 20% happy
- 10% surprised
- 10% sad
- 10% angry
- **Automatic blinking**: Eyes blink naturally at random intervals

The random demo mode runs indefinitely, making it perfect for a continuous desk display.

## Drawer Implementations

The example includes two drawer implementations:

### Full Featured Drawer
- White eye background with black pupils
- Eyebrows drawn as rotated lines with rounded caps
- Cheeks for emotional expressions
- Respects LVGL theme background color

### Monochrome Blue Drawer
- Electric blue (#00BFFF) eyes on black background
- No pupils (solid colored eyes)
- Minimalist aesthetic perfect for sci-fi interfaces
- Black eyebrows and cheeks

See [README_DRAWERS.md](./main/README_DRAWERS.md) for details on creating custom drawer implementations.

## Example Output

<table>
<tr>
<td>happy <img alt="image" src="https://github.com/user-attachments/assets/b0cc5477-e0de-446d-bfd4-7f9e1d6d60e2" /></td>
<td>sad <img alt="image" src="https://github.com/user-attachments/assets/12c4acc0-94ee-403b-b557-4062a1596681" /></td>
</tr>
<tr>
<td>angry <img alt="image" src="https://github.com/user-attachments/assets/54059c71-3c0d-4d69-b5de-29e3a55df412" /></td>
<td>surprised <img alt="image" src="https://github.com/user-attachments/assets/78cdbe54-2d7a-41b4-a521-70546af1dec7" /></td>
</tr>
<tr>
<td>looking <img alt="image" src="https://github.com/user-attachments/assets/2fdfebb9-a241-4607-9f96-8b2082d51be1" /></td>
<td>looking <img alt="image" src="https://github.com/user-attachments/assets/3b12cae4-4c89-4d8b-9038-25e3c09a5833" /></td>
</tr>
</table>

Videos:

https://github.com/user-attachments/assets/42f5db22-1b2b-4a66-945f-542e57df55bf


<img width="800" height="470" alt="image" src="https://github.com/user-attachments/assets/fcdae7f6-8bcc-4d0a-bf05-38573cb492ad" />

```console
I (886) main_task: Calling app_main()
[Expressive Eyes Example/I][0.889]: Starting Expressive Eyes Example
[WsS3Touch/I][0.899]: Initializing LCD...
[WsS3Touch/I][0.900]: Initializing SPI...
[WsS3Touch/I][0.906]: Adding device to SPI bus...
[WsS3Touch/I][0.911]: Initializing the display driver...
[WsS3Touch/I][1.321]: Display driver initialized successfully!
W (1322) ledc: the binded timer can't keep alive in sleep
[WsS3Touch/I][1.324]: Initializing display with pixel buffer size: 12000
[WsS3Touch/I][1.334]: Display initialized successfully!
[Expressive Eyes Example/I][1.335]: Display size: 240x280
[Expressive Eyes Example/I][1.342]: Using Monochrome Blue drawer
[Expressive Eyes Example/I][1.392]: Expressive eyes initialized
[Expressive Eyes Example/I][1.392]: Testing different expressions...
[Expressive Eyes Example/I][1.395]: Expression: Neutral
[Expressive Eyes Example/I][11.928]: Expression: Happy
[Expressive Eyes Example/I][22.548]: Expression: Sad
[Expressive Eyes Example/I][33.168]: Expression: Angry
[Expressive Eyes Example/I][43.788]: Expression: Surprised
[Expressive Eyes Example/I][54.407]: Testing look_at functionality
[Expressive Eyes Example/I][54.408]: Looking left
[Expressive Eyes Example/I][59.717]: Looking right
[Expressive Eyes Example/I][65.028]: Looking up
[Expressive Eyes Example/I][70.337]: Looking down
[Expressive Eyes Example/I][75.648]: Looking center
[Expressive Eyes Example/I][80.957]: Starting random demo mode - will run continuously
```
2 changes: 2 additions & 0 deletions components/expressive_eyes/example/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
idf_component_register(SRC_DIRS "."
INCLUDE_DIRS ".")
113 changes: 113 additions & 0 deletions components/expressive_eyes/example/main/Kconfig.projbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
menu "Expressive Eyes Example Configuration"

choice EXPRESSIVE_EYES_BOARD
prompt "Select Board"
default EXPRESSIVE_EYES_BOARD_ESP_BOX
help
Select the hardware board to run the example on.

config EXPRESSIVE_EYES_BOARD_ESP_BOX
bool "ESP-BOX"
help
Use ESP32-S3-BOX or ESP32-S3-BOX-3 development board.

config EXPRESSIVE_EYES_BOARD_MATOUCH_ROTARY
bool "MaTouch Rotary Display"
help
Use MaTouch Rotary Display board.

config EXPRESSIVE_EYES_BOARD_WS_S3_TOUCH
bool "WS-S3-Touch BSP"
help
Use WS-S3-Touch development board.

endchoice

choice EXPRESSIVE_EYES_DRAWING_METHOD
prompt "Select Drawing Method"
default EXPRESSIVE_EYES_MONOCHROME_BLUE if EXPRESSIVE_EYES_BOARD_WS_S3_TOUCH
default EXPRESSIVE_EYES_FULL_FEATURED
help
Select the eye drawing implementation to use.

config EXPRESSIVE_EYES_FULL_FEATURED
bool "Full Featured (White eyes with black pupils)"
help
Draw realistic eyes with white background, black pupils, eyebrows, and cheeks.

config EXPRESSIVE_EYES_MONOCHROME_BLUE
bool "Monochrome Blue (Electric blue on black)"
help
Draw simple monochrome eyes in electric blue on black background without pupils.

endchoice

config EXPRESSIVE_EYES_AUTO_DEMO
bool "Enable Auto Demo Mode"
default y
help
Automatically cycle through different expressions and eye movements.

config EXPRESSIVE_EYES_DEMO_INTERVAL_MS
int "Demo Interval (ms)"
default 3000
depends on EXPRESSIVE_EYES_AUTO_DEMO
help
Time in milliseconds between expression changes in demo mode.

config EXPRESSIVE_EYES_ENABLE_PUPILS
bool "Enable Pupils"
default y
help
Draw pupils in the eyes.

config EXPRESSIVE_EYES_PUPIL_SIZE
int "Pupil Size"
default 15
depends on EXPRESSIVE_EYES_ENABLE_PUPILS
range 5 50
help
Size of the pupils in pixels.

config EXPRESSIVE_EYES_AUTO_BLINK
bool "Enable Auto Blink"
default y
help
Automatically blink the eyes at random intervals.

config EXPRESSIVE_EYES_BLINK_INTERVAL_MS
int "Average Blink Interval (ms)"
default 4000
depends on EXPRESSIVE_EYES_AUTO_BLINK
range 1000 10000
help
Average time between blinks in milliseconds.

config EXPRESSIVE_EYES_EYE_SPACING
int "Eye Spacing"
default 100
range 20 300
help
Distance between the centers of the two eyes in pixels.

config EXPRESSIVE_EYES_EYE_WIDTH
int "Eye Width"
default 60
range 20 200
help
Width of each eye in pixels.

config EXPRESSIVE_EYES_EYE_HEIGHT
int "Eye Height"
default 80
range 20 200
help
Height of each eye in pixels.

config EXPRESSIVE_EYES_COLOR
hex "Eye Color (RGB565)"
default 0xFFFF
help
Color of the eyes in RGB565 format (default: white 0xFFFF).

endmenu
Loading