Giovambattista Vieri
Published © MIT

ARDA A Rapid Deployment Automatic environment monitor system

The climate change is upon us! We badly need an environmental monitoring system deployable in seconds.

BeginnerWork in progress8 hours1,800
ARDA A Rapid Deployment Automatic environment monitor system

Things used in this project

Hardware components

Arduino MKR Fox 1200
Arduino MKR Fox 1200
×1
LED (generic)
LED (generic)
×8
lever switch
×8
Resistor 10k ohm
Resistor 10k ohm
×8
Jumper wires (generic)
Jumper wires (generic)
×1
Wire Cable - By the Foot
OpenBuilds Wire Cable - By the Foot
×1

Software apps and online services

Arduino IDE
Arduino IDE
Sigfox
Sigfox

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

circuit schema

look at it, it's simple. You can use on breadboard or to realize (remember this circuit is for only one input... you want two input you have to duplicate and so on) a lever switch box (I have done so)

Code

A simple example

Arduino
Load it... Try it. Read the values from sigfox site. Then add hardware and try to modify the button positions. After you have to move the indicated code in the loop sections so that you can have a monitoring loop.
/*
  SigFox First Configuration 

Note: I (Giovambattista Vieri) have modified this code...

  This sketch demonstrates the usage of MKRFox1200 SigFox module.
  Since the board is designed with low power in mind, it depends directly on ArduinoLowPower library

  This example code is in the public domain.
*/

#include <SigFox.h>
#include <ArduinoLowPower.h>

void setup() {
  Serial.begin(9600);
  while (!Serial) {};

  
  if (!SigFox.begin()) {
    Serial.println("Shield error or not present!");
    return;
  }
  
  SigFox.debug();

  String version = SigFox.SigVersion();
  String ID = SigFox.ID();
  String PAC = SigFox.PAC();

  // Display module informations
  Serial.println("MKRFox1200 Sigfox configuration");
  Serial.println("SigFox FW version " + version);
  Serial.println("ID  = " + ID);
  Serial.println("PAC = " + PAC);

  Serial.println("");

  Serial.print("Module temperature: ");
  Serial.println(SigFox.internalTemperature());

  Serial.println("Register your board on https://backend.sigfox.com/activate with provided ID and PAC");
  Serial.println("(if you have already registered you can skip this step and you can delete these print lines)"); 

  delay(100);

  // Send the module to the deepest sleep
  SigFox.end();

 
//// the above part is coming from an example program of sigfox. 
//// the part below is mine and if you like you reuse without notice ... 
//// so the license is still "public domain" 

/* now start with pin setup! */
  Serial.println("\nhouse keeping procedures\n");  
  pinMode(0, INPUT);
  pinMode(1, INPUT);
  pinMode(2, INPUT);
  pinMode(3, INPUT);
  pinMode(4, INPUT);
  pinMode(5, INPUT);
  pinMode(6, INPUT);  
  pinMode(7, INPUT);
/* end of pin setup */

/* now read the bit */ 
  Serial.println("read values\n"); 
  uint8_t b0, b1, b2, b3, b4, b5, b6, b7; 

  
  b0= digitalRead(0); 
  b1= digitalRead(1); 
  b2= digitalRead(2); 
  b3= digitalRead(3); 
  b4= digitalRead(4); 
  b5= digitalRead(5); 
  b6= digitalRead(6); 
  b7= digitalRead(7); 
/*  now convert in a uchar */ 
  uint8_t res; 
  res=b0; 
  res+=b1 << 1;
  res+=b2 << 2;
  res+=b3 << 3;
  res+=b4 << 4;
  res+=b5 << 5;
  res+=b6 << 6;
  res+=b7 << 7;
// now res contains the value

    
  String message=String(res);
 

 Serial.println(message); 

 
  sendStringAndGetResponse(message);

//// end of part developed by me ... 
/* as you can see it is really simple if you ike you can move in loop */
/* if you do so, remember to add a delay ! */ 
 
}

void loop()
{
}

void sendString(String str) {
  // Start the module
  SigFox.begin();
  // Wait at least 30mS after first configuration (100mS before)
  delay(100);
  // Clears all pending interrupts
  SigFox.status();
  delay(1);

  SigFox.beginPacket();
  SigFox.print(str);

  int ret = SigFox.endPacket();  // send buffer to SIGFOX network
  if (ret > 0) {
    Serial.println("No transmission");
  } else {
    Serial.println("Transmission ok");
  }

  Serial.println(SigFox.status(SIGFOX));
  Serial.println(SigFox.status(ATMEL));
  SigFox.end();
}

void sendStringAndGetResponse(String str) {
  // Start the module
  SigFox.begin();
  // Wait at least 30mS after first configuration (100mS before)
  delay(100);
  // Clears all pending interrupts
  SigFox.status();
  delay(1);

  SigFox.beginPacket();
  SigFox.print(str);

  int ret = SigFox.endPacket(true);  // send buffer to SIGFOX network and wait for a response
  if (ret > 0) {
    Serial.println("No transmission");
  } else {
    Serial.println("Transmission ok");
  }

  Serial.println(SigFox.status(SIGFOX));
  Serial.println(SigFox.status(ATMEL));

  if (SigFox.parsePacket()) {
    Serial.println("Response from server:");
    while (SigFox.available()) {
      Serial.print("0x");
      Serial.println(SigFox.read(), HEX);
    }
  } else {
    Serial.println("Could not get any response from the server");
    Serial.println("Check the SigFox coverage in your area");
    Serial.println("If you are indoor, check the 20dB coverage or move near a window");
  }
  Serial.println();

  SigFox.end();
}

Credits

Giovambattista Vieri

Giovambattista Vieri

6 projects • 6 followers
Technical engineer, I love electronics and Informatics. My beloved language is C, I am happy when I can deploy sensors and collect data!

Comments