Smart Lights X4

Note

You are on the documentation site of the X4 version. Please reffer to X1 for documentation regarding the other board version.

Welcome to the documentation page of the Smart Lights X4, an electronic board based on the ESP32 with the target of controlling up to 4 dimmable led strips under 24VDC.

It can be powered from an standard electric socket (since the board can mount a \(100-240 V_{AC}\) to \(12 V_{DC}\)/\(24 V_{DC}\) power transformer) and being able to regulate 4 independent monochromes LED strips or one RGBW LED strip.

Contents

Safety guidelines

How to operate and manipulate the Smart Lights X4.

Getting started

First steps for configuring and working with the Smart Lights X4.

Schematics and drawings

Design files of the Smart Lights X4.

Technical support

If you have technical problems or cannot find the information that you need in the provided documentation, please contact me directly:

Author:

J.G.Aguado

Contact:

jon-garcia@hotmail.com

Board:

Smart Lights X4

Revision:

2

Date:

April 12, 2023

Safety guidelines

These safety guidelines, the operation instructions and the limit values listed in Technical Specifications are to be read carefully before operating the product.

Caution

This product has been designed for being used in domotic applications. It was not designed for any use involving serious risks or hazards that could lead to death, injury, serious physical damage, or loss of any kind without the implementation of exceptionally stringent safety precautions.

Risk of electric shock

_images/electric_shock.png

The usage of this product could imply working with high voltage installations (\(100-240 V_{AC}\)). Perform any action, specially in the area with this symbol on the board, with the appropriate means and always with safety.

If you have any question, please check with technical support (Technical support) before taking any action potentially dangerous.

Protection against ESD

_images/esd.png

The Smart Lights X4 contains components sensitive to ESD, which can be damaged by inappropriate handling. It’s therefore necessary to provide some safety precautions against ESD during the handling and operation.

Usage, transport and storage

During the use, transport and storage, this product must be protected from any mechanical stress (forces applied over the board or it’s components), temperatures out of the data-sheet’s range, high environmental humidity or aggressive atmospheres.

Avoid using it in areas where it cannot be assured the previously mentioned environmental conditions.

Repairs

If any of the components on the board gets damaged, a reparation is possible. This repair can be performed by yourself if you identify the problem and have the means for desoldering & soldering. If this is not the case, just write to the Technical support mail to reach a solution.

Disposal

_images/disposal.png

In accordance with national and local environmental protection and material recovery and recycling regulations, electronic devices that can no longer be used (in case a repair is not possible) must be disposed of separately and not with normal household garbage.

Restriction of Hazardous Substances

_images/RoHS.png

The PCB and the electronic components mounted on the Smart Lights X4 have been manufactured attending to the EU rules restricting the use of hazardous substances (RoHS) in electrical and electronic equipment to protect the environment and public health.

Getting started

Soldering

Important

Please note that some components in this board need to be soldered.

If you have never soldered or you want to improve your soldering techniques I recommend you the Adafruit Guide To Excellent Soldering

For better understanding where is located each component on the board check out the PCB layout with the interactive BOM.

Powering

The Smart Lights X4 can be powered in two ways: through the DC Power Jack or through the AC Input, but not simultaneously.

Caution

Power the board only after making all the connections

DC Power Jack

The DC Power Jack is a very common connector for home power supplies. The size of the one by default is a 5.5mm (outer) and 2.1mm (inner) diameter.

Since there are many power supplies with this connector it is important, before plugging any power supply to the board, checking out a few important details:

  • The output voltage of the power supply has to be in the range of 5 to 24VDC.

  • The power of the power supply is enough for the LEDs you want to power.

  • The connector polarity is correct. Inner pole positive and outer negative

_images/polarity.png
AC Input

If your preffer not to use external power suplies you can assemble one of the following ones directly on the board:

  • HLK-40M Series: 40W power supplies with output voltages 5/9/12/15/24VDC

  • HLK-20M Series: 20W power supplies with output voltages 5/9/12/15/24VDC

_images/HLK-40.png _images/HLK-20.png

Danger

If your are using the AC power never touch the board while is powered.

I/O

The Smart Lights X4 supports up to 4 independent analog outputs and 8 digital inputs/outputs:

Pinout table

GPIO

Input

Output

Name

16

Auxiliar 1

17

Auxiliar 2

18

Auxiliar 3

