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: Myyco.com Golden Teacher Liquid Culture For Sale   Sporeworks.EU Spores for European Microscopy   Original Sensible Seeds Bulk Cannabis Seeds   Mushroom-Hut Substrate Bags   MagicBag.co All-In-One Bags That Don't Suck   North Spore Bulk Substrate

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.
Re: My gift to the community--For those who love technology and programming... [Re: the_sonic16]
    #26247470 -

This is badass..Thanks for the pics man and congrats on your work. I know how it feels to see something like this come together for a person..

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

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



It does take knowledge of programming and electronics to accomplish this, someone could write psuedo code of instructions for completing this but if you already have the knowledge, everything is listed thats used including the code for someone to upload after they are finished with assembly.

To build this from scratch you do need to know basic programming concepts which does take time to learn and understand, if you'd like to try to build something that is more functional in 6 month's time I invite you to try but doubt you could... There's thousands of ways to accomplish one task, in programming depending which code is chosen, can affect how the program runs and operates which you'd quickly learn on your journey of education, and it takes time to mold code into something efficient and workable.

Everything has already been created before but this is unique in it's combination of devices and tech that's universal and extremely functional!

Can't really shit on my parade since building something much cheaper then buying the already made equipment.

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

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



The flight crew could possibly play catch with it, lol.

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

dschill said:
This is badass..Thanks for the pics man and congrats on your work. I know how it feels to see something like this come together for a person..



Thank you very much, really did push myself on this, it was frustrating on times, but it's a learning process. Thought I knew exactly what I wanted to do from the beginning but as things started to take shape things wanted changed and became what they are.

It's still not done though, there are more changes I would like to make, would like to make the code, electronics, and wiring to be as efficient and effective as possible when its done for reliability, usability, and durability.

If premade equipment was easier to get, less money, and better made then would of just went that route, but I see so many problems with how many things are made these days and feel if I can do something better and have the knowledge to do it, I should.

I would like to help push our species further into the future if possible.

Edited by K3yBoardC0WBoy (10/12/19 03:10 PM)

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

Down to my pan tub which has been pinning beautifully till get more BRF, would like to test this out on the pan tub as it should assist in better yields, but would like to write the datalogging part first.
    Idea is to print the temp/hum and time whenever a relay state is changed along with every 2hrs write time,temp, hum, and relay states.

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

#include <TimeLib.h>
#include <TimeAlarms.h>
#include <SD.h>
#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
const int chipSelect = 53;

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

// 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, LOW);
}
else {
digitalWrite(Light1Pin, HIGH);
}
output_saved = (char*)"  ";
}

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

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

void off_light2() {
if (digitalRead(Light2Pin)) {
digitalWrite(Light2Pin, HIGH);
}
else {
digitalWrite(Light2Pin, LOW);
}
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 < 1000) {
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], HIGH);
}
// 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));
}
setSyncProvider(rtc.now);
if (timeStatus() != timeSet)
Serial.println("Unable to sync with the RTC");

menu_system.update();
}

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

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

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();
for (int a = 0; a < 2; a++) {
if (now.hour() >= lightOn) {
Serial.print("Lights on!");
digitalWrite(relayPins[a], LOW);
}
else if (now.hour() >= lightOff) {
Serial.print("Lights off!");
digitalWrite(relayPins[a], HIGH);
}
}
}
void waterProgram() {
for (int a = 2; a <= 3; a++) {
if (h1 >= humOn) {
Serial.print("Water On");
digitalWrite(relayPins[a], LOW);
}
else {
Serial.print("Water Off");
digitalWrite(relayPins[a], HIGH);
}
}
}
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");
}
}

void Initialize_SDcard()
{
pinMode(chipSelect, OUTPUT);
//pinMode(SS, OUTPUT);
// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
// don't do anything more:
return;
}
Serial.println("SD initialized.");
Serial.println();
}

