Kategorien
home automation

Smart RGB CCT LED Bulb

For a comfortable ambiente at home when watching tv I bought a few LED bulbs. My intention was to flash them with tasmota and integrate them into my domoticz smart home system.

WiFi Bulb with packaging

After about 2 weeks the lamps were delivered (I ordered them on aliexpress) and I tried to flash the new firmware using tuya-convert. Because tuya-convert didn’t work after several attempts I had to go the hard way…

only clipped cover

I opend the bulb with a small screwdriver and removed carfully the led circuit board. In the figure you can see the LED board with the RGB, cold white and warm white leds.

the LED circuit board was fixed with some silicon

Then I soldered a few wires to the marked testpoints on the back of the wifi circuit board. For flashing the ESP8285 we need RX, TX, IO0 and the power supply pins 3.3V and Ground.

USB – Serial Adapter and soldered wires

Flashing over the serial connection was no problem. I reassembled the bulb and screwed it into a suitable socket. The next step was to find out which color is controlled by which gpio pin. I tested every gpio pin with the setting pwm1 in tasmota and slowly the table filled up:

Color	| GPIO		| PWM
---------------------------------
R	| D1 / GPIO5	| PWM1	
G	| D2 / GPIO4	| PWM2	
B	| D5 / GPIO14	| PWM3	
CW	| D6 / GPIO12	| PWM4	
WW	| D7 / GPIO13	| PWM5	

Finally i only had to enter the settings in tasmota and create a suitable domoticz device.

tasmota settings
domoticz settings, type „Color Switch – RGBWWZ“
bulb lights up with the settings above

Kategorien
home automation

cloud-less vaccum cleaner

I own a robot vaccum cleaner from eufy (RoboVac 30C), but what i hate are chinese cloud applications. So one of the first steps of the cleaner was on my table. In parts.

Vaccum bot in parts

The main controller of the bot is a STM microcontroller with sensorcontroller, motor controller, … The interessting part is the 4-wire cable to the ‚TYWE1S‘ WiFi Modul. This module, based on the ESP8266 microcontroller, is tasmota capable. And fortunatly all pins are labeled. So at first, i soldered a ribbon cable to all interessting pins and place the connector in the battery box. You can see the grey ribbon cable and the connector on the pictures above and below also.

WIFI Module with soldered ribbon cable
All pins are labeled!
debugging connector in the battery box

I debugged a while with the original app and firmware and map the following commands at 115200 Baud:

ESP commands to the STM (And corresponding Tasmota TuyaMCU commands, if available):

55 AA 00 00 00 00 FF -> Heartbeat

55 AA 00 1C 00 08 01 14 01 03 0E 1E 0F 05 7C 
--> Time and Date, Example:
55 AA 00 1C 00 08 01 14  01  03  0E  1E  0F  05   7C
Preamble........... 020 001 003 014 035 015 005 Chksum
->	              20/01/03    14:35:15 Friday

55 AA 00 06 00 05 05 04 00 01 00 14 
-> Auto -> TuyaSend4 5,0 

55 AA 00 06 00 05 05 04 00 01 01 15 
-> 30 min -> TuyaSend4 5,1

55 AA 00 06 00 05 05 04 00 01 02 16 
-> Spot -> TuyaSend4 5,2

55 AA 00 06 00 05 05 04 00 01 03 17 
-> Edges-> TuyaSend4 5,3

55 AA 00 06 00 05 02 01 00 01 00 0E 
-> Stop -> TuyaSend1 2,0
-> Start -> TuyaSend1 2,1 

55 AA 00 06 00 05 65 01 00 01 01 72 
-> Home -> TuyaSend1 101,1

55 AA 00 06 00 05 67 01 00 01 01 74 
-> Find Start -> TuyaSend1 103,1

55 AA 00 06 00 05 67 01 00 01 00 73 
-> Find Stop -> TuyaSend1 103,0

55 AA 00 06 00 05 03 04 00 01 00 12 
-> Forward-> TuyaSend4 3,0

55 AA 00 06 00 05 03 04 00 01 01 13 
-> Backward-> TuyaSend4 3,1

55 AA 00 06 00 05 03 04 00 01 02 14 
-> to the left -> TuyaSend4 3,2

55 AA 00 06 00 05 03 04 00 01 03 15 
-> to the right -> TuyaSend4 3,3

