Introduction: Voice Controlled Wooden Edison Lamp - (Video)
Question Price $5. That is how much Wifi Relay SONOFF (From ITEAD company) cost, which is the heart of this device.
"I have not failed. I've just found 10'000 ways that won't work." - Thomas A. Edison This is incredible, but more recently, people in schools wrote with feathers. And today, there is a magic brick with a picture, that fits in your pocket and provides access to all information in the world. Voice control and, as people say, the threat to mankind from the side of artificial intelligence. More recently, these technologies seemed like inaccessible fantasies. But today, I will show you how absolutely each of you, with basic programming knowledge, can use voice control. So, let's begin.
Step 1: Let's Begin
WARNING!!! Work with high voltage! The author of the article is not responsible for your actions! Or any material, or physical damage that may be as result from the use of this instruction!
Step 2: The General Scheme of the Device Working Algorithm.
Since the phone, at a time, can only be connected to one Wi-Fi access point, we will work through the router. In general, it is convenient when all your smart devices are on the same network and you can easily manage them without having to constantly reconnect to each of them. The disadvantage of this, is that all your devices depend on the performance of a single router.
Step 3: 1 - We Need to Reprogram Sonoff Wi-fi Relays.
By default, it is configured to work through a Chinese server. In my understanding, it is not very convenient to turn off the light bulb in the toilet through the Chinese server. For this we need to disassemble it and solder the contacts for reprogramming.
Now we can connect cp2102 module from Silicon Labs to Sonoff wifi. I also used it to program the Arduino mini.
WARNING!!! When you do reprogramming, do not connect the module to the 220/110 volt network!
Reprogram the relay is very simple. This is a regular esp8266 module. I took the standard sketch of the access point server from Arduino IDE and changed it a bit.
Firmware for SONOFF Wifi relay. To use it through your home router you can find on attached file. And use it from Arduino IDE.
You will need to specify the name of your access point (router), password and static ip address for the light bulb. Relay control is at pin 12. Be sure to set the Flash size to 1 MB in the IDE.
Press and hold the push button on the Sonoff board. Insert the cp2102 converter USB in your computer (while holding the push button). After 2–3 seconds, release the push button. Now it’s in flash mode. Load the sketch file in Arduino IDE. Click on Verify / Compile. After you flash it, the module should restart and the green LED will start blinking
Step 4: Let's Make Some Mobile App, to Control This Wifi Relay. (Android)
I will provide only the main code fragments. Then you can use them to implement it on your applications. Google provides a very simple and convenient interface for voice recognition. Here is the code that allows you to convert a voice to text and save it to a regular string. (Android main code parts, to use voice recognition you can find on attached files.) Then you can compare it with the commands you want to implement.
Code to work with WiFi. Sending a message to the server. You also can find on attached files.
The code is very simple. "1" turn on the light bulb, "0" turn off the light bulb. You can add, at will, any checks, receive a response from the server etc.. I created two programs for myself. The first is the voice control widget, which is located on the desktop and it always at hand. The second is a simple application of turning on / off a light bulb by pressing a button.
Step 5: And I Assume, That You Are Already Tired of Reading All Sorts of Texts and I Suggest You Watch the Video About How It Was.
1 Person Made This Project!
- Kybernetiks made it!