Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for MagicHome LED controllers #940

Closed
wants to merge 1 commit into from
Closed

Support for MagicHome LED controllers #940

wants to merge 1 commit into from

Conversation

lobradov
Copy link

MagicHome LED controllers (aka Flux-Led)

I got quite a few of these nice little boxes from AliExpress. Out of the box, they have a stock firmware that requires separate application on your phone.

img_0303
img_0304

https://www.aliexpress.com/item/Magic-Home-Mini-RGB-RGBW-Wifi-Controller-For-Led-Strip-Panel-light-Timing-Function-16million-colors/32686853650.html

It's essentially a ESP-12S with necessary voltage converters, little bit of flash, 3 or 4 MOSFETs to drive LED strip, connector for LED strip and optional IR receiver. It's powered by 12V that is used to power LED strip as well.

Board comes in (at least) 3 variants:

  • RGB
  • RGBW
  • RGBW + IR receiver

I happen to have 2 variants (RGBW and RGBW+IR) and internally they use same PCB and almost the same housing. IR variant, obviously, has a IR Receiver soldered, but non-IR has pins for it, so it's easy to "upgrade".

Application uses some binary protocol over UDP and is generally not open. People have reverse engineered the protocol (see flux-led python library) but I wasn't happy with it as it's still not MQTT enabled and it works very slow/unreliable with Home Assistant.
Sonoff-Tasmota to the rescue ;)

Configuration

Some GPIO are preconfigured with the board:

  • GPIO05 - Green color on the led strip, first pin from the GND
  • GPIO14 - Red color on the LED strip, second pin from the GND
  • GPIO12 - Blue color on the LED strip, third pin from the GND

