Snap4All IOT Button: based on ESP32, NGSI compliant secure connection

Primary tabs

Snap4All IOT Button Version 3 is based on ESP32: it is an NGSI devices, which can be customized to be compliant with other IOT protocols as well. It is a secure device with Mutual authentication and secure encrypted connection.

   

Once you have registered and configured can connect them by using MicroService Node/block in IOT Application by using:

If the connection succeed you can:

  • go on Dashboard Wizard to create a new Dashboard rendering the values received from your Snap4City IOT Button
  • go on IOT Applications to create a flow and application reacting to the commands you are sending by pressing the buttons. Commands can activate any activity on Snap4City IOT Applications: sending email, sending SMS, notifications, acting on Dashboards, communicating with other applications, changing messages on some virtual panels, sending the alarm to get help, etc. Have a fun and enjoy the Snap4All button.

We suggest to use 2 AAA Energizer® Ultimate Lithium™ batteries for longer lifespan and range: http://www.energizer.com/batteries/energizer-ultimate-lithium-batteries 

User Guide

As a first step we suggest you to be registered on Snap4City Portal in the role of Manager or upper. As a Manager, that is the first level of users in Snap4City, you can register your IOT Devices and also Snap4All IOT Buttons.

    • Go on IOT Directory and Devices and click on button "Add New Device" on top of the page, to register the New Device, please use the model "Snap4AllButtonV1".
    • Then provide the needed information, such as a name you would like to assign to it and the typical GPS position. Thus the system will provide you
      • Broker URI, will be requested during the setup of Arduino in the next steps
      • Both Protection approaches (you have to provide them during the registration one of them), and you can have to chose:
        • K1 and K2 and SHA, or
        • Certificate and the Private Key. Clicking on "Private Key" and "Certificate" two files will be downloaded. We suggest you to move them to a folder, where you can save the other informations by copy past in a file
          You can get this information at any time from the list of your devices (IOT Directory and Devices  My Devices) by clicking on the "+" corresponding to the device you registered. In case of large number of devices, search for the name you assigned.
          The Snap4All IOT Button device operates in two different modalities:
    • Setup: that permits to configure your device;
    • Operative: that permits to use your device to send information to the Snap4City platform.
      It’s always needed to Setup your device before starting the Operative modality
      As a second step you have to SETUP the button in the hands:
  • Press any buttons for a while, until the led starts blinking in , thus entering in the Setup mode. (please note the if the Button has been partially configured you have to press both buttons at the same time for a while to enter in setup)
  • After few seconds, an Access Point will be created. (the figure in the following is showing the case in which an initial configuration is performed, while that on right is presenting the case in which a second Wi-Fi network is added. It can keep up to 5 Wi-Fi networks)
    …       …     
    As a third step, we suggest you to use a PC (or use your smartphone) to connected to the WiFi created above.
  • The Access Point of the Snap4All IOT Button can be easily recognised since it is going to have "Snap4All" in the AP name, the so called SSID. The AP name will also include a ID code segment of the Snap4All IOT Button. Every Snap4All IOT Button has an identifier printed in the back. The unique identifier is composed by 5 segments: the first one is used for identification (e.g. In Access Point name) and the last 2 segments (dash included) form the default password.
  • Please connect to the WiFi AP of the Snap4All IOT Button and use as a password the last two segments of the identifier, such as "XXXX-YYYY". When you are connected to the button's AP, you will not be entitled to go on Internet, but you can get connection with the Snap4All IOT Button by using your browser and going to . The device will remain in this state for 4 minutes, after which it will switch off automatically.
  • The WiFi AP of the Snap4All IOT Button web page  for Setup mode will present a form to fill in:
      • WiFi-SSID: (write here the Access Point SSID of the WiFi that the button has to use to connect with Internet in operative mode). You can choose it from the options proposed in the dropdown field where the nearby connections are shown or write it manually.
      • WiFi-PSW: (write here the Access Point password of the WiFi that the button has to use to connect with Internet in operative mode). If your WiFi network needs to control/register the MAC address of all devices for security reason, the MAC address of the button is provided in the same page.
      • Device Type: (write here the Device Type you gave to your button during the registration of the button on Snap4City IOT Directory). If left empty, this field will be set to default (Snap4AllButtonV1).
      • IOT Device ID: (write here the name you gave to your button during the registration of the button on Snap4City IOT Directory).
      • Service Broker URI: (write here the Service Broker URI that Snap4City IOT Directory has provided to you on "+" information of your button, once completed the registraton of your button). The URI provided should be one using HTTPS secure protocol.
      • Broker URI Port: (write here the Broker URI Port that Snap4City IOT Directory has provided to you on "+" information of your button, once completed the registration of your button).
      • SHA thumbprint: (write here the value SHA that Snap4City IOT Directory has provided to you on "+" information of your button, once completed the registraton of your button).
      • Security level: select one of the two options (K1&K2 or Certificate&Key) to adjust the desired security level. Depending on your choice, a different menu will be shown.
        • K1, K2: (write here the values of K1, K2 that Snap4City IOT Directory has provided to you on "+" information of your button, once completed the registraton of your button).
        • Certificate and Key: (upload here the Certificate and Key that Snap4City IOT Directory has provided to you on "+" information of your button, once completed the registraton of your button).
  • Once completed all fields, click "Save" to save them and start using the button.
  • Clicking on cancel at any time the device will be turned off and no information will be saved.

