3 In 1 Dimming Including On/off Function For Meanwell Hlg Drivers

  • Thread starter AvidLerner
  • Start date
  • Tagged users None
AvidLerner

AvidLerner

296
63
I participate at other sites and I love tinkering with electronics. I have been following a discussion on 3 in 1 Dimming capabilities and what it is useful for.

For me, I found out how to use an arduino device; Storm, Typhon, or arduino uno; to dim led fixtures identical to the ones we DIY here with meanwell HLG series of dimmable drivers.

The article talks about many features, but there is an entire article elsewhere about not only dimming but also turning on/off HLG series of drivers already available in Europe, but not in the USA.

The figure at the bottom shows an on/off device. The device is available in two formats, hobby build or assembled. The hobby version can be found by searching for controllable power outlet on sparkfunhttps://www.sparkfun.com/products/11042 or by looking for the same at yourduino http://yourduino.com/sunshop2/index.php?l=product_detail&p=218.

I bought the kit and assembled it and tested it today with my coralux storm controller and it works. Next I will build a duplex outlet box with two power controllers on the outside to control turning lights on/off, dim, and dim Far Red, Deep Red, IR, and Royal Blue, all controlled from one console for two rooms. The unit uses a 5v dc signal from any arduino device.

I hope this helps others and they can learn from this, as well
peace
AL
 
3 in 1 dimming including onoff function for meanwell hlg drivers
Outlet 1 l
3in1dimfun1
AvidLerner

AvidLerner

296
63
SO I have narrowed down my choices. I found this unit at adafruit for controlling circuits and it is tested and has a warranty. ->https://www.adafruit.com/products/2935
I am now working on the code for the arduino to power and control the lights and timers, with four to six pwm outputs to control receptacles like this one and led lights directly.

I am working on a grow room controller similar to the Coralux controller for aquariums, but not modified for grow rooms, but totally re-worked and designed with our needs in mind, alone. peace
 
AvidLerner

AvidLerner

296
63
I have been busy. I have been experimenting with various lcd screens and interfaces. I am liking the arduifruit i2c lcd shield. I am also using a dht11 temp/humidity sensor. I have some code completed in arduino sketch format to share. peace
#define DHT11_PIN 0 // ADC0 Analog pin A0
// include the library code:
#include <Wire.h>
#include <Adafruit_RGBLCDShield.h>
#include <utility/Adafruit_MCP23017.h>


// The shield uses the I2C SCL and SDA pins. On classic Arduinos
// this is Analog 4 and 5 so you can't use those for analogRead() anymore
// However, you can connect other I2C sensors to the I2C bus and share
// the I2C bus.
Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();

// These #defines make it easy to set the backlight color
#define RED 0x1
int LCD_C=16;
int LCD_R=2;
int dhtTemp=0;
int dhtHumidity=0;

// end of i2c rgb lcd shield definitions

void setup()
{
DHTSetup();
SPrintBegin();
PrintBegin();
PrintTempMenu();
} // end setup

void loop()
{
GetDHTData();
PrintTempMenu();
} // end loop

