close-circle
Close
0%
0%

WEB IOT. Monitor Data Remotely - Simple

Internet-Of-Things open project - connect to the web and monitor data remotely with CC3200. Open source code and web support.

Similar projects worth following
close
Building an IOT device with CC3200 wireless MCU. Detailed instructions on how to send data over the network.

The shortcut - To test the IOT project:

  • Install CC3200 SDK
  • Download files from Github
  • Import project files into CCS workspace.
  • Enter your WiFi credentials in common.h (optional). 

Another way to enter credentials is to Press and hold SW2 button and reset the board. On prompt "Enter Password" enter WiFi password. On prompt "SSID name" enter WiFi name

  • Change location (strPtr = " & loc=Los Angeles \0"; // Your location.) to your geographical location in the source code main file.
  • Flush the code. 
  • Go to www.cnktechlabs.com/data.html and view the results in real time. (if needed I can add an additional page)

Project in details:

The project is being developed with  SimpleLink WiFi CC3200 LaunchPad. The LaunchPad board includes a wireless microcontroller (CC3200) as well as a temperature sensor and an accelerometer. The temperature and accelerometer data is collected and sent over a WiFi link to my webpage (www.cnktechlabs.com/data.html). The data.html web page is opened for anyone . 

Additional hardware - a Light Sensor Board, used to send signal if light is ON/OFF in the room.


Recently I have started tinkering with the http_client_demo CC3200 example project. The code demonstrates different HTTP web services methods: like GET, POST, PUT, and DELETE. My goal is to write code that will connect to my website and send temperature and accelerometer data over the internet. I am going to start with the GET method and then continue with the POST method.

GET method

The GET method sends URL page as well as data in a single string. The page and the encoded information are separated by the ? character.  http://www.cnktechlabs.com/get.php?name1=value1&name2=value2 The text that follows the ? is the query string. The GET method is restricted to send upto 1024 characters only. To test the GET method I have created and uploaded /get.php PHP file to my website (www.cnktechlabs.com/get.php). String sent by CC3200 to www.cnktechlabs.com"www.cnktechlabs.com/get.php?id=goodbye&mode=run" Below is the code code for the get.php page (this code is uploaded to my website and for your information only):

get.php page code
<html>
<head><title>PHP Get Results</title></head>
<body>
    <?php
        //This message is echoed back to CC3200 board 
        echo "Hello CC3200, reading GET page \n\r";
        // Show all URL parameters (and all form data submitted via the 'get' method)
        foreach($_GET as $key=>$value){
            echo $key, ' => ', $value; //Echo back to CC3200 the received data.
            echo"\n\r";
        }
        // Show a particular value.
        $id = $_GET['id'];
        echo"\n\r";
        
        if($id) {
            echo '<p/>ID: ', $id, "<br/>n";
            echo"\n\r";
        }
        else {
            echo '<p>No ID parameter.</p>';
        }
        //http://www.cnktechlabs.com/get.php?id=goodbye&mode=run 
    ?>
</body>
</html>

The printout on Termite serial terminal looks as follows:


As you can see above, the get.php page sends back all the file content including html tags and text punctuation. 

To get response from the PHP code shown above, I send the following string (main.c):

#define GET_REQUEST_URI    "/get.php?id=goodbye&mode=run"    //the text that follows the ? is the query string
#define HOST_NAME    "cnktechlabs.com"

Request to www.cnktechlabs.com/get.php:
GET(parameters)----------------------->www.cnktechlabs.com/get.php?id=goodbye&mode=run"

The two parameters, id=goodbye&mode=run,  are received and processed by the following PHP code  (this code is uploaded to my website and for your information only):

foreach($_GET as $key=>$value){
    echo $key, ' => ', $value; //Send back to CC3200 the received data.
    echo"\n\r";
}
$id = $_GET['id'];//id=goodby
...
Read more »

Adobe Portable Document Format - 141.32 kB - 09/13/2017 at 17:06

eye
Preview
download-circle
Download

  • 1 × SimpleLink Wi-Fi CC3200 LaunchPad The SimpleLink™ Wi-Fi® CC3200 LaunchPad™ development kit (with QFN-packaged device) is an evaluation development platform for the CC3200 wireless microcontroller (MCU), the industry’s first single-chip programmable MCU with built-in Wi-Fi connectivity. The board features on-board emulation using FTDI and includes sensors for a full out-of-the-box experience. This board can be directly connected to a PC for use with development tools such as Code Composer Studio™ Cloud integrated development environment (IDE) and IAR Embedded Workbench. Visit dev.ti.com and get started with your SimpleLink Wi-Fi CC3200 LaunchPad kit today.
  • 1 × LDR Light Sensor Board

  • Ambient Light Sensor

    Roman5 days ago 0 comments

    I have connected an ambient light sensor to PIN58 of the CC3200 board:

    The sensor board circuit diagram:

    I have created a web page for the light sensor board, you will find additional information here.

View project log

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates