In this case, of course, inconveniences arise even for a DIY user: the device does not look aesthetic, additional 5V power supply required..A device on a breadboard is all the more inappropriate for a vendor that plans to bring a product to market.
To obtain a full-fledged IoT device, it is necessary to modify the circuit so that the device works only from a 220V network. And also place this circuit on a printed circuit board by placing it in the case.
Design the PCB and enclosure for a Wi-Fi relay
In the example with a Wi-Fi relay from a DIY developer, there is no serious cost optimization task - it is about a small series of devices for himself and friends. Therefore, the stage of the selection of components and the preparation of the circuit board will be described in the theses.
All materials for preparing a Wi-Fi relay are posted in the public repository 2Smart Cloud. If desired, each of you can prepare a similar device, using this article as a tutorial.
How the device circuit has changed
The only task in changing the circuit of the Wi-Fi relay is the need to give up an additional 5V power supply in the form of a USB cable. The device must operate only from a 220V network, turning on and off the device connected to it - for example, an ordinary table lamp.
To solve this problem, we add an additional element to the circuit - a voltage converter (power module) AC-DC 220V/5V. Instead of the relay module, a conventional relay is installed, which is controlled through a transistor (such a circuit upgrade is not necessary).
Once the final version of the device circuit is obtained, it is possible to create a printed circuit board project. Use any popular board editor for this purpose - for example, easyeda.com.
After creating the project, it remains to order the production of the required batch of printed circuit boards. There are many services for this - for example, jlcpcb.com.
Also, need to order the components necessary to assemble a batch of devices.
Knowing the dimensions of the device, it is also possible to prepare the housing in any 3D editor and print it on a 3D printer.
Once the PCBs and components are ready, all that remains is to assemble the devices with a soldering iron and place them in the enclosure.
To firmware the ready-made devices on a printed circuit board, the same Production code is used as for the prototype device on the breadboard. No changes are needed in most cases.
It makes sense to keep the prototype IoT device on a breadboard for testing new features. And the devices on printed circuit boards should be used in real conditions, upgrading them with new firmware versions if necessary.
When using ESPHome-based firmware, there is the inconvenience of having to update each device manually, through a USB cable. In order to automate the firmware process, you need to prepare a Custom version, which will allow to receive updates over the air. We will talk about this in the next article of this series.
- 2Smart Cloud IoT platform – https://cloud.2smart.com/
- Materials for creating Wi-Fi Relay at public repository – https://github.com/2SmartCloud/2smart-cloud-esp32-relay
- Online PCB design tool – https://easyeda.com/
- PCB fabrication manufacturer – https://jlcpcb.com/
All articles about IoT device creation and support
- Learn your way around the IoT platform – create your first device and control it from your smartphone without an MCU
- How to create a Wi-Fi switch to control via a mobile app and Telegram bot
- 4 stages of using the platform to create a new IoT device
- How to create an IoT device on a printed circuit board and take it from prototype to finished product
- How to write firmware for an IoT device based on an SDK
- How to update the firmware and mobile application of ready-made devices within 5 minutes
- Collection and analysis of statistics – a useful tool for product improvement