Carlos Ventura
Published

Connect Your Home Automation Products to the Cloud w/ CC3200

Full instructions provided2,589
Connect Your Home Automation Products to the Cloud w/ CC3200

Things used in this project

Hardware components

CC3200-LAUNCHXL SimpleLink CC3200 Wi-Fi LaunchPad
Texas Instruments CC3200-LAUNCHXL SimpleLink CC3200 Wi-Fi LaunchPad
×1
DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (4 pins)
×1
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1
Male/male jumper wires & male/female jumper wires
×1
Breadboard (generic)
Breadboard (generic)
×1
Resistor 4.75k ohm
Resistor 4.75k ohm
×1

Story

Read more

Code

code.txt

Plain text
#include <SPI.h>

#include <WiFi.h>

#include <WiFiClient.h>

#include <dht.h>

code.txt

Plain text
WiFiClient client;

code.txt

Plain text
// Your network name also called SSID

char ssid[] = "yourNetworkName";

// your network password

char password[] = "password";

// your network key Index number (needed only for WEP)

int keyIndex = 0;

code.txt

Plain text
char * server_name = "www.dweet.io";

#define thing_name"yourThingName"

code.txt

Plain text
int motion = digitalRead(8);

Serial.println(motion);

code.txt

Plain text
float temperature, humidity;

if (dht::readFloatData(10, &temperature, &humidity, false) == 0)

{

Serial.print("T: ");

Serial.print(temperature);

Serial.print(" H: ");

Serial.println(humidity);

}

code.txt

Plain text
if (client.connect(server_name, 80)) {

Serial.println("Connected");



Serial.print(F("Sending request... "));



client.print(F("GET /dweet/for/"));

client.print(thing_name);

client.print(F("?temperature="));

client.print(temperature);

client.print(F("&humidity="));

client.print(humidity);

client.print(F("&motion="));

client.print(motion);

client.println(F(" HTTP/1.1"));



client.println(F("Host: dweet.io"));

client.println(F("Connection: close"));

client.println(F(""));



Serial.println(F("done."));

}

code.txt

Plain text
Serial.println(F("Reading answer..."));

while (client.connected()) {

while (client.available()) {

char c = client.read();

Serial.print(c);

}

}

Serial.println(F(""));

Github

https://github.com/MORA99/Stokerbot/tree/master/Libraries/dht

Github

https://github.com/openhomeautomation/cc3200-home-automation

Credits

Marco Schwartz

Posted by Carlos Ventura

Comments

Add projectSign up / Login