19

Auxiliar 4

23

Output 1

25

Output 2

26

Output 3

27

Output 4

32

Input 1

33

Input 2

34

Input 3

35

Input 4

Analog outputs:

Each one of these outputs are PWM controlled individually through power mosfets. Despite the PCB layout should allow a correct heat dissipation, an additional heatsink would be recommendable for applications where a high current is expected (long LED strips or high intensity LEDs)

The connection port of each of the outputs is located on the top left part of the board and is done through 3.5mm screw terminals. The polarity of the connection is defined on the PCB silkscreen.

_images/outputs.png

From left to right, the pin definion of each output is:

Output 1:

GPIO23

Output 2:

GPIO25

Output 3:

GPIO26

Output 4:

GPIO27

Digital inputs/outputs:

The connection port of these pins is located on the top right part of the board and is done through 2.54 pins.

_images/digital_io.png

From this set of pins, there are two groups: inputs and auxiliar pins. The difference is that the input pins are pulled-down through 10k resistors and are connected on the PCB to the pushbuttons.

Input 1:

GPIO32

Input 2:

GPIO33

Input 3:

GPIO34

Input 4:

GPIO35

Hint

These pins correspond to the ADC_1 (chanels 4-7) of the ESP-32, and therefore can be used as analog inputs, always taking into account that are pulled-down already on the board.

_images/led_pushbutton.jpg

The auxiliary pins access directly to the microcontroller pins and can behave as digital input/outputs. The intention of these auxiliar pins is to control LED rings on pushbuttons that have this feature

Auxiliar 1:

GPIO16

Auxiliar 2:

GPIO17

Auxiliar 3:

GPIO18

Auxiliar 4:

GPIO19

Communications

In addition to the I/O mentioned before, there is also a direct connection to:

IIC (\(I^2C\)) bus:
SDA:

GPIO21

SCL:

GPIO22

Serial bus:
Tx:

GPIO1

Rx:

GPIO3

Enclosure

The Smart Lights X4 has been designed to fit in the electronics enclosure LK-PLC01, compatible with DIN rails and screws, and it is recommended for indoors only.

_images/SL_X4_1.png
External size:

115x90x40mm

Material:

ABS Plastic

Color:

Transparent cover, black or beige base

Programming

There are two main programming methods supported and tested with the Smart Lights X4:
  • ESPHome

  • Arduino

In both scenarios, and if you are using the USB port or the Serial port for programming it, you will first need to enter the board into flashing mode. For that, press and hold the Flash pushbutton while you reset the board (pressing once the Reset pushbutton).

Caution

When flashing the board, make sure its only powered by the USB/Serial port.

ESPHome

ESPHome is a well known platform for programming ESP-based devices with a very little effort. It is configured via YAML files and supports a wide range of functionalities and sensors.

Important

For using ESPHome, and all its funcionalities, you need to have a Home Assistant instance running in the same network as your Smart Lights X4.

_images/captive_portal-ui.png

The Smart Lights X4 already comes with an embeded version of ESPHome, that would only require an OTA update to get it ready to work in your network:

  1. Power the board, and let it run for 1-2 minutes. When the board cannot connect to a WiFi network, it will create a fallback hotspot.

  2. Use a smartphone or tablet and go to the WiFi settings, connect to the recently created Smart-Lights-X4 hotspot with the password smartlights.

  3. Access to the captive portal and open the browser if doesn’t pop up automatically.

  4. Enter your network setttings and press Save.

Now, your ESPHome device is ready to be found by Home Assistant in your network. Add it from the ESPHome section to add and edit a customized configuration file.

