CC3200 HTTP Client Project
This is version 1.4.0 of the CC3200 SDK. Getting Started. To get started using the CC3200 LaunchPad with the Out of Box experience, please see the CC3200 Quick Start Guide. To get started with your project development, please see the CC3200 Getting Started Guide. Bug fixes; Example maintenance and updates. In case user flashed other SDK applications and need to download the out of box content again, follow below steps Open examplesoutofboxhtmloutofbox.ucf session file in Uniflash. Flash the files to the device. Detailed instructions at Uniflash User Guide. For downloading the SimpleLink Wi-Fi CC3200 Software Development Kit (SDK) you need a 'myTI' account which you may create for free. The SDK is a Windows executable which simply installs all the files needed for development on a Windows platform. To be able to use the files on Linux you may either run the SDK installer on a Windows box and copy the directory tree to your Linux system, or you.
http-client C-source code
Project on Hackaday
http_client_demo project - remotely view your CC3200 data and control LED at http://cnktechlabs.com/webapp_pub/grid.php
I have developed a simple web application for the CC3200 development board, an AK9753 Human Presence Sensor Breakout board , and an on-board TMP006 sensor.
The web application displays data collected from all sensors and allows to switch (ON/OFF) the on-board Red LED. I am planning to add more functions to the web application.
Show below is the image of my current circuit wiring diagram. The MB1212 Maxbotix sensors will be used as motion sensors in the project.
The CC3200 LaunchPad development board has an on-board temperature sensor (TMP006-Infrared Thermopile Sensor in Chip-Scale Package) and an accelerometer. Both sensors use I2C bus for data transfer.
A note on the AK9753 sensor
Cc3200 Sdk For Mac Os
The AK9753 is a low power and compact infrared-ray (IR) sensor module. It is composed of four quantum IR sensors and an integrated circuit (IC) for characteristic compensation. The four IR sensors’ offset and gain variations are calibrated at shipment. An integral analog-to-digital converter provides 16-bits data outputs. The AK9753 is suitable for several feet human detector by using external lens.
The AK9753 datasheet link.
Click on the image below to view the web-app:
To run a quick test of the project with your CC3200 development board:
- Download and install the CC3200 SDK on your PC.
- Download C-source code files from the Github. One of the files listed on the Github is a zip file of the CCS project (CC3200_client(CCS-project).zip).
You can download and unzip the file. - Connect CC3200 development board to a computer.
- Open a serial terminal on your PC and Set: COM PORT X, 115200 bps, 8N1, no parity, no flow control.
- I recommend (it is not required) changing the MAC address from a default one. The MAC address will be used as a unique ID number to monitor data sent by your board. To set a new MAC address enter unique values as shown below MAC_Address[0] ... MAC_Address[5]. After the board is programmed you will need to press and hold SW3 and push the Reset button while pressing SW3. Afetr a 10 - 15 seconds you see ' MAC address is set to: XX:XX:XX:XX:XX:XX' printen on a serial terminal:
- Enter your WiFi credentials (SSID name and password) in the common.h file:
- Save your project with the new credentials and compile it.
- Once the project is compiled the 'CC3200_client_web.bin' will be located in the Release folder:
- Program the CC3200 board with the CCS uniflash.
- If you want to change the MAC address from the default one, press and hold SW3 and push the reset button. Keep SW3 pressed untill the new MAC address is set and printed. This may take 15-20 sec
- Write down the number shown below. This is the ID number of your board. You will need it to display your data on the web-page. Conver the HEX value to a decimal and enter it on the web-app page as the ID number:
- Monitor and control CC3200 board from cnktechlabs.com/webapp_pub/grid.php.
- Enter the ID number in a decimal format:
The main.c file:
The buffer 'buf' is loaded below with all the information that will be sent to the cloud:
HTTP POST method is used here to send data to a server to create/update a resource.
Project Details:
The C-source code has beed updated. The new code allows remote control and monitoring of the CC3200 board with AK9753 (Qwiic) sensor connected to I2C port. The SparkFun AK9753 Human Presence Sensor Breakout is a Qwiic-enabled, 4-channel Nondispersive Infrared (NDIR) sensor. The board reports data collected from the AK9753 Human Presence sensor to the grid.php webpage, the onboard TMP006 I2C digital temperature sensor, and current status of the Red LED. The same webpage can be used to turn ON or OFF the onboard red LED. AK9753 is connected to I2C lines on the board - PIN_01 is the SCL and PIN_02 is the SDA. Compile and download CC3200_client.bin file into CC3200 development board. Connect Dev board to a PC. View USB messages on a Serial terminal on your PC. Monitor status of CC3200 sensors and Red LED as well as control the Red LED from cnktechlabs.com/webapp_pub/grid.php webpage.
How the data is transmitted and received over the web:
In the main file there are two functions:
- HTTPPostMethod_data(&httpClient);
- HTTPGetPageMethod(&httpClient);
They are used to transmit data to, and receive data from the grid.php webpage. The first function posts data to the grid.php web-page approximately once a minute.
The second function from the list receives commands from the grid.php web-page every 4-5 seconds.
The data that is sent over the web link is collected in the char buf[99] buffer:
Inside the buffer the data string looks as follows:
IR1=644 & IR2=494 & IR3=410 & IR4=562 & RoomT=22.90 & TName=controllall
The following code snippet reads current state of the Red LED and saves it in the buf buffer.
Once all data is collected it is sent over the Wi-Fi link.The HTTPPostMethod_data will send data:
static int HTTPPostMethod_data(HTTPCli_Handle httpClient);
Inside the HTTPPostMethod_data funtion HTTPCli_sendRequest will built a HTTP request:
lRetVal = HTTPCli_sendRequest(httpClient, HTTPCli_METHOD_POST, POST_REQUEST_URI, moreFlags);
lRetVal = HTTPCli_sendRequestBody(httpClient, buf, (sizeof(buf)-14)) function will send data saved in buf over the web.
The data is also streamed over the USB cabel to a local PC:
Project Start:
Recently I 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 a code that will connect CC3200 wireless MCU board 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.
The 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 up to 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 php code for the get.php page.
To get a response from a web page with the PHP code shown above I send the following string (main.c):
This is how I send a request to www.cnktechlabs.com/get.php file:
GET(parameters) -----------------------> www.cnktechlabs.com/get.php?id=goodbye&mode=run'
The web page get.php receives the data sent by the http client (CC3200 development) board and echoes it back.
Response from www.cnktechlabs.com/get.php file:
CC3200 (the response is printed on a serial interface) <---------- www.cnktechlabs.com/get.php
Response from the server printed on a serial terminal:
As you can see from the above printout the get.php page replies with page content that includes punctuation marks and html tags.
Using the GET method from the http_client_demo.c code example:
The data is appended to the URL as a series of name/value pairs. After the URL web address has ended, we include a question mark (?) followed by the name/value pairs, each one separated by an ampersand (&).
Image below shows the response from the get.php webpage printer on 'Termite' serial terminal.
As you can see from above image the get.php responds with html tags and text inside the tags, as well as text echoed from the PHP code.POST method
A POST request passes parameters in the body of the HTTP request, leaving the URL untouched. I have uploaded the following file to my server - www.cnktechlabs.com/post.php:
post.php
The POST method implementation with CC3200 Code:
Server response:
Hi Mom
The next step is to collect and send some data to a webpage. I have created post.php and data.html webpages to collect and display data. The 'post.php' file shown below is responsible for reading data from the CC3200 board.
main.c:
HTTPPostMethod_data function, shown below, will send temperature, accelerometer, and location data to the post.php file.
Below is the result I can view on my data.html webpage.
Image of the serial print out on the Termite Terminal
Below is the result I can view on my data.html webpage.
A new hardware addition to the project - Light Sensor
Light Sensor senses ambient light and transmits messages to the web page. The data out, DO, pin of the sensor is connected to GPIO_03, PIN_58 on the development board.
Current Project Circuit Diagram
Project Source Code
Settings for the serial port: 115200, 8N1, no handshake.
Enter PASSWORD and SSID name in the 'common.h' file
Change location (strPtr = ' & loc=Los Angeles 0'; // Your location.) to your geographical location in the source code main file.
Flush the project into your CC3200 board, and view the results on the www.cnktechlabs.com/data.html. Connect CC3200 to a serial terminal on your PC.
Reset the board.
To enter password and SSID name either:
Press and hold SW2 and reset the board
On prompt 'Enter Password' enter WiFi password
On prompt 'SSID name' enter WiFi name.
Or just reset the board and the common.h credentials will be used.
NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
Overview[edit]
CC3200 Antenna Selection is method by which user can configure the WLAN RF Antenna on the CC3200 device from a Browser. The CC3200 device scans the Access Points with 2 different Antennas, stores the SSID and RSSI information in the memory and create an HTML page. User can open the HTML page and select the Antenna which he/she wants to configure. Also user can check the connection to the Access Point using the selected Antenna.
Prerequisites[edit]
- CC3ANTENNABOOST (also known as CC31xx_antenna_diversity_board)
Usage[edit]
- Flash Example Content(html,image,js,Application binary)on serial flash by following below steps.
- If CC3200 SDK is installed at default location C:tiCC3200SDK
- Open C:tiCC3200SDKcc3200-sdkexampleantenna_selectionhtmlantenna_selection.ucf session file in Uniflash.
- Flash the files to the device. Detailed instructions at Uniflash User Guide.
- If CC3200 SDK is not installed at default location C:tiCC3200SDK
- Open <cc3200-sdk>examplesantenna_selectionhtmlantenna_selection.ucf session file in Uniflash.
- Modify Url for all the files in the list.
- Flash the files to the device. Detailed instructions at Uniflash User Guide.
- If CC3200 SDK is installed at default location C:tiCC3200SDK
- Run the reference application
- Run From IDE (IAR/CCS)
- Make the Board Modification as mentioned in the following section.
- Open the Project as mentioned in the <cc3200-sdk>docsCC3200-Getting Started Guide.pdf
- Build and download the application to the board
- Run Flashed Binary
- Remove SOP-2 Jumper on Board and Press Reset. Refer <cc3200-sdk>docsCC3200-Getting Started Guide.pdf for detailed Information
- Make the Board Modification as mentioned in the following section.
- Run From IDE (IAR/CCS)
- CC3200 Device first comes up in STA mode, scans for visible access-points. Next, it restarts and comes up in AP mode (Default SSID: mysimplelink-<MacAddr>)
- User connects his/her WIFI enabled device PC/MAC/Smartphone to above AP
- Type 'mysimplelink.netmain.html' in browser. it will Open CC3200 Main HTML Page
- Click/Press on Antenna Selection which will open the Antenna Selection page as shown in picture below
- Antenna Selection page displays the list of the Access Points SSID and RSSI with 2 different Antenna
- User select the AP by clicking on the Radio Button
- User also need to provide Security Type, Security Key and Profile Priority in the corresponding fields
- User clicks Add Button
- Device then switches to Station Mode and connects to the selected AP
- After the Connection is Successful or Failed, Alert Message is Displayed
Board Modifications[edit]
Below modifications are required on CC3200-LP for working with CC3ANTENNABOOST
- Unmount R111 & Mount R110
- Connect the U.FL connectors, J18 on Launch Pad to J19 on Antenna Board with U.FL-U.FL connector cable.
- Stack the Launch Pad and Antenna Board as shown in the picture below
Source Files briefly explained[edit]
- main.c
- Select Antenna 1
- Scans and Stores AP information
- Select Antenna 2
- Scans and Stores AP information
- Handles HTTP GET request to provide AP List
- Handles HTTP POST request to receive command to connect to AP with Selected Antenna
- Connection to the selected AP
- startup_ewarm.c
- Implements interrupt vector table when using IAR ewarm tool chain
Note: This example can be used either on TI-RTOS or FreeRTOS.For the application to work with TI-RTOS, ti_rtos_config project need to be imported into the application workspace. These projects can be found in CC3200-SDK under ti_rtos folder. Please follow this link for CC3200 TI-RTOS usage CC3200 TI-RTOS
Limitations/Known Issues[edit]
- Only 5 APs are displayed
- Duplicate SSIDs are displayed when the SSID has multiple BSSIDs
- During Connection Status Check, User Device PC/MAC/Smartphone might connect to different AP, User need to reconnect to the SimpleLink AP Again
Links[edit]
Cc3200 Sdk
{{#invoke: Navbox | navbox }}{{#invoke: Navbox | navbox }}
{{
Please post only comments related to the article CC3200 Antenna Selection Application here. | Keystone=
Please post only comments related to the article CC3200 Antenna Selection Application here. | C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article CC3200 Antenna Selection Application here. | DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article CC3200 Antenna Selection Application here. | MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article CC3200 Antenna Selection Application here. | OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article CC3200 Antenna Selection Application here. | OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article CC3200 Antenna Selection Application here. | MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article CC3200 Antenna Selection Application here. | For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article CC3200 Antenna Selection Application here. }} |
Links | |||
|