// ---Functions----//
// setup ddrc and portc
void DHTSetup(){
DDRC |= _BV(DHT11_PIN);
PORTC |= _BV(DHT11_PIN);
}
// read dht11 data line for input
byte read_dht11_dat()
{

byte i = 0;
byte result=0;
for(i=0; i< 8; i++)
{
while(!(PINC & _BV(DHT11_PIN))); // wait for 50us
delayMicroseconds(30);
if(PINC & _BV(DHT11_PIN))
result |=(1<<(7-i));
while((PINC & _BV(DHT11_PIN))); // wait '1' finish
}
return result;
}
// serial printbegin
void SPrintBegin()
{
Serial.begin(9600);
Serial.println("Ready");
}
// print setup routine
void PrintBegin()
{
lcd.begin(LCD_C, LCD_R);
lcd.clear();
lcd.setCursor(0,0);
} // end PrintBegin
// print temperature menu on line 1 on lcd
void PrintTempMenu()
{
lcd.setCursor(0,0);
lcd.print("Temp: F/RH: %");
lcd.setCursor(5,0);
lcd.print(dhtTemp);
lcd.setCursor(13,0);
lcd.print(dhtHumidity);
lcd.setCursor(15,0);
lcd.print("%");
}
// read data for input from dht11 temp/humidity sensor
void GetDHTData()
{
byte dht11_dat[5];
byte dht11_in;
byte i;// start condition
// 1. pull-down i/o pin from 18ms
PORTC &= ~_BV(DHT11_PIN);
delay(18);
PORTC |= _BV(DHT11_PIN);
delayMicroseconds(40);
DDRC &= ~_BV(DHT11_PIN);
delayMicroseconds(40);

dht11_in = PINC & _BV(DHT11_PIN);
if(dht11_in)
{
Serial.println("dht11 start condition 1 not met");
lcd.print("DHT11 checksum error");
return;
}
delayMicroseconds(80);
dht11_in = PINC & _BV(DHT11_PIN);
if(!dht11_in)
{
Serial.println("dht11 start condition 2 not met");
return;
}

delayMicroseconds(80);// now ready for data reception
for (i=0; i<5; i++)
dht11_dat = read_dht11_dat();
DDRC |= _BV(DHT11_PIN);
PORTC |= _BV(DHT11_PIN);
byte dht11_check_sum = dht11_dat[0]+dht11_dat[1]+dht11_dat[2]+dht11_dat[3];// check check_sum
if(dht11_dat[4]!= dht11_check_sum)

{
Serial.println("DHT11 checksum error");
}
dhtTemp=(int)round(1.8*dht11_dat[2]+32);
dhtHumidity=(int) dht11_dat[0];
} // end read data
---------------------------
This code will get the current temperature and humidity and print it out on the lcd screen. Obviously it does not have to report so often, and can report based on an interrupt process, which is much more elegant.
Avid
 
AvidLerner

AvidLerner

296
63
Here is a link to the shield kit I am going to use for two reason. 1. it only needs four pins and 23 it has 5 buttins for navigation purposes. ->https://www.adafruit.com/products/715
Here is the code to control the shield.
/*********************

i2C RGB LCD Shield with 5 buttons and display
**********************/
// include the library code:
#include <Wire.h>
#include <Adafruit_RGBLCDShield.h>
#include <utility/Adafruit_MCP23017.h>
// The shield uses the I2C SCL and SDA pins. On classic Arduinos
// this is Analog 4 and 5 so you can't use those for analogRead() anymore
// However, you can connect other I2C sensors to the I2C bus and share
// the I2C bus.
Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();

// These #defines make it easy to set the backlight color
#define RED 0x1
#define YELLOW 0x3
#define GREEN 0x2
#define TEAL 0x6
#define BLUE 0x4
#define VIOLET 0x5
#define WHITE 0x7
// setup variables
int LCD_C=16;
int LCD_R=2;
int time=0;
uint8_t i=0;
// setup
void setup() {
// Debugging output
SPrintBegin();
// set up the LCD's number of columns and rows:
PrintBegin();
PrintMessage();
// Print a message to the LCD. We track how long it takes since
// this library has been optimized a bit and we're proud of it :)
lcd.print("Hello, world!");
GetTime();

}// end setup

// loop
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis()/1000);
ReadButtons();

} // end loop
// -- Functions---//
// print setup routine
void PrintBegin()
{
lcd.begin(LCD_C, LCD_R);
lcd.clear();
lcd.setCursor(0,0);
} // end PrintBegin
void PrintMessage()
{
GetTime();
Serial.print("Took "); Serial.print(time); Serial.println(" ms");
lcd.setBacklight(WHITE);
}
// end PrintMessage
// ReadButtons
void ReadButtons()
{
uint8_t buttons = lcd.readButtons();

if (buttons) {
lcd.clear();
lcd.setCursor(0,0);
if (buttons & BUTTON_UP) {
lcd.print("UP ");
lcd.setBacklight(RED);
}
if (buttons & BUTTON_DOWN) {
lcd.print("DOWN ");
lcd.setBacklight(RED);
}
if (buttons & BUTTON_LEFT) {
lcd.print("LEFT ");
lcd.setBacklight(RED);
}
if (buttons & BUTTON_RIGHT) {
lcd.print("RIGHT ");
lcd.setBacklight(RED);
}
if (buttons & BUTTON_SELECT) {
lcd.print("SELECT ");
lcd.setBacklight(RED);
}
}
}
// end ReadButtons
// GetTime
void GetTime()
{
int time = millis();
time = millis() - time;

} // end getTime
// serial printbegin
void SPrintBegin()
{
Serial.begin(9600);
Serial.println("Ready");
}// end SPrintBegin