void dataRec() {
DateTime now = rtc.now();
h1 = dht1.readHumidity();
t1 = dht1.readTemperature(true);
File dataFile = SD.open("data.txt", FILE_WRITE);
if (now.hour()%2) {
if (dataFile) {
dataFile.print(now.month(), DEC);
dataFile.print('/');
dataFile.print(now.day(), DEC);
dataFile.print('/');
dataFile.print(now.year(), DEC);
dataFile.print(' ');
dataFile.print(now.hour(), DEC);
dataFile.print(':');
dataFile.print(now.minute(), DEC);
dataFile.print(':');
dataFile.print(now.second(), DEC);
dataFile.print(" ");
dataFile.print("Temp:");
dataFile.print(t1);
dataFile.print(" ");
dataFile.print("Hum:");
dataFile.print(h1);
dataFile.close();
}
}

}

###Just finished the datalogger, have to run it for a bit to confirm the data file is correct!####

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

Been playing with the container setup/fan for the ultrasonic mister as well and finally believe I have a decent mega cheap ultramister. The temp/hum is tested and working

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

#include <TimeLib.h>
#include <TimeAlarms.h>
#include <SD.h>
#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
const int chipSelect = 53;

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

// 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, LOW);
}
else {
digitalWrite(Light1Pin, HIGH);
}
output_saved = (char*)"  ";
}

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

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

void off_light2() {
if (digitalRead(Light2Pin)) {
digitalWrite(Light2Pin, HIGH);
}
else {
digitalWrite(Light2Pin, LOW);
}
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 <= 100) {
sample_period++;
input_saved = (char*)"  ";
}
else {
sample_period = 100;
}
}

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

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], HIGH);
}
// 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));
}
setSyncProvider(rtc.now);
if (timeStatus() != timeSet)
Serial.println("Unable to sync with the RTC");

menu_system.update();
}

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

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

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();
for (int a = 0; a < 2; a++) {
if (now.hour() >= lightOn) {
Serial.print("Lights on!");
digitalWrite(relayPins[a], LOW);
}
else if (now.hour() >= lightOff) {
Serial.print("Lights off!");
digitalWrite(relayPins[a], HIGH);
}
}
}
void waterProgram() {
for (int a = 2; a <= 3; a++) {
if (h1 >= humOn) {
Serial.print("Water On");
digitalWrite(relayPins[a], LOW);
}
else {
Serial.print("Water Off");
digitalWrite(relayPins[a], HIGH);
}
}
}
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");
}
}

void Initialize_SDcard()
{
pinMode(chipSelect, OUTPUT);
//pinMode(SS, OUTPUT);
// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
// don't do anything more:
return;
}
Serial.println("SD initialized.");
Serial.println();
}

void dataRec() {
DateTime now = rtc.now();
static unsigned long lastMillis_sample = 0;
h1 = dht1.readHumidity();
t1 = dht1.readTemperature(true);
File dataFile = SD.open("data.txt", FILE_WRITE);
if (millis() - lastMillis_sample > (sample_period * 1000)) {
lastMillis_sample = millis();
if (dataFile) {
dataFile.print(now.month(), DEC);
dataFile.print('/');
dataFile.print(now.day(), DEC);
dataFile.print('/');
dataFile.print(now.year(), DEC);
dataFile.print(' ');
dataFile.print(now.hour(), DEC);
dataFile.print(':');
dataFile.print(now.minute(), DEC);
dataFile.print(':');
dataFile.print(now.second(), DEC);
dataFile.print(" ");
dataFile.print("Temp:");
dataFile.print(t1);
dataFile.print(" ");
dataFile.print("Hum:");
dataFile.print(h1);
dataFile.close();
//delay(10000);
}
}

}
####You can edit how fast you want the screen to update and log date,time,temp,hum by adjusting the sample rate from 100 seconds to 0seconds.###

Edited by K3yBoardC0WBoy (10/15/19 03:41 PM)

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

Click the button that looks like
<?
And you can post code in a much better format

Code:

