Plug 'n play arduino controller, Arduino Green WEB Controller - Page 3 - The Planted Tank Forum
Reply
 
LinkBack Thread Tools Display Modes
post #31 of 200 (permalink) Old 01-15-2015, 06:44 AM
Planted Tank Enthusiast
 
Join Date: Aug 2014
Location: Edmonton, Alberta, Canada
Posts: 790
It's not a big deal on the custom labels, there isn't many anyways but I thought they could be php variables or whatever you're using stored in a database or something, didn't realize memory still relied on the arduino. I was going to have custom labels on my controller but yeah memory. Will this work on the due without to much work?
robsworld78 is offline  
Sponsored Links
Advertisement
 
post #32 of 200 (permalink) Old 01-15-2015, 02:06 PM Thread Starter
Children Boogie
 
mistergreen's Avatar
 
Join Date: Dec 2006
Location: Cincinnati
Posts: 16,743
Actually, you can customize it. You'd have to change the html code on the sd card but if people's programming skills aren't up to it, they don't have to touch anything. But no, the labels couldn't be variables.

Because of the memory requirements, it'll only work on a mega.

Another device you can add is the IR to control those fancy Sat lights. I can grab the code already developed so it's no big deal to incorporate.
mistergreen is online now  
post #33 of 200 (permalink) Old 01-15-2015, 05:06 PM
Planted Tank Enthusiast
 
Join Date: Aug 2014
Location: Edmonton, Alberta, Canada
Posts: 790
But the due has more memory?
robsworld78 is offline  
 
post #34 of 200 (permalink) Old 01-15-2015, 06:24 PM Thread Starter
Children Boogie
 
mistergreen's Avatar
 
Join Date: Dec 2006
Location: Cincinnati
Posts: 16,743
Quote:
Originally Posted by robsworld78 View Post
But the due has more memory?
Oh! it does. It has plenty at 96K vs 8K of the mega. I was thinking of something else.
I'm not 100% sure on the compatibility though.
mistergreen is online now  
post #35 of 200 (permalink) Old 01-15-2015, 07:04 PM
Planted Tank Enthusiast
 
Join Date: Aug 2014
Location: Edmonton, Alberta, Canada
Posts: 790
Yeah and its much much faster to, also has 12-bit PWM onboard. The difference is its 3.3v vs 5v and some libraries are different.
robsworld78 is offline  
post #36 of 200 (permalink) Old 01-15-2015, 07:20 PM Thread Starter
Children Boogie
 
mistergreen's Avatar
 
Join Date: Dec 2006
Location: Cincinnati
Posts: 16,743
Quote:
Originally Posted by robsworld78 View Post
Yeah and its much much faster to, also has 12-bit PWM onboard. The difference is its 3.3v vs 5v and some libraries are different.
Oh, the 12bit pwm is nice. I'll make 2 versions if necessary. It's a easy as swapping out libraries. Working on the mega is keeping me disciplined on memory management.
mistergreen is online now  
post #37 of 200 (permalink) Old 01-15-2015, 11:26 PM Thread Starter
Children Boogie
 
mistergreen's Avatar
 
Join Date: Dec 2006
Location: Cincinnati
Posts: 16,743
hey, I forget who but they tested this flow sensor and said they cut the pump's flow by half.
http://www.seeedstudio.com/depot/g11...?cPath=144_151

I just had this idea where you don't put it inline but at the end of the spray bar. The flow won't be obstructed and all you really care about the the percent of flow not the actual flow rate. Say, It's at 50% from last month. That's all you need.
mistergreen is online now  
post #38 of 200 (permalink) Old 01-16-2015, 12:29 AM
Planted Tank Guru
 
kman's Avatar
 
Join Date: Dec 2013
Location: Los Angeles
Posts: 2,350
Quote:
Originally Posted by mistergreen View Post
hey, I forget who but they tested this flow sensor and said they cut the pump's flow by half.
http://www.seeedstudio.com/depot/g11...?cPath=144_151

I just had this idea where you don't put it inline but at the end of the spray bar. The flow won't be obstructed and all you really care about the the percent of flow not the actual flow rate. Say, It's at 50% from last month. That's all you need.
OOOHH, that's slick. It'd be tough to do with lily pipes, though.

