Home | Community | Message Board


This site includes paid links. Please support our sponsors.


Welcome to the Shroomery Message Board! You are experiencing a small sample of what the site has to offer. Please login or register to post messages and view our exclusive members-only content. You'll gain access to additional forums, file attachments, board customizations, encrypted private messages, and much more!

Shop: MagicBag.co All-In-One Bags That Don't Suck   Original Sensible Seeds Bulk Cannabis Seeds   Myyco.com Golden Teacher Liquid Culture For Sale   North Spore Cultivation Supplies   Unfolding Nature Unfolding Nature: Being in the Implicate Order   Mushroom-Hut Substrate Bags   Sporeworks.EU Spores for European Microscopy

Jump to first unread post Pages: 1 | 2 | 3 | 4 | 5 |  [ show all ]
Some of these posts are very old and might contain outdated information. You may wish to search for newer posts instead.
My gift to the community--For those who love technology and programming... * 4
    #26195551 -

Arduino mega, 20x4 i2c lcd, dht temp/hum sensor, ds1307 rtc, arduinolay(8way relay controlled power strip), 5 pushbuttons, and misc resistors and wires.

Quote:
#include <EEPROM.h>
#include <RTClib.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <LiquidMenu.h>
#include <DHT.h>
#include "Button.h"

#define dht_apin A0 //Analog sensor pin is connected to.
#define DHTTYPE DHT11
#define Light1Pin 7
#define Light2Pin 6

DHT dht(dht_apin, DHTTYPE);
LiquidCrystal_I2C lcd(0x27, 20, 4);
RTC_DS1307 rtc;

// Button objects instantiation
const bool pullup = true;
Button left(8, pullup);
Button right(9, pullup);
Button up(10, pullup);
Button down(11, pullup);
Button enter(12, pullup);

// Pin definitions and variables for their state.
const byte pin6 = 6;
byte pin6_level = 0;

const byte pinA4 = A4;
byte pinA4_value = 0;

const byte pinA5 = A5;
byte pinA5_value = 0;

// The analog reading sample period in seconds.
// It is later overwritten by it's EEPROM value.
unsigned short sample_period = 2;

// Text used for indication for the save lines.
char* input_saved;
char* output_saved;
int printTime();
const char* light1State();
const char* light2State();
int lightOn;
int lightOff;
int relayPins[] = { 6,7 };

enum FunctionTypes {
increase = 1,
decrease = 2,
};

//temp/hum variables
int t1;
int h1;

// A LiquidLine object can be used more that once.
LiquidLine back_line(11, 1, "/BACK");
LiquidLine timeC(0, 0, printTime);

LiquidLine welcome_line1(1, 1, " Arduino ", LIQUIDMENU_VERSION);
LiquidLine welcome_line2(1, 2, "Garden Automater");
LiquidScreen welcome_screen(welcome_line1, welcome_line2);

// These lines direct to other menus.
LiquidLine Lights(0, 1, "Lights>");
LiquidLine TempHum(0, 2, "Temp/Hum>");
LiquidScreen io_screen(Lights, TempHum, timeC);

// This is the first menu.
LiquidMenu main_menu(lcd, welcome_screen, io_screen, 1);

LiquidLine Light1(0, 1, "Light1: ", light1State);
LiquidLine Light2(0, 2, "Light2: ", light2State);
LiquidScreen light_screen(Light1, Light2, timeC);

LiquidLine lightOn_line(0, 1, "Time ON: ", lightOn);
LiquidLine lightOff_line(0, 2, "Time OFF: ", lightOff);
LiquidScreen oSecondary_screen(timeC, lightOn_line, lightOff_line, back_line);

// This is the second menu.
LiquidMenu Lights_menu(lcd, light_screen, oSecondary_screen);


LiquidLine temp1_line(0, 0, "Temp1: ", t1);
LiquidLine temp2_line(0, 1, "Temp2: ", pinA5_value);
LiquidLine temp3_line(0, 2, "Temp3: ", pinA5_value);
LiquidLine temp4_line(0, 3, "Temp4: ", pinA5_value);
LiquidScreen temp_screen(temp1_line, temp2_line, temp3_line, temp4_line);

LiquidLine hum1_line(0, 0, "Hum1: ", h1);
LiquidLine hum2_line(0, 1, "Hum2: ", pinA5_value);
LiquidLine hum3_line(0, 2, "Hum3: ", pinA5_value);
LiquidLine hum4_line(0, 3, "Hum4: ", pinA5_value);
LiquidScreen hum_screen(hum1_line, hum2_line, hum3_line, hum4_line);

LiquidLine iSample_line(0, 1, "Sample: ", sample_period, "s");
LiquidLine iSave_line(0, 2, "Save", input_saved);
LiquidScreen iSecondary_screen(iSample_line, iSave_line, back_line);