peace Avid
 
AvidLerner

AvidLerner

296
63
Time for another update. I have a picture of the ArduinoMega2560 running the basic code set now. The sketch is running the main menu system and gathers date, tine, temperature and humidity as the main screen. menu's are accessed through hitting the select button, i.e. push the button vice left,right, up, down.

I have attached a picture of the GrowGreen LED Controller with the proposed lcd screen shield and arduino meg2560. enjoy
Avid
 
ArduinoV2
AvidLerner

AvidLerner

296
63
Update: I have completed the coding, sketch for the arduino. parts list as follows:
Arduino Uno Rev. 3 $25 -> https://www.adafruit.com/products/50
LCD shield $25-> https://www.adafruit.com/products/716 most important component as it allows the pins for other devices to be connected to the Arduino Uno.
DS1307 Real time Clock $6-> https://www.adafruit.com/products/264
Dht11 Temp/Humidity Sensor $5-> https://www.adafruit.com/products/386
breadboard for sharing power and ground pins $5 -> https://www.adafruit.com/products/64
power outlet controlled by program $20/ea. one required for each fixture ->https://www.adafruit.com/products/2935

assorted tools and wiring. Schematic is simple industry standard for each device to be connected.
code sketch -> https://github.com/AvidLerner/GrowGreen

The output pins are PWM pins 3,4,5,9,10,11, a six channel PWM driver to turn on/Off. The program display the first four channels as the LCD does not have enough room to display six channels. All six channels are set for 6:am start and 6:pm finish. times are adjustable and are maintained even when power off. After power re-start the Controller picks up right where it left of at the current time and date with the lights running just as they were set initially by the user. Each channels is adjustable and separate from each other.

I have attached a picture of the working model. I am still working on a container for the project to mount the lcd on teh surface and place the components on the inside and put a six pin PWM plug on the outside along with a 12v dc power hole for the unit power. A 12v power supply is required which is available from adafruit or others that sell arduino's. peace
 
GrowGreenController
AvidLerner

AvidLerner

296
63
latest update: I have completed the basic model the six channel PWM driver using the Arduino Uno, Rev 3. adafruit lcd button shield, DS1307 RTC, and a DHT11-optional. I am awaiting the case and some parts to package it together. i use mine on a sheet of plexiglass along with the LDD-6 Driver Board from Coralux, and the MW 48v power supply. I run cables using security cable; two wire; from the LDD driver board to the LED light dimmer circuit on the driver and the Relay switch, using a y tap for the five volt signal. I directly control the dimming and on/off capability of both CoB's and LED's. My settings are remembered even after power off. The clock resets itself to the current time it went offline and continues from there. if you spent hours offline, you will have to reset the time to the current time, but the cycles will continue as if there was no power outage.

I also have developed a twelve channel PWM driver using the exact same components. I have written two sketches for eth Arduino Uno rev 3. One is called the GrowGreen.ino and the other is called GrowGreen12Channel.ino. Both are available at this location on Github ->https://github.com/AvidLerner/GrowGreen If you buy the components as follows you can build either the six or twelve PWM channel unit as desired.:

1. Arduino Uno Rev 3 ->https://www.adafruit.com/products/50
2. Adafruit lcd shield using only pins 5v, GND, SDA, SCL ->https://www.adafruit.com/products/716
3. DS1307 RTC ->https://www.adafruit.com/products/264
4. a 12v power supply ->https://www.adafruit.com/products/798
5. LDD6up Driver ->http://coralux.net/?wpsc-product=ldd-6-driver-board
6. Mean Well LDD drivers 700mA & 1000mA. The 1000mA run the Royal blues and the 700mA run the various reds. One LDD driver for each 12 red or bluer leds, 15 max.
7. Mean Well SE-350-48v power supply ->
8a. relay options a. -> adafruit built one for each fixture ->https://www.adafruit.com/products/2935
8b. relay option b sparkfun relay unit which can be connected with the driver at the fixture and connected to the GrowGreen Controller with extension cables->https://www.sparkfun.com/products/13815
9. PWM connectors from Arduino Uno to the case for connecting the six or twelve channels.

