Board IPST คืออะไร?
Board IPST (สสวท.) คือไมโครคอนโทรลเลอร์ที่สร้างโดยสถาบันส่งเสริมการสอนวิทยาศาสตร์และเทคโนโลยี ออกแบบสำหรับการเรียนการสอน IoT และ Robotics ในประเทศไทย รองรับการเขียนโปรแกรมด้วย MicroPython และ C/C++
ส่วนประกอบสำคัญ
| ส่วนประกอบ | คำอธิบาย | การใช้งาน |
| ขา Digital | D0–D7 | อ่าน/เขียนสัญญาณ HIGH/LOW (0V/3.3V) |
| ขา Analog | A0–A3 | อ่านค่าความต้านทาน 0–1023 |
| I2C | SDA / SCL | เชื่อมต่อ Display, Sensor หลายตัว |
| Serial | TX / RX | สื่อสารกับ Computer และ Module |
| ไฟ | VCC / GND | จ่ายไฟ 3.3V และกราวด์ |
ตัวอย่างโปรแกรม MicroPython
กระพริบ LED
from machine import Pin
import time
led = Pin(2, Pin.OUT) # ขา D2 เป็น Output
while True:
led.on() # เปิด LED
time.sleep(0.5)
led.off() # ปิด LED
time.sleep(0.5)
อ่านค่าเซนเซอร์อุณหภูมิ DHT11
from machine import Pin
import dht
sensor = dht.DHT11(Pin(4)) # เซนเซอร์ที่ขา D4
sensor.measure()
temp = sensor.temperature() # อุณหภูมิ (°C)
humi = sensor.humidity() # ความชื้น (%)
print(f"อุณหภูมิ: {temp}°C | ความชื้น: {humi}%")
ส่งข้อมูลขึ้น Server (HTTP POST)
import urequests
data = {"temperature": temp, "humidity": humi}
url = "https://apisit.sites.hwp.ac.th/insert_data.php"
res = urequests.post(url, json=data)
print(res.text)
res.close()
แบบฝึกหัด
- เขียนโปรแกรมให้ LED กระพริบเร็ว-ช้าสลับกัน 5 รอบ แล้วดับ
- อ่านค่าอุณหภูมิแสดงผลบน Serial Monitor ทุก 2 วินาที
- ถ้าอุณหภูมิเกิน 35°C ให้ LED ติดค้าง และส่งข้อมูลขึ้น Server