// And this is the final third menu.
LiquidMenu TempHum_menu(lcd, temp_screen, hum_screen, iSecondary_screen);

/*
* LiquidSystem object combines the LiquidMenu objects to form
* a menu system. It provides the same functions as LiquidMenu
* with the addition of add_menu() and change_menu().
*/
LiquidSystem menu_system(main_menu, Lights_menu, TempHum_menu);


// Checks all the buttons.
void buttonsCheck() {
if (right.check() == LOW) {
menu_system.next_screen();
}
if (left.check() == LOW) {
menu_system.previous_screen();
}
if (up.check() == LOW) {
menu_system.call_function(increase);
}
if (down.check() == LOW) {
menu_system.call_function(decrease);
}
if (enter.check() == LOW) {
menu_system.switch_focus();
}
}

// Callback function that will be attached to back_line.
void go_back() {
// This function takes reference to the wanted menu.
menu_system.change_menu(main_menu);
}

void goto_Lights_menu() {
menu_system.change_menu(Lights_menu);
}

void goto_TempHum_menu() {
menu_system.change_menu(TempHum_menu);
}

void on_light1() {
if (digitalRead(Light1Pin)) {
digitalWrite(Light1Pin, HIGH);
}
else {
digitalWrite(Light1Pin, LOW);
}
output_saved = (char*)"  ";
}

void on_light2() {
if (digitalRead(Light2Pin)) {
digitalWrite(Light2Pin, HIGH);
}
else {
digitalWrite(Light2Pin, LOW);
}
output_saved = (char*)"  ";
}

void off_light1() {
if (digitalRead(Light1Pin)) {
digitalWrite(Light1Pin, LOW);
}
else {
digitalWrite(Light1Pin, HIGH);
}
output_saved = (char*)"  ";
}

void off_light2() {
if (digitalRead(Light2Pin)) {
digitalWrite(Light2Pin, LOW);
}
else {
digitalWrite(Light2Pin, HIGH);
}
output_saved = (char*)"  ";
}

void save_input() {
EEPROM.put(11, sample_period);
input_saved = (char*)" *";
}

void increase_lightsOn() {
if (lightOn <= 24) {
lightOn = lightOn + 1;
}
else {
lightOn = 24;
}
}

void decrease_lightsOn() {
if (lightOn <= 24) {
lightOn =- 1;
}
else {
lightOn = 0;
}
}

void increase_lightsOff() {
if (lightOff <= 24) {
lightOff = lightOn + 1;
}
else {
lightOff = 24;
}
}

void decrease_lightsOff() {
if (lightOff <= 24) {
lightOff = -1;
}
else {
lightOff = 0;
}
}

void increase_samplePeriod() {
if (sample_period < 10) {
sample_period++;
input_saved = (char*)"  ";
}
}

void decrease_samplePeriod() {
if (sample_period > 0) {
sample_period--;
input_saved = (char*)"  ";
}
}

