michael osumuneAkinola ShafiuOladoyin Arewa
Published © Apache-2.0

Solar farm monitoring using lorawan & AI

To accelerate our smart and sustainable living conditions for low-income farmers and businesses using solar, AI, and IoT

BeginnerWork in progressOver 1 day93
Solar farm monitoring using lorawan & AI

Things used in this project

Hardware components

SenseCAP K1100 - The Sensor Prototype Kit with LoRa® and AI
Seeed Studio SenseCAP K1100 - The Sensor Prototype Kit with LoRa® and AI
×1

Software apps and online services

Arduino Web Editor
Arduino Web Editor
AWS IoT
Amazon Web Services AWS IoT

Story

Read more

Code

Soil Testing code

Arduino
This code is used to collect data from the soil through Wio Terminal and send it to the AWS cloud via MQTT
//Libraries
#include <Arduino.h>
#include <Wire.h>
#include <TFT_eSPI.h> //Wio LCD screen
#include "Free_Fonts.h" //include the header file
#include <SensirionI2CSht4x.h>  //SHT40 Temp and Hum sensor
#include <sensirion_common.h> //SGP30 VOC and CO2 sensor
#include <sgp30.h>
#include "rpcWiFi.h"
#include <WiFiClientSecure.h>
#include <MQTTClient.h>
#include "config.h"

//Pin definitions
#define h2o_pin A0



//Initializations
TFT_eSPI tft;
TFT_eSprite spr = TFT_eSprite(&tft);
SensirionI2CSht4x sht4x;
WiFiClientSecure net;
MQTTClient mqtt;

char payload[700];
char str_temp[6];
char str_hum[6];
char str_lux[6];
char str_h2o[6];
char str_co2[6];
char str_voc[6];


void setup() {
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) yield();
  net.setCACert(AWS_CERT_CA);
  net.setCertificate(AWS_CERT_CRT);
  net.setPrivateKey(AWS_CERT_PRIVATE);
  mqtt.begin(AWS_IOT_ENDPOINT, 8883, net);

  
  //Wio Terminal LCD initialization
  Wio_LCD_init();
  Wire.begin();

  //Serial connection
  Serial.begin(9600);
  delay(1000);
  Serial.println("Smart Greenhouse");

  //Pin configurations
  pinMode(WIO_LIGHT, INPUT);
  pinMode(WIO_BUZZER, OUTPUT);

  //SGP30 Gas sensor setup
  int16_t sgp_err;
  uint16_t sgp_eth;
  uint16_t sgp_h2;

  //if (sgp_probe() != STATUS_OK) {
    //Serial.println("Trying to initialize SGP30...");
    //delay(1000);
  //}

  //sgp_err = sgp_measure_signals_blocking_read(&sgp_eth, &sgp_h2);
  //if (sgp_err != STATUS_OK) {
    //Serial.println("Error: Could not read signal from SGP30");
  //}
  //sgp_set_absolute_humidity(13000);
  //sgp_err = sgp_iaq_init();
  //Serial.println("Sgp40 sensor ready");

  //SHT40X Temp sensor setup
  uint16_t sht_err;
  char errorMessage[256];
  sht4x.begin(Wire);

  uint32_t serialNumber;
  sht_err = sht4x.serialNumber(serialNumber);
  if (sht_err) {
    Serial.print("Error trying to execute serialNumber(): ");
    errorToString(sht_err, errorMessage, 256);
    Serial.println(errorMessage);
  } else {
    Serial.print("Serial Number: ");
    Serial.println(serialNumber);
  }

  Serial.println("Sht4x sensor ready");


}