Still, I've really wished, on more than one occasion, for a way to monitor flow from my canister, just so I could know when flow rate is down, etc. You're right, precise values aren't important, just relative ones. But I can't afford a 50% hit to my flow rate, that's for sure.
kman is offline  
post #39 of 200 (permalink) Old 01-16-2015, 12:44 AM Thread Starter
Children Boogie
 
mistergreen's Avatar
 
Join Date: Dec 2006
Location: Cincinnati
Posts: 16,743
I got a 1% flow rate the other day. That's what got me thinking. I need an alert!
They do make flow sensors that don't obstruct but they're hundred of dollars.

I have 2 filters in my 75G. That's why I didn't notice.
mistergreen is online now  
post #40 of 200 (permalink) Old 01-16-2015, 12:56 AM
Planted Tank Guru
 
kman's Avatar
 
Join Date: Dec 2013
Location: Los Angeles
Posts: 2,350
Quote:
Originally Posted by mistergreen View Post
I got a 1% flow rate the other day. That's what got me thinking. I need an alert!
They do make flow sensors that don't obstruct but they're hundred of dollars.

I have 2 filters in my 75G. That's why I didn't notice.
My Eheim Ecco 60 impeller died.. but the motor still sounded like it running normally. Fortunately I had a spare head (I had a cracked canister a month ago, so I had purchased a whole replacement filter). I could tell something was off, but not what... until I did a water change, I didn't notice that the outflow had reduced to barely a trickle! Much relief when I hooked up the new head and flow resumed at normal levels.
kman is offline  
post #41 of 200 (permalink) Old 01-17-2015, 07:06 PM Thread Starter
Children Boogie
 
mistergreen's Avatar
 
Join Date: Dec 2006
Location: Cincinnati
Posts: 16,743
Live Stream is enabled!

https://www.youtube.com/watch?v=JAgaJNq0ZWg

You can definitely have a better webcam than mine. I'm using my crappy laptop to stream. If you're streaming 24/7, I'd recommend the few lowest bit rate streaming options. You don't want to hog your network. Oh, and don't let the computer go to sleep or the stream will stop
mistergreen is online now  
post #42 of 200 (permalink) Old 01-18-2015, 01:08 AM
Planted Tank Enthusiast
 
Join Date: Aug 2014
Location: Edmonton, Alberta, Canada
Posts: 790
Looks good till it freezes up at the end, lol. That's exactly what I was talking about. I like how you set it up so you can watch any video through it, now you can advertise my controller.
robsworld78 is offline  
post #43 of 200 (permalink) Old 01-18-2015, 02:07 PM
Algae Grower
 
Join Date: Jan 2015
Location: Canada
Posts: 6
Amazing progress! Glad you got the video working.
jamblor is offline  
post #44 of 200 (permalink) Old 01-18-2015, 03:45 PM Thread Starter
Children Boogie
 
mistergreen's Avatar
 
Join Date: Dec 2006
Location: Cincinnati
Posts: 16,743
Quote:
Originally Posted by robsworld78 View Post
Looks good till it freezes up at the end, lol. That's exactly what I was talking about. I like how you set it up so you can watch any video through it, now you can advertise my controller.
Streaming vids tend to freeze for a second once in a while. Home internet tends to be good at downloading but slow at uploading so streaming video quality won't be too good. Hey, at least you can see light, water level and any float dead fish, it does its job.

If you're lucky to have fiberoptics, you can set up multiple cameras.
mistergreen is online now  
post #45 of 200 (permalink) Old 01-20-2015, 02:35 AM
Planted Tank Enthusiast
 
Join Date: Aug 2014
Location: Edmonton, Alberta, Canada
Posts: 790
Here's the code for lunar cycle.

Create a file called moon_phases.h and included the following.
Code:
int GetPhase(int nYear, int nMonth, int nDay);
const char* getMoonPhaseName(int phase);
Then create a file called moon_phases.cpp and include the following.
Code:
#include <math.h>
/* // This was original code for showing text, I didn't care to show any so I didn't edit
 // this section but left it for reference if I decide to.
const char* moonPhasesText[] = {
                   "New            \0", //  XXXXXXXX\0",
                   "Waxing crescent\0", //  XXXXXX__\0",
                   "First quarter  \0", //  XXXX____\0",
                   "Waxing gibbous \0", //  XX______\0",
                   "Full           \0", //  ________\0",
                   "Waning gibbous \0", //  ______XX\0",
                   "Last quarter   \0", //  ____XXXX\0",
                   "Waning crescent\0", //  __XXXXXX\0"
                 };
*/
const char* getMoonPhaseName(int phase){
  return moonPhasesText[phase];
}

