Getting Started With Favoriot IoT Platform Using Raspberry Pi

If your project is required to using IoT platform, you can consider Favoriot!

INTRODUCTION

FAVORIOT offers an IOT platform specifically designed for any Internet of Things (IoT) projects. The platform is developed to support the integration of data from sensors and actuators on the internet. Collecting and storing data from IOT devices become much easier.

This tutorial will show you how to get start with Favoriot using Raspberry Pi. Before that, you might need to read following tutorial first:

  1. Getting Started With Maker pHAT
  2. Displaying Sensor’s Data On Blynk App Using Raspberry Pi

VIDEO

This video will show you how to get started with Favoriot IoT platform using Raspberry Pi.

Untuk versi bahasa Melayu, sila rujuk link dibawah.

HARDWARE PREPARATION

Below is the list item used in the video.

Wiring connection table

Raspberry PiDHT22 Sensor
5VVCC
GNDGND
18DAT

Sample Code

This is sample code used in the video. Please replace “YOUR FAVORIOT APIKEY” and “Your Device Developer ID” with yours.

from gpiozero import Buzzer
from time import sleep
import Adafruit_DHT
import requests
import json
from decimal import Decimal
APIKEY = "YOUR FAVORIOT APIKEY"
DEVICE_DEV_ID = "Your Device Developer ID"
buzzer = Buzzer(26)
SEN_TYPE = Adafruit_DHT.DHT22
SEN_PIN = 18
url = "https://api.favoriot.com/v1/streams"
headers = {
'apikey': APIKEY,
'content-type': "application/json"
}
try:
while 1:
humidity, temperature = Adafruit_DHT.read_retry(SEN_TYPE, SEN_PIN)
if humidity is not None and temperature is not None:
root = {}
root["device_developer_id"] = DEVICE_DEV_ID
data = {}
data["temperature"] = round(temperature, 1)
data["humidity"] = round(humidity, 1)
root["data"] = data
body = json.dumps(root)
print body
response = requests.request("POST", url, headers=headers, data=body)
print response.text
print ""
buzzer.beep(0.1, 0.1, 1)
else:
print "Failed to get reading. Try again!"
buzzer.beep(0.2, 0.2, 3)
sleep(2)
except KeyboardInterrupt:
sys.exit(0)
view raw FavoriotDHT22.py hosted with ❤ by GitHub

Thank You

References:

  1. Getting Started With Maker pHAT
  2. Displaying Sensor’s Data On Blynk App Using Raspberry Pi
  3. Raspberry Pi Lesson: Send Data Favoriot

Thanks for reading this tutorial. If you have any technical inquiry, please post at Cytron Technical Forum.

Leave a Comment

Your email address will not be published.

Share this Tutorial

Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest
Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest

Latest Tutorial

Smart Door Announcer with Raspberry Pi
Why Raspberry Pi is the future of computing devices?
Face Recognition Door Lock System Using OpenCV on Raspberry Pi
Send Data to Firebase Using Arduino Uno WiFi Rev2
Simple Alarm System Using Maker Nano
Scroll to Top