element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Legacy Personal Blogs Safe & Sound Wearables - Trackable Safety Helmet for Miners #7: Data from Sensor to PC
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: msimon
  • Date Created: 2 May 2017 8:54 PM Date Created
  • Views 722 views
  • Likes 3 likes
  • Comments 4 comments
  • safe and sound
  • safe & sound
  • smart helmet
  • helmet_sensor
Related
Recommended

Safe & Sound Wearables - Trackable Safety Helmet for Miners #7: Data from Sensor to PC

msimon
msimon
2 May 2017

In the last post, I have mentioned the sensor board I built on Arduino. I was testing the system using the serial port and before adding many sensors, I wanted to make the board work independently. Therefore I connect MSP432 and Arduino using the serial port and send the data over WiFi module. I am using TI-RTOS on MSP432 so I add the UART driver to the previous WiFi code. The echoFxn basically echoes the serial data over WiFi. The data is read and assigned to Mymessage variable. Then task sleeps a second.

 

 

Void echoFxn(UArg arg0, UArg arg1)
{
    char input;
    UART_Handle uart;
    UART_Params uartParams;
    const char echoPrompt[] = "\fEchoing characters:\r\n";


    /* Create a UART with data processing off. */
    UART_Params_init(&uartParams);
    uartParams.writeDataMode = UART_DATA_BINARY;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.readReturnMode = UART_RETURN_FULL;
    uartParams.readEcho = UART_ECHO_OFF;
    uartParams.baudRate = 9600;
    uart = UART_open(Board_UART0, &uartParams);


    if (uart == NULL) {
        System_abort("Error opening the UART");
    }


    UART_write(uart, echoPrompt, sizeof(echoPrompt));


    /* Loop forever echoing */
    while (1) {
        UART_read(uart, &input, 10);
        Mymessage =  &input;
        //UART_write(uart, &input, 10);
        //UART_write(uart, "\n\r", 10);
        Task_sleep(10);
    }
}

 

The image below shows how the system can work independently from the computer. The purple box is power bank and distributes power to MSP432 and Arduino via black USB multiport. The image is not clear but this is not final I will try to embed these inside the helmet.

 

image

 

The following C# program gathers the data. It is not my code any TCP application will work for this application. I have my own code but it won't show the raw data. It will show only warnings and general info.

 

image

 

I have ordered an MSP430 for NFC communication. It will control the gate and send data to the computer via serial port. All the information will be seen on C# program. Next, I will work on RSSI strength to track the user and combine that information with the accelerometer.

 

 

You can see all the links related to this project in the first blog: Safe & Sound Wearables - Trackable Safety Helmet for Miners #1: Introduction to Project

 

/*
 * Copyright (c) 2015-2016, Texas Instruments Incorporated
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * *  Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * *  Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * *  Neither the name of Texas Instruments Incorporated nor the names of
 *    its contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */


/*
 *  ======== tcpEchoCC3X00.c ========
 */


#include <string.h>
#include <stdbool.h>


/* XDCtools Header files */
#include <xdc/std.h>
#include <xdc/runtime/System.h>
#include <xdc/cfg/global.h>




/* BIOS Header files */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>


/* TI-RTOS Header files */
#include <ti/drivers/GPIO.h>
#include <ti/drivers/UART.h>


/* SimpleLink Wi-Fi Host Driver Header files */
#include <simplelink.h>


/* Example/Board Header file */
#include "Board.h"


/* Local Platform Specific Header file */
#include "sockets.h"




#include <stdint.h>






/* Port number for listening for TCP packets */
#define TCPPORT         1000


#define TASKSTACKSIZE   1024








/* IP addressed of server side socket. Should be in long format,
* E.g: 0xC0A8000A == 192.168.0.10 */
#define IP_ADDR_Server 0xC0A8000A


extern bool smartConfigFlag;
Task_Struct task0Struct;
Char task0Stack[TASKSTACKSIZE];




Task_Struct taskUARTStruct;
Char taskUARTStack[TASKSTACKSIZE];






/* Globals */


void *netIF;


char connected = 0; // re-connect the AP


char *Mymessage = "elemet14";




/*
 *  ======== echoFxn ========
 *  Task for this function is created statically. See the project's .cfg file.
 */
Void echoFxn(UArg arg0, UArg arg1)
{
    char input;
    UART_Handle uart;
    UART_Params uartParams;
    const char echoPrompt[] = "\fEchoing characters:\r\n";


    /* Create a UART with data processing off. */
    UART_Params_init(&uartParams);
    uartParams.writeDataMode = UART_DATA_BINARY;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.readReturnMode = UART_RETURN_FULL;
    uartParams.readEcho = UART_ECHO_OFF;
    uartParams.baudRate = 9600;
    uart = UART_open(Board_UART0, &uartParams);


    if (uart == NULL) {
        System_abort("Error opening the UART");
    }


    UART_write(uart, echoPrompt, sizeof(echoPrompt));


    /* Loop forever echoing */
    while (1) {
        UART_read(uart, &input, 10);
        Mymessage =  &input;
        //UART_write(uart, &input, 10);
        //UART_write(uart, "\n\r", 10);
        Task_sleep(10);
    }
}










/*
 *  ======== gpioButtonFxn ========
 *  Callback function for the GPIO interrupt on Board_BUTTON1.
 */
void gpioButtonFxn(unsigned int index)
{
    /* Begin smart config process */
    smartConfigFlag = true;
}






int socketHandler=-1;
int status;
char recievedBuff[4];




/*
 *  ======== TCPsend Function ========
 *  It creates socket, send message, receive it
 *  then close the socket
 */






void blink()
{
    /* Turn on user LED */
    GPIO_toggle(Board_LED0);
}








Void TCPSetup(char *message)
{




    while(1)
    {
      if(connected != 1)
      {
          // Open WiFi and await a connection
          netIF = socketsStartUp();


          socketHandler = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);


          /*
           * SL_AF_INET indicates using IPv4
           * SL_SOCK_STREAM indicates using TCP
           * IPPROTO_TCP
           */


          connected = 1;


          if (socketHandler == -1)
          {
             System_printf("Error: socket not created.\n");
             connected = 0;
          }


          SlSockAddrIn_t Addr;  // Socket settings
          Addr.sin_family = SL_AF_INET;
          Addr.sin_port = sl_Htons(TCPPORT);
          Addr.sin_addr.s_addr = sl_Htonl(IP_ADDR_Server);


          status = sl_Connect(socketHandler, ( SlSockAddr_t *) &Addr, sizeof(SlSockAddrIn_t));
      }


      status = sl_Send(socketHandler, Mymessage, 10, 0 );




     // sl_Close(socketHandler);


      Task_sleep(10);


    }
            // Close the network - don't do this if other tasks are using it
            //socketsShutDown(netIF);


}






/*
 *  ======== main ========
 */
int main(void)
{
    /* Construct BIOS objects */
    Task_Params taskParams;


    /* Call board init functions. */
    Board_initGeneral();
    Board_initGPIO();
    Board_initWiFi();
    Board_initUART();




    Task_Params_init(&taskParams);
    taskParams.stackSize = TASKSTACKSIZE;
    taskParams.stack = &task0Stack;
    taskParams.priority = 1;
    Task_construct(&task0Struct, (Task_FuncPtr)TCPSetup, &taskParams, NULL);








    Task_Params_init(&taskParams);
    taskParams.stackSize = TASKSTACKSIZE;
    taskParams.stack = &taskUARTStack;
    taskParams.instance->name = "echo";
    Task_construct(&taskUARTStruct, (Task_FuncPtr)echoFxn, &taskParams, NULL);








    /* Install Button callback */
    GPIO_setCallback(Board_BUTTON1, gpioButtonFxn);


    /* Enable interrupts */
    GPIO_enableInt(Board_BUTTON1);


    /* Turn on user LED */
    GPIO_write(Board_LED0, Board_LED_ON);


    System_printf("Starting the TCP Echo example for the CC3X00 \n"
                  "System provider is set to SysMin. Halt the target to view"
                  " any SysMin content in ROV.\n");


    /* SysMin will only print to the console when you call flush or exit */
    System_flush();


    /* Start BIOS */
    BIOS_start();


    return (0);
}

  • Sign in to reply

Top Comments

  • DAB
    DAB over 9 years ago +2
    Nice update. It looks like you are making good progress. DAB
  • msimon
    msimon over 9 years ago in reply to DAB

    Thanks DAB , I hope I will make more progress this week image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • msimon
    msimon over 9 years ago in reply to balearicdynamics

    I hope so image The problem is development board is a little big to put inside but we will see. I haven't tried yet.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • balearicdynamics
    balearicdynamics over 9 years ago

    Good. I thing it is not too difficult to bednthe studf inside an helmet.

     

    Enrico

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 9 years ago

    Nice update.

     

    It looks like you are making good progress.

     

    DAB

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube