Hacking IKEA Växer

2,804

20

2

Introduction: Hacking IKEA Växer

Here's a quick weekend project to automate IKEA's Växer (+ Krydda) indoor cultivator light, integrating it into Home Assistant using a microcontroller and ESPHome.

This assumes you're already up and running with Home Assistant.

Supplies

IKEA Växer cultivation light

ESP32Cam

DC-DC Buck Converter

Cheap relay module

FTDI USB interface (for programming the microcontroller)

Step 1: Basic Overview

A wifi enabled microcontroller, in this case an ESP32Cam (as I have one lying around), will control the IKEA light via a relay.

It'll be scheduled to turn on the IKEA light in the morning and off at night using Home Assistant's web interface.

Step 2: The Microcontroller

I'm using an ESP32Cam. As the name suggests the ESP32Cam is also a Camera, which means I can control that too for the exciting bonus feature of time-lapse lettuce growing.

Step 3: DC-DC Step-down, Buck Converter

I'll be powering both the light and the microcontroller from the power brick that IKEA supplies. As the voltage of the LED light is 24V, I'll use a DC to DC buck converter to drop the voltage to 5V for the microcontroller.

You can pick these buck converters up very cheaply from ebay, amazon or wherever you like. Take care to adjust the small trim-pot to 5V output before you fry your delicate microcontroller.

Step 4: Relay

Finally, the relay module, a controllable switch designed to work with high voltage whilst isolating from the low voltage controlling input.

Toggling an I/O pin on the microcontroller, connected to the relay's input signal pin, will switch the 24V line to the light.

Step 5: Wiring It Up

Follow the wiring diagram. Eventually I'll connect the GND and 5V pins on the microcontroller to the output of the buck converter but there's no need at this stage to connect to the 24V power, or to connect the relay to the light. Powering it from the PC's USB 5V via an FTDI cable will do as it's tested and programmed.

Connect a wire from the relay's signal pin to GPIO 12 on the microcontroller, this will control the relay and connect the serial receive and transmit lines from the microcontroller to the FTDI's RX and TX taking care to swap the lines (microcontroller's TX goes to RX and RX to TX).

Step 6: Using ESPHome

Previously I would have programmed the microcontroller directly, using various wifi and MQTT Arduino libraries to communicate with Home Assisant. Now, thanks to ESPHome, it's much much easier to integrate ESP microcontrollers into Home Assistant without rolling your own code each time.

Step 7: Adding ESPHome to Home Assistant

Add the ESPHome Repository

As I'm using Hassio it's as easy as clicking 'Hass.io' on the left of Home Assistant's web front-end, clicking the 3 dots in the top right and selecting 'Repository' and adding 'https://github.com/esphome/hassio'.

Install the ESPHome Add-on

On Hassio's 'Add on store' page, scroll to ESPHome and install the ESPHome Add-on. Easy.

Step 8: Add Your Device to ESPHome

To add the ESP32Cam microcontroller to ESPHome click on the 'ESPHome' Add-on and click 'Open Web UI'.

You'll be asked if you want to add a node - nodes are what ESPHome calls these microcontroller devices - Click the '+'.

Give your node a name, I've called it 'vaxer_light', and select the type of device, mine is an 'AI Thinker ESP32-CAM'.

Finally supply your wifi network credentials and click 'Submit'.

Step 9: ESPHome Firmware

You might want to restart the ESPHome Add-on at this stage. With a bit of luck the new node 'vaxer_light' should now show up.

Click 'Edit' and the vaxer_light YAML file will be displayed. ESPHome uses YAML configuration files much like the rest of Home Assistant. However these YAML files will be compiled to become the firmware on the microcontroller, a far cry from delving deep into Arduino C code.

The YAML file for my vaxer light device looks like this:

esphome:
  name: vaxer_light
  platform: ESP32
  board: esp32cam

wifi:
  ssid: "xxxxxxxx"
  password: "xxxxxxxx"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Vaxer Light Fallback Hotspot"
    password: "xxxxxxxx"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

# ESP32Cam AI Thinker version
esp32_camera:
  external_clock:
    pin: GPIO0
    frequency: 20MHz
  i2c_pins:
    sda: GPIO26
    scl: GPIO27
  data_pins: [GPIO5, GPIO18, GPIO19, GPIO21, GPIO36, GPIO39, GPIO34, GPIO35]
  vsync_pin: GPIO25
  href_pin: GPIO23
  pixel_clock_pin: GPIO22
  power_down_pin: GPIO32

 # Image settings
  name: ESP32Cam
  resolution: 640x480
  jpeg_quality: 10

# relay on GPIO 12
switch:
  - platform: gpio
    pin: 12
    name: "VaxerLight"

Save and Close the YAML file, click the three dots and select 'Compile'

Step 10: Flash the ESPHome Firmware

When the YAML file has compiled click 'Download Binary'.

As this is the first time ESPHome has been put on this microcontroller, I need to manually upload the code to the board. In future, once the microcontroller has the ESPHome firmware on it, ESPHome can upload any new code over wifi.

To upload the binary to the microcontroller use the ESPHome Flasher tool.

Download ESPHome Flasher tool from: https://github.com/esphome/esphome-flasher/releases

The ESP32Cam is far from my favourite microcontroller, to get it into the upload state you must first link GPIO 0 to GND and press the reset button. This might be quite difficult depending on fatness of finger and whether or not you've plugged the thing into breadboard as the reset button is on the underside of the board, impossible to get to if using breadboard.

Run the esphome-flasher, select your downloaded binary file and the serial port of your FTDI adaptor.

With GPIO 0 linked to GND and having pressed the reset button, cross your fingers and click 'Flash ESP'.

When finished, unlink GPIO 0 and press reset again.

Step 11: Set Up Home Assistant

Having flashed the new ESPHome firmware to the ESP32Cam microcontroller, jump back to Home Assistant to add the new device.

Click 'Configuration', on the bottom left and then 'Integrations', click the plus sign and search for ESPHome.

Enter the host, the name of your node, in my case 'vaxer_light.local' and click 'Submit'.

Your ESPHome integration should now be shown, click it to see a list of devices and then click 'vaxer_light' to see the device info.

Click 'Add all device entities to lovelace'.

It's now fairly straightforward to use Home Assistant's automations to get the light to turn on and off at specific times of day.

The camera is available as camera.esp32cam, to take photos use Home Assistant's camera.snapshot service.

For example, an automation to take a photo at a specific time of day, and create my masterpiece time-lapse lettuce movie, would be:

- id: '20202907'
  alias: 'timelapse lettuce'
  trigger:
  - at: '11:30'
    platform: time
  action:
  - service: camera.snapshot
    data_template:
      entity_id: camera.esp32cam
      filename: '/config/timelapse_lettuce/esp32cam_{{ now().year }}_{{ now().day }}_{{ now ().month }}_{{ now ().hour }}{{ now ().minute }}.jpg'

Step 12: Finishing Off

And that's it. All that needs to be done is to wire it up to the power brick and buck converter as shown and then somehow glue it together and secure - wedge it up with blutak - it onto the housing.

Hope you enjoyed my Instructable, any questions please ask. More photos of this and other projects can be found on my instagram @limpfish.

Thanks

Be the First to Share

    Recommendations

    • Halloween Contest

      Halloween Contest
    • Fashion Challenge

      Fashion Challenge
    • First Time Author Contest

      First Time Author Contest

    2 Comments

    0
    seerena
    seerena

    1 year ago

    Nice idea

    0
    seamster
    seamster

    1 year ago

    Nicely done! : )