Is this page helpful?YesNo
Last Updated on : 2022-05-20 08:20:04download
This topic describes information about CBx modules to implement MCU connection development.
CBx modules are low-power embedded combo modules developed by Tuya Smart. Both Wi-Fi and Bluetooth Low Energy (Bluetooth LE) are supported. This type of module supports connections to access points (APs) and stations (STAs) and enables connections over Bluetooth LE.
Connections between a module and a 3.3V microcontroller unit (MCU)
Connections between a module and a 5V MCU
In the following figure, voltage level shifting can be implemented with a bidirectional level shifter chip, a MOS transistor, or a triode.
Shifting circuit with an n-type metal–oxide–semiconductor (NMOS) transistor
In this example, an NMOS transistor and a built-in body diode are used to implement two-way communication.
Shifting circuit with a negative-positive-negative (NPN) triode
In this example, an NPN triode is used to implement one-way communication.
The following table lists the specifications of CBx modules, including the pins that are used for serial communication with an MCU.
|Module model||Input voltage (TYP)||Input current (MAX)||Transmitter pin No.||Transmitter silk screen||Receiver pin No.||Receiver silk screen|
Each time the module is powered on, the setup time
t2 of the high-level voltage of the module’s GPIO pin must be greater than or equal to the setup time
t1 of the voltage for the module’s power supply pin, as shown in the figure below.
t2 is less than
t1, the module might fail to start.
In this case, even if you repeatedly power on and off the power supply pin of the module, the module cannot be restored to the normal working state.
However, you can pull down the hardware reset pin (RST/CEN) of the module for 1 ms and then pull up again to restart the module and put it into the normal working state.
Avoid using metal shells and metal shells with metallic painting or coating in the direction of the antenna radiation. Avoid using metal screws, metal rivets, or other metal parts that affect the antenna radiation.
The distance from the top cover to the antenna affects the antenna performance. A longer distance decreases the impact on the antenna performance.
The distance from the top shell and bottom shell to the antenna affects the antenna performance. A longer distance decreases the impact on the antenna performance.
Keep the module away from speakers, power switches, cameras, HDMI, USB, and other high-speed signals to avoid interference.
Avoid metal shielding near the antenna. If co-channel interference occurs, you must evaluate the impact on the antenna and ensure the isolation from the interference.
It is recommended to place the module at the edge of the backplane with the antenna facing outward, and flush the module GND with the backplane GND that are fully connected with each other.
Embed the module into the backplane through a slot that is flushed with or deeper than the module ground. The side of the slot must be 15 mm or farther from the module board edge.
A wider slot can achieve better performance but weaker than that of horizontal placement.
Insert the module into the backplane slot vertically with the antenna facing upward. The module GND and the backplane GND shall be fully connected with each other. In an ideal condition, the clearance around the antenna is ≥ 15 mm.
Control the power-on and power-off of the power supply pin of the module to achieve a low power consumption of the finished device.
As shown in the figure, the MCU controls the switch S1 through the GPIO port to power on and power off the module. When there is data to be reported, the GPIO port controls the switch S1 to be powered on. At this time, the module is powered on and establishes a serial connection. And then, the MCU synchronizes the data to the cloud and the client through the module. When the data reporting is completed, the GPIO port controls the switch S1 to disconnect. The module is powered off, without power consumption.
Disadvantages: When the switch S1 is disconnected, the module is powered off, and the TXD pin and RXD pin of the module are still connected to those of the MCU. At this time, the power flows through the UART pin of the MCU to the UART pin of the module, and then flows back to the VCC pin of the module. The TXD pin and RXD pin of the module are still at a high level. The current backflow will increase the power consumption of the module. Next time when S1 is turned on, the module is powered on. The setup time of the high level of TXD and RXD pins of the module is earlier than the setup time of the power supply pin voltage of the module, causing the module to crash.
Solution 1: The hardware is not changed, and the MCU software is optimized. When the MCU detects that the task of reporting data to the cloud and the client is completed, the MCU program also needs to follow the steps below.
This solution does not apply to the situation where the MCU serial pins cannot be configured as open-drain or weak pull-down states. If there is a pull-up resistor on the serial port link, one end of the pull-up resistor needs to be connected to the VCC pin of the module, or the pull-up resistor must be removed.
Solution 2: The MCU software is not changed. Add a level shifting circuit to the hardware. For the level shifting circuit, see the previous Reference diagrams of level shifting circuits. Follow the 3.3V MCU diagram in Serial communication between a module and an MCU and embed the level shifting circuit in the serial port link.
By pulling down the CEN or RST pin of the module, reduce the power consumption when the module is not working. This way, achieve low power consumption of the finished device.
As shown in the figure, the MCU controls the CEN or RST pin of the module through the GPIO port. This way, power on and off the module. When there is data to be reported, the GPIO port outputs a high level. At this time, the module is powered on and establishes a serial connection. And then, the MCU synchronizes the data to the cloud and the client through the module. When the data reporting is completed, the GPIO port outputs a low level. The module is reset, with low power consumption.
Disadvantages: There is a 10K pull-up resistor inside the CEN or RST pin of the module. When the module is in the reset state, the input current of the module is still 330 μA.
The antenna is susceptible to the distance from the shell to the surrounding components. We recommend that you test the radio frequency (RF) performance after the finished device test. The RF test items and indicators are listed in the following table.
|No.||Test item||Test metric|
|1||Indoor distance increasing||≥25 m|
|2||Outdoor distance increasing||≥75 m|
|3||Total radiated power (TRP) of finished device signaling mode (11B 1 Mbit/s test mode)||≥10 dBm|
|4||Total isotropic sensitivity (TIS) of a finished device||≤-62 dBm|
Is this page helpful?YesNo
Is this page helpful?YesNo