diff --git a/hardware/arduino/Weather_Shield_Basic/Weather Shield.pdf b/hardware/arduino/Weather_Shield_Basic/Weather Shield.pdf deleted file mode 100644 index d14b0de..0000000 Binary files a/hardware/arduino/Weather_Shield_Basic/Weather Shield.pdf and /dev/null differ diff --git a/hardware/arduino/Weather_Shield_Basic/micro.png b/hardware/arduino/Weather_Shield_Basic/micro.png deleted file mode 100644 index d011b94..0000000 Binary files a/hardware/arduino/Weather_Shield_Basic/micro.png and /dev/null differ diff --git a/hardware/arduino/calibration_jig/MAX6816-MAX6818.pdf b/hardware/arduino/calibration_jig/MAX6816-MAX6818.pdf new file mode 100644 index 0000000..124773d Binary files /dev/null and b/hardware/arduino/calibration_jig/MAX6816-MAX6818.pdf differ diff --git a/hardware/arduino/calibration_jig/README.md b/hardware/arduino/calibration_jig/README.md new file mode 100644 index 0000000..8a7a825 --- /dev/null +++ b/hardware/arduino/calibration_jig/README.md @@ -0,0 +1,3 @@ +# calibration_jig + +An Arduino based build that allows testing and reading various sensors (used elsewhere) values for calibration prior to setup with the main dashboards and deployment. diff --git a/hardware/arduino/calibration_jig/calibration_jig.ino b/hardware/arduino/calibration_jig/calibration_jig.ino index efa66aa..3096b4e 100644 --- a/hardware/arduino/calibration_jig/calibration_jig.ino +++ b/hardware/arduino/calibration_jig/calibration_jig.ino @@ -1,5 +1,6 @@ #include #include + #include #include "SPI.h" #include "Adafruit_GFX.h" @@ -7,13 +8,13 @@ #include #include #include -//FreeMono18pt7b.h -//FreeMono24pt7b.h -//FreeMono9pt7b.h -//FreeMonoBold12pt7b.h -//FreeMonoBold18pt7b.h -//FreeMonoBold24pt7b.h -//FreeMonoBold9pt7b.h + +// Various sensors used for calibration data reads +#include +#include +#include "Adafruit_seesaw.h" +Adafruit_seesaw sensor_soil_adafruit; +I2CSoilMoistureSensor sensor_soil_catnip; // Various tunables #define ERROR_LED_PIN 13 @@ -56,9 +57,11 @@ void TaskLCD(void *pvParameters); // UI screens void screenClear(); -void screenSoilStemma(); -void screenSoilCatnip(); -void screenWaterLevelETape(); +void screenI2CDIP(bool readValue); +void screenSoilStemma(bool readValue); +void screenSoilCatnip(bool readValue); +void screenWaterLevelETape(bool readValue); +void screenWaterLevelETapeI2C(bool readValue); // Color conversion (RGB888 -> RGB565 used by Adafruit GFX) uint16_t RGB565(uint8_t r, uint8_t g, uint8_t b) { @@ -87,6 +90,9 @@ void setup() { // ; // wait for serial port to connect. Needed for native USB, on LEONARDO, MICRO, YUN, and other 32u4 based boards. //} + Wire.begin(); + pinMode(A0, INPUT); + pixel.begin(); pixel.clear(); pixel.setBrightness(PIXEL_MAX_BRIGHTNESS); @@ -162,7 +168,7 @@ void TaskBlink(void *pvParameters) { void TaskLCD(void *pvParameters) { (void) pvParameters; - void (*screens[3])() = {screenSoilStemma, screenSoilCatnip, screenWaterLevelETape}; + void (*screens[5])(bool) = {screenI2CDIP, screenSoilStemma, screenSoilCatnip, screenWaterLevelETape, screenWaterLevelETapeI2C}; int current = 0; while (1) { @@ -176,7 +182,7 @@ void TaskLCD(void *pvParameters) { if (current >= sizeof(screens) / sizeof(screens[0])) { current = 0; } - screens[current](); + screens[current](false); } if (xSemaphoreTake(sem_btn_down, 50 / portTICK_PERIOD_MS) == pdPASS) { screenClear(); @@ -188,13 +194,14 @@ void TaskLCD(void *pvParameters) { if (current < 0) { current = sizeof(screens) / sizeof(screens[0]) - 1; } - screens[current](); + screens[current](false); } if (xSemaphoreTake(sem_btn_ok, 50 / portTICK_PERIOD_MS) == pdPASS) { tft.fillRect(tft.width() - 50, 0, 50, 20, RGB565(0, 0, 0)); tft.setFont(&FreeMonoBold9pt7b); tft.setCursor(tft.width() - 50, 15); tft.print("OK"); + screens[current](true); } } } @@ -216,7 +223,59 @@ void screenClear() { tft.fillScreen(RGB565(0, 0, 0)); } -void screenSoilStemma() { +void pixelDataReadAlert() { + pixel.setPixelColor(0, pixel.Color(0, 0, 255)); + pixel.setBrightness(PIXEL_MAX_BRIGHTNESS); + pixel.show(); +} + +void screenI2CDIP(bool readValue) { + byte dip_1 = 0; + byte dip_2 = 0; + + if (readValue) { + taskENTER_CRITICAL(); + pixelDataReadAlert(); + screenClear(); + Wire.requestFrom(0x65, 2); + // Wait for data to become available -- can be a delayed response due to # of pins to enumerate + while (!Wire.available()); + dip_1 = Wire.read(); + dip_2 = Wire.read(); + taskEXIT_CRITICAL(); + } + + tft.setFont(&FreeMonoBold18pt7b); + tft.setCursor(0, 25); + tft.println("DIP"); + tft.setFont(&FreeMono12pt7b); + tft.println("i2c DIP switch"); + tft.println("16 pin"); + tft.println("i2c address: 0x65"); + tft.println(""); + tft.setFont(&FreeMonoBold9pt7b); + tft.println("--Press OK To Read Value--"); + tft.println(""); + tft.print("DIP 1: "); + tft.println(dip_1, BIN); + tft.print("DIP 2: "); + tft.println(dip_2, BIN); +} + +void screenSoilStemma(bool readValue) { + float tempC = 0; + uint16_t capread = 0; + + if (readValue) { + taskENTER_CRITICAL(); + pixelDataReadAlert(); + screenClear(); + sensor_soil_adafruit.begin(0x36); + tempC = sensor_soil_adafruit.getTemp(); + capread = sensor_soil_adafruit.touchRead(0); + taskEXIT_CRITICAL(); + } + tft.setFont(&FreeMonoBold18pt7b); tft.setCursor(0, 25); tft.println("Soil"); @@ -229,11 +288,27 @@ void screenSoilStemma() { tft.setFont(&FreeMonoBold9pt7b); tft.println("--Press OK To Read Value--"); tft.println(""); - tft.println("Value: [value]"); + tft.print("Temperature: "); tft.print(tempC); tft.println("*C"); + tft.print("Capacitive: "); tft.println(capread); } -void screenSoilCatnip() { +void screenSoilCatnip(bool readValue) { + unsigned int capacitance = 0; + float temp_c = 0; + unsigned int light = 0; + if (readValue) { + taskENTER_CRITICAL(); + pixelDataReadAlert(); + screenClear(); + sensor_soil_catnip.begin(); + while (sensor_soil_catnip.isBusy()) delay(50); // available since FW 2.3 + capacitance = sensor_soil_catnip.getCapacitance(); + temp_c = sensor_soil_catnip.getTemperature() / (float)10; + light = sensor_soil_catnip.getLight(true); + taskEXIT_CRITICAL(); + } + tft.setFont(&FreeMonoBold18pt7b); tft.setCursor(0, 25); tft.println("Soil"); @@ -244,12 +319,22 @@ void screenSoilCatnip() { tft.setFont(&FreeMonoBold9pt7b); tft.println("--Press OK To Read Value--"); tft.println(""); - tft.println("Capacitance: [value]"); - tft.println("Temperature: [value]"); - tft.println("Light: [value]"); + tft.print("Capacitance: "); tft.println(capacitance); + tft.print("Temperature: "); tft.print(temp_c); tft.println("*C"); + tft.print("Light: "); tft.println(light); } -void screenWaterLevelETape() { +void screenWaterLevelETape(bool readValue) { + float value = 0; + + if (readValue) { + taskENTER_CRITICAL(); + pixelDataReadAlert(); + screenClear(); + value = analogRead(A0); + taskEXIT_CRITICAL(); + } + tft.setFont(&FreeMonoBold18pt7b); tft.setCursor(0, 25); tft.println("Water Level"); @@ -260,5 +345,27 @@ void screenWaterLevelETape() { tft.setFont(&FreeMonoBold9pt7b); tft.println("--Press OK To Read Value--"); tft.println(""); - tft.println("Value: [value]"); + tft.print("Value: "); + tft.print(value); +} + +void screenWaterLevelETapeI2C(bool readValue) { + if (readValue) { + taskENTER_CRITICAL(); + pixelDataReadAlert(); + screenClear(); + taskEXIT_CRITICAL(); + } + + tft.setFont(&FreeMonoBold18pt7b); + tft.setCursor(0, 25); + tft.println("Water Level"); + tft.setFont(&FreeMono12pt7b); + tft.println("Milone eTape"); + tft.println("i2c address: 0x5F"); + tft.println(""); + tft.setFont(&FreeMonoBold9pt7b); + tft.println("--Press OK To Read Value--"); + tft.println(""); + tft.println("Value: unknown"); } diff --git a/hardware/arduino/i2c_dip/README.md b/hardware/arduino/i2c_dip/README.md index 92ccd5a..bde003d 100644 --- a/hardware/arduino/i2c_dip/README.md +++ b/hardware/arduino/i2c_dip/README.md @@ -4,12 +4,4 @@ A *simple* i2c based dip switch that can be queried as a sensor. This build uses an ATTiny 2313 / 4313 for the i2c slave with an 8 pin dip switch. The status of all 8 pins on the dip switch are returned via i2c as a single byte that can be used to determine state of all 8. -## Folders - -### slave_sender - The main ATTiny code that reads the dip switch states and sends back a single byte with each dip's state encoded as a ```0``` for ```off``` and ```1``` for on. - -### master_reader - -Sample code used on an Arduino for testing purposes. diff --git a/hardware/arduino/i2c_dip/slave_sender/slave_sender.ino b/hardware/arduino/i2c_dip/i2c_dip.ino similarity index 100% rename from hardware/arduino/i2c_dip/slave_sender/slave_sender.ino rename to hardware/arduino/i2c_dip/i2c_dip.ino diff --git a/hardware/arduino/i2c_dip/master_reader/README.md b/hardware/arduino/i2c_dip/master_reader/README.md deleted file mode 100644 index 3bf98f1..0000000 --- a/hardware/arduino/i2c_dip/master_reader/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# master_reader - -Sample code used on an Arduino for testing purposes. diff --git a/hardware/arduino/i2c_dip/master_reader/master_reader.ino b/hardware/arduino/i2c_dip/master_reader/master_reader.ino deleted file mode 100644 index e07ef33..0000000 --- a/hardware/arduino/i2c_dip/master_reader/master_reader.ino +++ /dev/null @@ -1,32 +0,0 @@ -// Wire Master Reader -// by Nicholas Zambetti - -// Demonstrates use of the Wire library -// Reads data from an I2C/TWI slave device -// Refer to the "Wire Slave Sender" example for use with this - -// Created 29 March 2006 - -// This example code is in the public domain. - - -#include - -void setup() { - Wire.begin(); // join i2c bus (address optional for master) - Serial.begin(115200); // start serial for output - while (!Serial); -} - -void loop() { - Wire.requestFrom(0x65, 2); - // Wait for data to become available -- can be a delayed response due to # of pins to enumerate - while(!Wire.available()); - byte dip_1 = Wire.read(); - byte dip_2 = Wire.read(); - Serial.print("DIP 1: "); - Serial.println(dip_1, BIN); - Serial.print("DIP 2: "); - Serial.println(dip_2, BIN); - delay(500); -} diff --git a/hardware/arduino/i2c_dip/slave_sender/README.md b/hardware/arduino/i2c_dip/slave_sender/README.md deleted file mode 100644 index 8c9b89f..0000000 --- a/hardware/arduino/i2c_dip/slave_sender/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# slave_sender - -The main ATTiny code that reads the dip switch states and sends back a single byte with each dip's state encoded as a ```0``` for ```off``` and ```1``` for on.