void setup() {
Serial.begin(112000);

pinMode(pin6, OUTPUT);
for (int r = 0; r < 2; r++) {
pinMode(relayPins[r], OUTPUT);
digitalWrite(relayPins[r],LOW);
}
// Reads the values recorded in the EEPROM
EEPROM.get(9, pin6_level);
EEPROM.get(11, sample_period);
analogWrite(pin6, pin6_level);
lcd.begin(20, 4);
lcd.init();
lcd.backlight();

back_line.set_focusPosition(Position::LEFT);

back_line.attach_function(1, go_back);
back_line.attach_function(2, go_back);

Lights.attach_function(1, goto_Lights_menu);
Lights.attach_function(2, goto_Lights_menu);
TempHum.attach_function(1, goto_TempHum_menu);
TempHum.attach_function(2, goto_TempHum_menu);

Light1.attach_function(increase, on_light1);
Light1.attach_function(decrease, off_light1);
Light2.attach_function(increase, on_light2);
Light2.attach_function(decrease, off_light2);

lightOn_line.attach_function(increase, increase_lightsOn);
lightOn_line.attach_function(decrease, decrease_lightsOn);
lightOff_line.attach_function(increase, increase_lightsOff);
lightOff_line.attach_function(decrease, decrease_lightsOff);
iSave_line.attach_function(1, save_input);
iSave_line.attach_function(2, save_input);
iSample_line.attach_function(increase, increase_samplePeriod);
iSample_line.attach_function(decrease, decrease_samplePeriod);

input_saved = (char*)" *";
output_saved = (char*)" *";

if (!rtc.begin()) {
Serial.println("Couldn't find RTC");
while (1);
}
if (!rtc.isrunning()) {
Serial.println("RTC lost power, lets set the time!");

// Comment out below lines once you set the date & time.
// Following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));

// Following line sets the RTC with an explicit date & time
// for example to set January 27 2017 at 12:56 you would call:
// rtc.adjust(DateTime(2017, 1, 27, 12, 56, 0));
}
menu_system.update();
}
void loop() {
buttonsCheck();
h1 = dht.readHumidity();
t1 = dht.readTemperature(true);

// check if returns are valid, if they are NaN (not a number) then something went wrong!
if (isnan(t1) || isnan(h1)) {
Serial.println("Failed to read from DHT #1");
}
else {
Serial.print("Humidity 1: ");
Serial.print(h1);
Serial.print(" %\t");
Serial.print("Temperature 1: ");
Serial.print(t1);
Serial.println(" *C");
}
static unsigned long lastMillis_sample = 0;
if (millis() - lastMillis_sample > (sample_period * 1000)) {
lastMillis_sample = millis();
menu_system.update();
}

}
int printTime() {
DateTime now = rtc.now();
lcd.setCursor(0, 0);
lcd.print(now.month(), DEC);
lcd.print('/');
lcd.print(now.day(), DEC);
lcd.print('/');
lcd.print(now.year(), DEC);
lcd.print(' ');
lcd.print(now.hour(), DEC);
lcd.print(':');
lcd.print(now.minute(), DEC);
lcd.print(':');
lcd.print(now.second(), DEC);
}
const char* light1State() {
if (digitalRead(Light1Pin) == HIGH) {
return "ON";
}
else
{
return "OFF";
}
}
const char* light2State() {
if (digitalRead(Light2Pin) == HIGH) {
return "ON";
}
else
{
return "OFF";
}
}
void lightProgram() {
DateTime now = rtc.now();
int hour = now.hour();
for (int a = 0; a < 2; a++) {
if (lightOn == hour) {
Serial.print("Lights on!");
digitalWrite(relayPins[a], HIGH);
}
if (lightOff == hour) {
Serial.print("Lights on!");
digitalWrite(relayPins[a], LOW);
}
}
}



The function for watering is the last thing to be written for it to be fully functional.

Libraries needed are rtc, liquid menu, button, i2c lcd, dht, and the wire if not included in the lcd library.

This is for those who are into programming, and cultivation, updates will keep coming out, the water function will only take a few minutes to write but this should give anyone interested a good start at a stand alone system that can be adapted to any environment.

Datalogging will be added, looking into wifi to view data through the network and manage the lights and water program.

This is my gift to the community that helped me learn what I've been interested in, please enjoy... I tried to find a scrolling option to not take up such space but the qoute option was what I thought would be best.

The wiring can be understood in the code, standard wiring for everything, many tutorials online.

This is in beta phase, and is more for those into building and making things currently since there are updates to be made still along with alterations to try and make efficient use of the code.

A tutorial is planned to guide those with less knowledge through the process of building this, total spent is under 60, but spent 6 months designing, coding, and engineering.

Edited by K3yBoardC0WBoy (09/18/19 11:12 AM)

Extras: Filter Print Post Top
Re: My gift to the community--For those who love technology and programming... [Re: K3yBoardC0WBoy]
    #26195621 -

This is awesome! I started working on a project very similar to this using an arduino and GTOs many years ago but abandoned it before I really got started due to lack of time. I had been inspired by the grodunio project which at its time was in its infancy, I followed grodunio for a little bit after that but it seemed like it was always 2 steps forward 1 step back with it and progress was slow and at one point it seemed to be abandoned...I haven't look on it since then, not sure if it ever took off, but I read someone referencing it at one point so maybe they eventually got their shit together.

Thank you for this, I will definitely be following you. I've just recently blown this dust off my ardunio and have been wanting to get into home automation(and more) not that there are SO many GREAT tools to work with and the IoT finally blooming. Though I think I am going to get a new board before I do much.

But using it for gardening has always been the holy grail for me.

Did you plan on just watering on a schedule or with a soil sensor? I don't have the code for it anymore due to an unfortunate accident before I started backing up everything on the cloud, but one of my very first arduino projects was a soil moisture sensor built with 2 wires and 2 nails. It didn't trigger any pumps, just alerted me when voltage was out of range in either direction and had to be calibrated by hand for every batch of soil.

But now they have cheap soil moisture sensors built just for Arduino, so I imagine its easy as pie, and that would allow for different watering systems without having to worry too much about their gpm. Its amazing how much support hardware they have available for arduino and other single board micro-controllers now.

Edited by Holybullshit (09/18/19 12:06 PM)

Extras: Filter Print Post Top
Re: My gift to the community--For those who love technology and programming... [Re: Holybullshit]
    #26205862 -

