Datacake Docs
  • Welcome
  • Get Started
  • Changelog
  • Best practices
    • Best practices: Getting started
    • Best practices: Resolution (Timeframe)
    • Best practices: Dashboards
    • Best practices: Reports
    • Best practices: Grouping Devices
  • Datacake LNS
    • Getting Started
    • Gateways
      • Milesight LoRaWAN Gateway - UG6x
      • RAKwireless WisGate Edge Light 2
    • Devices
    • Add Devices without Gateway
  • Device
    • Product
    • Configuration
    • Claiming
    • Historical Data
    • Database
      • Configuration Fields
      • Fields
        • Manual input
        • Field Roles
        • Formulas
        • Mapping Fields
      • Data retention & Datapoints
      • Examples
        • Mapping 4-20mA Signals
        • Converting Units
  • Dashboards
    • Global Dashboards
      • Setting Homepage
    • Device Dashboards
    • Multi-Device Dashboards
    • Widgets
      • Value Widget
      • Chart Widget
      • Image Map
      • Map Widget
      • Text Widget
      • SOS Widget
      • Boolean Widget
      • iFrame Widget
      • Downlink Widget
      • Set Value Widget
      • Measurement List Widget
      • Heatmap Widget
      • Table Widget
      • Image Widget
  • Portal
    • Multi-Tenancy (Workspaces)
    • Reports
      • Energy Report
    • Administrators
    • Members
      • API Users
    • Security & Privacy
    • Billing
      • Support Packages
      • VAT Exemption / Tax ID
      • SMS Credits
      • Access Invoices
      • Unused time and Remaining time in Invoices (Prorations)
      • Codes
    • White Label
    • Rules
      • Legacy Rule Engine
        • Sending notifications via Telegram
      • New Rule Engine
        • Rule Engine Table Overview
        • Copy/Paste and Template Functionality
        • Advanced Rule Engine E-Mail and Webhook Templates
        • Time Restrictions
    • Zones
  • Cake Red
    • Get Started
    • Overview
  • LoRaWAN
    • Get Started
      • CSV Import
      • Custom LoRaWAN Device
    • Configuring LNS
      • The Things Stack (TTN / TTI) Automated Setup
      • The Things Stack (TTN / TTI) Manual Setup
      • Loriot
      • Kerlink Wanesy
      • Helium
      • ChirpStack
      • Tektelic
      • Actility ThingPark
      • Senet
      • Milesight Gateway
      • KPN
    • Downlinks (LoRaWAN)
      • Set Time Frame
    • Securing Webhooks
    • Payload Decoders
      • Location and GPS
      • Access Gateway Metadata
      • Access Measurements
      • Global Variables
    • Using Cayenne LPP
    • Converting Payload
  • Generic API Devices
    • HTTP Downlinks
  • Integrations
    • MQTT
    • Particle
      • Get Started
      • Adding Integrations
      • Decoding Payloads
      • Calling Functions
      • Templates
        • Particle Tracker One
    • Incoming Webhooks
    • Outgoing Webhooks
      • Securing Outgoing Webhooks in Datacake
    • Golioth
    • Blues Wireless Notecard
    • Sigfox
    • Swarm Asset Tracker
    • Grandcentrix Modbus Cloud Connect
    • YuDash LYNX IoT Gateway
    • Dragino NB-IoT
      • Changing NB-IoT Bands
    • Hardwario CHESTER
    • 1NCE OS
  • API
    • Exporting Data
    • Record Measurements via API
    • Node RED to Datacake
    • Generate Access Token
    • Internal MQTT
      • Get Started
      • MQTT Documentation
      • MQTT over WebSocket
      • Example Code
    • GraphQL API
      • Using GraphQL
      • Device Creation
      • Tutorials
        • Read Group via Tags
  • Guides
    • Python
    • Send Slack Notifications
    • Forward Data to Cake Red
    • Multiple Data Feeds
    • Automated Dynamic Downlinks
    • Ingesting JSON Data into Datacake API Devices
    • Working with Default HTTP Decoder on API Devices and Code Examples
    • Accessing Measurements in Decoders
    • Connecting Datacake to Notion Using Zapier
    • How to set up and use location on non-GPS devices
    • How to integrate with AWS IoT Core
    • How to Schedule Mass-Downlinks (Multicast) using Datacake Rule Engine
    • How to Map Sensor Values to Ranges or Booleans, Strings using Mapping Fields
    • Understanding Internal vs. External MQTT Brokers on Datacake
    • Sending UDP Messages between 1NCE OS and Datacake
    • Concepts of LoRaWAN Payload Decoders on Datacake
    • How to check if a value stays above or below limits for given time
