Mars Hydro TS1000 grow light controlled by ESP32

I recently setup a small grow station for basil, tomatoes, flowers (no nothing you smoke!) and so on for my wife and kids to have fun with. Of course, since the Mars Hydro TS1000 can be dimmed via an RJ11 port, I want to do so using ESPHome!

My first struggle is to pinpoint whether the TS1000 uses 0-10V or PWM as there appears to be no technical information online. The light I purchased has a Mars Hydro branded LED driver which I’ve read is different from the MeanWell branded one the old version used to use. If nobody knows, I guess I can open the box that has the dimmer knob to see what signal is injected into the driver using a scope.

Since I suspect it is just 0-10V, I purchased the DFRobot DFR0971 which uses a DAC (GP8403) supported by ESPHome and can output 0-10V.

The other issue is that I cannot find the pinout of the RJ11… so I guess I will really have to open the box to reverse engineer it. Anyone know?

In reality, a simpler solution would be to use the Qubino 0-10V dimmer as I have done in my non smart 5000 lumens workbench lights that only work with 0-10V dimmers… but I did those when I was not familiar with ESPHome. In those lights, I used a comparator that turns off a relay that I use to cut power to the LED driver so that setting the dimmer to 0% actually turns the light off. I might have to do this with the TS1000 as well since the lowest dim percentage is 10%. Or… I will just use the S31 plug in outlet (converted to ESPHome) to cut power to the light.

Open to feedback as I have only begun trying to figure out the best approach, and I will share my results.

Cut an end of a rj11 wire and strip. Plug it into the output port when it is control mode, you’ll be able to see which wire is hot. Most grow lights will take both an analog or digital signal. There is no schematic on the transformer?

Ah, I take it that the output port controls a daisy chained light based on the dimmer knob of the first one. I did not know that, I thought it was just a pass through from something you connected to the input port.

The driver doesn’t give any useful information. Brown/Blue is likely what goes to the LEDs and Purple/Pink is out mystery 0-10V or PWM signal.

Based on this post I just found @Rattykins mentions it is 0-10V. That makes it a lot easier as I don’t have to move the light or the scope to get this figured out. I’ll do what @Mikefila suggested and just look for a 0-10V with a DMM. Worst case I can open the little box up there as it should be pretty easy to figure out pinout by looking at the PCB.

Edit: Forgot to ask… since you said most lights can take both analog and digital, is there any benefit of one over the other? Accuracy of the control is not really meaningful here as I would be guessing the setting anyway.

Interesting! I’m about to setup something like that and stumbled over the Mars lighting. Still there is nothing to be found about a protocol. The iconnect BT adapter is a black box that only talks with their own app. Thanks, no. Anyone got more info? Alternative drivers? The only ones so far have at best a poti to set dimming meaning I have to crack and resolder. :frowning:

I put together and ESP32 and an ADC board that outputs 0-10V. I have then tested the voltage on the output jack of the light controller confirming a 0-10V so all I really need to do is connect the ADC to a phone wire I cut in half (has 4 wires and correct RJ11 jack on it so all you need for the job).

The two outer wires are positive and the two inner wires are the negative. I’ll need to double check that again just in case before making the connections to avoid damage.

Now that you reminded me of this, I’ll try to test it soon.

Edit: corrected the polarity.

Thanks! I was about to order a set this weekend. Just a bit afraid to to use wrong polarization and finding out they did no provide diodes for protection and seeing just magic smoke…

I have had some success following this
It’s wired straight into the rj11 socket on the light controller, so no dismantling of lights parts. Working on Migro Array and Meanwell Drivers.

I just used a 0-10V DAC board. This one to be exact:

Tested my simple setup and it works.

I connected GND to one of the two inner wires and VOUTx to one of the outer wires. I tested both inner/outer wires and it doesn’t seem to matter which one you use for control. I am guessing they are internally wired in parallel. It also doesn’t seem to matter whether you control the light via CH1 or CH2 jacks.

When I had the light at max output and unplugged the ESP32 from its power, the light dimmed (if I recall correctly it turns off if you unplug it) so it may be necessary or maybe just a good precaution to put some component on the output of the DAC to avoid the issue (maybe a diode or pull down resistor? I need to look into it more when I have time).

Oh thanks! The LEDs will arrive tommorow. Will see what can be done!

