My kid was offered a cheap unicorn shaped lamp. It has RGB LEDs with some effects, an IR remote and an internal battery that allows it to run unpluged from the wall.

Seems to be exactly this model.

Of course I had to tear it down, no way I was going to “just use it” as intended.

Teardown

The solder jobs on the PCBs were out right criminal.

The battery seems to be an 18650 LiPo. It has what seems to be a thermal sensor next to it. The soldering job on the “BMS” is a botch job that scares the shit out of me, how is this crap a product marketed for children?

Reverse engineering

After some multimeter action

SOC pinout:

  1. Bottom button
  2. IR Pin 1
  3. IR Pin 2
  4. VCC
  5. NC
  6. White LEDs
  7. NC
  8. Switch 2 Pin 1
  9. Switch 2 Pin 2
  10. NC
  11. GND
  12. RGB Pin 1
  13. RGB Pin 2
  14. RGB Pin 3

ESPHomeification

I targeted a MVP. I’m ditching the IR remote and the movement sensor. I’m keeping the LEDs and the bottom button.

The bottom button is useful to turn it on and off without reaching for the phone or another controller.

status_led:
  pin:
    number: GPIO02 # GPIO02 is mapped to D4, so they are the same thing
    inverted: true

light:
  - platform: rgbw
    id: rgbw_led
    name: "RGB LED"
    red: output_red
    green: output_green
    blue: output_blue
    white: output_white
    effects: 
      - random:
      - pulse:
      - flicker:
      - strobe:

output:
  - platform: esp8266_pwm
    id: output_white
    pin: D1
  - platform: esp8266_pwm
    id: output_blue
    pin: D2
  - platform: esp8266_pwm
    id: output_red
    pin: D3
  - platform: esp8266_pwm
    id: output_green
    pin: D5

binary_sensor:
  - platform: gpio
    name: "Button"
    pin:
      number: GPIO12
      inverted: true
      mode:
        input: true
        pullup: true
    on_press:
      then:
        - light.toggle: rgbw_led

Final result

Yeah… It turns out it works.

But…

Don’t overestimate the destructive power of a baby that is curious about a new toy. My flimsy solder joints never stood a chance.

It now stands destructed in the pile of projects on my desk.