Holybullshit said:
This is awesome! I started working on a project very similar to this using an arduino and GTOs many years ago but abandoned it before I really got started due to lack of time. I had been inspired by the grodunio project which at its time was in its infancy, I followed grodunio for a little bit after that but it seemed like it was always 2 steps forward 1 step back with it and progress was slow and at one point it seemed to be abandoned...I haven't look on it since then, not sure if it ever took off, but I read someone referencing it at one point so maybe they eventually got their shit together.

Thank you for this, I will definitely be following you. I've just recently blown this dust off my ardunio and have been wanting to get into home automation(and more) not that there are SO many GREAT tools to work with and the IoT finally blooming. Though I think I am going to get a new board before I do much.

But using it for gardening has always been the holy grail for me.

Did you plan on just watering on a schedule or with a soil sensor? I don't have the code for it anymore due to an unfortunate accident before I started backing up everything on the cloud, but one of my very first arduino projects was a soil moisture sensor built with 2 wires and 2 nails. It didn't trigger any pumps, just alerted me when voltage was out of range in either direction and had to be calibrated by hand for every batch of soil.

But now they have cheap soil moisture sensors built just for Arduino, so I imagine its easy as pie, and that would allow for different watering systems without having to worry too much about their gpm. Its amazing how much support hardware they have available for arduino and other single board micro-controllers now.



I have always loved technology since a child, always wanting to learn how things work and are put together.
    This project started about 6 months ago, even though have been practicing programming on and off for 10 yrs just never dived to deep till this project to try and understand the technology and language.
    I broke it down into parts so I could assemble such a project focusing on one part at a time, I had/have many ideas of how to cultivate on a higher level by the aid of tech.
    The menu was first, tried using a array to hold the menu names and use a function pointer to point to where the code to go if a selection was made, after a couple months of trying different ways of building a menu I decided to look into a menu library to possibly make this project easier and more maneagable, I found liquidMenu and after playing with the examples I felt like it was a good fit in order to move on.
  I knew I needed to keep time so a real time clock was a must, even though can use micros to keep time, how the program is written really affects how effecient micros works showing up to 10min difference over 6hrs later.
  20x4 lcd seemed like the best choice for visual reference to whats taking place even though I considered managing this through wifi with no real time display, still would kind of like to add wifi to post and graph all the data and further edit+control the program.
    There are tons of ways to do one thing, and very pleased with how this came out. It's beautiful combining arduino projects into one functional machine.
    I followed the arduinolay to build the power strip controlled by 8 relays so when I want something powered just tell that relay to go active according to whatever parameters.
    I do plan on adding more sensors to get as much data as possible, soil sensors, gas sensors, etc. and maybe a camera to take scheduled photos of whats happening.
    The idea is to put the tubs inside 2 big tubs with the top flipped over to act as a chamber for the tubs/enclosure, have a intake and exhaust fan, a humidifier in its own chamber inside the enclosure to let out vapor when activated so can circulate through the tubs, and finally with the lights at the top of each corner, and a hole to route the wires through and mount the system to the top of the enclosure.
    You can buy the receptacle socket enclosures to have a casing for your power strip outlets and the arduino should fit inside of that allowing for the entire system to be enclosed in a small plastic space.
    This place helped me greatly, these things are excellent medicine for me and a great alternative to pain meds so that's why I released my code here for you all to enjoy.
    For now the idea is to have the humidifier to activate when the humidity falls below a certain point, but could always add in a second way for it to humidify everything by saying if the soil moisture is below a certain point turn on. I feel it's best to just go off humidity for now, this is being tested and as time goes on if something shows itself that I can improve I will. The lights are set to a 12/12 schedule.
  Any variable that can be measured and recorded, would like to so as time goes on can view every piece of available data and learn what does what. This includes co2 and possibly other gases, this is where tech can shine, by doing a part of our work by recording every piece of data for later review.
  Even the watering system I spent a few weeks on and final verdict came to a atomizer in water to generate mist with a fan to assist in directing the mist. If someone has a better idea on watering I'd like to hear it, but I don't know what could beat extremely thick mist.

Extras: Filter Print Post Top
Re: My gift to the community--For those who love technology and programming... [Re: K3yBoardC0WBoy] * 1
    #26205864 -

It's not easy finding a balance between tech agriculture and science, but every day have been trying to read and learn more to further expand this and other ideas.
    If someone has some helpful input of what could be recorded, what would they like to record and view, I would like to hear it since that info could be used for future versions.
    There is still some clean up with the code to be done and a few other things to make more efficient. This is my way of returning the favor youve all done for me, this could be a great template for anyone as well looking to do the same thing to build upon and expand.
    Within a week I hope to release a more efficient version. It will be posted here. Any input on lighting/water systems would be appreciated as well.

Extras: Filter Print Post Top
Re: My gift to the community--For those who love technology and programming... [Re: K3yBoardC0WBoy]
    #26205875 -

