Bathroom Environment Remote Controller Reference Design€¦ · Bathroom Environment Remote...
Transcript of Bathroom Environment Remote Controller Reference Design€¦ · Bathroom Environment Remote...
Bathroom Environment Remote Controller Reference Design
WAS-19B1EN V1.00 1 / 14 July 27, 2020
Bathroom Environment Remote Controller Reference Design
D/N: WAS-19B1EN
Introduction
The Holtek bathroom environment remote controller solution is divided into transmitter and
receiver terminals. The transmitter terminal is a touch panel with a wireless transmission function
which has an LCD display, an NTC temperature measurement and touch key functions. The receiver
terminal has a wireless reception module which can output a 12V voltage to drive the relays and
the buzzer.
Figure 1
Applications
Bathroom environment remote controllers, wireless switches, smart homes, industrial irrigation controllers.
Bathroom Environment Remote Controller Reference Design
WAS-19B1EN V1.00 2 / 14 July 27, 2020
Solution Features
1. Fully Integrated Solution: The transmitter terminal has an LCD display, temperature
measurement, wireless transmission and touch control functions.
The transmitter terminal is composed of the HT67F2432, the BS83B08C and the BC2102 devices.
The HT67F2432 MCU includes a high accuracy HIRC, an LCD driver, and a 10-bit A/D converter
that can implement NTC temperature measurements. The device supports up to 20SEG×4COM
LCD display sizes, making the device suitable for product applications that require an LCD display.
The BS83B08C is a touch key Flash microcontroller which supports 8 touch keys and includes a
fully integrated SPI or I2C interface. The BC2102 is a Sub-1GHz OOK/FSK transmitter which is
used for wireless applications in the 315MHz, 433MHz, 868MHz and 915MHz frequency bands.
The device has four programmable output power values which are 0, 5dBm, 10dBm and 13dBm,
making it easy to generate different level RF signal transmissions.
2. Reduced Devices and Costs: The receiver terminal integrates an OOK receiver which can output
a large current, resulting in reduced component costs.
The receiver terminal is controlled by the BC45F7930. This device includes HVIO lines which
can output a 12V large current. The device also includes an integrated OOK RF demodulation
receiver that supports the 315/433/868/915MHz RF frequency bands and a symbol rate of up to
20ksps. The device has the features of a low SLEEP current of 0.4µA which can easily receive
RF data in cooperation with the OOK transmitter.
Functional Description
This bathroom environment remote controller solution can turn on or off the corresponding functions
using the touch panel, including Child Lock, Lighting, Fan, Automatic, Heating 1, Heating 2 and
Ventilation functions. The corresponding patterns, characters and current temperature can be
displayed on the LCD and the corresponding RF data will be transmitted. After receiving the data, the
receiver can output a 12V voltage to directly drive the corresponding relay operation and illuminate
the corresponding LED indicator. The buzzer will give a short or long warning to inform whether the
relay is on or off.
Actual product pictures for a bathroom environment remote controller solution are shown in Figure 2
and Figure 3 below.
Figure 2
Bathroom Environment Remote Controller Reference Design
WAS-19B1EN V1.00 3 / 14 July 27, 2020
Figure 3
Operating Principles
The bathroom environment remote controller solution is divided into transmitter and receiver
terminals. The transmitter terminal is composed of the HT67F2432, the BS83B08C and the BC2102
devices. The HT67F2432 is used to generate and output LCD drive waveforms, display LCD
characters and patterns and control the RF transmission. The BS83B08C is used to detect touch keys
and notify the master MCU, the HT67F2432, using its I2C communication interface. The Sub-1GHz
BC2102 is used to transmit data. The receiver terminal is mainly controlled by the BC45F7930 which
is used to receive RF signals. After the receiver decodes the received signal, it will drive relays, buzzer
and LEDs to perform the corresponding operations according to the data. The transmitter and receiver
terminals will be introduced separately.
Hardware Description
Figure 4
Bathroom Environment Remote Controller Reference Design
WAS-19B1EN V1.00 4 / 14 July 27, 2020
The bathroom environment remote controller transmitter terminal is powered by a 3V button battery.
If the panel is not triggered, the HT67F2432, the BS83B08C and the BC2102 will be in the SLEEP
mode to reduce power consumption. If the BS83B08C detects that the panel is triggered, it will
generate a rising edge to notify the master MCU, the HT67F2432, to start requesting data after which
it will wait for the master to return a signal. The detected key value will then be transmitted by the I2C
interface. The master then requests to receive the key value from the BS83B08C after detecting a
voltage transition via its external interrupt. The master will receive the data and determine which key
is triggered, the displayed pattern and character values will be written into the LCD memory to drive
the LCD display. The A/D will detect the converted temperature every 2 seconds and the temperature
will be displayed on the LCD. At the same time, the currently displayed data is loaded into the BC2102
and transmitted by an RF signal.
Figure 5
The bathroom environment remote controller receiver terminal is powered by a 12V power adapter.
The BC45F7930 is always in the receiving state. If the receiver receives an RF signal, it will perform
signal decoding and data judgement, and then outputs a 12V voltage on an HVIO line to drive the
corresponding LED and relay on or off. The buzzer will give a short or long warning to indicate
whether the relay is on or off.
Bathroom Environment Remote Controller Reference Design
WAS-19B1EN V1.00 5 / 14 July 27, 2020
Layout and Hardware Considerations
The transmitter terminal PCB Layout top and bottom views are shown in Figure 6 and Figure 7.
The receiver terminal PCB Layout top and bottom views are shown in Figure 8 and Figure 9.
Figure 6. Transmitter Terminal PCB
Layout Top View
Figure 7. Transmitter Terminal PCB
Layout Bottom View
Figure 8. Receiver Terminal PCB
Layout Top View
Figure 9. Receiver Terminal PCB
Layout Bottom View
Bathroom Environment Remote Controller Reference Design
WAS-19B1EN V1.00 6 / 14 July 27, 2020
PCB BOM List
Table 1
Table 2
Bathroom Environment Remote Controller Reference Design
WAS-19B1EN V1.00 7 / 14 July 27, 2020
Software Description
Transmitter Terminal
Start
MCU initialisationClear RAM
NTC initialisation LCD initialisation
RF configure register initialisation and other operations
Implement A/D detection and temperature conversion;
Display current temperature value
Start 8s timing
Key trigger flag is high?
Is time to 2s?
Is time to 8s?
Is any function on?
Switch to low-speed mode,LIRC is on to drive the LCD
Switch to the SLEEP mode,LCD is off to reduce power
consumption
Drive LCD to display the corresponding patterns and characters
The currently displayed data are loaded into the BC2102;
The RF signal is transmitted
Clear the 8s timer;Clear the key trigger flag
N
Y
Read key value from the BS83B08C
through the I2C interface
Key trigger flag is set high
Implement A/D conversion;Display current temperature value
External interrupt trigger
N
Y
Y
N
Y
N
Figure 10
Bathroom Environment Remote Controller Reference Design
WAS-19B1EN V1.00 8 / 14 July 27, 2020
Initialisation
After a power-on reset, the first program to execute is the system setup initialisation which includes
MCU clock initialisation, clear RAM, NTC initialisation, LCD initialisation, RF register
configuration and other operations.
Main Loop
1. After the system initialisation has completed, A/D sampling will be executed and the
temperature value will be converted and displayed onto the LCD. At the same time, the 8-
second timer will start timing. If no function is turned on during counting, the entire system
will enter the SLEEP mode and the LCD will be turned off to reduce power consumption after
the 8-second timer overflows. Otherwise, the system clock will switch to the LIRC oscillator
and the system will enter the IDLE0 mode to drive the LCD display.
2. If the system enters the SLEEP mode, it will be woken up and will detect which key has been
pressed after the BS83B08C has detected that a key has been pressed. After the detection is
complete, it will notify the master MCU to read the key value on an I/O rising edge. The master
MCU will be woken up from the SLEEP mode or IDLE mode after detecting a level transition
through its external interrupt. It will read data through its I2C interface communication after the
master MCU main frequency is switched from fLIRC to fHIRC. The data reading process is as
follows: Send the start signal → Send a fixed address code (For example: 51h) → Wait for the
ACK → Read the data → Send the stop signal
3. After key value is read by the master MCU, according to the key value specific function, the
displayed patterns and characters data will be written into the LCD RAM memory to drive the LCD
display. The master MCU will automatically generate the waveform driving the LCD display.
4. After the master MCU completes the LCD display, the status of each function, whether on or
off, will be indicated by the status of the corresponding bit being 1 or 0. The status bits of all
functions form 8-bit data. After confirming that no data is being transmitted through the
fTxBusy flag, the data will be stored in the MRFData memory, the packet will then be
processed by the Data_Pro subfunction. Finally, start the RF timer to transmit the data.
5. When the master MCU has completed the LCD display, Time Base 0 is turned on to generate an
8-second timing. The NTC voltage will be sampled every 2s, the current temperature value can
be converted using a look-up table and the LCD displayed temperature will be updated. If the 8-
second timer overflows, the system will re-determine whether a function turned on. If no function
is turned on, the system will enter the SLEEP mode. Otherwise, the system clock will be switched
to the LIRC oscillator and the system will enter the IDLE0 mode to drive the LCD display.
Others
1. Master MCU and Touch Key MCU Communication Formats
Start7-bit slave address
0b0101000R/W bit ACK
8-bit data(key value)
NACK Stop
Figure 11. Communication Format
The communication between the master MCU, the HT67F2432, and the touch key MCU, the
BS83B08C, follows the standard I2C interface communication protocol. The HT67F2432 uses
the software emulated I2C interface as the master, the BS83B08C uses the hardware I2C
interface as the slave. Once the touch key MCU detects that a key has been pressed, the IRQ
Bathroom Environment Remote Controller Reference Design
WAS-19B1EN V1.00 9 / 14 July 27, 2020
pin voltage level will toggle. When the master external interrupt detects an interrupt signal, it
will read the key value through the standard I2C interface communication protocol. The master
will send a Start signal first, and then send data composed of a 7-bit slave address and a read
bit, R. The slave address is set to 50H in the example program. After this, the master waits to
receive a response signal returned by the slave. If it does not receive a response signal returned
by the slave within a specific time, it will immediately send a Stop signal to stop the
communication. If it receives a response returned from the slave, it will read the key value
sent from the slave and then send a NACK signal followed by a stop signal to terminate the
communication.
2. Key Value and Corresponding RF Data Automatic Power Ventilation Fan
Key Value 01H 02H 04H 08H
RF Data 0FH/10H 00H 10H/0FH 02H/1DH Lighting Heating 2 Heating 1 Child Lock
Key Value 10H 20H 40H 80H
RF Data 01H/1EH 0AH/15H 06H/19H —
Note: In the RF data in the above table, the former value indicates that the function is on, the
latter value indicates that the function is off.
The key value is composed of 8-bits of data. Each bit corresponds to a key function. When
any key is triggered, the corresponding bit will be set high and transmitted to the master
through the I2C interface.
The RF data length is 8-bits. Bit 0~Bit 4 correspond to the Lighting, Fan, Heating 1, Heating
2 and Ventilation functions respectively. Bit 5~Bit 7 are undefined. In addition, the Automatic
function is composed of Lighting, Fan, Heating 1 and Heating 2 functions. The Power key
only supports turning off all functions. The Child Lock supports display and control functions,
so the Child Lock function does not transmit any RF data. When the master reads the key
value from the touch key MCU, it will set the RF data corresponding bit high according to the
key value represented function and the RF data will be transmitted.
Example: When the panel does not display any function, if the “Ventilation” key is pressed,
the master will read the key value of 04H, the LCD displays the pattern and characters and the
master will transmit RF data with a value of 10H. If the key is pressed again, the LCD display
pattern and characters function is turned off. At the same time, the master will transmit RF
data calculated by the following formula.
RF data = Current RF data & 0FH = 00H.
By this analogy, if another function is turned on when existing functions are on, at the same
time, the master will transmit RF data calculated by the following formula.
Transmitted RF data = Current RF data | Function turned on value.
If an enabled function is turned off, at the same time, the master will transmit RF data
calculated by the following formula.
Transmitted RF data = Current RF data & Function turned off value
Bathroom Environment Remote Controller Reference Design
WAS-19B1EN V1.00 10 / 14 July 27, 2020
Receiver Terminal
Start
MCU initialisation Clear RAM
I/O initialisation Time Base initialisation
PTM initialisation and other operations
Read address from the EEPROM
BC2302 initialisation
Is any key pressed?The fAddrSave flag is set high;
Enter the learning mode;The LED7 flashes
fRxFnd==1?(RF signal is detected?)
Clear the fRxFnd flag
Call the Data_PROCESS subfunction to demodulate
fRxOK==1?
Clear the fRxOK flag
Call the PrcRxCode subfunction
fAddrSave==0?fLearn==1?
Address is stored into the EEPROM
The buzzer sounds for 100ms;
LED7 resumes lighting;Inform users of successful
learning
Y
N N
Y
Does the received address match the stored address?
Call the ProcRFFound subfunction;
Drive relay and LED operation
Y
Call the BeepProc subfunction;Drive buzzer operation
Y
N
Y
Y
N
N
N
N
Figure 12
Bathroom Environment Remote Controller Reference Design
WAS-19B1EN V1.00 11 / 14 July 27, 2020
Initialisation
After a power-on reset, the first program to execute is the system setup initialisation which includes
MCU clock initialisation, Clear RAM, I/O initialisation, Timer initialisation and other operations.
Read the previously stored 3-byte address from the EEPROM memory. The system will enter the
I2C mode to configure the BC2302 registers. Set the BC2302 to enter the RX mode, enable the
Time Base function and the global interrupt.
Main Loop
1. Call the ScanKey subprogram, if the key which is shared with the PA4 pin is triggered, the signal
on this pin will change to low level. The signal will implement a 30ms debounce, and then confirm
whether the key is still triggered. If it is confirmed that a key is triggered, the program will jump
to the ProcSaveID subroutine, the LEDWork flag will be set high and LED7 on the receiver
terminal will periodically illuminate or be extinguished every 500ms. The LED change process
lasts for 8 seconds. If a packet that fits the specific format is received within 8 seconds, the decoded
packet address will be stored in the EEPROM memory, the LED7 will resume being on as a power
indicator and the buzzer will sound for 100ms to indicate that the address has been received and
successfully saved. If the address is not received within 8 seconds, only LED7 resumes being
illuminated.
2. The fRxFnd flag is used to determine whether the signal decoding has completed. If the signal
decoding has completed, the flag is set high and the data is stored in mRFData[]. If the flag bit
fRxFnd is zero, the program will return to the "Is any key pressed?" step. Otherwise, the RFTimer
will be turned off, the fRxFnd flag will be cleared to zero and data decoding will be executed. The
RFTimer will be turned on after the data decoding has completed. The fRxOk flag is used to
determine whether the data decoding format is correct. If the data decoding format is correct, the
fRxOk flag will be set high. If the fRxOk flag is zero, the program will return to the "Is any key
pressed?" step. If it is high, clear fRxOk to zero and check the address. If the received signal
address is consistent with the stored address, the carry flag C will be 1 and the data decoding and
corresponding operations will be executed. The corresponding relays can be turned on or off. If
the buzzer is on, the buzzer will continue to sound for 100ms. If the buzzer is off, the buzzer will
continue to sound for 500ms. If the received address is not consistent with the stored address, go
to step 3.
3. The Time Base overflow time is 10ms. Whenever the Time Base overflows, the program will
jump to the Time Base interrupt subroutine and the corresponding flag, f10ms, will be set high.
This flag bit will be cleared to zero and the mKeyDeb parameter will be decremented in the main
loop. If the key remains at a low level when the mKeyDeb parameter is reduced to 0, this confirms
that the key was triggered. If the program enters the learning mode, the LED should flash. When
the data packet is received, it is necessary to determine it at the time of the data packet and drive
the buzzer to operate. Each time the program executes the Time Base interrupt subroutine, the
corresponding counter will be accumulated, the complete time judgment and the corresponding
operations will be executed in the LEDProc, Formatime and BeepRroc subfunctions.
Bathroom Environment Remote Controller Reference Design
WAS-19B1EN V1.00 12 / 14 July 27, 2020
RF Data Packet Format Description
The data packet is composed of Leading, Start, Address, Data, CRC and End. Leading Start Address Data CRC End
Parameter Information: Parameter Function Value
Leading_code Leading type 3/4 Start_Format Start type 1/3 Bit_Format Bit encoding type 2 CRC_BIT CRC check output bits 0/4/8 END_Format End type 1/4 Addr_W Address width 8/16/20/22/24 Data_W Data width 2/4/8
The above parameters are placed in Tx_Encoder.inc/Rx_Decoder.inc which need to be modified manually.
The detailed parameter descriptions are as follows:
1. Leading code: Select 3: 1λhigh + 31λlow; Select 4: (1λhigh + 1λlow)×8.
2. Start format: Select the packet start bits. There are two options. If the start format 1 is selected, the data packet has no start bit, if the start format 3 is selected, the packet has a start bit that is 4λhigh + 2λlow.
If Leading code=3, the start format must be selected as 1.
3. Bit format: Set the bit encoding type, it currently only supports a single bit format. The bit format status is as follows.
0: 1λhigh + 3λlow
1: 3λhigh + 1λlow
4. CRC_BIT: Select whether the packet has a CRC check function and CRC bits. If it is configured to 0, this means that the packet has no CRC. If it is set to 4, this means that the packet has a CRC check with a 4-bit CRC check output. If it is set to 8, this means that the packet has a CRC check with an 8-bit CRC check output.
5. END_Format: Select whether the packet has an End bit. There are two options. If the packet requires an End bit, it should be set to 4. End bit=2λhigh + 2λlow. If it is set to 1, the packet has no End bit.
6. Addr_W: Configure address width, currently 8/16/20/22-bit widths are available.
7. Data_W: Configure data width, currently 2/4/8-bit widths are available.
The current packet formats for the bathroom environment remote controller transmitter and receiver are as follows.
Leading(16λ)
Start(16λ)
Address(24-bit)
Data(8-bit)
CRC(8-bit)
End(4λ)
Bathroom Environment Remote Controller Reference Design
WAS-19B1EN V1.00 13 / 14 July 27, 2020
Operating Description Before use, a matching code operation must be implemented. The receiver will only respond to transmitters which have implemented a matching code operation. The transmitter has a 24-bit independent ID. The matching code operation means that the receiver will save the ID for identification.
Matching Code Press the “Learning” key on the receiver terminal, the learning indicator LED7 will flash and the device will enter the learning mode. If the “Power” key on the transmitter terminal is pressed, LED7 on the receiver terminal will illuminate and the buzzer will sound for 100ms, indicating that the receiver terminal has saved the transmitter terminal address. If the receiver terminal does not receive the matching code within 8s, LED7 will resume illumination as a power indicator.
Normal Mode Operation 1. Press the “Lighting” key on the transmitter terminal, the LCD screen will display the Lighting
characters and pattern and the Lighting relay on the receiver terminal will be turned on. Press
the “Lighting” key again, the LCD screen displayed characters and pattern will disappear and
the Lighting relay on the receiver terminal will be turned off.
2. Press the “Fan” key on the transmitter terminal, the LCD screen displays the characters and
pattern and the relay on the receiver terminal will be turned on. Press the key again, the LCD
screen displayed characters and pattern will disappear and the relay on the receiver terminal will
be turned off.
3. Press the “Automatic” key on the transmitter terminal, the LCD screen will display the
characters and patterns for Lighting, Fan, Heating 1 and Heating 2 functions. The Lighting, Fan,
Heating 1 and Heating 2 relays on the receiver terminal will be turned on. Press the key again,
the LCD screen displayed characters and patterns will disappear and the Lighting, Fan, Heating
1 and Heating 2 relays on the receiver terminal will be turned off.
4. Press the “Heating 1” key on the transmitter terminal, the LCD screen displays the characters
and patterns of the Heating 1 and Fan functions, the Heating 1 and Fan relays on the receiver
terminal will be turned on. Press the key again, the LCD screen displayed characters and patterns
will disappear and the Heating 1 and Fan relays on the receiver terminal will be turned off.
5. Press the “Heating 2” key on the transmitter terminal, the LCD screen displays the characters
and patterns of the Heating 2 and Fan functions, the Heating 2 and Fan relays on the receiver
terminal will be turned on. Press the key again, the LCD screen displayed characters and patterns
will disappear and the Heating 2 and Fan relays on the receiver terminal will be turned off.
6. Press the “Child Lock” key on the transmitter terminal, the LCD screen will display the child lock
characters and pattern. At this time, the Automatic, Heating 1 and the Heating 2 keys are
automatically turned off, the LCD screen displayed characters and patterns remain unchanged.
The corresponding relays on the receiver terminal will also remain unchanged.
7. Press the “Ventilation” key on the transmitter terminal, the LCD screen will display the
characters and pattern, the Ventilation relay on the receiver terminal will be turned on. Press the
key again, the LCD screen displayed characters and pattern will disappear and the Ventilation
relay on the receiver terminal will be turned off.
Bathroom Environment Remote Controller Reference Design
WAS-19B1EN V1.00 14 / 14 July 27, 2020
8. Press the “Power” key on the transmitter terminal, the LCD screen displayed characters and
patterns of all functions will disappear and all relays on the receiver terminal will be turned off.
Test Data Test Items Theoretical value Industrial Solution
Transmitter Terminal SLEEP Current – LCD Off 3.42µA 6.5µA Transmitter Terminal SLEEP Current – LCD On 13.3µA 16.5µA Test Distance in Open Areas – About 120m
Table 3
Conclusion
This application note has introduced the operating principles, hardware and software description for
bathroom environment remote controller transmitter and receiver terminals. The transmitter is
composed of the HT67F2432, the BS83B08C and the BC2102 which can implement touch switch
control, temperature measurement and wireless transmission functions on the bathroom environment
remote controller control panel. The receiver terminal is composed of the BC45F7930 which can
implement complete wireless reception and directly drive relay functions. This bathroom environment
remote controller solution can meet most functional requirements, greatly reducing the user's
development time.
Reference File
Reference file: HT67F2342, BS83B08C, BC2102, BC45F7930 datasheets.
For more information refer to the Holtek’s official website www.holtek.com.
Versions and Modify Information
Date Author Issue Release and Modification 2019.12.18 鄧子健 First Version
Bathroom Environment Remote Controller Reference Design
WAS-19B1EN V1.00 15 / 14 July 27, 2020
Disclaimer
All information, trademarks, logos, graphics, videos, audio clips, links and other items appearing
on this website ('Information') are for reference only and is subject to change at any time without
prior notice and at the discretion of Holtek Semiconductor Inc. and its related companies
(hereinafter 'Holtek', 'the company', 'us', 'we' or 'our'). Whilst Holtek endeavors to ensure the
accuracy of the Information on this website, no express or implied warranty is given by Holtek to
the accuracy of the Information. Holtek shall bear no responsibility for any incorrectness or leakage.
Holtek shall not be liable for any damages (including but not limited to computer virus, system
problems or data loss) whatsoever arising in using or in connection with the use of this website by
any party. There may be links in this area, which allow you to visit the websites of other companies.
These websites are not controlled by Holtek. Holtek will bear no responsibility and no guarantee to
whatsoever Information displayed at such sites. Hyperlinks to other websites are at your own risk.
Limitation of Liability
In no event shall Holtek Limited be liable to any other party for any loss or damage whatsoever or
howsoever caused directly or indirectly in connection with your access to or use of this website, the
content thereon or any goods, materials or services.
Governing Law
The Disclaimer contained in the website shall be governed by and interpreted in accordance with
the laws of the Republic of China. Users will submit to the non-exclusive jurisdiction of the
Republic of China courts.
Update of Disclaimer
Holtek reserves the right to update the Disclaimer at any time with or without prior notice, all
changes are effective immediately upon posting to the website.