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
Prosedur Desk Evaluasi PKM
1. Tujuan Tata cara penilaian dan review relevansi Pengabdian kepada Masyarakat bertujuan untuk: 2. Ruang Lingkup Penilaian dan review relevansi PkM meliputi: Prosedur : PR-RHJ-019-003
SKuP Hibah NonDitlitabmas Universitas Raharja
PANDUAN HIBAH NONDITLITABMAS No. CEKLISAN Link 1 PROPOSAL Link 2 LAPORAN AKHIR Link 3 LUARAN JURNAL/BUKU/HAKCIPTA Link 4 FORM 003 Link 5 FORM 004 Link 6 FORM 005 Link 7 FORM 006 Link 8 FORM 007 Link 9 FORM 008 …
TANGERANG – Universitas Raharja sukses mengimplementasikan program penelitian dan pengabdian kepada masyarakat yang didanai oleh Direktorat Penelitian dan Pengabdian kepada Masyarakat (DPPM), Direktorat Jenderal Riset dan Pengembangan, Kementerian Pendidikan, Kebudayaan, Riset, dan Teknologi. Keberhasilan ini merujuk pada diterimanya hibah BIMA …