h1 = dht1.readHumidity();
t1 = dht1.readTemperature(true);
File dataFile = SD.open("data.txt", FILE_WRITE);
if (now.hour()%2) {
if (dataFile) {
dataFile.print(now.month(), DEC);
dataFile.print('/');
dataFile.print(now.day(), DEC);
dataFile.print('/');
dataFile.print(now



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

bodhisatta said:
Click the button that looks like
<?
And you can post code in a much better format

Code:

h1 = dht1.readHumidity();
t1 = dht1.readTemperature(true);
File dataFile = SD.open("data.txt", FILE_WRITE);
if (now.hour()%2) {
if (dataFile) {
dataFile.print(now.month(), DEC);
dataFile.print('/');
dataFile.print(now.day(), DEC);
dataFile.print('/');
dataFile.print(now






I can and did if you look...

Thank you very much, was wondering about a code button.

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

Code:
#include <TimeLib.h>
#include <TimeAlarms.h>
#include <SD.h>
#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
const int chipSelect = 53;

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

// 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, LOW);
}
else {
digitalWrite(Light1Pin, HIGH);
}
output_saved = (char*)" ";
}

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

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

void off_light2() {
if (digitalRead(Light2Pin)) {
digitalWrite(Light2Pin, HIGH);
}
else {
digitalWrite(Light2Pin, LOW);
}
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 <= 100) {
sample_period++;
input_saved = (char*)" ";
}
else {
sample_period = 100;
}
}

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

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], HIGH);
}
// 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));
}
setSyncProvider(rtc.now);
if (timeStatus() != timeSet)
Serial.println("Unable to sync with the RTC");

menu_system.update();
}

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

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

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();
for (int a = 0; a < 2; a++) {
if (now.hour() >= lightOn) {
Serial.print("Lights on!");
digitalWrite(relayPins[a], LOW);
}
else if (now.hour() >= lightOff) {
Serial.print("Lights off!");
digitalWrite(relayPins[a], HIGH);
}
}
}
void waterProgram() {
for (int a = 2; a <= 3; a++) {
if (h1 >= humOn) {
Serial.print("Water On");
digitalWrite(relayPins[a], LOW);
}
else {
Serial.print("Water Off");
digitalWrite(relayPins[a], HIGH);
}
}
}
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");
}
}

void Initialize_SDcard()
{
pinMode(chipSelect, OUTPUT);
//pinMode(SS, OUTPUT);
// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
// don't do anything more:
return;
}
Serial.println("SD initialized.");
Serial.println();
}

void dataRec() {
DateTime now = rtc.now();
static unsigned long lastMillis_sample = 0;
h1 = dht1.readHumidity();
t1 = dht1.readTemperature(true);
File dataFile = SD.open("data.txt", FILE_WRITE);
if (millis() - lastMillis_sample > (sample_period * 1000)) {
lastMillis_sample = millis();
if (dataFile) {
dataFile.print(now.month(), DEC);
dataFile.print('/');
dataFile.print(now.day(), DEC);
dataFile.print('/');
dataFile.print(now.year(), DEC);
dataFile.print(' ');
dataFile.print(now.hour(), DEC);
dataFile.print(':');
dataFile.print(now.minute(), DEC);
dataFile.print(':');
dataFile.print(now.second(), DEC);
dataFile.print(" ");
dataFile.print("Temp:");
dataFile.print(t1);
dataFile.print(" ");
dataFile.print("Hum:");
dataFile.print(h1);
dataFile.close();
//delay(10000);
}
}

}



### Adjust the sample rate to adjust how many seconds to update the screen and write the data to the log. It can be adjusted from 0-100###

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

I have a alternative idea for the section that runs the lights that may be more efficient and effective.
    Using a alarm to turn the lights ON and to turn them OFF. As time goes on ill find things to edit and change but for now this is extremely functional.
    This thing will be in use 24.7 as that was the purpose of the build, to try to do something better then currently can, and with automation that should be possible with science/tech.
    Air quality sensors are being considered along with soil sensors to detect ph, moisture, carbon dioxide, and oxygen.
    The data should be able to be graphed in excel!

Edited by K3yBoardC0WBoy (10/15/19 03:58 PM)

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

Anyone have anything they would like to see any other additional features to add?

Could add access to the internet so could control and view the data from the internet. There are 8 plugs, 2 for lights, 2 for humidifier+fan power.