Hi guys,
Anyone live around Cheshire in UK?
I need to see when and where is best for shroomi!!
Thanks

Extras: Filter Print Post Top
Re: My gift to the community--For those who love technology and programming... [Re: Spiderman19]
    #26243075 -

#include <EEPROM.h>
#include <RTClib.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <LiquidMenu.h>
#include <DHT.h>
#include "Button.h"

#define dht1_apin A0 //Analog sensor pin is connected to.
#define DHT1TYPE DHT11
#define Light1Pin 7
#define Light2Pin 6

DHT dht1(dht1_apin, DHT1TYPE);
LiquidCrystal_I2C lcd(0x27, 20, 4);
RTC_DS1307 rtc;

// Button objects instantiation
const bool pullup = true;
Button left(8, pullup);
Button right(9, pullup);
Button up(10, pullup);
Button down(11, pullup);
Button enter(12, pullup);

// The analog reading sample period in seconds.
// It is later overwritten by it's EEPROM value.
unsigned short sample_period = 2;

// Text used for indication for the save lines.
char* input_saved;
char* output_saved;
int printTime();
const char* light1State();
const char* light2State();
int lightOn;
int lightOff;
int humOn;
int relayPins[] = { 6,7,5,4 };

enum FunctionTypes {
increase = 1,
decrease = 2,
};

//temp/hum variables
float t1;
float h1;

// A LiquidLine object can be used more that once.
LiquidLine back_line(11, 1, "/BACK");
LiquidLine timeC(0, 0, printTime);

LiquidLine welcome_line1(1, 1, " Arduino ", LIQUIDMENU_VERSION);
LiquidLine welcome_line2(1, 2, "Garden Automater");
LiquidScreen welcome_screen(welcome_line1, welcome_line2);

// These lines direct to other menus.
LiquidLine Lights(0, 1, "Lights>");
LiquidLine TempHum(0, 2, "Temp/Hum>");
LiquidScreen io_screen(Lights, TempHum, timeC);

// This is the first menu.
LiquidMenu main_menu(lcd, welcome_screen, io_screen, 1);

LiquidLine Light1(0, 1, "Light1: ", light1State);
LiquidLine Light2(0, 2, "Light2: ", light2State);
LiquidScreen light_screen(Light1, Light2, timeC);

LiquidLine lightOn_line(0, 1, "Time ON: ", lightOn);
LiquidLine lightOff_line(0, 2, "Time OFF: ", lightOff);
LiquidScreen oSecondary_screen(timeC, lightOn_line, lightOff_line, back_line);

// This is the second menu.
LiquidMenu Lights_menu(lcd, light_screen, oSecondary_screen);


LiquidLine temp1_line(0, 0, "Temp1: ", t1);
LiquidLine hum1_line(0, 1, "Hum1: ", h1);
LiquidScreen temp_screen(temp1_line, hum1_line);

LiquidLine hum_line(0, 0, "HumOn: ", humOn, "%");
LiquidLine iSample_line(0, 1, "Sample: ", sample_period, "s");
LiquidLine iSave_line(0, 2, "Save", input_saved);
LiquidScreen iSecondary_screen(hum_line, iSample_line, iSave_line, back_line);

// And this is the final third menu.
LiquidMenu TempHum_menu(lcd, temp_screen, iSecondary_screen);

/*
* LiquidSystem object combines the LiquidMenu objects to form
* a menu system. It provides the same functions as LiquidMenu
* with the addition of add_menu() and change_menu().
*/
LiquidSystem menu_system(main_menu, Lights_menu, TempHum_menu);


// Checks all the buttons.
void buttonsCheck() {
if (right.check() == LOW) {
menu_system.next_screen();
}
if (left.check() == LOW) {
menu_system.previous_screen();
}
if (up.check() == LOW) {
menu_system.call_function(increase);
}
if (down.check() == LOW) {
menu_system.call_function(decrease);
}
if (enter.check() == LOW) {
menu_system.switch_focus();
}
}

// Callback function that will be attached to back_line.
void go_back() {
// This function takes reference to the wanted menu.
menu_system.change_menu(main_menu);
}

void goto_Lights_menu() {
menu_system.change_menu(Lights_menu);
}

void goto_TempHum_menu() {
menu_system.change_menu(TempHum_menu);
}

void on_light1() {
if (digitalRead(Light1Pin)) {
digitalWrite(Light1Pin, HIGH);
}
else {
digitalWrite(Light1Pin, LOW);
}
output_saved = (char*)"  ";
}

void on_light2() {
if (digitalRead(Light2Pin)) {
digitalWrite(Light2Pin, HIGH);
}
else {
digitalWrite(Light2Pin, LOW);
}
output_saved = (char*)"  ";
}