If the robot is controlled with the ir-remote, the stm sends the following commands to the WIFI module:

55 AA 03 00 00 01 01 04 
-> Heartbeat, every 15 sec

55 AA 03 1C 00 00 1E 
-> Heartbeat #2, every 4 heartbeat ( =60sec ) 
-> actual time is requested

55 AA 03 07 00 05 02 01 00 01 01 13 
55 AA 03 07 00 05 0F 04 00 01 00 22 
55 AA 03 07 00 05 05 04 00 01 00 18 
-> Start (last Program)

55 AA 03 07 00 05 02 01 00 01 01 13 
55 AA 03 07 00 05 0F 04 00 01 00 22 
55 AA 03 07 00 05 05 04 00 01 00 18 
55 AA 03 07 00 05 66 04 00 01 01 7A 
-> Start (Auto)

55 AA 03 07 00 05 02 01 00 01 01 13 
55 AA 03 07 00 05 0F 04 00 01 00 22 
55 AA 03 07 00 05 05 04 00 01 01 19 
55 AA 03 07 00 05 66 04 00 01 01 7A 
-> Start (30 min)

55 AA 03 07 00 05 02 01 00 01 01 13 
55 AA 03 07 00 05 0F 04 00 01 00 22 
55 AA 03 07 00 05 05 04 00 01 02 1A 
55 AA 03 07 00 05 66 04 00 01 02 7B 
-> Start (Spot)

55 AA 03 07 00 05 02 01 00 01 01 13 
55 AA 03 07 00 05 0F 04 00 01 00 22 
55 AA 03 07 00 05 05 04 00 01 03 1B 
55 AA 03 07 00 05 66 04 00 01 02 7B 
-> Start (Edges)

55 AA 03 07 00 05 02 01 00 01 00 12 
55 AA 03 07 00 05 0F 04 00 01 01 23 
55 AA 03 07 00 05 05 04 00 01 04 1C 
-> Stop

55 AA 03 07 00 05 65 01 00 01 01 76 
55 AA 03 07 00 05 0F 04 00 01 05 27 
-> Home

55 AA 03 07 00 05 65 01 00 01 00 75 
55 AA 03 07 00 05 0F 04 00 01 01 23 
-> Home interrupted

55 AA 03 07 00 05 65 01 00 01 00 75 
55 AA 03 07 00 05 0F 04 00 01 03 25 
-> Home successful

55 AA 03 07 00 05 0F 04 00 01 02 24
55 AA 03 07 00 05 0F 04 00 01 01 23 
-> ?

55 AA 03 07 00 08 68 02 00 04 00 00 00 5B DA
-> Battery percentage -> 5B = 91%

How can I now control the robot via WIFI and my Domoticz installation without the Tuya cloud?

I have started flashing Tasmota to the WIFI module. Unfortunately tasmota only supports Tuya devices with 9600 baud. So i need a custom tasmota build for the bot. In the tuyamcu code (xdrv_16_tuyamcu.ino) i set the baudrate to 115200 (i probably will fix this problem with a new command, because i want one build for all my devices…) :

// In function TuyaInit:
...
//if (TuyaSerial->begin(9600)) { // comment out this line
if (TuyaSerial->begin(115200)) { // add this line
...

Another problem is the battery percentage value of the bot, there i have two options: change the tasmota code or recalculate the percentage in domoticz. I choose the first option and changed the following line (because i map the battery percentage later to the active_power value with the tuyamcu command):

// In function TuyaProcessStatePacket
...
//Energy.active_power[0] = (float)packetValue / 10;
Energy.active_power[0] = (float)packetValue; // my line
...

After the code changes i build the firmware and flash the controller. Here are my tasmota settings:

Tasmota device settings
Tasmota domoticz parameter

In the console the following commands are executed to map from fnId to dpId:

CMD: TuyaMCU 11,2
-> Map 'Relay1' (fnId 11) to dpId 2 (Start/Stop)

TuyaMCU 31,104
-> Map 'Power' (fnId 31) to dpId 104 (Battery Percentage)

In domoticz a simple switch device control the bot now, the ‚action when off ‚ is for homing the bot when you ’switch off‘:

Domoticz switch definition

For the battery percentage i add a ‚general, percentage‘ device:

Domoticz battery percentage

And finally i can control the robot without any cloud with my smartphone and the domoticz app, even when i’m not at home (via OpenVPN).

reassembled vacuum cleaner