A Smart Whistle Counter For Cooking And More

This article describes a Smart Whistle Counter that counts the number of pressure-cooker whistles and the duration of cooking time. It will trigger a buzzer alarm when the preset whistles count or the preset amount of cooking time is reached.

This design can also be used in factories that have boilers with pressure release valves to automatically turn them off when hearing the sound of the boiling point. Or it can be used in steam engines to automatically cut off the power when a sound is made at the ship’s outlet valve.

fig.  1: Block diagram of the project
fig 1 Block diagram of the project

Additionally, the code can be integrated into metaverse and AR/VR environments for gesture-based control.

Gesture Controller using Raspberry Pi

Join us as we explore the exciting possibilities of gesture-based control for a more intuitive and immersive home automation experience.

So let’s start the project with a collection of the following components-

Bill of Materials 

Components Quantity Description Price
Raspberry Pi 41SBC 1GB RAM4000
5V Relay Module15V AC SPST50
RPi camera1CSI Ribbon300

Code for Gesture Controller

To recognize the hand and fingers, calculate the distance between fingertips, and detect gestures, we can employ two different approaches-

The first approach uses Numpy and OpenCV, while the second combines OpenCV with Mediapipe.

Although the Mediapipe-based system is accurate and efficient, the library may have installation issues. For now, we will focus on using OpenCV exclusively for coding purposes.

However, we plan to update this project in the next version by incorporating Mediapipe.

First, you must install OpenCV and Numpy on your Raspberry Pi using the Linux terminal. Execute the following commands:

sudo pip3 install opencv
sudo pip3 install numpy

Once the installation is complete, you can proceed with the code implementation.

First, import the OpenCV and Numpy libraries. Then, utilize the gpiozero library to control the GPIO pins on the Raspberry Pi. Assign the appropriate LED number to control the light based on finger movements. Next, capture the frames in the code.

Afterward, process the video frames to detect the hand and fingers. Use an if condition to determine the distance between the index and thumb fingers. If the thumb and index finger touch each other, set a function to turn the lights on.

DIY Hand Gesture Controller

Gesture Controller Circuit Diagram

To connect the relay to your Raspberry Pi, follow these steps:

  1. Locate the 5V and GND pins on the Raspberry Pi. Connect the corresponding pins of the relay to these pins. The 5V pin provides power to the relay, while the GND pin establishes the ground connection.
  2. Choose a free pin on the Raspberry Pi for relay control. In this example, we’ll use pin 17, but you can use any available pin that suits your needs.
  3. Connect the input pin of the relay to pin 17 on the Raspberry Pi. This pin will control the relay’s state.
Raspberry Pi and Relay Connection

Make sure to refer to the circuit diagram for a visual representation of the connections. Remember that you can use any free pin on the Raspberry Pi for relay control, not just pin 17.

Testing and Working

To test the code, follow these steps:

  1. Run the code you have implemented.
  2. Position your finger in front of the Raspberry Pi camera.
  3. Move your fingers and touch your index finger to your thumb.
Hand Gesture Tracking using OpenCV

If the code functions correctly, touching the index and thumb fingers should activate the relay, turning it on. However, please note that finger and palm detection accuracy may not be optimal since you did not utilize any machine learning (ML) models in the current implementation.

To enhance the accuracy of finger and palm detection, consider updating the project by incorporating Mediapipe. Mediapipe provides robust ML models for hand and gesture recognition, leading to improved accuracy in detecting fingers and palm positions.

Raspberry Pi based Gesture Controller


Source link


Leave a Comment

Your email address will not be published.