Fingertron-3000

by gafelson in Circuits > Electronics

37 Views, 0 Favorites, 0 Comments

Fingertron-3000

view.png

Built a Python-Arduino Setup That Counts My Fingers and Flashes the Number on a Display. Totally Unnecessary, But Ridiculously Fun!

Supplies

System Requirements

  1. Python 3.11 (recommended version) - (conservative releases)
  2. Arduino Uno
  3. Webcam or external camera

Python to Arduino Communication

p1.png

I wanted to figure out how to send commands from Python to Arduino. Here’s a basic Python code snippet for sending a specific number to an Arduino via serial communication


I attempted to create a loop to test the wiring connections. Something like this:

number = 0 # Define Number
while number <= 9:
if 0 <= number <= 9:
arduino.write(str(number).encode())
print(f"Sent number {number} to Arduino")
time.sleep(1)
else:
print("Invalid number.(1..9)")
number += 1

Downloads

Camera and Hand Detection With Mediapipe

p2.png

To count the fingers on an open hand, I used Mediapipe. Here’s a Python code snippet to open the camera and count fingers:


Explanation:

  1. mp.solutions.hands: Detects hand landmarks.
  2. count_fingers: Determines finger count by comparing landmark positions.
  3. cv2.putText: Displays the finger count on the video feed.

Downloads

Combining the Two

Then combined them and make communication with the finger detection and Arduino:

Downloads

Check Out the Complete Project

Check out the complete project on my GitHub account: @gafelson