void loop() {
  //Variables
  float temp = 0, hum = 0, lux = 0, h2o = 0;
  uint16_t voc = 0, co2 = 0, sgp_err = 0, sht_err = 0;
  char errorMessage[256];
  
  //Readings
  //Temp and Hum
  sht_err = sht4x.measureHighPrecision(temp, hum);
  if (sht_err) {
    Serial.print("Error trying to execute measureHighPrecision(): ");
    errorToString(sht_err, errorMessage, 256);
    Serial.println(errorMessage);
  }
  //Soil moisture sensor: 400 in wet, 1023 in dry
  h2o = map(analogRead(h2o_pin), 1023, 0, 20, 85);
  //Light
  lux = analogRead(WIO_LIGHT);
  //VOC and CO2
  //sgp_err = sgp_measure_iaq_blocking_read(&voc, &co2);

  // Serial Displays
  //  Serial.print("Temperature: ");
  //  Serial.println(temp);
  //  Serial.print("Humidity: ");
  //  Serial.println(hum);
  //  Serial.print("Soil moisture: ");
  //  Serial.println(h2o);
  //  Serial.print("Light: ");
  //  Serial.println(lux);
  //  Serial.print("VOC: ");
  //  Serial.println(voc);
  //  Serial.print("CO2: ");
  //  Serial.println(co2);

  //Wio Terminal LCD Display
  //Temp
  spr.createSprite(55, 30);
  spr.fillSprite(TFT_BLACK);
  spr.setFreeFont(&FreeSansBoldOblique18pt7b);
  spr.setTextColor(TFT_WHITE);
  spr.drawNumber(temp, 0, 0);
  spr.pushSprite(17, 95);
  spr.deleteSprite();

  //H20
  spr.createSprite(55, 30);
  spr.fillSprite(TFT_BLACK);
  spr.setFreeFont(&FreeSansBoldOblique18pt7b);
  spr.setTextColor(TFT_WHITE);
  spr.drawNumber(h2o, 0, 0);
  spr.pushSprite((tft.width() / 3) + 15, 95);
  spr.deleteSprite();

  //Hum
  spr.createSprite(70, 30);
  spr.fillSprite(TFT_BLACK);
  spr.setFreeFont(&FreeSansBoldOblique18pt7b);
  spr.setTextColor(TFT_WHITE);
  spr.drawNumber(hum, 0, 0);
  spr.pushSprite(17, 185);
  spr.deleteSprite();

  //Light
  spr.createSprite(70, 30);
  spr.fillSprite(TFT_BLACK);
  spr.setFreeFont(&FreeSansBoldOblique18pt7b);
  spr.setTextColor(TFT_WHITE);
  spr.drawNumber(lux, 0, 0);
  spr.pushSprite((tft.width() / 3) + 15, 185);
  spr.deleteSprite();

  //CO2
  spr.createSprite(70, 30);
  spr.fillSprite(TFT_BLACK);
  spr.setFreeFont(&FreeSansBoldOblique18pt7b);
  spr.setTextColor(TFT_WHITE);
  spr.drawNumber(co2, 0, 0);
  spr.pushSprite(2 * (tft.width() / 3) + 13, 95);
  spr.deleteSprite();

  //VOC
  spr.createSprite(70, 30);
  spr.fillSprite(TFT_BLACK);
  spr.setFreeFont(&FreeSansBoldOblique18pt7b);
  spr.setTextColor(TFT_WHITE);
  spr.drawNumber(voc, 0, 0);
  spr.pushSprite(2 * (tft.width() / 3) + 13, 185);
  spr.deleteSprite();


  //Alarm
  if ((h2o < 40) || (lux < 5) || (co2 > 700)) {
    analogWrite(WIO_BUZZER, 128);
    delay(1000);
    analogWrite(WIO_BUZZER, 0);
  }

  else{delay(1000);}
  

  delay(500);

  //mqtt.connect(THINGNAME);

  while (!mqtt.connect(THINGNAME)) yield();
  dtostrf(temp, 4, 2, str_temp);
  dtostrf(hum, 4, 2, str_hum);
  dtostrf(lux, 4, 0, str_lux);
  dtostrf(h2o, 4, 2, str_h2o);
  dtostrf(co2, 4, 2, str_co2);
  dtostrf(voc, 4, 2, str_voc);
  
  sprintf(payload, "%s", ""); // Cleans the payload
  sprintf(payload, "{\"%s\":", "Temp"); // Adds the variable label
  sprintf(payload, "%s%s", payload, str_temp); // Adds the value
  sprintf(payload, "%s}", payload); // Closes the dictionary brackets
  mqtt.publish(topic, payload);
  delay(250);

  sprintf(payload, "%s", ""); // Cleans the payload
  sprintf(payload, "{\"%s\":", "Hum"); // Adds the variable label
  sprintf(payload, "%s%s", payload, str_hum); // Adds the value
  sprintf(payload, "%s}", payload); // Closes the dictionary brackets
  mqtt.publish(topic, payload);
  delay(250);

  sprintf(payload, "%s", ""); // Cleans the payload
  sprintf(payload, "{\"%s\":", "Light"); // Adds the variable label
  sprintf(payload, "%s%s", payload, str_lux); // Adds the value
  sprintf(payload, "%s}", payload); // Closes the dictionary brackets
  mqtt.publish(topic, payload);
  delay(250);

  sprintf(payload, "%s", ""); // Cleans the payload
  sprintf(payload, "{\"%s\":", "Moisture"); // Adds the variable label
  sprintf(payload, "%s%s", payload, str_h2o); // Adds the value
  sprintf(payload, "%s}", payload); // Closes the dictionary brackets
  mqtt.publish(topic, payload);
  delay(250);

  sprintf(payload, "%s", ""); // Cleans the payload
  sprintf(payload, "{\"%s\":", "CO2"); // Adds the variable label
  sprintf(payload, "%s%s", payload, str_co2); // Adds the value
  sprintf(payload, "%s}", payload); // Closes the dictionary brackets
  mqtt.publish(topic, payload);
  delay(250);

  sprintf(payload, "%s", ""); // Cleans the payload
  sprintf(payload, "{\"%s\":", "VOC"); // Adds the variable label
  sprintf(payload, "%s%s", payload, str_voc); // Adds the value
  sprintf(payload, "%s}", payload); // Closes the dictionary brackets
  mqtt.publish(topic, payload);
  delay(250);
}




