This GitHub repository contains the code for an IoT project that allows you to control lights using voice commands. The project consists of two main components: a Wemos board program and a React website.
- Wemos board (e.g., Wemos D1 Mini)
- Relay module
- Jumper wires
- USB cable
- Arduino IDE
- Firebase
- Google Speech-to-Text API
- React.js
The repository is structured as follows:
/wemos_code
directory: Contains the Arduino sketch for the Wemos board./react_website
directory: Contains the code for the React website.
To set up the project, follow these steps:
- Connect the relay module to the Wemos board using jumper wires. Refer to the hardware connections mentioned in the Wemos code.
- Install the Arduino IDE on your computer if you haven't already.
- Open the Arduino IDE and install the "Firebase ESP8266" library.
- Open the Arduino sketch in the
/wemos_code
directory. - Replace the placeholder Firebase credentials with your own credentials obtained from the Firebase console.
- Connect the Wemos board to your computer using a USB cable.
- Select the appropriate board and port in the Arduino IDE.
- Upload the sketch to the Wemos board.
- Install Node.js on your computer if you haven't already.
- Open a command line interface and navigate to the
/react_website
directory. - Run the command
npm install
to install the required dependencies. - Open the
src/firebase.js
file and replace the placeholder Firebase credentials with your own credentials obtained from the Firebase console. - Open the
src/GoogleSpeechToText.js
file and replace the placeholder Google API credentials with your own credentials obtained from the Google Cloud Console. - Run the command
npm start
to start the React development server.
- Ensure that the Wemos board is powered on and connected to the Wi-Fi network.
- Access the React website by opening a web browser and navigating to the provided URL or
http://localhost:3000
if running the website locally. - On the website, you will see the current status of the lights fetched from Firebase.
- Use the voice commands "light on" or "light off" to control the lights.
- Observe the relay module connected to the Wemos board and see how it responds to the voice commands.
- If there are issues with the Wemos board connectivity, check the Wi-Fi credentials set through the Wemos AP setup.
- Ensure that the Firebase and Google API credentials are correctly configured in both the Wemos code and the React website code.
Contributions to this project are welcome. If you find any bugs or have suggestions for improvement, please feel free to open an issue or submit a pull request.
This project was inspired by the need for a hands-free, voice-activated lighting solution. We would like to acknowledge the developers of the Firebase, Google Speech-to-Text API, and React.js for providing the tools and frameworks that made this project possible.