void off_light1() {
if (digitalRead(Light1Pin)) {
digitalWrite(Light1Pin, LOW);
}
else {
digitalWrite(Light1Pin, HIGH);
}
output_saved = (char*)"  ";
}

void off_light2() {
if (digitalRead(Light2Pin)) {
digitalWrite(Light2Pin, LOW);
}
else {
digitalWrite(Light2Pin, HIGH);
}
output_saved = (char*)"  ";
}

void save_input() {
EEPROM.put(11, sample_period);
input_saved = (char*)" *";
}

void increase_lightsOn() {
if (lightOn <= 24) {
lightOn++;
}
else {
lightOn = 24;
}
}

void decrease_lightsOn() {
if (lightOn > 0) {
lightOn--;
}
else {
lightOn = 0;
}
}

void increase_lightsOff() {
if (lightOff <= 24) {
lightOff++;
}
else {
lightOff = 24;
}
}

void decrease_lightsOff() {
if (lightOff > 0) {
lightOff--;
}
else {
lightOff = 0;
}
}

void increase_samplePeriod() {
if (sample_period < 10) {
sample_period++;
input_saved = (char*)"  ";
}
}

void decrease_samplePeriod() {
if (sample_period > 0) {
sample_period--;
input_saved = (char*)"  ";
}
}

void increase_hum() {
if (humOn <= 100) {
humOn++;
}
else {
humOn = 100;
}
}

void decrease_hum() {
if (humOn > 0) {
humOn--;
}
else {
humOn = 0;
}
}

void setup() {
Serial.begin(9600);
dht1.begin();

for (int r = 0; r < 4; r++) {
pinMode(relayPins[r], OUTPUT);
digitalWrite(relayPins[r], LOW);
}
// Reads the values recorded in the EEPROM
EEPROM.get(11, sample_period);
lcd.begin(20, 4);
lcd.init();
lcd.backlight();

back_line.set_focusPosition(Position::RIGHT);

back_line.attach_function(1, go_back);
back_line.attach_function(2, go_back);

Lights.attach_function(1, goto_Lights_menu);
Lights.attach_function(2, goto_Lights_menu);
TempHum.attach_function(1, goto_TempHum_menu);
TempHum.attach_function(2, goto_TempHum_menu);

Light1.attach_function(increase, on_light1);
Light1.attach_function(decrease, off_light1);
Light2.attach_function(increase, on_light2);
Light2.attach_function(decrease, off_light2);

lightOn_line.attach_function(increase, increase_lightsOn);
lightOn_line.attach_function(decrease, decrease_lightsOn);
lightOff_line.attach_function(increase, increase_lightsOff);
lightOff_line.attach_function(decrease, decrease_lightsOff);
hum_line.attach_function(increase, increase_hum);
hum_line.attach_function(decrease, decrease_hum);
iSave_line.attach_function(1, save_input);
iSave_line.attach_function(2, save_input);
iSample_line.attach_function(increase, increase_samplePeriod);
iSample_line.attach_function(decrease, decrease_samplePeriod);

input_saved = (char*)" *";
output_saved = (char*)" *";

if (!rtc.begin()) {
Serial.println("Couldn't find RTC");
while (1);
}

if (!rtc.isrunning()) {
Serial.println("RTC lost power, lets set the time!");

// Comment out below lines once you set the date & time.
// Following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));

// Following line sets the RTC with an explicit date & time
// for example to set January 27 2017 at 12:56 you would call:
// rtc.adjust(DateTime(2017, 1, 27, 12, 56, 0));
}

menu_system.update();
}

void loop() {
buttonsCheck();
lightProgram();
tempSensor();

static unsigned long lastMillis_sample = 0;
if (millis() - lastMillis_sample > (sample_period * 1000)) {
lastMillis_sample = millis();
menu_system.update();
}
waterProgram();

}

int printTime() {
DateTime now = rtc.now();
lcd.setCursor(0, 0);
lcd.print(now.month(), DEC);
lcd.print('/');
lcd.print(now.day(), DEC);
lcd.print('/');
lcd.print(now.year(), DEC);
lcd.print(' ');
lcd.print(now.hour(), DEC);
lcd.print(':');
lcd.print(now.minute(), DEC);
lcd.print(':');
lcd.print(now.second(), DEC);
}

const char* light1State() {
if (digitalRead(Light1Pin) == LOW) {
return "ON";
}
else
{
return "OFF";
}

}

