add rest of the pots
This commit is contained in:
parent
06efe8bb02
commit
0523250906
3
README.md
Normal file
3
README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# drop - Automatic Watering System
|
||||
|
||||
This is a project for automatic plant watering using a single Arduino Mega.
|
130
config.hpp
130
config.hpp
|
@ -36,10 +36,10 @@ constexpr int VALVE_DELAY_MS = 1 * SECOND / 4;
|
|||
constexpr int PUMP_DELAY_MS = 1 * SECOND / 4;
|
||||
|
||||
/// the amount of time to water the plot (valve open and pump running)
|
||||
constexpr int WATER_TIME_MS = 1 * SECOND;
|
||||
constexpr int WATER_TIME_MS = 1 * SECOND / 4;
|
||||
|
||||
/// how long to wait between loops
|
||||
constexpr int LOOP_DELAY_MS = 1 * SECOND; // TODO set higher once it is working
|
||||
constexpr int LOOP_DELAY_MS = 1 * SECOND;
|
||||
|
||||
/// minimum amount of time to wait between watering each pot, even when minimum wetness has been reached
|
||||
constexpr int MIN_WATERING_INTERVAL_MS = 10 * SECOND; // TODO set higher once it is working
|
||||
|
@ -72,6 +72,132 @@ constexpr PotConfig POT_CONFIGS[] = {
|
|||
.calibration_wet = 100,
|
||||
}
|
||||
},
|
||||
{
|
||||
.valve_pin = 27,
|
||||
.led_pin = 26,
|
||||
.sensor = {
|
||||
.pin = A2,
|
||||
.calibration_dry = 520,
|
||||
.calibration_wet = 100,
|
||||
}
|
||||
},
|
||||
{
|
||||
.valve_pin = 29,
|
||||
.led_pin = 28,
|
||||
.sensor = {
|
||||
.pin = A3,
|
||||
.calibration_dry = 520,
|
||||
.calibration_wet = 100,
|
||||
}
|
||||
},
|
||||
{
|
||||
.valve_pin = 31,
|
||||
.led_pin = 30,
|
||||
.sensor = {
|
||||
.pin = A4,
|
||||
.calibration_dry = 520,
|
||||
.calibration_wet = 100,
|
||||
}
|
||||
},
|
||||
{
|
||||
.valve_pin = 33,
|
||||
.led_pin = 32,
|
||||
.sensor = {
|
||||
.pin = A5,
|
||||
.calibration_dry = 520,
|
||||
.calibration_wet = 100,
|
||||
}
|
||||
},
|
||||
{
|
||||
.valve_pin = 35,
|
||||
.led_pin = 34,
|
||||
.sensor = {
|
||||
.pin = A6,
|
||||
.calibration_dry = 520,
|
||||
.calibration_wet = 100,
|
||||
}
|
||||
},
|
||||
{
|
||||
.valve_pin = 37,
|
||||
.led_pin = 36,
|
||||
.sensor = {
|
||||
.pin = A7,
|
||||
.calibration_dry = 520,
|
||||
.calibration_wet = 100,
|
||||
}
|
||||
},
|
||||
{
|
||||
.valve_pin = 39,
|
||||
.led_pin = 38,
|
||||
.sensor = {
|
||||
.pin = A8,
|
||||
.calibration_dry = 520,
|
||||
.calibration_wet = 100,
|
||||
}
|
||||
},
|
||||
{
|
||||
.valve_pin = 41,
|
||||
.led_pin = 40,
|
||||
.sensor = {
|
||||
.pin = A9,
|
||||
.calibration_dry = 520,
|
||||
.calibration_wet = 100,
|
||||
}
|
||||
},
|
||||
{
|
||||
.valve_pin = 43,
|
||||
.led_pin = 42,
|
||||
.sensor = {
|
||||
.pin = A10,
|
||||
.calibration_dry = 520,
|
||||
.calibration_wet = 100,
|
||||
}
|
||||
},
|
||||
{
|
||||
.valve_pin = 45,
|
||||
.led_pin = 44,
|
||||
.sensor = {
|
||||
.pin = A11,
|
||||
.calibration_dry = 520,
|
||||
.calibration_wet = 100,
|
||||
}
|
||||
},
|
||||
{
|
||||
.valve_pin = 47,
|
||||
.led_pin = 46,
|
||||
.sensor = {
|
||||
.pin = A12,
|
||||
.calibration_dry = 520,
|
||||
.calibration_wet = 100,
|
||||
}
|
||||
},
|
||||
{
|
||||
.valve_pin = 49,
|
||||
.led_pin = 48,
|
||||
.sensor = {
|
||||
.pin = A13,
|
||||
.calibration_dry = 520,
|
||||
.calibration_wet = 100,
|
||||
}
|
||||
},
|
||||
{
|
||||
.valve_pin = 51,
|
||||
.led_pin = 50,
|
||||
.sensor = {
|
||||
.pin = A14,
|
||||
.calibration_dry = 520,
|
||||
.calibration_wet = 100,
|
||||
}
|
||||
},
|
||||
{
|
||||
.valve_pin = 53,
|
||||
.led_pin = 52,
|
||||
.sensor = {
|
||||
.pin = A15,
|
||||
.calibration_dry = 520,
|
||||
.calibration_wet = 100,
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
constexpr unsigned int POT_COUNT = sizeof(POT_CONFIGS) / sizeof(POT_CONFIGS[0]);
|
||||
|
|
8
drop.ino
8
drop.ino
|
@ -13,6 +13,8 @@ Pot pots[POT_COUNT];
|
|||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
Serial.println("");
|
||||
Serial.println("Initializing...");
|
||||
|
||||
pinMode(PUMP_LED_PIN, OUTPUT);
|
||||
pinMode(PUMP_PIN, OUTPUT);
|
||||
|
@ -36,8 +38,6 @@ void setup() {
|
|||
}
|
||||
|
||||
void loop() {
|
||||
delay(LOOP_DELAY_MS);
|
||||
|
||||
Serial.println("");
|
||||
Serial.println("LOOP");
|
||||
|
||||
|
@ -52,6 +52,8 @@ void loop() {
|
|||
per_pot(pots[i]);
|
||||
Serial.println("");
|
||||
}
|
||||
|
||||
delay(LOOP_DELAY_MS);
|
||||
}
|
||||
|
||||
void per_pot(Pot &pot) {
|
||||
|
@ -129,7 +131,7 @@ void set_pump(bool on) {
|
|||
}
|
||||
|
||||
void set_valve(uint8_t valve, bool open) {
|
||||
Serial.print("setting pump on pin ");
|
||||
Serial.print("setting valve on pin ");
|
||||
Serial.print(valve);
|
||||
Serial.print(" to state ");
|
||||
Serial.println(open);
|
||||
|
|
Loading…
Reference in a new issue