Reef Central Online Community

Go Back   Reef Central Online Community > General Interest Forums > Do It Yourself
Blogs FAQ Calendar

Notices

User Tag List

Reply
Thread Tools
Unread 12/24/2015, 05:03 PM   #1
jrhupp
Registered Member
 
Join Date: Jun 2005
Location: Lincoln, NE
Posts: 318
Controlling MarsAqua from Arduino

Thought I would share some progress on one component of my on going build (I'll start a thread for the actual build soon; at least in theory). But in the mean time, here is progress on the control module for my lights (fyi this is one part of a larger open source project I'm working on; more to come "soon").

I have a couple of 300 Watt MarsAqua fixtures that will light my tank, and like what seems like everybody these days I want to control sunrise/sunset and automatically to do the dimming. And like many before I cracked it open and took some measurements, and seem to have a pretty good handle on how this works. Mine seem to be like all the rest that folks have posted about, but I will go ahead and post what I found in case it helps others:

-Four wires coming out of the LED driver: on/off, V+, Dim+ and Dim-
-V+ provides 12 VDC
-On/Off is the enable line for the driver. It needs to be connected to V+ for the lights to work. The current draw is minimal for the enable pin; measured in circuit at less than 5 mA.
-Dim+ and Dim- provide the dimming. It is an analog signal (confirmed with an oscilloscope) and ranges 0-10 VDC (but quite noisy). Peak current draw between Dim+ and Dim- was measured at about 5.5 mA.
-Dimming works by pulling Dim+ to Dim-. With an open circuit between the two the drive is full on; shorted together the driver is full off.

With the above understanding of the operation I have laid an optically isolated circuit that uses an SSR and an optocoupler (4N35) that allows the driver to be interfaced directly to an Arduino (in my case the Pro Mini). I have bench tested it from a bread board mock up and it seems to work awesome! The first rev of the PCB is etching right now, and by the end of the holiday weekend I hope to have it populated and installed. I'll post more as I go.

Here is the schematic for now. I'll post the eagle files and the Arduino sketch once they get cleaned up a bit (still some details missing and the sketch isn't fully vetted yet).



__________________
Current build thread : http://www.reefcentral.com/forums/showthread.php?t=2547305

I ate a jellyfish... tasted like soy sauce.

Current Tank Info: 180 gallon system in progress
jrhupp is offline   Reply With Quote
Unread 12/24/2015, 06:58 PM   #2
jrhupp
Registered Member
 
Join Date: Jun 2005
Location: Lincoln, NE
Posts: 318
Here is what I'm doing for hangers for the fixtures. These are 3D printed in black ABS. They attach to the lights with a section of #6 threaded rod and two acorn nuts, and are meant to be hung with 3/8" threaded rod (I'm using Uni-Strut to hang everything above the tank).



If you want, the SketchUp file and an STL can be pulled from here:
https://www.dropbox.com/s/2jt1slrzff...anger.skp?dl=0
https://www.dropbox.com/s/s8jueorier...anger.stl?dl=0


__________________
Current build thread : http://www.reefcentral.com/forums/showthread.php?t=2547305

I ate a jellyfish... tasted like soy sauce.

Current Tank Info: 180 gallon system in progress
jrhupp is offline   Reply With Quote
Unread 12/24/2015, 08:54 PM   #3
jrhupp
Registered Member
 
Join Date: Jun 2005
Location: Lincoln, NE
Posts: 318
Looks like I messed up the images. These should hopefully work.






__________________
Current build thread : http://www.reefcentral.com/forums/showthread.php?t=2547305

I ate a jellyfish... tasted like soy sauce.

Current Tank Info: 180 gallon system in progress
jrhupp is offline   Reply With Quote
Unread 12/24/2015, 09:03 PM   #4
geekengineer
Registered Member
 
Join Date: Aug 2015
Location: colorado
Posts: 638
did I miss the schematic? said you were going to attach it?

Sounds very interesting I haven't gotten around to interfacing my Arduino controller (based on dohboys design) yet for dimming my mars aqua 165W.

EDIT: LOL never mind.


geekengineer is offline   Reply With Quote
Unread 12/24/2015, 09:21 PM   #5
geekengineer
Registered Member
 
Join Date: Aug 2015
Location: colorado
Posts: 638
so is reefmod/reefcom something your starting? I couldn't really find much on google about it? it isn't the reef angel is it?

+1 for using isolators that is a good idea.