const char* light2State() {
if (digitalRead(Light2Pin) == LOW) {
return "ON";
}
else
{
return "OFF";
}

}
void lightProgram() {
DateTime now = rtc.now();
for (int a = 0; a < 2; a++) {
if (now.hour() >= lightOn) {
Serial.print("Lights on!");
digitalWrite(relayPins[a], HIGH);
}
else if (now.hour() >= lightOff) {
Serial.print("Lights off!");
digitalWrite(relayPins[a], LOW);
}
}
}
void waterProgram() {
for (int a = 2; a <= 3; a++) {
if (h1 >= humOn) {
Serial.print("Water On");
digitalWrite(relayPins[a], HIGH);
}
else {
Serial.print("Water Off");
digitalWrite(relayPins[a], LOW);
}
}
}
void tempSensor() {
h1 = dht1.readHumidity();
t1 = dht1.readTemperature(true);

// check if returns are valid, if they are NaN (not a number) then something went wrong!
if (isnan(t1) || isnan(h1)) {
Serial.println("Failed to read from DHT #1");
}
}
#This is a complete working rtos environment controller
#I Do plan on adding additional temp/hum + other sensors but for now #this is complete and functioning

Edited by K3yBoardC0WBoy (10/10/19 04:17 PM)

Extras: Filter Print Post Top
Re: My gift to the community--For those who love technology and programming... [Re: K3yBoardC0WBoy]
    #26243326 -






Extras: Filter Print Post Top
Re: My gift to the community--For those who love technology and programming... [Re: K3yBoardC0WBoy]
    #26243489 -

Very interesting! Thank you for sharing. :popcorn:

Extras: Filter Print Post Top
Re: My gift to the community--For those who love technology and programming... [Re: k5hd2y] * 1
    #26243493 -

:biggestfan: Boy that's a lot to read, but right on! :lol:


--------------------
Helpful Threads

The Shroomery Store

Tormato's Q&A Thread Post Questions Here or PM me!

"Lately it occurs to me what a long, strange trip it's been." ~ Grateful Dead

Before you start...Do you have a Pressure Cooker and a Dehydrator? I highly recommend getting both!

Extras: Filter Print Post Top
Re: My gift to the community--For those who love technology and programming... [Re: Tormato] * 1
    #26245518 -

All of that is the code that makes this functional, would paste the code into your editor that you work with and upload to a microcontroller after making sure you have the same libraries installed and correct wiring done for each electronic component.
    I've always been drawn to technology, amazing things can be done with very little electronic equipment, and why not automate something if you can?
6 months of programming, engineering, and electric design... done all by myself.
    If had assistance from another like myself could really make amazing things, im talking world changing things...

Edited by K3yBoardC0WBoy (10/11/19 04:44 PM)

Extras: Filter Print Post Top
Re: My gift to the community--For those who love technology and programming... [Re: K3yBoardC0WBoy]
    #26245607 -

Damn! :omgz:

Got any pics of this computer device? How well does it work?

Extras: Filter Print Post Top
Re: My gift to the community--For those who love technology and programming... [Re: LogicaL Chaos] * 1
    #26245923 -

Id also love to see pics or a small video of the whole setup running. This is very interesting!

Extras: Filter Print Post Top
Re: My gift to the community--For those who love technology and programming... [Re: dschill] * 2
    #26246503 -





This is still in prototype phase and that's why it doesn't look professional yet, but it will!

I have to be sure of my wiring configuration before making a circuit board to replace the breadboard for durability and reliability.

You can see the temp sensor which is a DHT11 infront of the blue box that is holding the arduino, relays, rtc, and wires. The breadboard on the side holds the buttons and manages the ground and power for the electrical components.

I just need to build or find a wooden box to house this stuff, make the circuit board, and put it in a enclosure with the button and lcd panel on the outside of the electronic enclosure.

It really does work and does the right job! there would still be 4 plugs available to use which could be used for exhaust/intake fans, heating, and other pumps making this a very universal system.

I do have 3 dht22 sensors I do plan to connect so each sensor can go into a tub with the dht11 staying on the outside to log the temp/hum in and outside the tubs.

Also plan to add datalogging either written to the microController or to a sd card to record the data being received by the sensors. It's been challenging at times deciding what code is best to use, how to engineer it, and electrical design, but I am dedicated to seeing this through and to make it easy for others to do as they wish.

Edited by K3yBoardC0WBoy (10/12/19 04:36 AM)

Extras: Filter Print Post Top
Re: My gift to the community--For those who love technology and programming... [Re: K3yBoardC0WBoy]
    #26246525 -

Dude.


I cant understand code :lol: but from your other posts i get what your doing. Thats pretty badass man you did that in 6 months??


--------------------
If I ever give out misinformation please inform me so I can have the correct information. :cheers:

Tmethyl said:
Chuck Norris once roundhouse kicked a monotub that wasn't pinning fast enough. The force of the kick rearranged the genetics of the mushrooms, we now call them Penis Envy.

Caps McGee said:
:thumbsup:
Fun part is figuring out what works best for you