void Wio_LCD_init() {
  //Wio LCD screen initialization
  tft.begin();
  tft.setRotation(3);
  tft.fillScreen(TFT_BLACK);

  //Heading
  tft.setFreeFont(&FreeSansBoldOblique18pt7b);
  tft.setTextColor(TFT_WHITE);
  tft.drawString("Smart Greenhouse", 4, 10);
  tft.drawFastHLine(0, 50, tft.width(), TFT_GREEN);

  //Round boxes
  //Temp box
  tft.drawRoundRect(5, 60, (tft.width() / 3) - 6, (tft.height() - 69) / 2, 10, TFT_WHITE);
  //H2O box
  tft.drawRoundRect((tft.width() / 3) + 3, 60, (tft.width() / 3) - 6, (tft.height() - 69) / 2, 10, TFT_WHITE);
  //Hum box
  tft.drawRoundRect(5, ((tft.height() - 69) / 2) + 64, (tft.width() / 3) - 6, (tft.height() - 69) / 2, 10, TFT_WHITE);
  //Lux box
  tft.drawRoundRect((tft.width() / 3) + 3, ((tft.height() - 69) / 2) + 64, (tft.width() / 3) - 6, (tft.height() - 69) / 2, 10, TFT_WHITE);
  //VOC and CO2 box
  tft.drawRoundRect(2 * (tft.width() / 3) + 1, 60, (tft.width() / 3) - 6, tft.height() - 65, 10, TFT_WHITE);


  //Text
  //Temp
  tft.setFreeFont(&FreeSansBoldOblique9pt7b);
  tft.setTextColor(TFT_RED);
  tft.drawString("Temp", 8, 65);
  tft.setTextColor(TFT_GREEN);
  tft.drawString("o", 78, 112);
  tft.drawString("C", 85, 120);

  //H20
  tft.setFreeFont(&FreeSansBoldOblique9pt7b);
  tft.setTextColor(TFT_RED);
  tft.drawString("Moisture", (tft.width() / 3) + 6, 65);
  tft.setTextColor(TFT_GREEN);
  tft.drawString("%", 185, 120);

  //Hum
  tft.setFreeFont(&FreeSansBoldOblique9pt7b);
  tft.setTextColor(TFT_RED);
  tft.drawString("Hum", 8, ((tft.height() - 69) / 2) + 66);
  tft.setTextColor(TFT_GREEN);
  tft.drawString("%", 82, 210);

  //Lux
  tft.setFreeFont(&FreeSansBoldOblique9pt7b);
  tft.setTextColor(TFT_RED);
  tft.drawString("Light", (tft.width() / 3) + 6, ((tft.height() - 69) / 2) + 66);
  tft.setTextColor(TFT_GREEN);
  tft.drawString("cd", 180, 210);

  //CO2
  tft.setFreeFont(&FreeSansBoldOblique9pt7b);
  tft.setTextColor(TFT_RED);
  tft.drawString("CO2", 2 * (tft.width() / 3) + 4, 65);
  tft.setTextColor(TFT_GREEN);
  tft.drawString("ppm", 268, 120);

  //VOC
  tft.setFreeFont(&FreeSansBoldOblique9pt7b);
  tft.setTextColor(TFT_RED);
  tft.drawString("VOC", 2 * (tft.width() / 3) + 4, ((tft.height() - 69) / 2) + 66);
  tft.setTextColor(TFT_GREEN);
  tft.drawString("ppm", 268, 210);


}

