DIY Smart Plug and Bulb on Tuya IoT | Adaprox Fingerbot
by AkarshA2 in Circuits > Arduino
2855 Views, 8 Favorites, 0 Comments
DIY Smart Plug and Bulb on Tuya IoT | Adaprox Fingerbot
Hey, what's up, Guys! Akarsh here from CETech.
In older times, only humans were considered smart, but as time passes, we humans keep making things around us smart as well to ease our lives. One such thing that is trending nowadays is a Smart home. Everyone wants their home to be smart and when we talk about smart homes the first thing that comes to our minds is a Smart Plug. A Smart Plug is basically a small adaptor that can be plugged into a regular electrical wall outlet but the difference is that it has the capability of connecting to Wifi and by the virtue of this any device or appliance that is plugged into the smart plug adaptor can be turned on or off by using a smartphone.
Smart plugs make it easy to automate and control small appliances and devices in your home. So today we are going to build a Smart Plug of our own. It may seem a lengthy and difficult task but actually, it is not, All thanks to the Tuya IoT Platform and Tuya Sandwich Evaluation Kit which made it easy for us to customize and build smart home appliances of our own.
So, Today we will get an insight into what's inside a Tuya Sandwich Evaluation Kit. After that, we will build a smart plug of our own using this kit and at the end, we will look check out a Fingerbot by Adaprox which is also built on the Tuya IoT Platform. It is going to be a lot of fun so let's jump into it.
Get PCBs for Your Projects Manufactured
PCBGOGO, established in 2015, offers turnkey PCB assembly services, including PCB manufacturing, PCB assembly, components sourcing, functional testing, and IC programming. PCBGOGO offers great quality PCBs for prices as cheap as $5 for 10 PCBs with a delivery time of 1-2 days for 2-layer PCBs.
Its manufacturing bases are equipped with the most advanced production equipment such as YAMAHA pick and place machine, Reflow oven, Wave soldering Machine, X-RAY, AOI testing machine; and the most professional technical personnel.
PCBGOGO a Chinese PCB Prototype Manufacturing Company has 5 factories of its own and has successfully fulfilled the needs of 300,000+ Customers till now. They are completing 3000+ online orders daily and each and every material is tested before shipping so you get the best products at your doorstep.
Join PCBGOGO now and you will get a $50 PCB Cash Coupon which can be used while ordering PCBs from PCBGOGO.
Tuya IoT Platform and Tuya Sandwich Evaluation Kit
Tuya IoT Platform is a powerful platform with the help of which brands, developers, retailers, and manufacturers can directly tap into the AIoT/Smart Home opportunity and quickly grow their smart products. There is a wide range of products and appliances on this platform that can be built and customized. There are some pre-built products as well which are based on the Tuya Platform and can prove to be very useful in our daily life. You can access the Tuya IoT Platform from here but before using it you need to create an account on this Platform.
Having talked about the Tuya IoT Platform, Let's have a closer look at the Sandwich evaluation kit. Tuya builds a stable and sophisticated development board based on Arduino specifications. Tuya Sandwich Evaluation Kit as its name suggests is like a sandwich, assembled layer by layer, which allows you to quickly implement a complete IoT product prototype. Based on the Arduino open-source ecosystem, any open device can be connected to the Tuya Cloud Platform through the Tuya cloud modules of various communication protocols such as Zigbee, BLE, Wi-Fi, and NB-IoT. It allows you to explore more possibilities in the IoT field. The main components of a Tuya Sandwich Evaluation Kit are as follows:-
- Master control board: The master control board conforms to the Arduino interface (such as Arduino UNO and ST Nucleo). The master control board works as MCU and can be quickly connected to the communication board through Tuya MCU SDK to access the Tuya Cloud Platform.
- Communication board: The wireless communication board provides various networking capabilities for the master control board. The Wi-Fi communication board with voice capabilities supports local far-field voice wake-up, online speech recognition, and device control.
- Function Board: The function board provides substantial peripheral functions for the Evaluation Kit, such as sensors and actuators.
-
Power board: The Power board provides stable and continuous electricity for the development kit to strengthen the power supply capability of the master control board. It can also output different electrical levels for device debugging.
The Programs that we need to upload to the Tuya Sandwich development board can be written and uploaded using Arduino IDE. So, this is was a brief introduction about the Tuya IoT Platform and the Tuya Sandwich evaluation kit. You can read about the kit in detail from here and here.
Smart Bulb Demo Using Tuya IoT Platform
Now with some brief but sufficient knowledge about the Tuya IoT Platform and Tuya Sandwich Evaluation Kit, we will now create a simple DIY Smart Bulb with the help of the Tuya Platform and the Tuya Sandwich evaluation Kit. The materials required for this demo are:-
- Tuya CBU MCU wireless communication Development board
- Arduino Uno
- LED
- Jumper wires
Now to create the Smart bulb we need to follow the steps given below:-
- First of all, we need to connect some jumper wires to our Tuya CBU MCU board. We will connect a black wire to the GND pin of the MCU board, red wire to the pin corresponding to Pin No - 13 of the Arduino UNO i.e the pin of the MCU board that is connected to the Pin No-13 of the Arduino when the MCU board is stacked over the Arduino UNO. In a similar way, connect a green wire to the Pin on MCU corresponding to Pin 7 of the Arduino UNO.
- Now as the wiring mod is done we need to connect the Black wire to the shorter leg of the LED i.e. to the GND and connect the Red wire to the other leg of the LED.
- Right now we will keep the Green wire floating and will not connect it anywhere.
So in this way, we are done with the Hardware Part of our smart bulb now in the next step we will set up the Tuya IoT Platform and upload the code in the Arduino UNO
Setting Up the Tuya IoT Platform and Uploading the Code
In the previous step, we did the hardware configuration part. Now, in this step, we will be setting up the Tuya IoT Platform for operating the smart bulb and after that, we will upload the code in the Arduino UNO board with the help of Arduino IDE which will complete the setup. We need to follow the steps given below:-
- Before using the Tuya IoT platform you need to make sure that you have an account on that platform. You can access the Tuya Smart website from here. Here you have to register your details and create an account. As soon as the account is created, you will be able to access the Tuya IoT platform. Then you need to log in using your credentials and you are ready to go.
- Now as you log in to the Tuya IoT Platform. On the left-hand side, you will see a Products button click on that and the products tab will open up. Under the products tab, there you need to click on the Development button.
- When you will click the Development button you will see a "Create" button in the middle of the screen click on that and the new product development screen will open up in front of you.
- Here we need to select the type of product that we are going to make. In our case, we are making a smart bulb, so we will quickly go to the Lighting section now we have to select the Category so here under General Lighting we will select Light Source.
- After the Category has been selected, we will Select a Solution for our product as we are making a Custom Product so we need to select Custom Solution and then click on Light Source.
- Now we have to enter the Product Information Details. Here we have to enter the Product Name. You can give any name you like.
- As we are using the Wifi+Bluetooth module. Therefore under Protocol, we need to select Wifi+Bluetooth and after that select Standard Power Consumption. When all these are done, click on the Create button.
- As you click the Create button, the platform will ask you to add the standard functions that you want in your Product. By default, 13 functions are selected here we need to remove all these functions by clicking on the Remove Optional Function button.
- Now we need to select the ON/OFF function from the list of functions present on the left-hand side which has a DP ID-20. When selected it will appear on the right-hand side under the selected functions list and after that click the OK button. We are only adding this function because we just need to switch the LED ON or OFF.
- Once all this Product Definition thing is done, we need to head over to the Hardware Development tab. Here we need to select the Integration method as Tuya Standard Module MCU SDK. As we select the Integration method, a list of modules will open up. From this list, we need to select the module that we are using. In our case, we need to select the CBU Wifi &Bluetooth Module
- After selecting the module, we need to select the firmware. So click on the Select Firmware button there you will see that only one firmware is available we need to select that and click OK and with that, we are done with the setup. Now after completing this we need to copy the PID and the module firmware version and save them somewhere as we need them in the next step.
- Now we need to upload the code in the Arduino UNO. You can get the code from the Github repository of this project. In the repository, you will see a file named "Arduino_tuya_code.ino". This is the code file of this project, open this file in your Arduino IDE.
- You also need to add the Tuya_Wifi_MCU_SDK library to your Arduino IDE this library also you can get on the Github repository of the project with the name "Tuya_Wifi_MCU_SDK". Download this library and paste it into the libraries folder of your IDE.
- Now head over to the code that you have opened in the Arduino IDE. Here we need to replace the PID and the module firmware version in their corresponding places.
- Once this is done, we need to connect our Arduino UNO board to our laptop, Select the correct board, COM port, and hit the upload button but we need to keep in mind that while uploading the code we just need to connect the Arduino and does not need to connect the Wifi+Bluetooth Shield. As it will give you an error if done so.
- Once the code is uploaded we just need to disconnect the Arduino Uno and connect the shield to the Arduino board and reconnect the Arduino to the laptop for the power supply.
- Now after doing this we need to download the Tuya Smart app into our mobile phone and log in with our account on that. When the app opens up, you will see a page saying No devices and a button that says "Add device". We need to click that button but before clicking that button we need to connect the green wire to the GND pin of the LED. This is the same wire that we left floating in the previous step.
- After clicking the Add Device button, you need to click on the Auto Scan button. Once the device is found in the Auto Scan, you can disconnect the green wire as the devices are paired. You just need to enter your Wifi SSID and Password and hit the confirm button.
- The screen will show Connecting with a Percentage bar on it. When the devices are connecting, you will see that the LED will keep on blinking which is a sign showing that the LED is connecting to the Wifi and once it is connected. The blinking will turn OFF.
- Now you will see that the device has been added successfully and you will see that the name that you gave to your device appears automatically with the device. Now click on Done and after that, you will see the Arduino LED device with an ON/OFF button. Click on the button and you will see the LED will turn On and OFF with the toggling of the switch.
And in this, you have made your own Smart Bulb by following some simple steps. This was a simple smart bulb but you can create a large number of smart devices of your own using this platform as you will see on the Platform itself.
Another Way of Making a Smart Bulb
If you don't want to create the smart bulb using the Arduino UNO then don't worry we have an alternate for that as well. You can use the Tuya CBU SOC board for the Project. It is a standalone board that comes pre-programmed with firmware. It comes pre-programmed but we can also program it on our own in the same way in which we programmed the Arduino board. What I did is that I connected some LEDs to the board straight after taking it out of the box and after that connected it to the power supply. After that, I opened my Tuya Smart App and there it was auto connected. It appears with the name CBU and after that some text in Chinese but you can rename the device. Once you click on the device, you will see that it acts like an RGB bulb. When you turn it ON you will see that the LEDs you have connected will light up in accordance with the color that you select on the controller. If you use an RGB LED then the LED will light up in the color that you have selected.
So this was the board that comes preprogrammed you cab directly plug and play or you can program it using SDK according to your need. You can also connect the other boards of the Kit with this board and perform several applications.
Adaprox Fingerbot Overview
Till now we have come across the Tuya IoT Platform and Tuya Sandwich Evaluation Kit. We have also created a Smart bulb of our own using the platform and modules that Tuya offers. But now we will have a look at an awesome product that is based on the Tuya Platform and is a part of the Tuya IoT Platform. It is a Fingerbot which is brought to us by Adaprox. The Fingerbot as its name suggests is a robot that mimics the action of a human finger while switching a button ON or OFF and it can be connected and controlled from our mobile phones which means that we can switch appliances On and Off from a distance far away from the switch. It's a pretty handy gadget and can be very useful in our day-to-day life. Let's have a quick look at the setting up and configuration of this fingerbot.
- Firstly we need to download the Adaprox Home app from our Google Play Store or App Store. Once the app is installed we need to open the app and quickly log in or register on the app.
- After logging in you will see a plus like button on the top right side. This button is used to add a device. Click on that button and after that select Fingerbot from the products that are shown on the Product Selection Screen.
- Now after selecting the device you need to take your fingerbot and after that switch it On and Off two to three times in order to get it started and after that click on the Confirm button.
- Once this is done, you will see that the Fingerbot is connecting. Once it is connected, the app will say Paired successfully. We can confirm this and after that, we can go back and we will see that our fingerbot will be available there.
- When we will click on that fingerbot button you will notice that the fingerbot will toggle with the switch. It will move up and down. You can also change some configurations of the bot such as its sustain time which is the time for which the bot holds its position and moves back to the original position.
So you see how easy it is to use the fingerbot and how useful this cute bot can be in our day-to-day life. The most amazing thing is that it is built on the Tuya platform so you can notice that how many possibilities are there on the Tuya Platform. Tuya does not only offers you services but also offers you some great smart home products.
Conclusion
So These were some awesome solutions for your Smart Home queries though we have made only a smart bulb and tested a fingerbot here but the possibilities are endless. A lot of different things can be made using the Tuya IoT Platform and the Tuya Sandwich Evaluation Kit as you might have noticed on the Tuya IoT Platform and apart from them, you can make something of your own as well. Keep thinking and you might come up with something like Adaprox Fingerbot. There is another great product from Adaprox that is a Gateway from which we can connect different smart home devices and control them but we have not discussed that today maybe in nearby future we might come across that as well but for today this is it.