double MyNormalize(double v)
{
  v = v - floor(v);
  if (v < 0)
    v = v + 1;
  return v;
} 

int GetPhase(int nYear, int nMonth, int nDay) // calculate the current phase of the moon
{
  int phase;
  double AG, IP;
  long YY, MM, K1, K2, K3, JD;
  YY = nYear - floor((12 - nMonth) / 10);
  MM = nMonth + 9;
  if (MM >= 12)
  {
    MM = MM - 12;
  }
  K1 = floor(365.25 * (YY + 4712));
  K2 = floor(30.6 * MM + 0.5);
  K3 = floor(floor((YY / 100) + 49) * 0.75) - 38;
  JD = K1 + K2 + nDay + 59;
  if (JD > 2299160)
  {
    JD = JD - K3;
  }
  IP = MyNormalize((JD - 2451550.1) / 29.530588853);
  AG = IP*29.53;
  if (AG <= .98435) phase = 0; // 0%
  else if (AG <= 1.96870) phase = 1; // 1%
  else if (AG <= 2.95305) phase = 2; // 4%
  else if (AG <= 3.93741) phase = 3; // 10%
  else if (AG <= 4.92176) phase = 4; // 18%
  else if (AG <= 5.90611) phase = 5; // 27%
  else if (AG <= 6.89047) phase = 6; // 36%
  else if (AG <= 7.87482) phase = 7; // 45%
  else if (AG <= 8.85917) phase = 8; // 54%
  else if (AG <= 9.84352) phase = 9; // 63%
  else if (AG <= 10.82788) phase = 10; // 72%
  else if (AG <= 11.81223) phase = 11; // 81%
  else if (AG <= 12.79658) phase = 12; // 90%
  else if (AG <= 13.78094) phase = 13; // 96%
  else if (AG <= 14.76529) phase = 14; // 100%
  else if (AG <= 15.74964) phase = 15; // 100%
  else if (AG <= 16.73400) phase = 16; // 96%
  else if (AG <= 17.71835) phase = 17; // 91%
  else if (AG <= 18.70270) phase = 18; // 84%
  else if (AG <= 19.68705) phase = 19; // 77%
  else if (AG <= 20.67141) phase = 20; // 69%
  else if (AG <= 21.65576) phase = 21; // 61%
  else if (AG <= 22.64011) phase = 22; // 52%
  else if (AG <= 23.62447) phase = 23; // 43%
  else if (AG <= 24.60882) phase = 24; // 35%
  else if (AG <= 25.59317) phase = 25; // 27%
  else if (AG <= 26.57752) phase = 26; // 18%
  else if (AG <= 27.56188) phase = 27; // 10%
  else if (AG <= 28.54623) phase = 28; // 4%
  else if (AG <= 29.530588853) phase = 29; // 1%
  return phase;
}
Then in your main sketch add reference to moon_phases.h with the following.
Code:
#include "moon_phases.h"
And to show images I have the following function in the main sketch.
Code:
void showMoonPhase(){
  phase = GetPhase(year(), month(), day(now()));
  int xMoon=298;
  if (fadeInProgress==true && fadeFromMode==3 && dispScreen==1) {
    xMoon=231; 
    myFiles.loadBitmap(240, 138, 36, 11, "homeL2.raw");
  }
  else if (fadeInProgress==true && fadeToMode==3 && dispScreen==1) {
    xMoon=365; 
    myFiles.loadBitmap(374, 138, 36, 11, "homeL2.raw");
  }
  else if (dispScreen==1) {
    xMoon=298; 
    myFiles.loadBitmap(307, 138, 36, 11, "homeL2.raw");
  }

  if (phase==0) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon1.raw"); // 0%
  else if (phase<=1) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon2.raw"); // 2%
  else if (phase<=3) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon3.raw"); // 10%
  else if (phase<=4) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon4.raw"); // 18%
  else if (phase<=5) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon5.raw"); // 25% right
  else if (phase<=6) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon6.raw"); // 38%
  else if (phase<=7) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon7.raw"); // 50% right
  else if (phase<=8) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon8.raw"); // 59%
  else if (phase<=10) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon9.raw"); // 67%
  else if (phase<=11) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon10.raw"); // 75% right
  else if (phase<=13) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon11.raw"); // 84%
  else if (phase<=14) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon12.raw"); // 92%
  else if (phase<=15) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon13.raw"); // 100%
  else if (phase<=16) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon14.raw"); // 92%
  else if (phase<=17) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon15.raw"); // 84%
  else if (phase<=19) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon16.raw"); // 75% left
  else if (phase<=20) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon17.raw"); // 67%
  else if (phase<=22) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon18.raw"); // 59%
  else if (phase<=23) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon19.raw"); // 50% left
  else if (phase<=24) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon20.raw"); // 38%
  else if (phase<=25) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon21.raw"); // 25% left
  else if (phase<=26) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon22.raw"); // 18%
  else if (phase<=28) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon23.raw"); // 10%
  else if (phase<=29) myFiles.loadBitmap(xMoon, 80, 55, 55, "moon24.raw"); // 2%
}
And finally in my alarm for moonlight mode I have the following. To use this you need to have moonlight value set to at least 30 as there are 30 phases. For 8-bit PWM you need really low power leds or 30 (full moon) is way to bright.
Code:
  moonLum=1;
  
  if (lunarOnOff==0)
  {
    showMoonPhase();    
    if (phase==0) moonLum=0; // 0%
    else if (phase==1) moonLum=.01; // 1%
    else if (phase==2) moonLum=.04; // 4%
    else if (phase==3) moonLum=.1; // 10%
    else if (phase==4) moonLum=.18; // 18%
    else if (phase==5) moonLum=.27; // 27%
    else if (phase==6) moonLum=.36; // 36%
    else if (phase==7) moonLum=.45; // 45%
    else if (phase==8) moonLum=.54; // 54%
    else if (phase==9) moonLum=.63; // 63%
    else if (phase==10) moonLum=.72; // 72%
    else if (phase==11) moonLum=.81; // 81%
    else if (phase==12) moonLum=.90; // 90%
    else if (phase==13) moonLum=.96; // 96%
    else if (phase==14) moonLum=1; // 100%
    else if (phase==15) moonLum=1; // 100%
    else if (phase==16) moonLum=.96; // 96%
    else if (phase==17) moonLum=.91; // 91%
    else if (phase==18) moonLum=.84; // 84%
    else if (phase==19) moonLum=.77; // 77%
    else if (phase==20) moonLum=.69; // 69%
    else if (phase==21) moonLum=.61; // 61%
    else if (phase==22) moonLum=.52; // 52%
    else if (phase==23) moonLum=.43; // 43%
    else if (phase==24) moonLum=.35; // 35%
    else if (phase==25) moonLum=.27; // 27%
    else if (phase==26) moonLum=.18; // 18%
    else if (phase==27) moonLum=.10; // 10%
    else if (phase==28) moonLum=.04; // 4%
    else if (phase==29) moonLum=.01; // 1%
  }
  
  // target color is moonlight
  targetColor.Red = (lightMoon.Red*moonLum);
  targetColor.Green = (lightMoon.Green*moonLum);
  targetColor.Green2 = (lightMoon.Green2*moonLum);
  targetColor.Blue = (lightMoon.Blue*moonLum);
  targetColor.Blue2 = (lightMoon.Blue2*moonLum);
  targetColor.White = (lightMoon.White*moonLum);
  targetColor.Violet = (lightMoon.Violet*moonLum);
  targetColor.Moon = (lightMoon.Moon*moonLum);
I only added 24 images because I did this before I went to fat32 SD card and I was reaching my limit. Technically you can have any mix of phases or images as you want. Originally I tried 200 phases but it took to much flash memory, what a waste of time that was. I trimmed it as much as I could without losing too much effect.

And here's a link to 360 high quality images of the moon, more than you'll ever need.

http://commons.wikimedia.org/wiki/Us...side-phase-set
robsworld78 is offline  
Reply

Quick Reply
Message:
Options

Register Now



In order to be able to post messages on the The Planted Tank Forum forums, you must first register.
Please enter your desired user name, your email address and other required details in the form below.

User Name:
Password
Please enter a password for your user account. Note that passwords are case-sensitive.

Password:


Confirm Password:
Email Address
Please enter a valid email address for yourself.

Email Address:
OR

Log-in









Human Verification

In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.



Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page
Display Modes
Linear Mode Linear Mode



Posting Rules  
You may post new threads
You may 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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On

 
For the best viewing experience please update your browser to Google Chrome