 Hi guys! In this video I want to analyze and redesign a smart device. Smart devices are quite cheap, so the design won't be complex, right? I want to redesign a smart sensor, you may ask why, because I wanna try to do better. I know it's not easy, so the new smart sensor must be easy to use, repair and must allow for hardware upgrades over the time. For example, for change the communication protocol or the sensor or the type of battery. So guys, let's get started! This video is sponsored by PCBway. In my lab I have some smart devices to test and compare. There are different types of smart devices on the market and today I will try to analyze and redesign this window and door sensor. There are two versions of this device, the first one that use Wi-Fi as the communication protocol and the second one with ZigBee protocol. There are smart sensors like this one that also use other protocols like Z-Wave. So the two versions have prawns and cons. Usually the Wi-Fi version is easier to set up because it doesn't need a gateway to operate than the ZigBee version, but the energy consumption of the ZigBee version is lower than Wi-Fi version. We can say that the main problems are the first one is the battery life, in particular with the Wi-Fi version. The second problem is the protocol flexibility. And another problem that many people ignore is the environmental impact of this device, because as you can see they are not designed at all to be repaired or reused in other applications. That's why they are cheap. The possible solution of the first problem is energy harvesting. So we can try to charge the battery or try to remove the battery and use a super capacitor. For the second problem a solution is modular hardware, because it's possible to upgrade and change the microcontroller. Example change the communication protocol of a smart device from Wi-Fi to ZigBee or to another protocol that does not exist. And for the last problem a possible solution is again modular hardware, because at the sign with a modular hardware it's easy to repair, reuse and upgrade over the time. And these are some reasons why I decided to develop this project. Before starting with the design of the new device let's begin by analyzing the performance of this Mars sensor. The PCB is very simple, the circuit is powered by these two batteries. The performance is very interesting. In deep sleep mode the power consumption is around 6.7 mA and the device takes more than 8 seconds to complete the task. With an overrange power consumption of 9 mA with peaks of 1A. Now it's time to design the PCBs of the new device we are going to make. Actually I have already designed so I have soldered and tested these PCBs. And thank you again to PCBWay for manufacturing these very nice PCBs. And this is the final result of the smart device. As you can see it consists of two different modules. The first one there is the ESP32C3 together with LDO and in the second module there is the read switch with the RGB LED and other components. So now let's test the device. First of all I have uploaded a simple firmware to the device and the firmware allows the device to send the status of the read switch so if it's open or closed contact and also the state of battery charge is transmitted. The protocol is MQTT and I have installed the broker on a VPS. I did a lot of tests verifying the power consumption of each component to try to optimize the efficiency of the device in deep sleep. And here are some results. As you can see if I use all components the power consumption in deep sleep is very high. The problem can be solved by removing unnecessary components such as the accelerometer which I added in this version to see if it would be useful for this type of application. Or it's possible to reduce the power consumption by adding a MOSFET and turning off the RGB LED power supply when the device is in deep sleep. I used an RGB LED to improve the user experience when setting up of the device to understand the status. But it will be smarter to use a regular RGB LED and not this one that is dressable. Also when the read switch is closed the power consumption is very high compared when it's open. I will solve this problem in the next video. I found a solution but I have to redesign the PCB. As you can see the micro controller always draws 5 mA. Perhaps for this type of application it might be of interest to find an alternative to deep sleep mode. How you can see from the data I tried the sibling enable of the LDO which provides a 3.3V 2V circuit to accept the RGB LED. It might be interesting in the next version of the project to take advantage of the LDO enable pin to trigger the system. I'm aware that it's a bit more complex because the change of the state of the read switch has to be interpreted by a circuit. So in the next video I will show you how I have optimized this smart device. If you have any suggestion please write them in the comment. Thank you again to PCBWay for supporting the project. You can buy your PCBs for only $5. And that's it guys, thank you for watching until the end and see you next time.