After clicking "Save" the device will switch to Operative mode

As final step, you can use it performing different types of pressure:

    • press (1) of squareButton - associated color: yellow.
    • press (1) of roundButton - associated color: orange.
    • double press (2) of squareButton - associated color: fuchsia.
    • double press (2) of roundButton - associated color: purple.
    • long press (3) of squareButton - associated color: blue.
    • long press (3) of roundButton - associated color: aqua.
    • long press (3) of squareButton and simultaneously long press (3) of roundButton. Enters the setup mode.
    •  

The same Access Point described in the third step will be created and you can access it following the same instructions. Going to  a slightly different page will be shown. On top there will be a recap of the previously inserted parameters. Under "Saved Connections" will be listed all the saved connections by the user, selecting one of them and clicking on "Delete" it will be erased from memory and the AP will be shut down. Again, the fields WiFi-SSID and WiFi-PSW, described before, will allow you to add a new connection. Note that in case of multiple connections the device will choose the strongest one. Just like before, clicking on "Cancel" the device will be turned off and no information will be saved. Last but not least, clicking on the "Reset" button all the saved informations will be erased, included the security credentials. A confirm check will precede the operation, giving you the opportunity to prevent this from happening by mistake. After a reset, each pressure will activate the setup mode to let you provide a new configuration.

  • In the first 6 cases the operation of sending the data will be highlighted by the following sequence of colors:
    1. The first long blink, which color depends on the pressure type e.g. press of squareButton  yellow, means that the device is trying to connect to one the WiFis provided by you before in Setup.
    2. A green or red blink will follow to report the outcome of the operation.
    3. The second long blink, which color depends on the pressure type e.g. press of squareButton  yellow, means that the device is trying to send the signal to the server.
    4. A green or red blink will follow to report the outcome of the operation.
    • Wait for 15/30 seconds before performing a new sending.

In case of no blinking appear after several tries, please replace the batteries: remove the old batteries, press the buttons repeatedly for a few seconds to discharge the capacitors and finally replace the new ones.

Developer Guide

:

  • Download the last version of the Arduino IDE.
  • Run Arduino IDE.
  • In Preferences > Additional Board Managers URLs add the link
  • In Tools > Board > Board Manager search esp32 and install the board manager by Espressif System.
  • In Tools > Board select the board NodeMCU-32S.
  • In Tools > Board apply the following (default) settings:
    • Upload Speed: 921600.
    • Flash Frequency: 80MHz.
    • Programmer: AVRISP mkll.
  • In Sketch > Include library search and install NeoPixelBus by Makuna.

:

  • Connect the FTDI programmer to the IoT button as shown below. Depending on the programmer that you have
  • Titolo: fig: