Sujata
Published © GPL3+

Distance Monitoring mats

A minimalist low-cost social distancing enforcement system

IntermediateFull instructions provided2 hours3,049
Distance Monitoring mats

Things used in this project

Hardware components

Pushbutton switch 12mm
SparkFun Pushbutton switch 12mm
×1
Arduino MKR WiFi 1010
Arduino MKR WiFi 1010
×1
Li-Ion Battery 1000mAh
Li-Ion Battery 1000mAh
×1
Mat(generic)
×1
Buzzer
Buzzer
×1

Software apps and online services

Arduino IDE
Arduino IDE
Ubidots
Ubidots
Android Studio
Android Studio

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Hot glue gun (generic)
Hot glue gun (generic)
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires

Story

Read more

Schematics

Final Circuit

Fritzing file for final circuit

Final CIrcuit image

Image file for final circuit

Code

Arduino sensing code

C/C++
/****************************************
 * Include Libraries
 ****************************************/
#include "UbidotsESPMQTT.h"

/****************************************
 * Define Constants
 ****************************************/
#define TOKEN "BBFF-HQzhjmDxosWtw94dhMISDcaLpZAzxK" // Your Ubidots TOKEN
#define WIFINAME "Moinak" //Your SSID
#define WIFIPASS "lklklklk" // Your Wifi Pass

Ubidots client(TOKEN);

/****************************************
 * Auxiliar Functions
 ****************************************/

void callback(char* topic, byte* payload, unsigned int length) {
  Serial.print("Message arrived [");
  Serial.print(topic);
  Serial.print("] ");
  for (int i=0;i<length;i++) {
    Serial.print((char)payload[i]);
  }
  Serial.println();
}

/****************************************
 * Main Functions
 ****************************************/

void setup() {
  // put your setup code here, to run once:
  //client.ubidotsSetBroker("business.api.ubidots.com"); // Sets the broker properly for the business account
  client.setDebug(true); // Pass a true or false bool value to activate debug messages
  Serial.begin(115200);
  client.wifiConnection(WIFINAME, WIFIPASS);
  client.begin(callback);
  }

void loop() {
  // put your main code here, to run repeatedly:
  if(!client.connected()){
      client.reconnect();
      }
  
  float value1 = analogRead(0);
  //float value2 = analogRead(2)
  client.add("temperature", value1);
  //client.add("status", value2);
  client.ubidotsPublish("my-new-device");
  client.loop();
}

Shift_resgister_testing

C/C++
Code for testing the working of the 165 shift register
#define enable 2
#define load 3
#define clock1 4
#define data 5
void setup()
{
  pinMode(enable,OUTPUT);
  pinMode(load,OUTPUT);
  pinMode(clock1,OUTPUT);
  pinMode(data,INPUT);
  digitalWrite(load,HIGH);
  digitalWrite(enable,HIGH);
  Serial.print("Input = ");
  Serial.begin(9600);
}
void loop()
{
  Serial.print("Input = ");
  digitalWrite(load,LOW);
  delayMicroseconds(5);
  digitalWrite(load,HIGH);
  delayMicroseconds(5);
  digitalWrite(clock1,HIGH);
  digitalWrite(enable,LOW);
  byte incoming=shiftIn(data,clock1,MSBFIRST);
  digitalWrite(enable,HIGH);
  for(int i=7;i>=0;i--)
  {
    if(bitRead(incoming,i)==1)
    {
      Serial.print("1");
    }
    else
    {
      Serial.print("0");
    }
  }
}

Credits

Sujata

Sujata

5 projects • 3 followers
FPGA developer based in India worked on image processing based edge applications in healthcare and security. Die-hard IoTian home automator

Comments