As an example of such configuration file (and the one flashed on the factory settings of the Smart Lights X4) with all the I/O:

  1substitutions:
  2  device_name: "smart-lights-x4"
  3  friendly_name: "Smart Lights X4"
  4  project_name: "smart.lights_x4"
  5  project_version: "1.0"
  6  ap_ssid: "Smart-Lights-X4"
  7  ap_pwd: "smartlights"
  8
  9esphome:
 10  name: "${device_name}"
 11  name_add_mac_suffix: true
 12  project:
 13    name: "${project_name}"
 14    version: "${project_version}"
 15
 16esp32:
 17  board: esp32dev
 18  framework:
 19    type: arduino
 20
 21# Enable logging
 22logger:
 23
 24# Enable Home Assistant API
 25api:
 26
 27# Enable Over The Air updates
 28ota:
 29
 30#Public location of this yaml file
 31dashboard_import:
 32  package_import_url: github://JGAguado/Smart_Lights/docs/source/files/configuration.yaml@X4
 33  import_full_config: false
 34
 35# Enable fallback hotspot (captive portal) in case wifi connection fails
 36captive_portal:
 37
 38esp32_improv:
 39  authorizer: none
 40
 41improv_serial:
 42
 43wifi:
 44  ap:
 45    ssid: "${ap_ssid}"
 46    password: "${ap_pwd}"
 47
 48    
 49light:
 50  - platform: monochromatic
 51    name: "Light 1"
 52    id: light_1
 53    output: l1
 54  - platform: monochromatic
 55    name: "Light 2"
 56    id: light_2
 57    output: l2
 58  - platform: monochromatic
 59    name: "Light 3"
 60    id: light_3
 61    output: l3
 62  - platform: monochromatic
 63    name: "Light 4"
 64    id: light_4
 65    output: l4
 66
 67
 68output:
 69  - platform: ledc
 70    id: l1
 71    pin: GPIO23
 72  - platform: ledc
 73    id: l2
 74    pin: GPIO25
 75  - platform: ledc
 76    id: l3
 77    pin: GPIO26
 78  - platform: ledc
 79    id: l4
 80    pin: GPIO27
 81    
 82binary_sensor:
 83  - platform: gpio
 84    name: "PB1"
 85    pin:
 86      number: GPIO32
 87    on_press:
 88      then:
 89        - light.toggle: light_1
 90  - platform: gpio
 91    name: "PB2"
 92    pin:
 93      number: GPIO33
 94    on_press:
 95      then:
 96        - light.toggle: light_2
 97  - platform: gpio
 98    name: "PB3"
 99    pin:
100      number: GPIO34
101    on_press:
102      then:
103        - light.toggle: light_3
104  - platform: gpio
105    name: "PB4"
106    pin:
107      number: GPIO35
108    on_press:
109      then:
110        - light.toggle: light_4

Arduino

If you are still interested in programming directly with the Arduino IDE, the procedure is no different than with any other ESP32 devices:

  1. Open the Arduino IDE and go to File -> Preferences option.

  2. Add to the Additional Boards Manager URSLs the url:

https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
  1. Close the preferences and open in the menu Tools -> Board -> Boards Manager.

  2. Search for esp32 and install it. This might take some time.

  3. Now you can select the board ESP32 Dev Module as the target board. Leave the rest of parameters by default.

  4. Select the correct port and remember to enter the board into flashing mode before uploading the sketch.

FAQ

After connecting everything and turning on the Smart Lights X4, the power LED doesn’t turn on, why?

If the board is connected correctly and you cannot see the power LED on, disconnect the power immediately. Please check all the connections and measured with a multi-meter the resistance between 3V3 and gnd in any port (\(I^2C\) or Serial). If the resistance is close to zero you have a short circuit somewhere in your board, please check your connections and any soldering you’ve made If the problem persist reach Technical support

Can I upload ESPHome directly from the Home Assistance setup running on my Raspberry Pi?

Yes you can, and actually this is one of the simplest and more effective way to upload ESPHome.

Can I upload firmware through the Serial bus?

Yes you can, however this is only recommended if you have troubles using the USB port and you are familiar with the procedure.

I want to use the IIC port for expanding the possibilities, how can I do it?

Once you have located the sensor that you want to connect to the IIC port, check that is compatible with the 3.3V power supply from the Smart Lights X4. If this is the case, just connect it directly, power the board and update the firmware!

Schematics and drawings

Electronic schematics

_images/Schematic_1.png _images/Schematic_2.png

Download PDF

PCB

Enclosure drawings

_images/LK-PLC01.png

Download PDF

Technical Specifications

Electrical

Parameter

Symbol

Min.

Max.

Unit

Supply voltage (AC)

\(V_{AC}\)

100

240

V

Supply voltage (DC)

\(V_{DC}\)

9

24

V

Power

P

40

W

Environment

Parameter

Symbol

Min.

Typ.

Max.

Unit

Working temperature [1]

\(T_{amb}\)

0

25

60

°C

Storage temperature [1]

\(T_{amb}\)

0

25

60

°C