Finger Count 1.0ο
Note
π Welcome to the SunFounder Facebook Community! Whether youβre into Raspberry Pi, Arduino, or ESP32, youβll find inspiration, help ideas here.
β Be the first to get free learning resources.
β Stay updated on new products & exclusive giveaways.
β Share your creations and get real feedback.
Kit purchaseο
Looking for parts? Check out our all-in-one kits below β packed with components, beginner-friendly guides, and tons of fun.
Name |
Includes Arduino board |
PURCHASE LINK |
|---|---|---|
Ultimate Sensor Kit |
Arduino Uno R4 Minima |
|
Elite Explorer Kit |
Arduino Uno R4 WiFi |
|
3 in 1 Ultimate Starter Kit |
Arduino Uno R4 Minima |
|
Universal Maker Sensor Kit |
Γ |
Course Introductionο
This project controls the LED matrix on an Arduino Uno R4 WiFi board based on finger count data received from a Python script. The script detects the number of fingers shown to a camera and sends this data to the Arduino via serial communication(USB). The Arduino then displays the corresponding number on the LED matrix.
Note
If this is your first time working with an Arduino project, we recommend downloading and reviewing the basic materials first.
Required Components
In this project, we need the following components:
SN |
COMPONENT INTRODUCTION |
QUANTITY |
PURCHASE LINK |
|---|---|---|---|
1 |
Arduino UNO R4 WIFI |
1 |
|
2 |
USB Type-C cable |
1 |
Operating Steps
Note
Copy the following code into Arduino IDE.
Use the Arduino Library Manager and search for ArduinoGraphic and Arduino_LED_Matrix install libraries.
Select the board(Arduino UNO R4 WIFI) and then clicking the Upload button.
Then use the Python code
FingerCountSender. You can click hereFingerCountSender.zipto download it.- Update the Python script to use the correct serial port(COMx), ensuring it matches the one identified during Arduino setup(COMx).
Then run the python code to open the camera window.
#include "ArduinoGraphics.h"
#include "Arduino_LED_Matrix.h"
ArduinoLEDMatrix matrix;
char lastChar = '\0'; // Variable to store the last read character
void setup() {
// Start serial communication
Serial.begin(115200);
Serial.setTimeout(1);
matrix.begin();
delay(500);
}
void loop() {
// Check if data is available on the serial port
if (Serial.available() > 0) {
// Read one character from serial input
char c = Serial.read();
// Check if the new character is different from the last character
if (c != lastChar) {
// Update the last character
lastChar = c;
// Clear the matrix before displaying the new character
matrix.clear();
matrix.beginDraw();
matrix.stroke(0xFFFFFFFF); // Set stroke color
matrix.textFont(Font_5x7); // Set font
matrix.beginText(4, 1, 0xFFFFFF); // Position and color for text
matrix.print(c); // Display the character
matrix.endText();
matrix.endDraw();
}
// Delay to prevent too frequent updates (optional)
delay(10);
}
}