Here is how to create a smart brightness-controlled lamp with motion sensor.
This article aims to demonstrate the design of a smart brightness-controlled lamp with a motion sensor using a programmable mixed-signal matrix with four outputs, operating voltage up to 13.2 V, and 2 A current per output. The system is created using high voltage macrocells and other internal and external components within the chip to interact with a motion sensor.
The lamp has two modes: the intensity-controlled and the night mode. In the intensity-controlled mode, the light becomes brighter when the ambient light decreases and vice versa. In the night mode, the brightness is constantly dim. The light turns on only when the motion is detected by the PIR motion sensor. The lamp is powered with 3 AAA batteries (in total 4.5 V) and it has a red LED blinking signal to notify about batteries discharging. The design can be used as additional lighting in residential houses and business locations such as hallway and garage.
Construction and operating principle
The block diagram is shown in Figure 1.
Figure 1 The block diagram highlights the design building blocks of a brightness-controlled lamp. Source: Renesas
The complete design file created in free GUI-based Go Configure Software Hub is available on GP file.
The design consists of six main parts.
The first one is Mode Select Switch. The first part of the design is shown in Figure 2.
Figure 2 Here is how the Mode Select Switch looks like. Source: Renesas
The Mode Select Switch is LOW until pressing the button. Then the signal goes to DFF1, where the signal is latched before the next pressing. So, Mode Select has two states: LOW and HIGH, which are changed by pressing the button.
Then, the signal goes to Mode Select part (Figure 3).
Figure 3 The image shows the Mode Select part. Source: Renesas
When the Mode Select is low, the output of LUT3 is the output of Intensity Controlled Mode, when the Mode Select is high, the output of LUT3 is the output of Night Mode.
The Night Mode is a stable PWM signal with the duty cycle of ~12.5% and 64 Hz frequency (Figure 4).
Figure 4 The Night Mode employs a stable PWM signal. Source: Renesas
The design of the Intensity Controlled Mode is shown in Figure 5.
Figure 5 Here is how Intensity Controlled Mode looks like. Source: Renesas
The idea is to create a Schmitt trigger oscillator using PIN 2, PIN 3, inverter, and a resistor. In this case, the 10 M (dark resistance) photoresistor is used instead. It means that the frequency of the oscillator depends on the value of the resistance. When the ambient light increases, the resistance decreases, and when it becomes darker, the resistance increases. Accordingly, when the resistance increases, the frequency decreases, and vice versa.
Then, this signal is used as data for the one-shot macrocell (CNT4).
Since the clock at 8.3 MHz and the inverted one-shot pulse width at 10.9 us are constant, the output signal results in PWM with a constant 10.9 us of LOW and the rest period of HIGH, depending on the frequency generated by the Schmitt trigger oscillator with a photoresistor.
When the Mode is selected, the LUT3 output signal goes to HV OUT CTRL to drive the 6 LEDs connected in parallel. It is configured as half-bridge in Pre-Driver Mode (Figure 6) to provide the necessary current of 120 mA.
Figure 6 Six LEDS are connected in parallel in this mode. Source: Renesas
The lamp has a PIR motion sensor to lower power consumption. The configuration can be seen in Figure 7.
Figure 7 The image highlights the configuration in which PIR motion sensor is used. Source: Renesas
The CNT1 counts 30 seconds of motion sensor output. When the sensor output is LOW, more than 30 seconds, HV OUT CTRL and oscillators are powered down with a HIGH sleep signal (see Figure 8).
Figure 8 This is how the oscillators configuration looks like. Source: Renesas
As the lamp is powered by 3 batteries of 1.5 V (4.5 V), the device needs a battery discharge notification which helps the user not to forget to change batteries. The configuration can be found in Figure 9. The analog comparator CMP0 with 0.5 gain compares VDD and reference voltage. If this voltage is smaller than 1,952 mV, it is time to change batteries because the voltage has already decreased to 3.9 V. In this case, the red LED starts blinking with a 25% duty cycle notifying about discharge.
Figure 9 The image shows the configuration for battery discharge notification. Source: Renesas
The full circuit design can be seen in Figure 10.
Figure 10 Here is how full circuit design for battery discharge notification looks like. Source: Renesas
To test the design, the circuit is connected to 5 V (VDD, VDD_A, and VDD_B).
The oscilloscope screenshots show the Schmitt trigger oscillator signal (PIN 2, GPIO 0) in blue and the Intensity Controlled Mode output (PIN 7, HV_GPO0_HD) in yellow in Figure 11 to Figure 15.
As can be seen from these figures, the duty cycle of Intensity Controlled Mode increases (decreases) when the period of Schmitt trigger oscillator increases (decreases).
Figure 11 Period of the Schmitt trigger oscillator amounts to 12.2 us. Source: Renesas
Figure 12 Period of the Schmitt trigger oscillator amounts to 16.9 us. Source: Renesas
Figure 13 Period of the Schmitt trigger oscillator amounts to 20.65 us. Source: Renesas
Figure 14 Period of the Schmitt trigger oscillator amounts to 29.45 us. Source: Renesas
Figure 15 Period of the Schmitt trigger oscillator amounts to 55.9 us. Source: Renesas
The results prove that the circuit works as expected, and the chip used is capable of acting as the control module for LEDs.
Creating a smart lamp
The article describes how to configure the HVPAK chip to create a smart brightness-controlled lamp with motion sensor. It works only when the motion is detected and has two modes. The Night Mode has a constant low brightness. The Intensity Controlled Mode varies depending on the ambient light. In addition, the smart lamp has a battery discharge notification.
The internal resources in the SLG47105 chip, including the oscillators, logic, and GPIOs, are easy to configure to implement the desired functionality for this design.
This article was originally published on EDN.
Irena Antoniuk is technical documentation apps engineer at Renesas Electronics.