Also still thinking about the soil sensor, if 2 nails or metal rods may be able to be very functional in getting additional info from the substrate, even could apply power to the substrate for faster growth.

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

Just results. Its very cool but if it doesn't grow mushrooms well :shrug:

I would hope its all being programmed by someone who's an expert at growing so the programming isn't based off of reading about what mushrooms want but rather its based on experience growing them

Ive seen lots of automation made by people who've grown zero to very few mushrooms and the programs are made to keep conditions based on what it says in books. Keeping 100% RH for instance.

The automation needs to react to the mushrooms appearance, the surface conditions, etc... It needs to be reactive to what the grow is saying it needs. Not what a humidity and temp sensor say

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

bodhisatta said:
Just results. Its very cool but if it doesn't grow mushrooms well :shrug:

I would hope its all being programmed by someone who's an expert at growing so the programming isn't based off of reading about what mushrooms want but rather its based on experience growing them

Ive seen lots of automation made by people who've grown zero to very few mushrooms and the programs are made to keep conditions based on what it says in books. Keeping 100% RH for instance.

The automation needs to react to the mushrooms appearance, the surface conditions, etc... It needs to be reactive to what the grow is saying it needs. Not what a humidity and temp sensor say



I agree if one doesn't have the knowledge of how to grow through common means then this may not be of much help, but it can help you figure out what's going on with the substrate through sensor readouts.

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





Light fixture is in the top half of the outside tub that goes on top to keep things concealed. The humidifier is placed in a empty milk jug with a fan on top to direct the mist outwards into the atmosphere. It works fine so far after testing the light timing and humidity settings. Figured might as well at least test the durability/reliability of the system on tubs that are near there end point. Spliced a pc fan into a common power supply and the other power supply you see connected is for the humidifier.
I should of wrote down which plugs are tied to the system at the moment since accidentally connected the plugs to the wrong side of the outlets when should of been on the right side. Simple fix with a sharper to number the outlets.

Edited by K3yBoardC0WBoy (10/21/19 06:13 AM)

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

So right now its updating the screen every 30 seconds as well as writing to the log file on the sd card. Lights are set to a 12/12 timing and humidity comes on if falls below 86%
After confirm the reliability and durability will make a circuit board to place the buttons, lcd screen, and sensor plug in's to expand the system easily.
  I could then write a settings menu so sensors can be added without modifying the programming every time would like to add a soil/temp or humidity sensor, having a array of pin outs that could be selected to the appropriate connection for such sensor.
  Air quality sensors are currently being considered in which sensor and or sensors would be best and what gases are looking to measure.
  The wifi card will be added towards the end of this project for viewing and controlling the system through the internet incase if on vacation. Could even tie a camera into the system that takes pics every so often so could view your grow.
  If want to get really fancy could write a program to help identify any issues with the substrate or fruits, assisting in identifying different molds.

Edited by K3yBoardC0WBoy (10/21/19 06:23 AM)

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

There is a code tag that is supported here, if you want to go back and add some formatting.
Damn near impossible to read without indentation.

Code:

public void Test()
{
// this is a test
}



--------------------
Cultivating Panaeolus cyanescens


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

Asura said:
There is a code tag that is supported here, if you want to go back and add some formatting.
Damn near impossible to read without indentation.

Code:

public void Test()
{
// this is a test
}





Bod pointed that out after which I started to use the code tag in the latest code examples.

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

The temp and hum sensor would assist in telling the user when they are not in optimal conditions for growth. By setting when to cut humidity you can help insure no over watering will occur and the lights being timed will assist in getting more consistent results. The sensors cause a reactive response to the grow automating more so then doing it by hand.
    The decision to do this was after completing a bit of grows that may be able to get better, more consistent, and reliable results through the use of technology. That is what is being attempted here, only trying to learn and progress to greater things in this area. Including bio engineering new fruits.

Edited by K3yBoardC0WBoy (10/21/19 06:35 AM)

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

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


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. 13 members, 1,128 guests and 31 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.038 seconds spending 0.018 seconds on 17 queries.