ketan guptaJYOTI MALIK
Published © CERN-OHL

Touch & Go

Intelligent and efficient waste management system.

AdvancedShowcase (no instructions)2,128
Touch & Go

Things used in this project

Hardware components

CC3200-LAUNCHXL SimpleLink CC3200 Wi-Fi LaunchPad
Texas Instruments CC3200-LAUNCHXL SimpleLink CC3200 Wi-Fi LaunchPad
×1
Proximity Sensor
Proximity Sensor
×1

Software apps and online services

BlueMix
IBM BlueMix
Energia
Texas Instruments Energia
AWS IoT
Amazon Web Services AWS IoT

Hand tools and fabrication machines

Texas Instruments energia
IBM BlueMix

Story

Read more

Custom parts and enclosures

System placement

we place the system in given manner

Schematics

INTERFACING

It is CC3200 simplelink Wifi module.It is interfaced with proximity sensor.For doing so first we need to short top of J8 pin 7 buttom of SOP 2

Code

MQTT

C/C++
#include <WiFi.h>
#include <PubSubClient.h>
#include <SPI.h> 
#define PROX_PIN  24
#define MAX_SENSOR_VOLTAGE 2.8
#define MIN_SENSOR_VOLTAGE 0.4
#define MAX_SENSOR_DISTANCE_CM  150
#define MIN_SENSOR_DISTANCE_CM  15
float prox_sensor_value_V = 0;
float distance_cm = 0;
WiFiClient wclient;

byte server[] = { 198, 41, 30, 241 }; 
byte ip[]     = { 192, 168, 43, 79 };
#define       WIFI_SSID         "AndroidAP"
#define       WIFI_PWD          "kjrk7589"


char sensorRead[4];



PubSubClient client(server, 1883, callback, wclient);

void callback(char* inTopic, byte* payload, unsigned int length){

}

void setup()
{

  Serial.begin(115200);

  Serial.println("Start WiFi");
  WiFi.begin(WIFI_SSID, WIFI_PWD);
  while(WiFi.localIP() == INADDR_NONE) {
    Serial.print(".");
    delay(300);
  }
  Serial.println("");

  printWifiStatus();

}

void loop()
{
  
   prox_sensor_value_V = (float)analogRead(PROX_PIN) *2*  1.46 / 4096;
              int val = (prox_sensor_value_V - MIN_SENSOR_VOLTAGE) * \
    (MIN_SENSOR_DISTANCE_CM - MAX_SENSOR_DISTANCE_CM)\
    / (MAX_SENSOR_VOLTAGE - MIN_SENSOR_VOLTAGE) + MAX_SENSOR_DISTANCE_CM;
  Serial.println(val);

 
  String str = (String)val; 
  int str_len = str.length() + 1;  
  e null terminator)
  char char_array[str_len];   
  str.toCharArray(char_array, str_len); 
  
  
  if (client.connect("LaunchPadClient")) {
    client.publish("outTopic", char_array);
    
    Serial.println("Publishing successful!");
    client.disconnect();
  }

}

void printWifiStatus() {
  
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());


  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);
}

Credits

ketan gupta

ketan gupta

1 project • 0 followers
pursuing btech ECE from VIT University
JYOTI MALIK

JYOTI MALIK

1 project • 2 followers
Thanks to Prof. BalaMurugan MS.

Comments