---
# System prepended metadata

title: 'Part 4: Using Pybytes to Visualize Collected Data'
tags: [PyCom, ESP32, TA Stuff ESP32]

---

# Part 4: Using Pybytes to Visualize Collected Data
###### tags: `TA Stuff ESP32` `PyCom` `ESP32`

:::info
**This tutorial works on PyCom devices, if you have *FiPy*, *LoPy4*, *WiPy3*, or *GPy* you can follow it to visualize your data on Pybytes.**
:::  

It's time to start sending your sensor data to the cloud. And the easiest place to get started doing that is probably Pybytes. This is done in 2 steps, first, you'll get the device connected to Pybytes over Wi-Fi and then you'll get to send data and organize the Dashboard.

## Environment Settings
:::info
We follow the instruction suggested by [**PyCom (here)**](https://docs.pycom.io/pybytes/gettingstarted/) you can check it for the latest update.
:::  

Follow these steps to set up the environment for your Pybytes connection:
* **Step 1:** If you already have a Forum or Webshop account with PyCom, you can use the same credentials to log into [**Pybytes**](https://pybytes.pycom.io/), Else, go to [**Pybytes (here)**](https://pybytes.pycom.io/) and create an account and login.
* **Step 2:** After you logged in to the Pybytes follow the numbered steps on the screenshots below to register your device on the Pybytes website. (Before being able to send data we must register our device)
Click on $Devices$ from the left panel then on $Via USB$
![](https://i.imgur.com/qv9hOZO.jpg) 
<br>

Choose your $development board$ from the choices.
![](https://i.imgur.com/VRl5avV.jpg) 
<br>

Choose your $expansion board$ from the choices.
![](https://i.imgur.com/0ts5OzX.jpg) 
<br>

Choose $WiFi$ and then enter your home WiFi credentials.  
![](https://i.imgur.com/DbMUv7V.jpg) 
<br>

Click on next.
![](https://i.imgur.com/R0Ewbot.jpg) 
<br>  

Write a $Device Name$ and $Description$ then click on next.
![](https://i.imgur.com/W7hrEq2.jpg) 
<br>  

Click on $Finish$.
![](https://i.imgur.com/u9X6Vxw.jpg) 
<br>  

Now you see your newly created device, click on it and follow the next step.
![](https://i.imgur.com/lIosv7r.jpg) 
<br>  

* **Step 3:** Now we need to $Flash$ our development board with $PyCom Firmware Update$ tool. It is because we must have Pybyte dependencies for being able to connect to it. We start by creating a new $Token$ on the Pybyte website and use that token while we flash our device. Follow numbered steps on the screenshots below:
Choose $Provisioning$ then $Desktop Application$ and Finally click on the button to generate a new token and $Copy$ it. 
![](https://i.imgur.com/doGWxTF.jpg) 
<br>  

Now open your $PyCom Firmware Update$ tool and press continue.
![](https://i.imgur.com/RVs7FMD.jpg) 
<br>  

Click on continue. 
![](https://i.imgur.com/fyX9Ety.jpg) 
<br>  

Choose everything similar to the screenshot.
![](https://i.imgur.com/OZgUZhO.jpg) 
<br>  

Paste the copied $Activation Token$ in this field.
![](https://i.imgur.com/LWS2Pc0.jpg) 
<br>  

Choose everything similar to the screenshot then continue.
![](https://i.imgur.com/VBqLRX9.jpg) 
<br>  

After finishing the flash it takes a while and if you provide the correct home WiFi credentials you will see your device connection on $Pybytes Control Panel$.
![](https://i.imgur.com/6ymL2z3.jpg) 
<br>  

:::success
Everything is set and you can open atom to upload data to your Pybytes.
:::

## Sending Random Values to Pybytes
We demonstrate how to send signals to our Pybytes. Please follow the steps:
* **Step 1:** Open Atom and create a new project folder then open it and create `main.py` in it. 
* **Step 2:** Copy the following code to `main.py`. The following code tries to create two random values between *0* and *255* and send them to Pybyte as $Pin Signal 1$ and $Pin Signal 2$ (just imagine these values as humidity and temperature values).  
```python=
import machine
import time

while True:
    # Generate a random number between 0 and 255
    value = machine.rng() & 0xFF
    # Sending random value to pybytes in signal channel 1
    pybytes.send_signal(1, value)
    print("sending: {}".format(value))
    time.sleep(1)

    # Generate a random number between 0 and 255
    value = machine.rng() & 0xFF
    # Sending random value to pybytes in signal channel 2
    pybytes.send_signal(2, value)
    print("sending: {}".format(value))

    # Send every 5 seconds
    time.sleep(5)
```
<br>  


We do **not** need to add any *WLAN* method for internet connection because Pybyte created a **jason** file including wireless connection when we flashed the board. After uploading the `main.py` it takes a while and your board will start sending values…
![](https://i.imgur.com/UAmT7Bc.jpg) 
<br>  

* **Step 3:** Open your Pybytes then go to $Signals$ you should see common signals from your board over the internet. 
![](https://i.imgur.com/Qs7KqGX.jpg) 
<br>  

* **Step 4:** You also could see the updating charts in the $Dashboard$.
![](https://i.imgur.com/BHvPPXU.jpg) 
<br>  

:::success
You are successfully connected to the Pybytes and send some values to it now is the time to find more features on the Pybytes control panel and/or send some data from your temperature sensors.
Good Luck!
:::  


<style>

.markdown-body code{
    font-size: 1em !important;
}
.markdown-body .a{
    font-size: 5em !important;
}
.markdown-body pre {
    background-color: #333;
    border: 1px solid #333 !important;
    color: #dfdfdf;
    font-weight: 600;
}
.token.operator, .token.entity,
.token.url, .language-css .token.string,
.style .token.string {
    background: #000;
}
.markdown-body table {
    display: table;
    padding: 1em;
    width: 100%;
}
.markdown-body table th,
.markdown-body table td,
.markdown-body table tr {
    border: none !important;
}
.markdown-body table tr {
    background-color: transparent !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2) !important;
}
</style>

