Automation of INTEX SWG

Apr 20, 2021
13
Spain
Pool Size
10700
Surface
Vinyl
Chlorine
Salt Water Generator
SWG Type
Intex Krystal Clear
Hi all,

As I have no much time, I'm gonna share what I have (is working now in my SWG). Remember that is a Work In Progress code, so any contribution or idea will be very much appreciated.

For this project, original cable between display board and main board will now be from display board to ESP32 board. You'll need a new cable to connect ESP32 board to the main board. This way the ESP32 will be in the middle of every comunication. For the new cable I used a NEMA17 motor cable (the one that 3D printers use) as I had several ones at home, and one connector fits what I need, so only have to change the other connector from this cable.

Here is the repo:

For the circuit you'll need:
- ESP32
- Relay module
- Power supply, I used 5V, but you can use 3.3V instead (wiring is different!)
- 2x Female and 1x Male XH2.54 4pin connectors (they are the most similar I've found that fits original cable)
- Level shifter as the logic from ESP32 is 3.3V and the SWG logic is 5V.
- Fuse for the power supply (optional)
- NEMA17 cable (I used this because I had several ones at home, but you can use whatever you have or you can buy)

For the wiring, take into account the ESP32 pins:
- GPIO 19 -> SWG main board clock
- GPIO 18 -> SWG main board data
- GPIO 17 -> Display board clock
- GPIO 16 -> Display board data
- GPIO 0 -> Relay module control

As I haven't done any schematics yet, guessing which wire is everyone on the original cable between the main board and the display board is on you. Check the schematic of the display controller (TM1650) which is in Documentation folder within the repository. The pins you need to check on the TM1650 are the following:
- PIN2 clock
- PIN3 Data
- PIN4 GND
- PIN 10 VDD (+5V)
Once you've indentified these pins, you can easily identify wich pin in the cable corresponds to every pin in the TM1650, and you'll be able to properly connect it to the level shifter, and from here to the proper pins on the ESP32.

Main power wire must be disconnected from the main board within the machine to be able to fully control power from the ESP32 (and avoid turning on itself depending on it's programming). Instead, this cable now goes to the relay module and to the input of the power supply in ESP32 board. The output of the relay goes were the original power wire was connected before on the main board. Now the ESP32 can turn ON and OFF the machine. By default when the system is powered, the ESP32 goes to standby mode, which means the machine has power and can be controlled using the default factory buttons. If the ESP32 powers OFF the machine, it won't be available to be operated using the buttons, and will only able to go back to standy state using the Rest API, or unplugging and plugging back the system. This way I've kept factory behaviour.

Before using the API, first you'll need to configure the WIFI on the ESP32. For that this project includes the wifi manager which allows you to scan and set a wifi configuration easily from your phone, as ESP32 will create its own wifi for that. If you use the console and the USB connection you'll see the assigned IP. I strongly recomend you associate the IP to the MAC address in your router configuration to make sure every time DHCP on your router assings IP to the system, the IP remains the same (I haven't implemented anything yet to specify a custom static IP from the phone).

For the API to control the system there are some endpoints that you could check in the code.
Basic API calls are the following:
- Control the machine
POST http://ip_addr:8080/api/v1/intex/swg
{
"data": {
"power": "{on|off|standby}"
}
}

- Get current status and info
GET http://ip_addr:8080/api/v1/intex/swg

- OTA Update
http://ip_addr:8080

Hope I can find the time to create a propper documentation with schematics, pictures, credits and agreements to other projects that I used. If you have any problem with this or you need help, feel free to ask, I'll try to help you.

Enjoy!
 

jressel01

Member
Jul 19, 2021
8
Germany
hello tony,
nice to hear from you. the github link doesn't work.
in your github there is only "esp32-wifi-manager".
Regards
Jürgen
 
Apr 20, 2021
13
Spain
Pool Size
10700
Surface
Vinyl
Chlorine
Salt Water Generator
SWG Type
Intex Krystal Clear
hello tony,
nice to hear from you. the github link doesn't work.
in your github there is only "esp32-wifi-manager".
Regards
Jürgen
Sorry, I forgot to change visibility from private to public repository. You can try again.

Regards,
 
  • Like
Reactions: jressel01

jressel01

Member
Jul 19, 2021
8
Germany
Hi Tony,
i try to Build but i get an Error:
../main/IntexSWG.cpp:28:10: fatal error: wifi_manager.h: No such file or directory
#include "wifi_manager.h"
if i take the wifi_manager.h file from your other Projekt it dont work
[2/3] Linking CXX executable IntexSWG.elf
FAILED: IntexSWG.elf
cmd.exe /C "cd . && C:\Users\Diag\.espressif\tools\xtensa-esp32-elf\esp-2021r1-8.4.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-g++.exe -mlongcalls -Wno-frame-address @CMakeFiles\IntexSWG.elf.rsp -o IntexSWG.elf && cd ."
c:/users/diag/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/main/libmain.a(IntexSWG.cpp.obj):(.literal._Z6RTOS_2Pv+0x1c): undefined reference to `wifi_manager_clear_wifi_configuration'
c:/users/diag/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/main/libmain.a(IntexSWG.cpp.obj):(.literal.app_main+0x44): undefined reference to `wifi_manager_start'
c:/users/diag/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/main/libmain.a(IntexSWG.cpp.obj):(.literal.app_main+0x48): undefined reference to `wifi_manager_fetch_wifi_sta_config'
c:/users/diag/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/main/libmain.a(IntexSWG.cpp.obj):(.literal.app_main+0x4c): undefined reference to `wifi_manager_set_callback'
c:/users/diag/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/main/libmain.a(IntexSWG.cpp.obj): in function `RTOS_2(void*)':
c:\intex-swg-iot-master\intex-swg-iot-master\build/../main/IntexSWG.cpp:488: undefined reference to `wifi_manager_clear_wifi_configuration'
c:/users/diag/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/main/libmain.a(IntexSWG.cpp.obj): in function `app_main':
c:\intex-swg-iot-master\intex-swg-iot-master\build/../main/IntexSWG.cpp:687: undefined reference to `wifi_manager_start'
c:/users/diag/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: c:\intex-swg-iot-master\intex-swg-iot-master\build/../main/IntexSWG.cpp:687: undefined reference to `wifi_manager_fetch_wifi_sta_config'
c:/users/diag/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: c:\intex-swg-iot-master\intex-swg-iot-master\build/../main/IntexSWG.cpp:690: undefined reference to `wifi_manager_set_callback'
c:/users/diag/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: c:\intex-swg-iot-master\intex-swg-iot-master\build/../main/IntexSWG.cpp:690: undefined reference to `wifi_manager_set_callback'
c:/users/diag/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: c:\intex-swg-iot-master\intex-swg-iot-master\build/../main/IntexSWG.cpp:728: undefined reference to `wifi_manager_set_callback'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
PS C:\intex-swg-iot-master\intex-swg-iot-master>
 
Last edited:

jressel01

Member
Jul 19, 2021
8
Germany
i flasch the ESP first with esp32-wifi manager and it work.

i reflash the ESP with intex-swg-iot. no error but i get no wifi Access point.
Output from Monitor in Loop:
rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4784
load:0x40078000,len:13700
ho 0 tail 12 room 4
load:0x40080400,len:3188
0x40080400: _init at ??:?

entry 0x40080610
I (423) cpu_start: Pro cpu up.
I (423) cpu_start: Starting app cpu, entry point is 0x40081324
0x40081324: call_start_cpu1 at C:/Users/Diag/Desktop/esp-idf/components/esp_system/port/cpu_start.c:141

I (0) cpu_start: App cpu up.
I (437) cpu_start: Pro cpu start user code
I (437) cpu_start: cpu freq: 240000000
I (437) cpu_start: Application information:
I (442) cpu_start: Project name: IntexSWG
I (447) cpu_start: App version: 1
I (451) cpu_start: Compile time: Oct 1 2021 13:51:07
I (457) cpu_start: ELF file SHA256: e7bf3f6f3d0393fb...
I (463) cpu_start: ESP-IDF: v4.3.1-dirty
I (469) heap_init: Initializing. RAM available for dynamic allocation:
I (476) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (482) heap_init: At 3FFB9490 len 00026B70 (154 KiB): DRAM
I (488) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (495) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (501) heap_init: At 40093CE4 len 0000C31C (48 KiB): IRAM
I (508) spi_flash: detected chip: generic
I (512) spi_flash: flash io: dio
ets Jun 8 2016 00:22:57
 
Last edited:

jressel01

Member
Jul 19, 2021
8
Germany
I have set up a Raspi with Debian and checked out the files. Build and Flash without error or warnings. But I get just as far. I have a boot loop. It doesn't work. what am I doing wrong?