# Devices, Variables, and Dots

The main entities in Ubidots are:

* Devices
* Variables
* Dots

Every time an **Ubidots** **Device** receives a sensor value in a variable, a data-point or "dot" is created. Ubidots stores dots that come from your devices inside variables, and these stored dots have corresponding timestamps:

![](https://884329393-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhzNRg0B4ECiNXc093G%2F-MiSvYYnI7k7ALlFh0UT%2F-MiSwJ_Ua-noDT_kJxTD%2Fimage.png?alt=media\&token=91c5dbf1-6823-4b15-b028-25c686396099)

{% hint style="info" %}
An **Ubidots Device** is a virtual entity. This means you could map multiple physical devices to a single **Ubidots Device**, or map many variables from a single physical device to several Ubidots Devices. It is your decision how you want to organize your data in your Ubidots account.

Our recommendation is of course to map **1 Physical Device to 1 Ubidots Device**.
{% endhint %}

### The Dot

Each dot contains these items:

| Item        | Description                                                                                                             | Mandatory | Size limit                           |
| ----------- | ----------------------------------------------------------------------------------------------------------------------- | --------- | ------------------------------------ |
| `value`     | A numerical value.                                                                                                      | Yes       | Up to 16 bit floating-point numbers. |
| `timestamp` | Unix Epoch time, in **milliseconds**. If not specified, then our servers will assign one upon reception.                | No        |                                      |
| `context`   | An arbitrary collection of key-value pairs. Mostly used to store the latitude and longitude coordinates of GPS devices. | No        | 1 KB                                 |

You can find further details below.

#### Values

A numerical **value**. Ubidots accepts up to 16 floating-point length numbers.

`{"value" : 34.87654974}`

#### Timestamps

A **timestamp**, as best described [here](https://www.unixtimestamp.com/), is a way to track time as a running total of seconds. This count starts at the Unix Epoch on January 1st, 1970 at UTC. Therefore, the unix time stamp is merely the number of seconds between a particular date and the Unix Epoch.&#x20;

{% hint style="info" %}
Please keep in mind that Ubidots timestamps are in **milliseconds**.
{% endhint %}

**But why did we choose to have a timestamp in milliseconds?** This is not only a common practice in APIs, it also allows us to support many IoT applications where several datapoints are send in the same second.&#x20;

`"timestamp" : 1537453824000`

The above timestamp corresponds to Thursday, September 20, 2018 2:30:24 PM.

{% hint style="success" %}
**PRO-TIP:** A useful tool to convert between Unix timestamps and human-readable dates is [Epoch Converter](http://https/www.epochconverter.com/).
{% endhint %}

#### Context

Numerical values are not the only data type supported; you can also store string or char data types inside what we call **context**. The context is a key-value object that allows you to store not only numerical but also string values. An example use of the context could be:

`"context" : {"status" : "on", "weather" : "sunny"}`

A context is commonly used to store the latitude and longitude coordinates of your device for GPS/tracking application use cases. All Ubidots maps uses the lat and lng keys from a dot's context to extract the coordinates of your device, in that way you just need to send a single dot with the coordinates values in the variable context to plot a map instead of sending separately both latitude and longitude in two different variables. Below you can find a typical context with coordinates values:

`"context" : {"lat":-6.2, "lng":75.4, "weather" : "sunny"}`

Please note that you can mix both string and numerical values in the context. If your application is for geo-localization purposes, make sure that the coordinates are set in decimal degrees.
