Blog 2Smart (EN)

How to create an IoT device on a printed circuit board and take it from prototype to finished product

PCB board by 2Smart
By assembling a prototype IoT device (in our example, a Wi-Fi relay) on a breadboard and connecting it to the 2Smart Cloud platform, we got a device that can already be used. 

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).

PCB design

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,

Designing a printed circuit board in the online editor

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,

Service for ordering printed circuit boards

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.

Finished PCBs for Wi-Fi relays

Relay in a 3D-printed enclosure

Firmware devices

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.

WiFi relay on PCB with table lamp connected


All articles about IoT device creation and support

  1. Learn your way around the IoT platform –  create your first device and control it from your smartphone without an MCU
  2. How to create a Wi-Fi switch to control via a mobile app and Telegram bot
  3. 4 stages of using the platform to create a new IoT device
  4. How to create an IoT device on a printed circuit board and take it from prototype to finished product
  5. How to write firmware for an IoT device based on an SDK
  6. How to update the firmware and mobile application of ready-made devices within 5 minutes
  7. Collection and analysis of statistics –  a useful tool for product improvement
Made on