Screen Display

C Header File
This is a header file is used for display purposes on the Wio Board. it is used alongside the Arduino code
// Attach this header file to your sketch to use the GFX Free Fonts. You can write
// sketches without it, but it makes referencing them easier.

// This calls up ALL the fonts but they only get loaded if you actually
// use them in your sketch.
//
// No changes are needed to this header file unless new fonts are added to the
// library "Fonts/GFXFF" folder.
//
// To save a lot of typing long names, each font can easily be referenced in the
// sketch in three ways, either with:
//
//    1. Font file name with the & in front such as &FreeSansBoldOblique24pt7b
//       an example being:
//
//       tft.setFreeFont(&FreeSansBoldOblique24pt7b);
//
//    2. FF# where # is a number determined by looking at the list below
//       an example being:
//
//       tft.setFreeFont(FF32);
//
//    3. An abbreviation of the file name. Look at the list below to see
//       the abbreviations used, for example:
//
//       tft.setFreeFont(FSSBO24)
//
//       Where the letters mean:
//       F = Free font
//       M = Mono
//      SS = Sans Serif (double S to distinguish is form serif fonts)
//       S = Serif
//       B = Bold
//       O = Oblique (letter O not zero)
//       I = Italic
//       # =  point size, either 9, 12, 18 or 24
//
//  Setting the font to NULL will select the GLCD font:
//
//      tft.setFreeFont(NULL); // Set font to GLCD

#define LOAD_GFXFF

