Thanks manNever worry too much about getting everything perfect. Worry about not doing.You are just laying the groundwork for growing even better weed down the line.
I have not yet seen how you accomplish your automation, in full, I see the microprocessor and relays but am curios what you mean when you say you changed the program? Are you writ g control code or do youmean you just changed a few input parameters. Is it an off the shelf unit? Arduino? RasPi?I just changed my program a little.
Now it turns on the vacuum pump to recover any nutrient solution right after the spray nozzles turn on.
The pump is on for 30 seconds, and the vacuum chamber opens for 30 seconds, this happens every 180 seconds.
No more water on my roots, not even a little bit.
It's ran by an arduino mega 2560.I have not yet seen how you accomplish your automation, in full, I see the microprocessor and relays but am curios what you mean when you say you changed the program? Are you writ g control code or do youmean you just changed a few input parameters. Is it an off the shelf unit? Arduino? RasPi?
That is basically what I meant, I'm happy to look at your code and would ask you to look at mine? I can pm you or post here your choice.It's ran by an arduino mega 2560.
I wrote the code, and put it in the zip file that I attached a few posts ago. Feel free to poke around in it to see what it looks like, took me a while to get everything working the way I wanted it to.
I'm not sure what you mean by how I accomplish my automation though. What did you want to know?
You can post it here, that's ok with me. Plus it might help others in the future.That is basically what I meant, I'm happy to look at your code and would ask you to look at mine? I can pm you or post here your choice.
Many questions about how to program and interface with sensors still, and I'm using an uno r3 to control things.
you are doing a lot of type of things like pulling real-time status information of devices that I am looking to add more of.You can post it here, that's ok with me. Plus it might help others in the future.
Just put it in a zip file and attach it to your reply.
Figuring out how to make a light timer that doesn't break when the day rolls over to 0 was very counter-intuitive for me as well, but I'm happy to report that both of those work equally as well.you are doing a lot of type of things like pulling real-time status information of devices that I am looking to add more of.
You seem to handle the passing of a day (time 23:59 to time 0:00) much the way I originally envisioned but could not figure out how to make the code work when the user wanted to run lights on at night (i.e. on at 4pm off at 10am) so I went a different route..
My most current code (rev5load4) has a lot of things commented out because I believe I have an issue with the power supply on the r3 not being sufficient to power my 8 channel relay when more than 6 relays are called to be on.
I don't want to start a growing debate but I am currently experimenting with a 20 hour day and the code I use for that is Rev5shortenday.
I particularly find the control logic for your HPA system confusing and intriguing because that technique is completely foreign to me but one of the main objectives that I have with the code I am writing is to make it easy for the end user to customize to their needs.
There are a couple things that I would change immediately, the first is that you do not need to constantly try and set your time every run through loop(), you can put that inside of a timer and have it run every minute at the max because what we are doing is not super critical of the exact time but we DO want to be synchronized with the time, so use system time instead which is set when you read the RTC time into system time. This will make your loop run much faster which is the end goal (fast and stable).you are doing a lot of type of things like pulling real-time status information of devices that I am looking to add more of.
You seem to handle the passing of a day (time 23:59 to time 0:00) much the way I originally envisioned but could not figure out how to make the code work when the user wanted to run lights on at night (i.e. on at 4pm off at 10am) so I went a different route..
My most current code (rev5load4) has a lot of things commented out because I believe I have an issue with the power supply on the r3 not being sufficient to power my 8 channel relay when more than 6 relays are called to be on.
I don't want to start a growing debate but I am currently experimenting with a 20 hour day and the code I use for that is Rev5shortenday.
I particularly find the control logic for your HPA system confusing and intriguing because that technique is completely foreign to me but one of the main objectives that I have with the code I am writing is to make it easy for the end user to customize to their needs.
I just fixed the relay just as you describe, probably as you were typing it, had to test with whacked out temp and humidity parameters but it worked, I have a 3a 5v and took off from a bus.Figuring out how to make a light timer that doesn't break when the day rolls over to 0 was very counter-intuitive for me as well, but I'm happy to report that both of those work equally as well.
You should power your relay board with a separate power supply, the output pins for the uno are only supposed to do like 20mA per pin normally (40mA max I think)
Yeah, can't really do without an RTC they're really handy. I use real time extensively, the system time is synchronized with the RTC every so often because if not the system time is subject to drifting several seconds per day depending on temperature.
So, if your program is long and you are running a bunch of different functions it is a good idea to snapshot the time at the beginning or near the beginning of your loop(), you do that by putting the time into one variable that all the different functions you call use, because different functions use different amounts of clock cycles and things can get screwy if you don't do this.
I'm a novice, and don't know what reducing the day to 20 hours does but if it works for you then great. I don't grow stellar shit yet bro, still learning.
I'll explain how the HPA functions work, this is a state machine, it "remembers" its' last position and only calls digitalwrite() if it needs to because calling digitalwrite is easier than manipulating pins directly but it uses a lot of clock cycles so it's better if we don't call it every time we go through the function.
void hpasolenoid1() //function call
{
if ((t - HPA1timer) > sprayinterval) //if the current time "t" minus the last time that the sprayers were on is greater than the time that is supposed to pass before they spray THEN
{
HPA1spray = true; //set the spray flag to true (this ultimately is what turns on/off the solenoids)
HPA1timer = t; //set the function timer (HPA1timer) to the current time (t)
}
if (((t - HPA1timer) >= sprayduration) && HPA1spray == true) //if the current time minus the function timer (HPA1timer) is greater than OR equal to the amount of time to spray AND they are flagged to be spraying
{
HPA1spray = false; //turn the sprayers off
HPA1timer = t; //reset the function timer
}
if (HPA1SprayState != HPA1spray) //if the current state does not equal the remembered state (this is what turns the sprayers on or off) if it is the same then it skips this and continues the program
{
if (HPA1spray == true) //if the spray flag is true
{
digitalWrite(FETone, HIGH); //turn the sprayers on
}
if (HPA1spray == false) //if the spray flag is false
{
digitalWrite(FETone, LOW); // turn the sprayers off
}
}
HPA1SprayState = HPA1spray; //sets the state
}
Nice! Now things should be more stable for you and you should be able to manipulate all the relays no problem.I just fixed the relay just as you describe, probably as you were typing it, had to test with whacked out temp and humidity parameters but it worked, I have a 3a 5v and took off from a bus.
I do take a snapshot of time, was wondering why you used millis function when you had and RTC but makes sense the way you explain it
are you worried about your program freezing from a brownout? If so you should enable the watchdog timer, included in the AVR lib.The delay after flipping the man lights on is a safety, should only go through that when switching that relay from off to on. I get a lot of power fluctuanions and outages so being able to recover from one safely was critical, if I were using hps MH or other lamp I'd suggest a few minutes worth of delay before kicking back on. I will double check for unnecessary delays though and get the serial statement sorted as you suggest. I use an app called arduinodroid on an old phone but just as a monitor for those serial print statements.
CRS (cant remember shit)
do you have a battery backup?