The Digi-Key IoT Studio provides a new method for prototyping IoT applications without the need for learning about device specifics or even having any prior knowledge on writing code. In this How-to, we will look at some of the different elements available for the Huzzah32 (and most standard IoT devices).
There are many elements to choose from in the Digi-Key IoT Studio, and there are elements for devices, the application, and the cloud functions, but in this How-To, we will only be looking at Device elements and what they do.
This element is used for configuring the characteristics of the Bluetooth connection. Characteristics that can be changed include the UUID, Service UUID, the ability to read/write, the type of data that is read, and the type of data that is written.
The BLE Connection element is used for creating Bluetooth connections, and this element will be critical when connecting our device to the Digi-Key IoT Studio system (so that we can view live data from the device). This element includes properties such as the pairing type and the passkey, and it behaves similarly to the Wi-Fi Connection element (connected, disconnected, etc.).
This element is used to trigger events and actions when a cloud command is received. For example, the cloud could be programmed to read data from other devices and then combine this data to produce a result (such as light switch press detection). Then, when the combined result reaches the desired value, the cloud can send a command to a device to perform an action.
The Cloud Event element is used to send events to the cloud. For example, an ADC pin can be read at specified intervals, and then the value of the ADC can be sent to a Cloud Event element to send the data to the cloud.
The function element itself can be used with the code editor to create custom functions. This is something that only advanced users, who have knowledge and experience in microcontroller coding, should use.
This element is used to interact with the GPIO pins on your selected device. This can be used to configure GPIO, read GPIO, and write to GPIO.
This element is used to read from analog input pins. The output of this element is an unsigned integer, so be sure to check that the elements read from this are treating the data as an unsigned integer.
This element is used to create a PWM signal on the chosen GPIO pin with a set frequency and duty cycle. The duty cycle can be changed with other connected elements (such as Variable elements).
The UART element is used to send and receive data over the inbuilt UART connection. The element itself can be used to change the baud rate while elements that connect to it can trigger sending data or read data.
The interval element is similar to a timer that triggers connected events after a certain interval. The length of the interval can be adjusted, and this element is one of the most commonly used elements, as it can be used to dictate timed events.
The comparison element is used to perform a comparison between a piece of data and some constant. The comparison element is capable of comparing both numbers and strings and is useful in applications such as thermostats, monitors, and control systems. Conditions that cause a trigger include equal, less than, and greater than.
The Type Conversion element is used to convert one type of data into another. For example, if a number is to be sent over UART, but instead of sending a binary number, a string is desired, this element can be used to do this task.
This element is used to perform math operating onto the element that connects to this element. For example, a variable can have its value increased or decreased by a constant when some event is triggered.
The Variable element is used to define and store a variable. The variable can have a unique name assigned to it and all instances of that name refer to that variable. Variables can have values assigned to them, and their values can be retrieved for use in other elements (such as sending to the cloud and performing mathematical operations).
The Regular Expression element is used for string comparisons (based on the Python RE command) including matches for characters, patterns, exact matches, and parsing. This is a complex element that should be used only by more experienced users.
This element can be used to send debug messages over the UART port for reading on a computer. This element will only be useful during the prototype stage where the IoT device under development is connected to a computer that both recognizes the device and has a virtual COM port that can be used to read the serial device from the IoT device.
The Wi-Fi element is used to connect and disconnect from a specified Wi-Fi network. Properties that can be changed include the SSID and password, while events can be triggered upon a successful connection or disconnection.
Application logic elements are used to create the app’s core. These elements include timers, averaging, web communications, and conditions.
The NFC element is used for “Near Field Communication” -- a common short-range radio technology. Contactless debit cards, which are used to speed up a payment process, generally for small transactions, are just one example of widespread NFC technology. The NFC element can perform many tasks, including reading metadata, and emptying records.
The buffer element is used to hold values in a stack, which can be retrieved later. The buffer element can have its index changed so that any element can be selected, have values pushed to it, have values pop from it, be spliced, and cleared. In cases where an internet connection may not be available, the buffer element is very useful.
The average element is used for averaging samples, such as data from a sensor. This element is similar to the buffer in that values can be pushed to it. However, the average element can have a set sample size, meaning that new data being added to the average element will remove old data, which ensures you have an up-to-date averaged value.
The condition element simply compares the input to a condition, and if that condition is met, the elements connected to the condition are triggered.
The “ForEach” element is a classic function that is often used in typical programming. The element is a loop function that typically takes all of the values in a buffer element and then iterates through each value. From there, each value can be passed into other elements for processing. An example of this would be sending each value to the cloud when an internet connection has been established to publish new sensor readings.
The interval element fires repeatedly after a predetermined time interval and is useful for frequently checking on data. For example, it is needed when reading up-to-date information from a Bluetooth element.
The “WebLink” element is used to open the user’s browser and navigate to a specified web page. This can be useful for “about” buttons and other buttons that open website pages.
The “WebIO” element is a fairly powerful element that gives your application the capability to interact with websites via GET and POST HTTP commands. A webpage can be obtained using this element, or data can be submitted to a PHP page, which can be further processed.
Cloud elements are used to interact with the cloud service provided by Digi-Key IoT. This is important if you want to have dashboards capable of showing data on graphs, charts, and other GUI elements.
The “CloudEvent1” element is used to send events, which can have values attached to them, to the cloud. For example, a cloud event can be triggered on an interval whereby sensor data in a buffer can be sent for display on a chart.
The “CloudCommand” element makes it possible for commands to be sent by the cloud to an application. It can be used to trigger other actions, get variable data, change the state of GUI elements on the application, and much more!