Due to variants, I left the option of choosing how would you like to use:

  • GPIO04 - on non-IR boards, it's open pin you can use for Onewire, button or something else. On IR-enabled boards, IR receiver is connected there so maybe we will add IR receiver support to Sonoff-Tasmota.
  • GPIO13 - This pin is not used on RGB board (so you'll leave it as "None"), but on RGBW, it's driving another channel for LED strip. Depending on the strip type, you can set it to PWM1 (for RGB+Cold White) or PWM2 (for RGB+Warm White).

btw, I'm actually driving 4 different white (single-color) strips with this board. Just make sure GND is common for all of them.

How to flash

Original firmware doesn't even have OTA update option, so trying to do something like SonOTA wouldn't work.

Board has RX, TX, GND and GPIO00 pads exposed on the bottom side of the PCB. You can use those pads to program the board either by:

  • holding programmer pins directly (ugly and imprecise - you might need someone's help to press the buttons while you juggle with pins),
  • using putty (a bit better, but still frustrating) or
  • temporary soldering wires to pads.

img_0307

You should also connect VCC from the MagicHome to VCC on the programmer, but for me, this didn't work. I used the VCC pin of the IR Receiver, so some resistors/capacitors/diodes might have gotten in the way. Other explanation might be that programmer didn't supply enough power for the whole board (maybe MOSFETs are drawing something).

In either case, I needed to power the board while keeping it connected to the programmer.

With all Sonoff boards that works with AC, this is a big no-no that will fry your programmer, your Sonoff and might even get you killed.
In this case, you'd be dealing with 12V, so the only thing that matters is to connect the GND of your programmer to GND of the board before you supply the 12V. Not doing so might fry your board and/or programmer, but would definitely not hurt you.

Steps I used:

  1. Connect your programmer to a breadboard and notice the locations of GND, TX and RX columns.
  2. Open the MagicHome controller box and expose bottom side of PCB
  3. Solder 4 jumper wires to 4 exposed pads.
  4. FIRST connect GND to your programmer (and make sure they are connected well!)
  5. Connect RX from the MagicHome to TX on the programmer. TX from the board goes to RX on the programmer.
  6. Connect GPIO00 to GND (best to use same column on the breadboard)
  7. Connect the 12V power supply to MagicHome. As GPIO00 is connected to GND, board will go into flash mode. I usually disconnect GPIO00 after few seconds, but not sure if this is mandatory or optional.
  8. Upload Sonoff-Tasmota like it would be any other board.
  9. Once upload is complete, disconnect power from the MagicHome controller
  10. Disconnect RX and TX and then only then GND. GND gets disconnected LAST.

You can then connect the power back to the board and Sonoff-Tasmota should be running on it. Once you verify that board is up and you can access it over the Web, you can unsolder temporary wires and update subsequent firmware versions using OTA.

@davidelang
Copy link
Collaborator

davidelang commented Sep 30, 2017 via email

@lobradov
Copy link
Author

I will once patch makes it into the release - no point in claiming support for a device if the code is not there ;)

@arendst
Copy link
Owner

arendst commented Sep 30, 2017

Implemented in next (pre) release

arendst added a commit that referenced this pull request Sep 30, 2017
5.8.0c
 * Add warning to webpage when USE_MINIMAL is selected (#929)
 *
Fix compile error when DOMOTICZ_UPDATE_TIMER is not defined (#930)
 *
Fix alignment of web page items in some browsers (#935)
 * Add smoother
movement of hour hand in WS2812 led clock (#936)
 * Add support for
Magic Home RGBW Led controller (#940)
@lobradov
Copy link
Author

lobradov commented Oct 1, 2017

Added a wiki page and updated reference.

@lobradov lobradov closed this Oct 3, 2017
@lobradov lobradov deleted the magic-home branch October 3, 2017 10:15
@PeggyFree
Copy link

PeggyFree commented Oct 4, 2017

What about the domoticz integration of RGBW devices like this Strip controller or the B20? Is it plug and play, is it identical to a milight or yeelight device under domoticz, with color, white and brightness commands?

@jeylites
Copy link

This is great, how to get this going with Homebridge? I tried the plugin, it show up on Homekit App but can't communicate with my hardware.

http-tasmota-led

arendst added a commit that referenced this pull request Oct 30, 2017
5.9.0 20171030
* Rewrite code (partly) using Google C++ Style Guide
(https://google.github.io/styleguide/cppguide.html)
* Rewrite code by using command lookup tables and javascript (client
side) web page expansions
* Change HTML/CSS to enable nicer form field entry
* Change default PWM assignments for H801 RGB(CW) led controller to
support optional Color/Dimmer control
*   GPIO04 (W2)    from GPIO_PWM2 to GPIO_USER to be user configurable
for GPIO_PWM5 (second White - Warm if W1 is Cold)
*   GPIO12 (Blue)  GPIO_PWM3 no change
*   GPIO13 (Green) from GPIO_PWM4 to GPIO_PWM2
*   GPIO14 (W1)    from GPIO_PWM1 to GPIO_USER to be user configurable
for GPIO_PWM4 (first White - Cold or Warm)
*   GPIO15 (Red)   from GPIO_PWM5 to GPIO_PWM1
* Change default PWM assignments for MagicHome RGB(W) led controller to
support optional Color/Dimmer control
*   GPIO05 (Green) from GPIO_PWM4 to GPIO_PWM2
*   GPIO12 (Blue)  from GPIO_PWM5 to GPIO_PWM3
*   GPIO13 (White) GPIO_USER to be user configurable for GPIO_PWM4
(White - Cold or Warm)
*   GPIO14 (Red)   from GPIO_PWM3 to GPIO_PWM1
* Change default PWM assignment for Witty Cloud to support optional
Color/Dimmer control (#976)
*   GPIO12 (Green) from GPIO_PWM4 to GPIO_PWM2
*   GPIO13 (Blue)  from GPIO_PWM5 to GPIO_PWM3
*   GPIO15 (Red)   from GPIO_PWM3 to GPIO_PWM1
* Change when another module is selected now all GPIO user configuration
is removed
* Change command name IRRemote to IRSend (#956)
* Remove Arduino IDE version too low warning as it interferes with
platformio.ini platform = espressif8266_stage
* Fix command FullTopic entry when using serial or console interface
* Fix possible UDP syslog blocking
* Fix minimum TelePeriod of 10 seconds set by web page
* Fix command GPIOx JSON response (#897)
* Fix inverted relay power on state (#909)
* Fix compile error when DOMOTICZ_UPDATE_TIMER is not defined (#930)
* Fix alignment of web page items in some browsers (#935)
* Fix setting all saved power settings to Off when SetOption0
(SaveState) = 0 (#955)
* Fix timezone range from -12/12 to -13/13 (#968)
* Fix Southern Hemisphere TIME_STD/TIME_DST (#968)
* Fix TLS MQTT SSL fingerprint test (#970, #808)
* Fix virtual relay status message used with Color/Dimmer control (#989)
* Fix command IRSend and IRHvac case sensitive parameter regression
introduced with version 5.8.0 (#993)
* Fix pressure calculation for some BMP versions regression introduced
with version 5.8.0i (#974)
* Fix Domoticz Dimmer set to same level not powering on (#945)
* Fix Blocked Loop when erasing large flash using command reset 2
(#1002)
* Fix relay power control when light power control is also configured as
regression from 5.8.0 (#1016)
* Fix Mqtt server mDNS lookup only when MqttHost name is empty (#1026)
* Add debug information to MQTT subscribe
* Add translations to I2Cscan
* Add translation to BH1750 unit lx
* Add light scheme options (Color cycle Up, Down, Random) and moving
WS2812 schemes up by 3
* Add Domoticz counter sensor to IrReceive representing Received IR
Protocol and Data
* Add option 0 to MqttHost to allow empty Mqtt host name
* Add support for Arilux AL-LC01 RGB Led controller (#370)
* Add esp8266 de-blocking to PubSubClient library (#790)
* Add Domoticz sensors for Voltage and Current (#903)
* Add platformio OTA upload support (#928, #934)
* Add warning to webpage when USE_MINIMAL is selected (#929)
* Add smoother movement of hour hand in WS2812 led clock (#936)
* Add support for Magic Home RGBW and some Arilux Led controllers (#940)
* Add command SetOption15 0 (default) for command PWM control or
SetOption15 1 for commands Color/Dimmer control to PWM RGB(CW) leds
(#941)
* Add Domoticz counter sensor to Sonoff Bridge representing Received RF
code (#943)
* Add support for Luani HVIO board
(https://luani.de/projekte/esp8266-hvio/) (#953)
* Add PWM initialization after restart (#955)
* Add IR Receiver support. Disable in user_config.h (#956)
* Add support for inverted PWM (#960)
* Add Sea level pressure calculation and Provide command Altitude (#974)
* Add support for up to 8 relays (#995)
* Add commands RfSync, RfLow, RfHigh, RfHost and RfCode to allow sending
custom RF codes (#1001)
* Add retain to ENERGY messages controlled by command SensorRetain
(#1013)
* Add commands Color2, Color3, Color4, Width2, Width3, Width4 and
SetOption16 to set Ws2812 Clock parameters (#1019)
* Add German language file (#1022)
* Add support for connecting to MQTT brokers without userid and/or
password (#1023)
* Add support for esp8266 core v2.4.0-rc2 (#1024)
* Add commands PwmRange 1,255..1023 and PwmFrequency 1,100..4000 (#1025)
* Add Polish language file (#1044, #1047)
* Add support for KMC 70011 Power Monitoring Smart Plug (#1045)
* Add support for VEML6070 I2C Ultra Violet level sensor (#1053)
* Add light turn Off Fade (#925)
* Add IrSend command option Panasonic as IrSend {"Protocol":"Panasonic",
"Bits":16388, "Data":<Panasonic data>}
*   where 16388 is 0x4004 hexadecimal (#1014)
* Add retry counter to DHT11/21/22 sensors (#1082)
curzon01 pushed a commit to curzon01/Tasmota that referenced this pull request Sep 6, 2018
5.8.0c
 * Add warning to webpage when USE_MINIMAL is selected (arendst#929)
 *
Fix compile error when DOMOTICZ_UPDATE_TIMER is not defined (arendst#930)
 *
Fix alignment of web page items in some browsers (arendst#935)
 * Add smoother
movement of hour hand in WS2812 led clock (arendst#936)
 * Add support for
Magic Home RGBW Led controller (arendst#940)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants