jassak
Published © GPL3+

Sigfox-Enabled Parking Lot

Driving around the town, looking for free parking space, leaving carbon footprint? No longer an issue, simply check Twitter for a spot!

IntermediateFull instructions provided2 hours2,338
Sigfox-Enabled Parking Lot

Things used in this project

Hardware components

Arduino MKR Fox 1200
Arduino MKR Fox 1200
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Light Dependent Resistor
×1
Resistor 221 ohm
Resistor 221 ohm
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
Pushbutton switch 12mm
SparkFun Pushbutton switch 12mm
×1
LED (generic)
LED (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE
Sigfox
Sigfox
ThingSpeak API
ThingSpeak API
Twitter
Twitter

Story

Read more

Schematics

Sigfox enabled Parking Lot

Schematic for connection.

Code

Sigfox enabled Parking Lot

Arduino
This is .ino code for connecting your parking space to internet.
#include <SigFox.h>



int led = 5;
int ldr = A5;
int sread = 0;
uint8_t carstate = 1;
boolean changestate = true;
int BTN = 12;
int BTN_state = 0;
int BTN_prev = 0;
int BTN_NR_OF_PRESS = 0;

void setup() {
  SigFox.debug();
  Serial.begin(9600);
  pinMode(5, OUTPUT);
  pinMode(A5, INPUT);
  if (!SigFox.begin()) {
    Serial.println("Sigfox module unavailable.");
  }

}

void loop() {
  sread = analogRead(ldr);
  Serial.println(sread);

  BTN_state = digitalRead(BTN);

  if (BTN_state != BTN_prev) {
    if (BTN_state == HIGH) {
      BTN_NR_OF_PRESS++;
    }
  }

  BTN_prev = BTN_state;

  if (BTN_NR_OF_PRESS % 3 == 0) {

    if (sread > 900 && sread < 1023) {
      digitalWrite(led, HIGH);
    }
    else {
      digitalWrite(led, LOW);
    }
  }

  if (BTN_NR_OF_PRESS % 4 == 0) {
    digitalWrite(led, LOW);
  }

  if (sread > 900 && changestate == true && BTN_NR_OF_PRESS % 4 == 0)
  {
    // digitalWrite(5, HIGH);
    carstate = 1;

    SigFox.beginPacket();
    SigFox.write(carstate);
    SigFox.endPacket();

    changestate = false;
  }
  else if (sread < 900 && changestate == false && BTN_NR_OF_PRESS % 4 == 0) {
    //   digitalWrite(5, LOW);
    carstate = 2;

    SigFox.beginPacket();
    SigFox.write(carstate);
    SigFox.endPacket();

    changestate = true;

  }

  delay(100);

}

Credits

jassak

jassak

2 projects • 11 followers
UNi Student

Comments