Extras: Filter Print Post Top
Re: My gift to the community--For those who love technology and programming... [Re: van hatton]
    #26246597 -

van hatton said:
Dude.


I cant understand code :lol: but from your other posts i get what your doing. Thats pretty badass man you did that in 6 months??



Yes 6 months from start to finish once I had every component needed,went through 3 different menu concepts till I used whats being used now. Organizing code, and arranging it in a way to be edited and not to hard to understand the flow of code. Largest program I have written so far being over 400 lines, and not easy to keep track of each line when trying to understand what each line is doing and the effects produced, but debugging helps with that.

I cut it down into parts to make it easier to manage by myself till finally having a working prototype. Code isn't hard to learn, if would like to learn I think python is as user friendly as it gets so you can learn the concepts used and be able to transfer that knowledge and apply it to learning a alternative language, this is written in C/C++

This has the ability to be very universal, and the ability to get very technical being able to provide easier access managing alternative growing techniques and experiments... Like giving a plant a electric charge to assist in growth rate/yield, managing a vacuum pump for a pressurized grow setup, or even managing a grow using fish to supply nutrients to the plant/biological being.

Edited by K3yBoardC0WBoy (10/12/19 06:17 AM)

Extras: Filter Print Post Top
Re: My gift to the community--For those who love technology and programming... [Re: K3yBoardC0WBoy] * 3
    #26246699 -

Id like some pics of results

Extras: Filter Print Post Top
Re: My gift to the community--For those who love technology and programming... [Re: bodhisatta]
    #26246755 -




A test run should be starting maybe today but defiantly really soon, just need to put tubs in enclosure n mount the lights.

Would be best to test fresh sub out to be able to see any differences.

Edited by K3yBoardC0WBoy (10/12/19 07:47 AM)

Extras: Filter Print Post Top
Re: My gift to the community--For those who love technology and programming... [Re: K3yBoardC0WBoy]
    #26246814 -

You ever take that device with you while traveling by air or train? Jk

Extras: Filter Print Post Top
Re: My gift to the community--For those who love technology and programming... [Re: k5hd2y]
    #26247403 -

A simple notebook and a keen mind with vivid observations and simple instruments could do this....

Extras: Filter Print Post Top
Re: My gift to the community--For those who love technology and programming... [Re: spore-ty]
    #26247413 -

spore-ty said:
A simple notebook and a keen mind with vivid observations and simple instruments could do this....



Way to crap all over somebody's hard work :thumbdown:.

Extras: Filter Print Post Top
Jump to top Pages: 1 | 2 | 3 | 4 | 5 |  [ show all ]

Shop: MagicBag.co All-In-One Bags That Don't Suck   Original Sensible Seeds Bulk Cannabis Seeds   Myyco.com Golden Teacher Liquid Culture For Sale   North Spore Cultivation Supplies   Unfolding Nature Unfolding Nature: Being in the Implicate Order   Mushroom-Hut Substrate Bags   Sporeworks.EU Spores for European Microscopy


Similar ThreadsPosterViewsRepliesLast post
* Re: I love you guys
( 1 2 all )
Anonymous 2,257 25 05/07/01 05:57 PM
by Crasher
* mushroom Researcher Computer Program
( 1 2 all )
SWiTtles 7,267 27 06/27/26 09:50 AM
by q3wex64r75ctv8y9gu
* A Gift for Your Special Girl HerbanShaman 618 4 07/17/04 02:31 PM
by K20A2
* Mushroom Growing Program phunkjunky311 1,135 5 07/11/07 03:54 PM
by euphoricpoison
* Advice on kits -- I want to give one as a gift scummy_d 1,176 8 01/28/02 05:39 PM
by WakingUpLate
* I love the shroomery! RasHelio1 543 4 08/31/04 09:41 PM
by RasHelio1
* Self Contained Growing Gifts, humidity question. JovialLeprechaun 930 3 11/12/02 04:37 AM
by lazyvegan
* Roadkill, we love you (update - the wanderer has returned!)
( 1 2 3 4 all )
Anonymous 5,209 73 10/06/03 07:39 PM
by Hongosmeester

Extra information
You cannot start new topics / You cannot reply to topics
HTML is disabled / BBCode is enabled
Moderator: Shroomism, george castanza, RogerRabbit, veggie, mushboy, fahtster, the_chosen_one, LogicaL Chaos, 13shrooms, hamloaf, cronicr, Stipe-n Cap, Pastywhyte, bodhisatta, Tormato, Land Trout, A.k.a
2,016 topic views. 16 members, 1,123 guests and 63 web crawlers are browsing this forum.
[ Show Images Only | Sort by Score | Print Topic ]
Search this thread:

Copyright 1997-2026 Mind Media. Some rights reserved.

Generated in 0.039 seconds spending 0.012 seconds on 18 queries.