I will provide a video in the next week or so, showing the system and it's operation. until then have fun building your own unit. I will provide DIY kits with the code loaded, unit assembled, and tested.

As soon as I get the case in, I will provide a video for you folks. My setup is running two 200w LED lights, a Royal blue channel , Deep Red. IR channels and a Far Red channel at various times and lumen levels. 24/7 and I already went through a power outage and recovered. i just had to reset my clock after being offline for hours. peace
Avid
 
AvidLerner

AvidLerner

296
63
cleaned up the code. removed he dht11 and redesigned he screen and stopped some lcd screen corruption that was occurring over time. newest version avail;be at the same link.
peace
Avid
 
AvidLerner

AvidLerner

296
63
Finished version 2 with a 20x4 lcd screen, Uno platform, DS32331 RTC, and a rotary encoder to access and change parameters for time and eight channels PWM control for COB's or led's using a beefcake relay fixture mounted, adafruit relay outlet, or LDD driver boards used for dimmabele LDD drivers for 3W led's. peace
Avid
Arduino V2
 
AvidLerner

AvidLerner

296
63
So I have completed the design and build of the LED controller. It works great and I laser cut my own cases. Just like the one you see above. PM me if you are interested in having one built. peace
Avid
 
AvidLerner

AvidLerner

296
63
For those aware or not aware, there is an issue of 5v pwm dimming versus 10v pwm dimming. 5v dimming is good for buck led drivers, LDD drivers using a driver board. Mean Well LED Drivers uses a 10v dimming circuit alien to Arduino and it's 5v pwm dimming signal. I resolved this was a MOD to the cable from the arduino to the led driver. The cable MOD provides both 5v and 10v pwm dimming signals simultaneously, to both dim the driver and turn the driver on/off as promised. Here is the basic circuit, it has two components, a npn bipolar transistor 2222 and a 1k ohm resistor. This MOD works and has been tested using a 9v battery for the power, total cost about $3. I provide a copy of the mean well data circuit and my circuit. peace
Avid
 
3in1dimfun1
10vpwmcircuit
AvidLerner

AvidLerner

296
63
update: ->https://www.youtube.com/channel/UCd9auE6zyUoJoe9rlxoJq6Q
BTW, ask yourself, how would you invert a 10v inverted signal back to it's original orientation? Using a npn transistor and a resistor I was able to invert the signal, with the help of a 9v battery on the collector. So I asked myself, self, how would I invert that signal yet again. I slept on it and woke up thinking a second transistor connected in a similar fashion to the first transistor, should do the trick, but not just any transistor. So I started doing some more research with the thought of reversing the orientation of the signal from negative to positive. I would have to reverse the polarity of the transistor. That's right, I went with a pnp transistor to accommodate the next step of reversing the voltage from -10v to +10v. The question became which transistor to use with so many out there? The solution works, as I have had circuit boards made for the circuit, and will populate the PCB with the appropriate devices and use them to create both 5v and 10v pwm signals simultaneously for the GrowGreen LED Controller.
peace
Avid
 
AvidLerner

AvidLerner

296
63
I have discovered more ways to create both 5v and 10v pwm signals within the cable allowing both dimming and on off functionality to a single channel. The GrowGreen differs from other controllers with 8 pwm channels with independent channel controls over brightness and timing schedule. Being Arduino based the controller is compatible with all lighting led systems including bucking LDD drivers and hlg style 0-10v pwm dimming. Peace
Avid
 
AvidLerner

AvidLerner

296
63
A little update for folks.
First we have an arduino based industrial PLC applications using relays, and pwm drivers we have been looking at here. It is 45 minuters long, but you can fast forward to the parts you find interesting.
Second. PWM dimming for HLG drivers. Thee is a non-DIY solution for you folks out there, that are interested. here is a the simplest and cheapest solution per channel available on ebay here
http://www.ebay.com/itm/262623559315?_trksid=p2060353.m1438.l2649&ssPageName=STRK:MEBIDX:IT This board will convert your 5vdc pwm signal to a 10vdc pwm signal. enjoy. peace
Avid
 
AvidLerner

AvidLerner

296
63
here is a blue tooth four channel relay with blue tooth with no programming required, just for t6hose guys that want blue tooth control over a few LED fixtures.
peace
Avid
 
Top Bottom