---
# System prepended metadata

title: Pycom Pysense/FiPy starter!

---

# Pycom Pysense/FiPy starter!

#### Project by: Tuomas Kuusela - tk222wb

---

The goal with this project is to make the Pycom Pysense 2.0 X expansion board send data to Pybytes with the help of a Pycom FiPy development board. 

With the Pysense humidity sensor, we can for example test if a humidifier gives the promised effect.

This can therefore be seen as the first step using Pycom hardware and eventually move onto more interesting projects afterwards.

*Estimated time to complete: ~2h*

---

### Objective
This project is mostly aimed at those with no previous IoT-knowledge including no previous programming skills.

My initial plan for this was to test the effectiveness of my humidifiers I use in my appartment, but have refrained from using them due to the current heatwave. Will try later this year though!

*With limited time and no previous IoT-knowledge I had to keep the project simple.*

---

### Material
|Item|Price|
|-|-|
|Pycom Pysense 2.0 X|€29.65|
|Pycom FiPy|€59.40|
|Micro USB 2.0 Cable|€8.35|

The Pycom Pysense is a expansion board with a lot of different sensors that can come in handy for different projects: light, pressure, temerature, humidity and accelerometer sensors are included.

With the  Pycom FiPy development board we can combine it directly with the Pysense for easy setup and use one of the  network options: WiFi, Bluetooth, LoRa, Sigfox or dual LTE-M (CAT-M1 and NB-IoT) including access to global LPWAN networks.

*Hardware bought from https://www.electrokit.com*

---

### Computer setup
Start with updating the firmware of the Pycom hardware: 
https://docs.pycom.io/updatefirmware/device/

The chosen IDE for this project was Atom, to use this install the following:
- Node.js [https://nodejs.org]
- Atom [https://atom.io]

Within Atom install **(Settings>Install)** the *pymakr* package which is used with Pycom hardware.


---

### Putting everything together
Since we are only using Pycom hardware, this part will be very simple. Insert the FiPy module with the reset button/LED towards the Pysense USB connector.

*[See: https://pycom.github.io/pydocs/gettingstarted/connection/fipy.html]*

---

### Platform
Pycom gives easy setup and access to its Pybytes platform. Within Pybytes you can create and organize widgets with your incoming data, for example temperature and humidity as seen at the bottom of this guide.

---

### The code
Libraries for the Pycom hardware can be downloaded here:
https://github.com/pycom/pycom-libraries

The following code was used:

```python    
import time
import pycom
import machine

from pycoproc_2 import Pycoproc    # Pycom libraries
from SI7006A20 import SI7006A20    # Pycom libraries

pycom.heartbeat(False)
pycom.rgbled(0x0A0A08)

py = Pycoproc()

pybytes_enabled = False
if 'pybytes' in globals():
    if(pybytes.isconnected()):
        print('Pybytes is connected, sending signals to Pybytes!')
        pybytes_enabled = True     # Using pybytes.

si = SI7006A20(py)     # Getting temperature and humidity from the added pycom library.
print("Temperature is " + str(round(si.temperature(), 1)) + " degrees celsius with a relative humidity of " + str(round(si.humidity(), 1)) + "%")

if(pybytes_enabled):
    pybytes.send_signal(1, si.temperature())     # Sending temperature to pybytes. 
    pybytes.send_signal(2, si.humidity())        # Sending humidity to pybytes.
    print("Data sent!")                          # Using pin 1 and 2.

```

---

### Transmitting the data
Currently the data is sent when needed, which means it doesn't upload a constant flow of data or in specific intervals. This can ofcourse be changed if needed. WiFi is used to send the data to Pybytes.

---

### Presenting the data
The data is presented as dashboard on https://pybytes.pycom.io

![](https://i.imgur.com/RGsnxJC.jpg)

---

### Finalizing the design

This project shows the fundamentals on how to setup and work with the Pycom hardware used in this example. I think it can work as a stepping stone into more advanced projects using the same hardware with maybe a few added sensors using breadboard.