1. We are currently experiencing issues with viewing and uploading images, our team is working on the issue.
    Dismiss Notice

HLG Arduino Dimming

Discussion in 'Advanced Marijuana Cultivation' started by sleepless_canuck, Sep 9, 2017.

  1.  
    sleepless_canuck

    sleepless_canuck Active Member

    I currently have a fit COB fixture and my room is fully automated through an arduino mega.

    Has anyone on here figured how to dim HLG drivers using code instead of a potentiometer?

    This is my last hurdle.

    Here a pic of my app.
     

    Attached Files:

    CannaBruh likes this.
  2.  
    CannaBruh

    CannaBruh Well-Known Member

    What is the potentiometer doing in your HLG circuit? Now make the arduino emulate that.

    How did you automate a whole room on arduino but not perform the function of a pot with arduino? Did you copy/paste code to get your room working?
     
  3.  
    sleepless_canuck

    sleepless_canuck Active Member

    I learned some basic code and learned from multiple setups online.

    As well as Blynk community.

    I have read conflicting information about dimming the HLG driver so I was mainly curious if anyone had done it successfully.
     
    CannaBruh likes this.
  4.  
    CannaBruh

    CannaBruh Well-Known Member

    I get that, but what I'm getting at is do you understand what the potentiometer is doing in circuit with your HLG?

    Once you understand that, then make the arduino do that thing.
     
  5.  
    BobCajun

    BobCajun Well-Known Member

    You hook an optocoupler to the Arduino PWM output, hook the dimmer leads to the output of the optocoupler and use a code like this. The optocoupler reverses things so low in the code is actually the on time and high is the off time. You also need a 250 ohm resistor on the output from the Arduino before it gets to the optocoupler.The reason for the optocoupler is that the output is 5v rather than the 10v required by the driver dimmer. The driver produces it's own 10v power for the dimming, you just need the optocoupler to open and close the dimmer wire circuit with its 5v PWM output.

    In this code I arbitrarily chose to use microseconds and the on/off ratio shown. I tried a bunch of different duty cycles. BTW with PWM you don't gain any efficiency from dimming the LEDs, because they're still on full power during the on part of the duty cycle.
     
    Last edited: Sep 9, 2017
  6.  
    BobCajun

    BobCajun Well-Known Member

    Actually I just thought of something. Since an Arduino puts out 5v and 5v makes the driver dim to 50%, you might be able to wire it straight up, as long as you only want the driver to be at 50% current during the on part of the duty cycle. That means you could run the LEDs at half the driver current and get an efficiency gain and also avoid getting an opto and a resistor. I don't know what the current is for the Arduino PWM output though offhand. You'd have to make sure it's within the range that the driver dimmer circuit can handle. So say you want the LEDS to run at 700 ma during the on cycle. You would use a 1400 ma driver. And the code would be normal, not reversed.

    Honestly I don't know how it would turn out if you hooked it up direct. I did find out that the Arduino PWM signal is 40 ma though. But I don't know how much the driver can take. The optocoupler method worked for me though. When the cycle is in the off phase I think the LED is still at 10% power though, because that's as far down as they can go. They never actually go all the way to zero, even with a potentiometer. This page has some info on meanwell dimming. Apparently there are complications with the HLG B type drivers.
     
    Last edited: Sep 9, 2017
  7.  
    CannaBruh

    CannaBruh Well-Known Member

  8.  
    Timothypaul26

    Timothypaul26 Member

    There are a lot of controllers being made for fish tanks that are emulating the bulk of what we are trying to do as growers. There are even pretty cheap controllers available made from Arduino platforms for this purpose. They have some very good codes, and habe been very good references for me. I would not recommend connecting the dim leads directly to your arduino. I can't remember the ma output of the half, but arduino can't handle supplying or taking in much power. I know output on megas are around 50ma. To answer your question though. Many have been successful making dim loops on arduino for the hlg, but it will be inverted logic if using a transducer, which is the easiest way to go imo.
     
  9.  
    dstroy

    dstroy Well-Known Member

    Yes, get a mosfet pwm thing from amazon

    https://www.amazon.com/gp/aw/d/B01K...F8&qid=1506263453&sr=1&pi=AC_SX236_SY340_QL65

    And 10v source for the dimming circuit.

    Works great, very reliable.

    You don't need the 4 channel one, but every driver you want to dim should be on its own channel.

    Let me know if you need help with the code.
     
    Philip-O likes this.
  10.  
    dstroy

    dstroy Well-Known Member

    That's not true, for example a 500w load @50% duty cycle is 250w RMS. It's still on 100%, but for 50% as long, so it "uses" half of the power. Hooking a multimeter up to a 10v source and then reducing the duty cycle by 50% causes the multimeter to "see" 5v, because it's 5vrms even though the source is 10v.

    The meanwell HLG drivers DO NOT produce their own 10v for dimming.
     
  11.  
    CannaBruh

    CannaBruh Well-Known Member

    How can it be on 100% if it's off for 50% ;)
     

Share This Page