Today the LEDs arrived. It’s a different brand but with RJ11 connectors for daisy chaining. I hooked up my lab power supply, set the device to slave mode and it responded to 0-10V. I just ordered the controller you mentioned (takes another 2 days) and will see how it works (I guess with no issue :slight_smile:

Thanks again for the elaborate answer!

1 Like

Uhm, no problems. Well. Turns out to be Chinese documentation mentality (I had a similar issue in the past…). The example sketch allows to set only one fixed voltage on start (or some sinus which I do not need). There is no documentation of the device registers and obviously the code is not working as it should. Asked on their forum - will see. How did you get around this?

Phew - Chinese docs…
I figured out to remove the store call which obviously sets the device into a “frozen-mode”. Once removed the setDACOutVoltage worked in the loop.

@thomaskilian - The DFRobot module DFR0971 I used is supported in ESPHome so it was quite easy to implement. I initial YAML I am using is posted below but it is the bare minimum to just test it out. I am planning on adding a temperature and humidity sensor, PWM fan control, relays for additional devices (or dumb lights), etc.

There may be errors, and there likely is a better way to do this, but it works…

substitutions:
  devicename: grow-tent
  friendly_devicename: "Grow Tent"
  device_description: "Grow Tent Controller"
  update_interval_s: "60s"
  update_interval_wifi: "300s"


esphome:
  name: ${devicename}
  comment: ${device_description}
  friendly_name: ${friendly_devicename}

esp32:
  board: lolin_s2_mini
  variant: esp32s2
  # framework:
  #   type: esp-idf
  #   version: recommended

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: !secret api_key

ota:
  - platform: esphome
    password: !secret ota_password

wifi:
  networks:
  - ssid: !secret iot_wifi_ssid
    password: !secret iot_wifi_password
  reboot_timeout: 15min

#Faster than DHCP. Also use if can't reach because of name change
  manual_ip:
    static_ip: 10.1.3.210
    gateway: 10.1.2.1
    subnet: 255.255.254.0
    dns1: 10.1.0.50
    dns2: 10.1.0.51

#Manually override what address to use to connect to the ESP.
#Defaults to auto-generated value. Example, if you have changed your
#static IP and want to flash OTA to the previously configured IP address.
  use_address: 10.1.3.210

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "${devicename}"
    password: !secret iot_wifi_password

web_server:
  port: 80
  version: 2
  include_internal: true
  ota: false

#captive_portal:

# Sync time with Home Assistant
time:
  - platform: homeassistant
    id: ha_time

i2c:
  - id: bus_a
    sda: 18
    scl: 16
    scan: true
    frequency: 800kHz #To get rid of slow sht3xd component warnings

gp8403:
  id: gp8403_dac
  voltage: 10V
  address: 0x5F

text_sensor:
  - platform: wifi_info
    ip_address:
      name: "IP"
      icon: "mdi:ip-outline"
      update_interval: ${update_interval_wifi}
    dns_address:
      name: "DNS"
      icon: "mdi:dns-outline"
      update_interval: ${update_interval_wifi}
    ssid:
      name: "SSID"
      icon: "mdi:wifi-settings"
      update_interval: ${update_interval_wifi}
    bssid:
      name: "BSSID"
      icon: "mdi:wifi-settings"
      update_interval: ${update_interval_wifi}
    mac_address:
      name: "MAC"
      icon: "mdi:network-outline"
    scan_results:
      name: "Wifi Scan"
      icon: "mdi:wifi-refresh"
      disabled_by_default: true


binary_sensor:
  #Status Binary Sensor exposes the node state for Home Assistant.
  - platform: status
    name: "Connection Status"
    id: connection_status
    entity_category: diagnostic

sensor:
  - platform: wifi_signal
    name: "WiFi Signal"
    update_interval: ${update_interval_wifi}
    device_class: signal_strength


output:
  - platform: gp8403
    channel: 0
    id: gp8403_0

  - platform: gp8403
    channel: 1
    id: gp8403_1

#Lights need gamma_correct: 1 for a linear voltage response, which can then even be limited per channel with max_power and min_power at the output.
light:
  - platform: monochromatic
    name: "LED 1"
    output: gp8403_0
    gamma_correct: 1


  - platform: monochromatic
    name: "LED 2"
    output: gp8403_1
    gamma_correct: 1

button:
  - platform: restart
    name: "Restart"
    entity_category: diagnostic

  - platform: safe_mode
    name: "Safe Mode"
    entity_category: diagnostic

Ah, that looks like there is a better way :slight_smile: I finally hacked some code to control the LEDS so they make a soft start/stop like sunset (I guess the plants don’t care so much, but it was some extra challenge).

I have a DHT22 (IIRC) running for humidity temp alread elswhere, That now I setup using the existing integration.

We need 1 to 10 volts. And all lamps i know provide gnd, 10v out for the potentiometer/or to provide my circuit 10v and analog in. If i use for example an esp32 with onboard voltage regulator 12 v or greater (thats absolutely neccessary!), we need only a transistor and a resistor to 10v. Pwm is more or less analog, with only low and high. There is no need for a DAC. Maybe you need one resistor and one capacitor more as a filter.

@DOMin8or With the DAC I don’t need a power supply that outputs more than 5V as the DAC is able to output 10V even if powered at 5V. In other ESP32 builds I use a buck/boost converter board to power the build with 12V and have 5V for the ESP32 but in this case, it was simpler to stick with 5V and use a DAC board.