IEEE P21451-1 Smart Sensor Network

Brian Finch, Eric Guidarelli, Keith Hall, Jacob Harris, Anas Muhamed, Matt Oldland, Nick Parisi, Tom Stoudt


Unsplashed background img 1
reorder

About This Project

The P21451-1 Standard defines a set of common network communication protocols for IEEE 1451 smart transducers and has five main services that are illustrated in the table below: Identification, Transducers Access, Transducer Electronic Data Sheet (TEDS) Access Services, Event Notification, and Transducer Management Services. The network also identifies protocols and performs other services. The basis of the standard defines the communication between clients, servers, and transducer interface modules (TIMs). The primary communication method used in this project were XMPP (Extensible Messaging Presence Protocol) for communication between the NCAP Client and NCAP Server, and UART (Universal Asynchronous Receiver/ Transmitter) for communication between the NCAP Server and the TIM. Previously, UDP communication was used for as the basis for all communication between the nodes of the network, however, this communication method was slower and required all the nodes to be connected on the same router of a local network. Using XMPP, the nodes of the network do not have to be connected to the same network as each other as the nodes are connected onto the internet

P21451-1 Services and Example Code

  • contactsIdentification Services

    The process in which the client, servers, and TIMs discover and establish communication between each other.

    def Server_init
      NCAPServerRegister()

    def Server_down
      NCAPServerUnRegister()

    def Server_main

      msg = Parse(rawmsg,',', ';')

      if msg[0] == '713'
        NCAPServerDisocery()
      elif msg[0] == '714'
        NCAPTIMDiscovery()
      elif msg[0] == '715'
        NCAPTransducerDiscovery()
      elif msg[0] == '716'
        NCAPClientJoin()
      elif msg[0] == '717'
        NCAPClientUnJoin()

    def NCAPServerRegister
      msg = '711,' + ServerID + ',' + ServerName + ',' + ServerIP
      xmpp_send(ClientIDGroup, msg,type = 'All')

    def NCAPServerUnRegister
      msg = '712,' + ServerID
      xmpp_send(ClientIDGroup, msg,type = 'All')

    def NCAPServerDiscovery(msg)
      msg[1] == ClientID
        reply = '0,' + ServerID
        xmpp_send(ClientID,reply)

    def NCAPTIMDiscovery(msg)   if msg[1] == ClientID     reply = '0,' + NumTIM + ',' + TIMID     xmpp_send(ClientID,reply)   else     reply = '1'   xmpp_send(ClientID,reply)
  • equalizerTransducer Access Services

    The process in which data is read from the transducer and conveyed to the client from the server.

    int ServerID = '1';

    def Server_main

      msg = Parse(rawmsg,',', ';')

      if msg[0] == '721'
        ReadTransducerSampleDataFromAChannelofTIM()
      elif msg[0] == '722'
        ReadTransducerBlockDataFromAChannelofTIM()
      elif msg[0] == '723'
        ReadTransducerSampleDataFromMultipleChannelsofTIM()
      elif msg[0] == '724'
        ReadTransducerBlockDataFromMultipleChannelsofTIM()
      elif msg[0] == '725'
        ReadTransducerSampleDataFromMultipleChannelsofMultipleTIM()
      elif msg[0] == '726'
        ReadTransducerBlockDataFromMultipleChannelsofMultiplesTIM()
      elif msg[0] == '727'
        WriteTransducerSampleDataFromMultipleChannelsofTIM()

    # Reading Transducer sample data from a single channel of single TIM
      def ReadTransducerSampleDataFromAChannelofTIM(msg)
        if msg[1] == ServerID
          TIMID = msg[2]
          ChannelID = msg[3]
          Timeout = msg[4]

          #Poling TIM for data
          if ChannelID == 1
            UART_send(TIMID,Channel1,'721')
            SampleData = UART_Rec(TIMID,Channel1);
          elif ChannelID == 2
            UART_send(TIMID,Channel2,'721')
            SampleData = UART_Rec(TIMID,Channel2);

          reply = '0,' + ServerID +',' TIMID + ',' + ChannelID + ',' SampleData
          xmpp_send(ClientID,reply)
        else
          reply = '1,' + ServerID
          xmpp_send(ClientID,reply)

    #End
  • devicesTEDS Access Services

    The process in which the client/servers read and write from the TEDs of the transducer.

    def Server_main

      msg = Parse(rawmsg,',', ';')

      if msg[0] == ’ 732 ’
        ReadTransducerChannelTEDServices()
      elif msg[0] == ’ 7312 ’
        ReadWriteTransducerChannelTEDSServices()

    def ReadTransducerChannelTEDSservices
      if msg[1] == ServerID
        TIMID = msg[2]
        ChannelID = msg[3]
        Timeout = msg[4]

        #Message to be sent to the TIm
        TimMSG = '732,' + ChannelID

        #Sending request to TIM
        UART_send(timId,ChannelId,TimMSG)
        TEDS1 = UART_Rec(TIMId,ChannelId) # Receives the TED information

        reply = '0,' +TEDS1
        xmpp_send(ClientID,reply)
      else
        reply = '1,' + ServerID
        xmpp_send(ClientID,reply)
  • feedbackEvent Notification Services

    The process in which a client is alerted by a server that a new TIM has been connected/ disconnected to the network. The client is then alerted when a sensor alert has occurred.

    def Server_main

      msg = Parse(rawmsg,',', ';')

      if msg[0] == '743'
        SubscribeSensorAlert(msg)

    # Client Subscribes to a Sensor Alerts-----------------
    def ReadTransducerSampleDataFromAChannelofTIM(msg):
      if msg[1] == ServerID
        TIMID = msg[2]
        ChannelID= msg[3]
        Threshold = msg[4]
        Subscriber = msg[5]

        SubscriptionID = 1;

        reply = '0,' + ServerID +',' SubscriptionID
        xmpp_send(ClientID,reply)
    #-----------------END------------------------------

    def NotifySensorAlert:
      Alert = UART_Rec(TIMID,)
      TIMAlert = Parse(Alert',', ';')
      Data = TIMAlert[0]
      AlertType = TIMAlert[1]
      reply = '0,' + ServerID +',' TIMID + ',' + ChannelID + ',' + Data + ',' + Subscriber+ ',' + SubscriptionID +',' + AlertType
      xmpp_send(Subscriber,reply)

    #-----------------END--------------------------------

Hardware Implementation

Raspberry Pi’s were used to emulate the client, server, and TIM using the Raspian operating system and the internal Idle python compiler. A sensor was connected to a TIM; this sensor was used to measure room temperature; this data was sent to the client through the server. The TIM also had a fan and a light attached to it as well, to serve as model actuators. The fan and light could be controlled by the client. The client would send a request to the sever to turn the fan or light on or off. The server will then communicate with the TIM by using UART.


Client Side Communication

An android application written in Java to be used as the client side of the smart sensor network model and communicated between the client and server with XMPP commands to request transducer information or control.

The Android XMPPconnection library, Smack, was used throughout the application to connect to the server and send and receive messages. The library allows you to specify the XMPP server, the port we are communicating on, and gives presence of who else is connected to the server

The Android GUI allows the user to issue commands via XMPP to the NCAP server. The commands, which are in the standardized message structure, are sent to the XMPP server. The NCAP server is listening to the message log on the XMPP server and parses each command, and sends the proper

Want More?

Thanks for reading! If you enjoyed that or are looking for more check out the three poster presentations by clicking on the red icon on the bottom left.