Getting Started With ProjekIoT.com Using Raspberry Pi

Another IoT platform developed by our young local talent!

Introduction

ProjekIoT.com is an IoT middleware system that allows IoT developers to store their IoT device data for recording and processing. This IoT platform was developed in collaboration with 2 local companies Sahrul Technologies (Shahrul Nizam) and InStack Technologies (Akmal Hazim). The interesting part is, Akmal Hazim is 14 years old and yes he is still in school! So in this tutorial, I will share on how to get start with ProjekIoT.com using Raspberry Pi.

Video

This video will show you how to get start and send sensor’s data to ProjekIoT.com using Raspberry Pi.

Hardware Preparation

This is the list of items used in the video.

Sample Program

This is python 3 sample program which can be used with Thonny Python IDE. Please enable I2C in Raspberry Pi, and install MPL3115A2 circuitpython library from Adafruit, with following command.

sudo pip3 install adafruit-circuitpython-mpl3115a2
from time import time
from gpiozero import Buzzer
from urllib import request, error
import board
import busio
import adafruit_mpl3115a2
buzzer = Buzzer(26)
# Initialize the I2C bus.
i2c = busio.I2C(board.SCL, board.SDA)
# Initialize the MPL3115A2.
sensor = adafruit_mpl3115a2.MPL3115A2(i2c)
# Alternatively you can specify a different I2C address for the device:
#sensor = adafruit_mpl3115a2.MPL3115A2(i2c, address=0x10)
# You can configure the pressure at sealevel to get better altitude estimates.
# This value has to be looked up from your local weather forecast or meteorlogical
# reports. It will change day by day and even hour by hour with weather
# changes. Remember altitude estimation from barometric pressure is not exact!
# Set this to a value in pascals:
sensor.sealevel_pressure = 102250
token = "430c0d91-3621-4917-9557-3aea5dc5fadb"
interval = 60 # in seconds
prevTime = 0
buzzer.beep(0.1, 0.1, 2)
try:
while True:
if time() prevTime > 1:
pressure = sensor.pressure / 1000
print("Pressure: {0:0.2f}kPa".format(pressure))
altitude = sensor.altitude
print("Altitude: {0:0.2f}m".format(altitude))
temperature = sensor.temperature
print("Temperature: {0:0.2f}°C".format(temperature))
url = "http://endpoint.projekiot.com/send?token=" + token
url = url + "&pressure={0:0.2f}".format(pressure)
url = url + "&altitude={0:0.2f}".format(altitude)
url = url + "&temperature={0:0.2f}".format(temperature)
url = url + "&interval={}".format(interval)
print(url)
try:
response = request.urlopen(url).read()
print(response)
except error.HTTPError as e:
print(e.code)
buzzer.beep(0.1, 0.1, 1)
except error.URLError as e:
print(e.reason)
buzzer.beep(0.1, 0.1, 1)
except error.HTTPException as e:
print("HTTP Exception")
buzzer.beep(0.1, 0.1, 1)
except Exception:
import traceback
print(traceback.format_exc())
buzzer.beep(0.1, 0.1, 1)
print("")
prevTime = time()
except KeyboardInterrupt:
buzzer.off()

Thank You

References:

Thanks for reading this tutorial. If you have any technical inquiries, 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

Send Data to Firebase Using Arduino Uno WiFi Rev2
Simple Alarm System Using Maker Nano
Program Cucumber ESP32-S2 Using CircuitPython
Face Recognition Using OpenCV on Raspberry Pi 400
Turned Your Tablet as a Display for the Raspberry Pi 400
Scroll to Top