Smart Shower

by nouralmslmani in Circuits > Electronics

344 Views, 0 Favorites, 0 Comments

Smart Shower

بدون عنوان.png

The idea of the project is smart dispensers in the hotel for each cleaner and room when
the guest want some soap for example just by the voice say "soap" and the dispenser well give order to Dc motor put some soap and same idea with other cleaners, for each tank there is a sensor to measure how much left in the tank to send the percentage of the tanks in each room to the Reception to fill the tanks If necessary

Working principle of the selected design

the main idea for a project to use Technology (speech to text )to do it in the python language It is about converting spoken words into text. To make an order to the servo to turn on the machine

We can know the amount of materials inside the machine using a sensor. Send a report to a user to know the actual quantity


Raspberry Pi 4 Preparation

word-image-475.png
ww.png

The first step we have to do to install the system on raspberry pi

we do that throw raspberry imager

Throw Raspberry pi website we download raspberry imager.

first, go to the Raspberry pi website then, software > our software > Install Raspberry Pi Imager.

this is the link for the website:

https://www.raspberrypi.org/software/

after downloading the imager a window will appear as shown :

then, plug-in SDcard and choose it in the SD card menu.

after choosing the SDcard just click erase to make sure that the SDcard is empty

after that, choose the OS by clicking the operating system button then, choose the OS in the project we choose raspberry pi OS full (32-bit)

finally, unplug the SD card from your pc and plug it into the raspberry pi, and follow the instructions

when we start on the raspberry we have also download python 3 so this is common inside the terminal install it

$ sudo apt update

$ sudo apt install python3 idle3

Install package for pyaudio :

Install pyaudio

sudo pip3 install pyaudio

if you have an issue when you install this package you can use this command :

sudo apt-get update -y

sudo apt-get install -y libportaudio-dev

for update and upgrade raspberry pi buy use this command :

$sudo apt-get update

$sudo apt-get upgrade

$sudo reboot

Speech Recognition

تنزيل.png

the main thing in our project is about speech to text, so we install package (vosk ) in Raspberry pi

Installation and usage

Make sure you have up-to-date pip and python3 versions:

Python version: 3.5-3.9

Upgrade python and pip if needed.

If you have trouble installing, check the output of the following commands and provide it for reference:

$ python3 --version

$pip3 --version

Then install vosk : $ pip3 install vosk

if you want to change pip to be pip3 to install any package we can use this command

$ alias pip=pip3

the advantage of this library can work as offline so we have to download the Model for language and put it in the same place for your code

the link:https://alphacephei.com/vosk/models

Install Microphone

features.png

This board a highly integrated quad-channel ADC with I2S/TDM output transition for high definition voice capture, which allows the device to pick up sounds in a 3 meters radius.

Features

4 Microphones

3 meters radius voice capture

2 Grove Interfaces

Note: There is no audio output interface on ReSpeaker 4-Mic Array for Raspberry Pi. It is only for voice capture. We can use the headphone jack on Raspberry Pi for audio output

Hardware Overview

MIC: 4 analog microphones

Raspberry Pi 40-Pin Headers: support Raspberry Pi Zero, Raspberry Pi 1 B+, Raspberry Pi 2 B, Raspberry Pi 3 B and Raspberry Pi 3 B+ and Raspberry Pi 4

Install driver

Step 1:Please Make sure to run the latest Raspbian Operating System

Step 2 :open terminal and write incoming command :

$ sudo apt-get update

$ sudo apt-get upgrade $ git clone https://github.com/respeaker/seeed-voicecard.git

$ cd seeed-voicecard

$ sudo ./install.sh

$ reboot

Step 3: Then select the headphone jack on Raspberry Pi for audio output:

sudo raspi-config
# Select 7 Advanced Options

# Select A4 Audio

# Select 1 Force 3.5mm ('headphone') jack

# Select Finish

Step 4: to test the Microphone we have to install audacity, this program can record the voice

the command :

$ sudo apt update
$ sudo apt install audacity

$ audacity // run audacity

DC Installing

l293-connections.jpg
1_vM70vWw-rI8PED_bxK-WMg.png

in this tutorial, I will show you how to connect two motors to Raspberry Pi

part :

An L293 using this module you can control DC Motor, stepper motor, and servo motor. you can check the datasheet by this link :

https://www.ti.com/lit/ds/symlink/l293.pdf

Connecting Dc Motor to Raspberry pi :

The first steps involve wiring up the power through the L293 motor driver

Next involves setting up the GPIO’s for the first Dc motor We will use GPIO 23 (Pin 16, 8 pins over), GPIO 24 (Pin 18, 9 pins over), and GPIO 25 (Pin 22, 11 pins over). Be careful about the ground pin

To add a second motor to this circuit will involve hooking up to the other side of the motor driver. This will be similar to the first side, connecting three GPIO’s to some pins.

You should have the two middle pins (13, 12) connected to the negative rail. The next step is to connect GPIO 17 (Pin 11), GPIO 27 (Pin 13), and GPIO 22 (Pin 15) to the motor stepper. GPIO 22 gets connected to pin 9

Finally, add a power supply to the circuit holder wires to the positive bar and negative bar.

Sensor

TOF10120-pinout-scaled.jpg
5131pBVhuUL._AC_SY355_.jpg

The sensor we used is TOF10120 laser range

sensor can measure the distance in mm and can be connected to the raspberry pi in two different ways, using serial port or I2C port in this project we focused on I2C port

To connect the sensor to the
raspberry pi using I2C port we are going to use the two address pins from the sensor which is SDA and SCL

Connect the VDD pin to the 3.3V on
the raspberry pi

And connect the ground pin to ground pin on the raspberry pi

Then connect SDA pin to the SDA pin on the raspberry pi

Finally, connect the SCL pin to the SCL pin on the raspberry pi

To make sure if the sensor is connected correctly write this command in terminal

$ sudo i2cdetect -y 1

After typing the scan command, the
sensor address should appear, the default address of the sensor is 52 if this number appears in the bus, we used then the sensor is connected correctly.

But if the sensors default address is 52 and connect another sensor to I2C port this will cause conflict between the sensors then the necessary step is changing address of the second sensor.

We can change the address of the sensor by activate the other busses in the raspberry pi, to activate it follow these steps:

First open up terminal then type $ cd /boot this command will change the directory.

Second type

· $ sudo nano config.txt this command will open configuration text scroll down until you find the I2C activation code, in the next line type:

dtoverlay=i2c-gpio,bus=4,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24

this line will activate the bus 4 and use the gpio 23 as SDA and gpio 24 as SCL

if you want to connect third sensor you can activate bus 3 by same steps and write this command:

dtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=17,i2c_gpio_scl=27

this line will activate the bus 3 and use the gpio 17 as SDA and gpio 27 as SCL

you can write the scan command

· $ sudo i2cdetect -y 1 but do not forget to change the bus number that you want to scan

Connect Raspberry to SQL Host Server

postgresql-as-a-service-elephantsql.png

to sent data from a raspberry pi (python language ) by following steps

step 1: create an account host SQL server https://api.elephantsql.com/

step2: create a database inside the website

step3:write a python code (Test -Insert -Delete ) in your raspberry pi to sent data into your host SQL server account

After Running

Smart Shower

Obtaining soap using speech-to-text technology and knowing the levels in the cabinets through sensors sent from Raspberry to the user