Powered by GitBook
On this page
  • Introduction
  • What is a Mapping Field?
  • Start
  • Steps to Add a Mapping Field
  • Conclusion

Was this helpful?

  1. Guides

How to Map Sensor Values to Ranges or Booleans, Strings using Mapping Fields

Learn how to use Datacake IoT Platform to map numerical values like CO2 levels to string or boolean statuses for enhanced data monitoring and visualization.

Last updated 10 months ago

Was this helpful?

Introduction

Welcome to this tutorial. In this guide, we will demonstrate how to use the Datacake IoT platform to map numerical values to meaningful representations. This includes converting numerical readings such as temperature, humidity, or CO2 levels into string statuses (e.g., "OK", "Too High", "Too Low") or boolean values (e.g., "Person Detected"). These mappings are useful for monitoring various metrics and displaying them effectively on your dashboard.

What is a Mapping Field?

Read more here:

Start

Steps to Add a Mapping Field

1. Access the Device Configuration

  1. Log in to your Datacake account.

  2. Navigate to the device you want to configure (e.g., LHT 65).

  3. Go to the Configuration section of the device.

2. Locate the Payload Decoder and Fields

  1. Scroll down to the Payload Decoder section. Note that while mapping can be done here, we'll use the Fields section for this tutorial.

  2. Scroll to the Fields section to see the existing fields like battery, temperature (internal and external), humidity, and CO2.

3. Add a Mapping Field for Battery Status

  1. Identify the field you want to map (e.g., battery voltage).

  2. At the end of the field row, click on the three dots.

  3. Select Add Mapping Field.

4. Configure the Mapping Field

  1. Choose the field type (String, Integer, or Float). For battery status, select String.

  2. Name the field (e.g., "Battery Status"). The identifier will be generated automatically but can be overridden.

  3. Define the mapping logic using a lookup table:

    • Below or equal to 2.5V: "Battery Low"

    • Below or equal to 3.5V: "Battery Moderate"

    • Above 3.5V: "Battery OK"

  4. Add these mappings and save the field.

5. Simulate Data to Verify Mapping

  1. Enter the original field (e.g., battery voltage).

  2. Manually input a value to see the mapping in action. For example, input 2.998V to check if it maps to "Battery Moderate".

6. Display the Mapped Field on the Dashboard

  1. Go to the Dashboard for the device.

  2. Enter Edit Mode.

  3. Add a new widget:

    • Select Value Widget.

    • Choose the device and the newly created mapping field (e.g., "Battery Status").

  4. Save and place the widget on the dashboard.

  5. Exit Edit Mode to see the live status.

7. Mapping CO2 Levels to Determine Presence

  1. Identify the CO2 field that is fed by the sensor output.

  2. Add a mapping field for CO2 detection.

  3. Choose the field type Boolean.

  4. Name the field (e.g., "Person Detected").

  5. Define the mapping logic:

    • Above 800 ppm: True (Person Detected)

    • Below 800 ppm: False (Person Not Detected)

  6. Add this mapping and save the field.

8. Display the Boolean Field on the Dashboard

  1. Go to the Dashboard for the device.

  2. Enter Edit Mode.

  3. Add a new widget:

    • Select Value Widget or Status Widget.

    • Choose the device and the newly created mapping field (e.g., "Person Detected").

  4. Save and place the widget on the dashboard.

  5. Exit Edit Mode to see the live status.

9. Additional Examples and Uses

You can apply similar steps to other fields such as temperature:

  1. Add a mapping field for temperature.

  2. Define breakpoints (e.g., below 15°C: "Too Cold", 15-25°C: "OK", above 25°C: "Too Hot").

  3. Display this status on the dashboard.

10. Using Linear Scaling for Percentage Display

  1. Add a new mapping field and select Linear Scale.

  2. Configure the scaling (e.g., for battery percentage from 2.5V to 4V).

  3. Name the field (e.g., "Battery Percentage") and set the unit to %.

  4. Define the source range (e.g., 2.5V = 0%, 4V = 100%).

  5. Add boundaries to restrict values between 0% and 100%.

  6. Display this field as a gauge on the dashboard.

Conclusion

Mapping fields in Datacake IoT Platform allows you to create meaningful representations of your data, improving monitoring and alerting capabilities. By following this guide, you can map numerical values to string statuses or boolean values and display them effectively on your dashboard.

Thank you for following this tutorial. Stay tuned for more updates and tutorials on using Datacake IoT Platform.

Mapping Fields