#ifdef LOAD_GFXFF // Only include the fonts if LOAD_GFXFF is defined in User_Setup.h

    // Use these when printing or drawing text in GLCD and high rendering speed fonts
    #define GFXFF 1
    #define GLCD  0
    #define FONT2 2
    #define FONT4 4
    #define FONT6 6
    #define FONT7 7
    #define FONT8 8

    // Use the following when calling setFont()
    //
    // Reserved for GLCD font  // FF0
    //

    #define TT1 &TomThumb

    #define FM9 &FreeMono9pt7b
    #define FM12 &FreeMono12pt7b
    #define FM18 &FreeMono18pt7b
    #define FM24 &FreeMono24pt7b

    #define FMB9 &FreeMonoBold9pt7b
    #define FMB12 &FreeMonoBold12pt7b
    #define FMB18 &FreeMonoBold18pt7b
    #define FMB24 &FreeMonoBold24pt7b

    #define FMO9 &FreeMonoOblique9pt7b
    #define FMO12 &FreeMonoOblique12pt7b
    #define FMO18 &FreeMonoOblique18pt7b
    #define FMO24 &FreeMonoOblique24pt7b

    #define FMBO9 &FreeMonoBoldOblique9pt7b
    #define FMBO12 &FreeMonoBoldOblique12pt7b
    #define FMBO18 &FreeMonoBoldOblique18pt7b
    #define FMBO24 &FreeMonoBoldOblique24pt7b

    #define FSS9 &FreeSans9pt7b
    #define FSS12 &FreeSans12pt7b
    #define FSS18 &FreeSans18pt7b
    #define FSS24 &FreeSans24pt7b

    #define FSSB9 &FreeSansBold9pt7b
    #define FSSB12 &FreeSansBold12pt7b
    #define FSSB18 &FreeSansBold18pt7b
    #define FSSB24 &FreeSansBold24pt7b

    #define FSSO9 &FreeSansOblique9pt7b
    #define FSSO12 &FreeSansOblique12pt7b
    #define FSSO18 &FreeSansOblique18pt7b
    #define FSSO24 &FreeSansOblique24pt7b

    #define FSSBO9 &FreeSansBoldOblique9pt7b
    #define FSSBO12 &FreeSansBoldOblique12pt7b
    #define FSSBO18 &FreeSansBoldOblique18pt7b
    #define FSSBO24 &FreeSansBoldOblique24pt7b

    #define FS9 &FreeSerif9pt7b
    #define FS12 &FreeSerif12pt7b
    #define FS18 &FreeSerif18pt7b
    #define FS24 &FreeSerif24pt7b

    #define FSI9 &FreeSerifItalic9pt7b
    #define FSI12 &FreeSerifItalic12pt7b
    #define FSI19 &FreeSerifItalic18pt7b
    #define FSI24 &FreeSerifItalic24pt7b

    #define FSB9 &FreeSerifBold9pt7b
    #define FSB12 &FreeSerifBold12pt7b
    #define FSB18 &FreeSerifBold18pt7b
    #define FSB24 &FreeSerifBold24pt7b

    #define FSBI9 &FreeSerifBoldItalic9pt7b
    #define FSBI12 &FreeSerifBoldItalic12pt7b
    #define FSBI18 &FreeSerifBoldItalic18pt7b
    #define FSBI24 &FreeSerifBoldItalic24pt7b

    #define FF0 NULL //ff0 reserved for GLCD
    #define FF1 &FreeMono9pt7b
    #define FF2 &FreeMono12pt7b
    #define FF3 &FreeMono18pt7b
    #define FF4 &FreeMono24pt7b

    #define FF5 &FreeMonoBold9pt7b
    #define FF6 &FreeMonoBold12pt7b
    #define FF7 &FreeMonoBold18pt7b
    #define FF8 &FreeMonoBold24pt7b

    #define FF9 &FreeMonoOblique9pt7b
    #define FF10 &FreeMonoOblique12pt7b
    #define FF11 &FreeMonoOblique18pt7b
    #define FF12 &FreeMonoOblique24pt7b

    #define FF13 &FreeMonoBoldOblique9pt7b
    #define FF14 &FreeMonoBoldOblique12pt7b
    #define FF15 &FreeMonoBoldOblique18pt7b
    #define FF16 &FreeMonoBoldOblique24pt7b

    #define FF17 &FreeSans9pt7b
    #define FF18 &FreeSans12pt7b
    #define FF19 &FreeSans18pt7b
    #define FF20 &FreeSans24pt7b

    #define FF21 &FreeSansBold9pt7b
    #define FF22 &FreeSansBold12pt7b
    #define FF23 &FreeSansBold18pt7b
    #define FF24 &FreeSansBold24pt7b

    #define FF25 &FreeSansOblique9pt7b
    #define FF26 &FreeSansOblique12pt7b
    #define FF27 &FreeSansOblique18pt7b
    #define FF28 &FreeSansOblique24pt7b

    #define FF29 &FreeSansBoldOblique9pt7b
    #define FF30 &FreeSansBoldOblique12pt7b
    #define FF31 &FreeSansBoldOblique18pt7b
    #define FF32 &FreeSansBoldOblique24pt7b

    #define FF33 &FreeSerif9pt7b
    #define FF34 &FreeSerif12pt7b
    #define FF35 &FreeSerif18pt7b
    #define FF36 &FreeSerif24pt7b

    #define FF37 &FreeSerifItalic9pt7b
    #define FF38 &FreeSerifItalic12pt7b
    #define FF39 &FreeSerifItalic18pt7b
    #define FF40 &FreeSerifItalic24pt7b

    #define FF41 &FreeSerifBold9pt7b
    #define FF42 &FreeSerifBold12pt7b
    #define FF43 &FreeSerifBold18pt7b
    #define FF44 &FreeSerifBold24pt7b

    #define FF45 &FreeSerifBoldItalic9pt7b
    #define FF46 &FreeSerifBoldItalic12pt7b
    #define FF47 &FreeSerifBoldItalic18pt7b
    #define FF48 &FreeSerifBoldItalic24pt7b

    // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    // Now we define "s"tring versions for easy printing of the font name so:
    //   tft.println(sFF5);
    // will print
    //   Mono bold 9
    // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    #define sFF0 "GLCD"
    #define sTT1 "Tom Thumb"
    #define sFF1 "Mono 9"
    #define sFF2 "Mono 12"
    #define sFF3 "Mono 18"
    #define sFF4 "Mono 24"

    #define sFF5 "Mono bold 9"
    #define sFF6 "Mono bold 12"
    #define sFF7 "Mono bold 18"
    #define sFF8 "Mono bold 24"

    #define sFF9 "Mono oblique 9"
    #define sFF10 "Mono oblique 12"
    #define sFF11 "Mono oblique 18"
    #define sFF12 "Mono oblique 24"

    #define sFF13 "Mono bold oblique 9"
    #define sFF14 "Mono bold oblique 12"
    #define sFF15 "Mono bold oblique 18"
    #define sFF16 "Mono bold oblique 24" // Full text line is too big for 480 pixel wide screen

    #define sFF17 "Sans 9"
    #define sFF18 "Sans 12"
    #define sFF19 "Sans 18"
    #define sFF20 "Sans 24"

    #define sFF21 "Sans bold 9"
    #define sFF22 "Sans bold 12"
    #define sFF23 "Sans bold 18"
    #define sFF24 "Sans bold 24"

    #define sFF25 "Sans oblique 9"
    #define sFF26 "Sans oblique 12"
    #define sFF27 "Sans oblique 18"
    #define sFF28 "Sans oblique 24"

    #define sFF29 "Sans bold oblique 9"
    #define sFF30 "Sans bold oblique 12"
    #define sFF31 "Sans bold oblique 18"
    #define sFF32 "Sans bold oblique 24"

    #define sFF33 "Serif 9"
    #define sFF34 "Serif 12"
    #define sFF35 "Serif 18"
    #define sFF36 "Serif 24"

    #define sFF37 "Serif italic 9"
    #define sFF38 "Serif italic 12"
    #define sFF39 "Serif italic 18"
    #define sFF40 "Serif italic 24"

    #define sFF41 "Serif bold 9"
    #define sFF42 "Serif bold 12"
    #define sFF43 "Serif bold 18"
    #define sFF44 "Serif bold 24"

    #define sFF45 "Serif bold italic 9"
    #define sFF46 "Serif bold italic 12"
    #define sFF47 "Serif bold italic 18"
    #define sFF48 "Serif bold italic 24"

#else // LOAD_GFXFF not defined so setup defaults to prevent error messages

    // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    // Free fonts are not loaded in User_Setup.h so we must define all as font 1
    // to prevent compile error messages
    // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    #define GFXFF 1
    #define GLCD  1
    #define FONT2 2
    #define FONT4 4
    #define FONT6 6
    #define FONT7 7
    #define FONT8 8

    #define FF0 1
    #define FF1 1
    #define FF2 1
    #define FF3 1
    #define FF4 1
    #define FF5 1
    #define FF6 1
    #define FF7 1
    #define FF8 1
    #define FF9 1
    #define FF10 1
    #define FF11 1
    #define FF12 1
    #define FF13 1
    #define FF14 1
    #define FF15 1
    #define FF16 1
    #define FF17 1
    #define FF18 1
    #define FF19 1
    #define FF20 1
    #define FF21 1
    #define FF22 1
    #define FF23 1
    #define FF24 1
    #define FF25 1
    #define FF26 1
    #define FF27 1
    #define FF28 1
    #define FF29 1
    #define FF30 1
    #define FF31 1
    #define FF32 1
    #define FF33 1
    #define FF34 1
    #define FF35 1
    #define FF36 1
    #define FF37 1
    #define FF38 1
    #define FF39 1
    #define FF40 1
    #define FF41 1
    #define FF42 1
    #define FF43 1
    #define FF44 1
    #define FF45 1
    #define FF46 1
    #define FF47 1
    #define FF48 1

    #define FM9  1
    #define FM12 1
    #define FM18 1
    #define FM24 1

    #define FMB9  1
    #define FMB12 1
    #define FMB18 1
    #define FMB24 1

    #define FMO9  1
    #define FMO12 1
    #define FMO18 1
    #define FMO24 1

    #define FMBO9  1
    #define FMBO12 1
    #define FMBO18 1
    #define FMBO24 1

    #define FSS9  1
    #define FSS12 1
    #define FSS18 1
    #define FSS24 1

    #define FSSB9  1
    #define FSSB12 1
    #define FSSB18 1
    #define FSSB24 1

    #define FSSO9  1
    #define FSSO12 1
    #define FSSO18 1
    #define FSSO24 1

    #define FSSBO9  1
    #define FSSBO12 1
    #define FSSBO18 1
    #define FSSBO24 1

    #define FS9  1
    #define FS12 1
    #define FS18 1
    #define FS24 1

    #define FSI9  1
    #define FSI12 1
    #define FSI19 1
    #define FSI24 1

    #define FSB9  1
    #define FSB12 1
    #define FSB18 1
    #define FSB24 1

    #define FSBI9  1
    #define FSBI12 1
    #define FSBI18 1
    #define FSBI24 1

#endif // LOAD_GFXFF

AWS IoT connection

C Header File
This is a config file used to connect the Wio Terminal to the AWS cloud in other to send the data collected from the soil to AWS and it is used alongside the Arduino code, It also holds the IoT core certificates needed for authorization.
#define THINGNAME "WioTerminal"
#define topic "SmartGreenhouse"
//#define payload "{\"millis\": " + String(millis()) + "}"
#define ssid "DESKTOP-U71DTFE 7893"
#define password  "musaismail"
#define AWS_IOT_ENDPOINT "a59vqf5aen69u-ats.iot.us-east-1.amazonaws.com"

// Amazon Root CA 1
static const char AWS_CERT_CA[] PROGMEM = R"EOF(
-----BEGIN CERTIFICATE-----
MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF
ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6
b24gUm9vdCBDQSAxMB4XDTE1MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTEL
MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv
b3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALJ4gHHKeNXj
ca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgHFzZM
9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qw
IFAGbHrQgLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6
VOujw5H5SNz/0egwLX0tdHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L
93FcXmn/6pUCyziKrlA4b9v7LWIbxcceVOF34GfID5yHI9Y/QCB/IIDEgEw+OyQm
jgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
AYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3DQEBCwUA
A4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDI
U5PMCCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUs
N+gDS63pYaACbvXy8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vv
o/ufQJVtMVT8QtPHRh8jrdkPSHCa2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU
5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2xJNDd2ZhwLnoQdeXeGADbkpy
rqXRfboQnoZsG4q5WTP468SQvvG5
-----END CERTIFICATE-----
)EOF";

// Device Certificate
static const char AWS_CERT_CRT[] PROGMEM = R"KEY(
-----BEGIN CERTIFICATE-----
MIIDWjCCAkKgAwIBAgIVAPokVQujJKddJ2xuo5qzXb2oOJOYMA0GCSqGSIb3DQEB
CwUAME0xSzBJBgNVBAsMQkFtYXpvbiBXZWIgU2VydmljZXMgTz1BbWF6b24uY29t
IEluYy4gTD1TZWF0dGxlIFNUPVdhc2hpbmd0b24gQz1VUzAeFw0yMjA5MjEwODM5
MzZaFw00OTEyMzEyMzU5NTlaMB4xHDAaBgNVBAMME0FXUyBJb1QgQ2VydGlmaWNh
dGUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQD0R3Ce7HhuFRfh680Z
peGb2+9zLfn/qeIUlw2wIyulTJPInIjif9YMrhirA1Ya4LlIY4Y123MIE18wZn2f
KLE38sCqu+Wv45rKUINpgrPmr/zYBMoTksIo6ey9e9XI9wyTsatK9hzleL76pJ9o
T1CGiZis7H5BZbhGbj37tT1yEPNyoYeDD3Io+qW3CI3qJ+/JNMX7Jdhrb/Dm0e7q
WQdb/YjU9WgJiLgvrIC2OZrc7RmxMtcDfY4o+GgYZWjzowYXa7oBCmTOpWXBGhhE
2ym4gNUcwQVX9dP4Etn6CPzFqSCl/ujT0KuIGZBusKVpYrNg9hocXYJcScdR9mFX
d9r/AgMBAAGjYDBeMB8GA1UdIwQYMBaAFO+JE9jG5oqC/uYBVQpEC/MQIo+VMB0G
A1UdDgQWBBQOERfEJBKGT3JTjkRff2sG0aHI9DAMBgNVHRMBAf8EAjAAMA4GA1Ud
DwEB/wQEAwIHgDANBgkqhkiG9w0BAQsFAAOCAQEAIGYzhN+pvqbzUFh8QJ2umzuw
0YLRIfniLbPGs2dPhgScNBCNpr75Iz1w7c4a8yxiDgmLthXNctMwc8eQcA19tE5X
a/EI1CZubxFvWRfJQKC11mCCP5JipWpnEY6/9ol11OxvhgU6rsCUt6ysTkD/LNF6
8Flb+Ci0w+JyDYZJ8/5k3Y8v94/iMntNIlqPQYv2twqHl/t70yvqxyeLSHHI9yjD
Ji4oHoyeBT5+yMgo5dY3iAkBwK6p/FHQlSyvQ7g4IVsNHTpbr4anDq7S1yc9ERLR
pcG6bOma1kwULGhObYK4bOQbubXi6G0I6t/7F745iR5FfVw1BHj7bCy0WXViJA==
-----END CERTIFICATE-----
)KEY";