geekengineer is offline   Reply With Quote
Unread 12/24/2015, 09:36 PM   #6
jrhupp
Registered Member
 
Join Date: Jun 2005
Location: Lincoln, NE
Posts: 318
Quote:
Originally Posted by geekengineer View Post
so is reefmod/reefcom something your starting?
Yep, its mine. Not much info out there yet (I'm not supper far into this yet, but its coming along). Lets call this a soft launch.

ReefMod is how I'm branding my control system; its modular. I built an all in one controller with embedded server for my green house, and after several revisions because of a small change in one function or another I'm not doing the all in one thing again. For the tank, each function gets its own module and the module handles processing and control locally. If want to add something it is easily extensible. If I need to rework something, I'm only reworking one component.

ReefCom is the communication protocol. All the modules set on an addressed serial network, and talk to a main controller using an extensible language. The ReefCom library (I'll add a link to my build thread soon) handles all the message parsing and sending.


__________________
Current build thread : http://www.reefcentral.com/forums/showthread.php?t=2547305

I ate a jellyfish... tasted like soy sauce.

Current Tank Info: 180 gallon system in progress
jrhupp is offline   Reply With Quote
Unread 12/24/2015, 09:47 PM   #7
geekengineer
Registered Member
 
Join Date: Aug 2015
Location: colorado
Posts: 638
lol ok so is the main controller going to be an Arduino board? I have some issues with mine I have found when I am at my parents on network that is a bit non ideal. The mini webserver seems to not work really well with non-ideal situations or something is funny... I'm not sure what is going on.


geekengineer is offline   Reply With Quote
Unread 12/24/2015, 10:07 PM   #8
jrhupp
Registered Member
 
Join Date: Jun 2005
Location: Lincoln, NE
Posts: 318
I have an Arduino Yun I was planning to use originally. When I picked it up I was thinking I would leave some micro controller type tasks in the main controller. So it made sense having the dual processors. But the overall design has moved past that. So now I'm thinking olimex lime or pi zero. Will see though as I don't have much Linux experience to speak of.

I used a Mega with a Whiznet 5100 to run my greenhouse. It works well enough, but the Whiznet is prone to freeze up and is supper sensitive to EMI. I would not use it again for those reasons alone. But it's not a powerful enough combo for what I think I want to do with the reef tank anyway.


__________________
Current build thread : http://www.reefcentral.com/forums/showthread.php?t=2547305

I ate a jellyfish... tasted like soy sauce.

Current Tank Info: 180 gallon system in progress
jrhupp is offline   Reply With Quote
Unread 12/24/2015, 10:38 PM   #9
geekengineer
Registered Member
 
Join Date: Aug 2015
Location: colorado
Posts: 638
yeah I think douhboys future plans was an teensy 3.2 a small one sort of like a pi-zero. The pi-zero looks cool but seems like everyone else thinks so too so you can't hardly get your hands on one.


geekengineer is offline   Reply With Quote
Unread 12/25/2015, 07:42 PM   #10
jrhupp
Registered Member
 
Join Date: Jun 2005
Location: Lincoln, NE
Posts: 318
Some updates from today:

Here is the blank board; scribed, etched, tinned and ready to populate.


Solder side populated. I'm too shaky to make SMD parts look nice, but it works just the same.


Component side populated. The pre-packaged board on the left is an AC-DC power supply. The board is dual supply and should self select between AC power and the DC line on the serial bus connection.


And here is the rig that will house the board and handle power distribution to the lights. This mounts to the ceiling directly above the lights. Still needs the connectors for the control lines; just bare leads at the moment. There is also a short power cable for mains connected in this shot. Its for testing only. The final supply line will exit through the PVC 90 on the end and go down to a central power distribution center.



__________________
Current build thread : http://www.reefcentral.com/forums/showthread.php?t=2547305

I ate a jellyfish... tasted like soy sauce.

Current Tank Info: 180 gallon system in progress
jrhupp is offline   Reply With Quote
Unread 12/25/2015, 08:35 PM   #11
jrhupp
Registered Member
 
Join Date: Jun 2005
Location: Lincoln, NE
Posts: 318
Here is the board being tested with the LED fixture (video is about 5 minutes; 8 bits of dimming done in 1 second steps). You can see the PWM values in the Arduino serial monitor on the computer and the corresponding control signal on the multimeter. The dimming would look a bit more dramatic, but the gain kept adjusting on the camera.



Here is the direct link assuming the embedded code from youtube didn't work:
https://www.youtube.com/watch?v=OQMp...ature=youtu.be


__________________
Current build thread : http://www.reefcentral.com/forums/showthread.php?t=2547305

I ate a jellyfish... tasted like soy sauce.

Current Tank Info: 180 gallon system in progress
jrhupp is offline   Reply With Quote
Unread 12/25/2015, 09:58 PM   #12
geekengineer
Registered Member
 
Join Date: Aug 2015
Location: colorado
Posts: 638
lol I'm totally geeking out.

So any reason why for the large power supply? is that just for other stuff or am I missing something.


geekengineer is offline   Reply With Quote
Unread 12/26/2015, 08:17 AM   #13
jrhupp
Registered Member
 
Join Date: Jun 2005
Location: Lincoln, NE
Posts: 318
Thanks.

I didn't think the power supply was that "large"; Its something like a 1.5"x2" foot print. But it is probably bigger then needed. I think it is 500 mA, and I'm probably only running at around 150 mA at most.

I thought about pulling power from the LED drivers. But I didn't know what kind of current I could source from the V+ line (I'm guessing not much) and with as dirty as the signals looked on the scope I was not supper excited about having a common ground between the mirco and the LEDs. This is easy enough to isolated with a good DC-DC converter. But the AC-DC supply was the same price and didn't have the unknowns associated with the LED power supplies.

In practice, it will hardly ever run off the AC-DC supply that is on board. There is a power supply available through the serial bus and that is the primary.


__________________
Current build thread : http://www.reefcentral.com/forums/showthread.php?t=2547305

I ate a jellyfish... tasted like soy sauce.

Current Tank Info: 180 gallon system in progress
jrhupp is offline   Reply With Quote
Unread 12/26/2015, 10:40 AM   #14
geekengineer
Registered Member
 
Join Date: Aug 2015
Location: colorado
Posts: 638
ah ok. I think just looks large cause of the way the scale of the pictures make it look to me. So never mind. lol


geekengineer is offline   Reply With Quote
Unread 12/26/2015, 10:17 PM   #15
damage31
Registered Member
 
Join Date: Mar 2011
Posts: 36
jrhupp: I like what you've got going on here, very useful indeed. It appears that you have a fair amount of experience in this area. Thanks for sharing.

One question though, regarding the selection of the APT1211 to turn on and off the lights - I didn't think that this kind of a component would work with a (mostly) DC signal? I've never used one of these, so I don't know any better, but always thought that these were strictly for switching AC, not DC. I figured that with DC they would possibly get stuck on if they never crossed below ground?

I'm asking because, on my lights (mars aqua 165w) I only measure .14v AC on the 2 on/off related lines. Is that enough to allow this type of component to reliably trigger all the time?

I don't have access to an o-scope to see what the waveform might possibly look like on the on/off related lines, but maybe you've measured/seen the waveform to know that it crosses and would work I would guess?

I like your idea to use the APT1211, I was also researching if using something like this would be appropriate: CPC1002n


damage31 is offline   Reply With Quote
Unread 12/27/2015, 09:26 AM   #16
jrhupp
Registered Member
 
Join Date: Jun 2005
Location: Lincoln, NE
Posts: 318
Quote:
Originally Posted by damage31 View Post
jrhupp: I like what you've got going on here, very useful indeed. It appears that you have a fair amount of experience in this area. Thanks for sharing./
Thanks. I'm not sure how much experience I really have. But hopefully what I'm doing can help others.

Quote:
One question though, regarding the selection of the APT1211 to turn on and off the lights - I didn't think that this kind of a component would work with a (mostly) DC signal? I've never used one of these, so I don't know any better, but always thought that these were strictly for switching AC, not DC. I figured that with DC they would possibly get stuck on if they never crossed below ground?

I'm asking because, on my lights (mars aqua 165w) I only measure .14v AC on the 2 on/off related lines. Is that enough to allow this type of component to reliably trigger all the time?

I don't have access to an o-scope to see what the waveform might possibly look like on the on/off related lines, but maybe you've measured/seen the waveform to know that it crosses and would work I would guess?

I like your idea to use the APT1211, I was also researching if using something like this would be appropriate: CPC1002n
This is a good catch. I knew I had to do some clean up in the schematic (resistor values and AC-DC), but totally missed that I had used a different component in the schematic then what I was actually using in the real world (no component in my version of Eagle for the part, so I used one with the same foot print). Anyway, an updated version of the schematic should be shown in the thread here now.

The SSRs I'm using are CPC1017N. These look pretty comparable to the CPC1002N you are considering. The lower current rating on the contacts (100mA vs 700mA) for 1017 though shaves about a third off their price over the 1002. This is why I selected it. Also why I measured the current in circuit first before selecting the part (~5mA); so I could use a lower cost SSR.

I have looked at the wave forms, they are DC. A bit dirty, but DC none the less. Here is what the On/Off line looks like measured between V+ and On/Off on the stock pot dimmer:


Measured between Dim- and Dim+ on the stock dimmer, LEDs full bright:


LEDs minimum bright. I don't remember if the On/Off was on or off for this.


Here are the Eagle files if anybody wants to build one of these. I use ground planes, so run a rats nest operation before exporting anything from the board.

There is still a TBD component on the board. It will be a Shottkey diode for blocking the AC-DC +5VDC when not in use. Just have to pick one still. I missed it on my last parts order or it would be there.


__________________
Current build thread : http://www.reefcentral.com/forums/showthread.php?t=2547305

I ate a jellyfish... tasted like soy sauce.

Current Tank Info: 180 gallon system in progress
jrhupp is offline   Reply With Quote
Unread 12/27/2015, 01:03 PM   #17
damage31
Registered Member
 
Join Date: Mar 2011
Posts: 36
Spectacular! The images validate what I was hoping to see if I had a scope myself.

Your usage of the CPC1017N is indeed a better selection - meets required spec and is the cheapest I've seen yet.

Your design is nice and simple. I like the NFM-05 power supply, as I was kicking around how exactly I was going to power my circuit (which I plan to embed internally within the 165w fixture), and this device seems that it may possibly fit.


damage31 is offline   Reply With Quote
Unread 12/27/2015, 01:57 PM   #18
geekengineer
Registered Member
 
Join Date: Aug 2015
Location: colorado
Posts: 638
if your looking for something compact If used these before but I don't know if its much more compact than the NFM-05 anyways.

http://www.recom-power.com/pdf/Power...AC01_02-SC.pdf


geekengineer is offline   Reply With Quote
Unread 12/27/2015, 02:48 PM   #19
jrhupp
Registered Member
 
Join Date: Jun 2005
Location: Lincoln, NE
Posts: 318
damage31,

Thanks. Glad the images of the scope help. As far as I can tell, nobody has really done this. Also glad you like the design.

I was looking at a different board mount supply from MeanWell when I settled on the NFM-05. I don't remember which one it was, but specs were similar and I think the foot print was a bit smaller. I would have gone with it, as it was a bit less expensive (~8$), but Mouser was out of stock for it at the time.

At first pass the one from geekengineer looks like a good option too. Its a much cleaner package and looks like a smaller foot print. But looking at costs its about about 12$. I think the NFM-05 was around 10$.


__________________
Current build thread : http://www.reefcentral.com/forums/showthread.php?t=2547305

I ate a jellyfish... tasted like soy sauce.

Current Tank Info: 180 gallon system in progress
jrhupp is offline   Reply With Quote
Unread 12/27/2015, 03:30 PM   #20
geekengineer
Registered Member
 
Join Date: Aug 2015
Location: colorado
Posts: 638
yeah should have mentioned it was more expensive. Thanks. Nothing is for free I guess. lol


geekengineer is offline   Reply With Quote
Unread 12/28/2015, 02:51 PM   #21
jrhupp
Registered Member
 
Join Date: Jun 2005
Location: Lincoln, NE
Posts: 318
Some updates:

Finished wiring the lights and the rig that houses the controller. Here it is mounted to the ceiling.


I couldn't find a cover for the box that was solid, so I printed one. Not the greatest pic, but you get the idea. I used some lime green foam rubber to make a gasket between it and the box. Probably not a great seal, but it looks cool.


Took the pot dimmers out and used some small strain relief plugs to pass cables through the holes. They didn't quite fit my wire (4-22 shielded security system cable), so I had to file them out a bit. This pic shows the plugs before and after being filed out.


And here is what I passed through. Nothing fancy, but it gets the job done.



__________________
Current build thread : http://www.reefcentral.com/forums/showthread.php?t=2547305

I ate a jellyfish... tasted like soy sauce.

Current Tank Info: 180 gallon system in progress
jrhupp is offline   Reply With Quote
Unread 12/28/2015, 10:47 PM   #22
geekengineer
Registered Member
 
Join Date: Aug 2015
Location: colorado
Posts: 638
super cool keep it up there. OCD the whole way..


__________________
Come back from the dead. Not sure what I'm doing at this time.. have a 30 Gallon DT and 20 Sump sitting in mothballs.

Other interests DYI, 3D printing,

Current Tank Info: 30 gal saltwater and 20 gal sump
geekengineer is offline   Reply With Quote
Unread 01/02/2016, 05:24 PM   #23
jrhupp
Registered Member
 
Join Date: Jun 2005
Location: Lincoln, NE
Posts: 318
Quick update on the lights:

I have them working and I believe have all the bugs worked out of the sketch now as well.


The sketch ramps the LEDs up and down following a bell shaped curve; the model is based on a Lorentzian lineshape, mostly because this is what I am familiar with and because the half-width was a handy way to tie the end points of the curve to sunrise and sunset.

I'm using an older library (time lord) to do sunrise and sunset on the fly. These are computed based on date, geographic location and timezone. Date comes from the RTC on the board. Geographic location and timezone are stored in EEPROM and can be changed through the serial interface.

The light intensity is set on a per-minute basis and is solved in 1 byte steps for 255 to 0.

Peak intensity is user set as a percentage of total intensity and some additional parameters allow the the sunrise/sunset to be shifted by +/- 2hrs, or allow the day length to be truncated or extended (all also stored in EEPROM). That last parameter and the peak intensity are channel dependent, so the blue or white LEDs can turn on/off at different times and peak at different values.

There is also a manual mode that lets the LEDs be controlled direct through the serial interface. It was mostly for testing purposes, but I left it in.

Here is the sketch.


__________________
Current build thread : http://www.reefcentral.com/forums/showthread.php?t=2547305

I ate a jellyfish... tasted like soy sauce.

Current Tank Info: 180 gallon system in progress
jrhupp is offline   Reply With Quote
Unread 01/02/2016, 06:17 PM   #24
oreo57
Registered Member
 
Join Date: Apr 2013
Posts: 1,793
Small nit to picK
Quote:
The light intensity is set on a per-minute basis and is solved in 1 byte steps for 255 to 0.
A higher resolution for fading is more desirable..like 10 bit..


oreo57 is offline   Reply With Quote
Unread 01/02/2016, 08:10 PM   #25
jrhupp
Registered Member
 
Join Date: Jun 2005
Location: Lincoln, NE
Posts: 318
Quote:
Originally Posted by oreo57 View Post
Small nit to picK


A higher resolution for fading is more desirable..like 10 bit..
I have seen folks do that a few places, but I'm not sure I understand the rational behind it.

From a physiological perspective (ie photosynthesis) I don't see that finer increments for stepping intensity up or down make much of any difference between 8 and 10 bits; assuming peak intensity is near full sun and dimming is linear, at 8 bits a 1 bit change is less than 10 PPFD. In higher plants, that kind of step change in intensity is not such a big deal; the physiological response with that kind of change is mostly driven by energy input rather than at much larger step changes where activation/deactivation of the machinery is at play. I can't image coral function very differently. But the step change in PPFD with dimming is something I have not measured with this setup yet and I may be missing something in this logic.

From a visual perception stand point, I can't see the difference in intensity with a 1 bit change in dimming (this would suggest that each step change is considerably less than 10 PPFD). Well in all fairness, I can see the difference between off and the first bit increase. But that is about it.

From an intensity versus time perspective, solving on a per minute basis you would need a roughly 35 hour day to take full advantage of 10 bit dimming over the full intensity range. That would be with no dark period. With 8 bits, if you step through each intensity thats still 8.5 hours. Now in my setup, if I don't set the peak at 100% I don't step through each intensity; rather it truncates the range. So maybe there is an argument there?

Is there something I am missing as to a physical reason why 10 bits is better. Or is this is just a "more is better" thing and the trend has been to higher resolution? Please do let me know. I would like to understand the rational.


__________________
Current build thread : http://www.reefcentral.com/forums/showthread.php?t=2547305

I ate a jellyfish... tasted like soy sauce.

Current Tank Info: 180 gallon system in progress
jrhupp is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On



All times are GMT -6. The time now is 02:58 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Powered by Searchlight © 2024 Axivo Inc.
Use of this web site is subject to the terms and conditions described in the user agreement.
Reef CentralTM Reef Central, LLC. Copyright ©1999-2022
User Alert System provided by Advanced User Tagging v3.3.0 (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.