Unihiker K10 lesson 5
- Posted by Hendra kusumah
- Categories Home
- Date 24 Juli 2025
- Comments 0 comment
Introduction:
In this lesson, you will build a basic IoT (Internet of Things) application using the UNIHIKER K10. You’ll connect the device to a Wi-Fi network, read sensor values, and send the data to a cloud or local server using HTTP. This transforms your K10 from a standalone dashboard into a connected data logger, capable of contributing to smart monitoring systems.
What You’ll Learn:
How to connect the UNIHIKER K10 to Wi-Fi
How to collect sensor data in real-time
How to send JSON data to a web server using HTTP POST
How to troubleshoot connectivity issues
🔧 Step 1: Connect to Wi-Fi
Start by connecting to your Wi-Fi network. Replace "YourSSID" and "YourPassword" with your actual credentials.
import network
import time
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect("YourSSID", "YourPassword")
while not wlan.isconnected():
time.sleep(1)
print("Wi-Fi Connected!")
print(wlan.ifconfig())
Once connected, the K10 prints its IP address and becomes ready to send or receive data.
🌡️ Step 2: Read Sensor Data
Now you can collect real-time data from onboard sensors.
from pinpong.board import Board
from pinpong.libs.unihiker import TempHumSensor, LightSensor
Board().begin()
temp_humi = TempHumSensor()
light = LightSensor()
temp, humi = temp_humi.read()
light_val = light.read()
🌐 Step 3: Send Data Over HTTP
Use the urequests library to send your readings to a cloud server or local endpoint.
import urequests
data = {
"temperature": temp,
"humidity": humi,
"light": light_val
}
response = urequests.post("http://yourserver.com/api", json=data)
print(response.text)
Make sure your server supports HTTP POST and accepts JSON. You can use services like ThingSpeak, Node-RED, or your own Flask/MQTT server.
You may also like
Pelaksanaan Serdos Tahun 2026
Berdasarkan Nomor : 2027/DST/B4/DT.04.01/2026, perihal Serdos Tahun 2026, kampus Universitas Raharja mengajukan sebanyak 11 dosen dengan status Eligible Serdos, dengan syarat sudah memiliki NUPTK (dosen tetap), min jabatan akademik dosen Asisten Ahli, Masa kerja lebih dari 2 tahun, Laporan 4 …
tugas cyber scurity
BD308 – Cyber Security – Genap 25/26 Module Question 7 1. Explain the “Shared Responsibility Model”. What is the cloud provider responsible for, and what is the business (customer) responsible for? Status: ✔ Selesai Keterangan: Pada Shared Responsibility Model, penyedia …
tugas cyber scurity
BD308 – Cyber Security – Genap 25/26 Module Question 6 1. What are the core principles of GDPR (e.g., data minimization, purpose limitation)? Status: ✔ Selesai Keterangan: Prinsip utama GDPR meliputi lawfulness, fairness and transparency, purpose limitation, data minimization, accuracy, …