// Device Private Key
static const char AWS_CERT_PRIVATE[] PROGMEM = R"KEY(
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA9Edwnux4bhUX4evNGaXhm9vvcy35/6niFJcNsCMrpUyTyJyI
4n/WDK4YqwNWGuC5SGOGNdtzCBNfMGZ9nyixN/LAqrvlr+OaylCDaYKz5q/82ATK
E5LCKOnsvXvVyPcMk7GrSvYc5Xi++qSfaE9QhomYrOx+QWW4Rm49+7U9chDzcqGH
gw9yKPqltwiN6ifvyTTF+yXYa2/w5tHu6lkHW/2I1PVoCYi4L6yAtjma3O0ZsTLX
A32OKPhoGGVo86MGF2u6AQpkzqVlwRoYRNspuIDVHMEFV/XT+BLZ+gj8xakgpf7o
09CriBmQbrClaWKzYPYaHF2CXEnHUfZhV3fa/wIDAQABAoIBAAPwlwdpJvQXkQAK
zo8IVuAtpuoDptGRytysJwNdPdn3pzaIF8kXaLthn3I6povebf6V5FdAB9Xsgg+E
x6fmfx045BSc3TJ+CEQVElmESySAWCKfySaRqmIAi9nugl8wZNqI9gtKduLYlLP0
LcH/7XuOApFfaxXg7xzrsEI8BRau2T01qH8VKC1PGuftxMkZ4Gxcl0lQehrrRtLK
npQLnKRMEkA5WwnbknJwUuLip5eJpE8gnG9u6Eaeufi2tMA5QclfkBAJ8svgmBGt
FDL9ouIKpfMHY5ECsLtmmrSwijbf1CD7sLOSjMUM1tNaXM/5WNH5ktvsAbYZH951
mGIHYyECgYEA/DuRfE47G0r0ed0j5uWsTlhzBXmCzZkwOhX4bAbP31aT3qYDZhS7
mEpVBt85TP8GjO9LRu4kMM4VE4yazDcrVnnG0FVpUjEQ4INcX2uk03Y6XKqRj0Fm
c/zfl6xNOzdDGT3Lqf3dTKjl0smZekLikFAkqRwopOtVpCjwIRHYoPECgYEA9+11
1jp74BQ1GuOo5kMNEBDYHoA9tAUEcFITEGlsaTGPzIDnC5emirOBTAOtHZ+ZkahA
T+QZvOTwQ/hfcxh/6wsIG2q34QH/GWYm3WctpgTfDjNf/47eZI+VkHYe1kjg0itz
/OUl6A0SWRZkY4AS9PiA1KpChEnCAs6SwyXzOu8CgYALw/eQVdHZ/xASUydmkNYN
vYB4A+f/ESM3wmiZGWQ+5bn2C8Ziz5rEissWi/kPR2IV1t+rClaz1BkVlVxvJC+o
U/vbIfDMva8s2dPIO6wvlPc59Vbe2M0foe8IEyhzF6vQlJpYbpgRCFvYDkFTe6U3
2BUtsjuPHc8b3jD9SejR8QKBgQDpAOp145D4DwW5t6vMe8eTCcGTKMLUpMJ/LSNt
kSap1kJm195MLsH+KKWjYvEXnh8dnRqT+rOVqzODLbHG4YeWxk9gNPOLK+0rWa28
9nMYTAu1tOLLsuGfcLIHinuAuA1SeDQRwOnXJDHSOBEw0fT+9W1ecIUC/q6vJKUZ
clkdUQKBgQCvHLcf2FoHkyGlrNz4Q04DYMRVE0iGcoiKyVJjxnbfJfKJEyrEij0m
IBEHeysfq54DXNtAFg5x0t0GPqyqZ4znK36qvLb1O/gigd0JinSlWoAZTIrVvb2e
9h9ppWfczsuytRnzifl/PgnG60uiRso9J0Z/fKGKYv9qyQU01BP2Bg==
-----END RSA PRIVATE KEY-----
)KEY";

Credits

michael osumune

michael osumune

1 project • 3 followers
Akinola Shafiu

Akinola Shafiu

1 project • 1 follower
Oladoyin Arewa

Oladoyin Arewa

1 project • 1 follower

Comments

Add projectSign up / Login