it
เขียนโปรแกรม Arduino ในโทรศัพท์ —
Arduino บนมือถือ

เขียนโปรแกรม Arduino ในโทรศัพท์ ArduinoDroid Blynk Bluetooth WiFi USB OTG ESP32 IoT Smart Home มือถือ
เนื้อหาเกี่ยวข้อง — แนะนำให้อ่าน จีบให้วุ่นลงทุนด้วยรักพากย์ไทย bilibili 30 —
| แอป | Platform | Connection | ราคา | เหมาะกับ |
|---|---|---|---|---|
| ArduinoDroid | Android | USB OTG | ฟรี (มี Pro) | เขียน Code + Upload |
| Arduino Web Editor | Web (ทุก OS) | USB (ผ่าน Agent) | ฟรี | เขียน Code Online |
| Blynk | Android/iOS | WiFi/Bluetooth | ฟรี + Plus | IoT Dashboard |
| RemoteXY | Android/iOS | BT/WiFi/USB | ฟรี + Pro | UI Control |
| MIT App Inventor | Web + Android | Bluetooth | ฟรี | Custom App |
| Serial BT Terminal | Android | Bluetooth | ฟรี | Debug Serial |
Arduino Code Examples
# === Arduino LED Control via Bluetooth ===
# // Arduino Code - LED Control via Bluetooth
# #include <SoftwareSerial.h>
#
# SoftwareSerial bluetooth(10, 11); // RX, TX
# const int ledPin = 13;
#
# void setup() {
# Serial.begin(9600);
# bluetooth.begin(9600);
# pinMode(ledPin, OUTPUT);
# Serial.println("Bluetooth LED Control Ready");
# }
#
# void loop() {
# if (bluetooth.available()) {
# char cmd = bluetooth.read();
# if (cmd == '1') {
# digitalWrite(ledPin, HIGH);
# bluetooth.println("LED ON");
# Serial.println("LED ON");
# } else if (cmd == '0') {
# digitalWrite(ledPin, LOW);
# bluetooth.println("LED OFF");
# Serial.println("LED OFF");
# }
# }
# }
from dataclasses import dataclass
@dataclass
class ArduinoProject:
name: str
components: str
connection: str
difficulty: str
code_lines: int
projects = [
ArduinoProject("LED Bluetooth Control",
"Arduino Uno, HC-05, LED, Resistor 220Ω",
"Bluetooth (HC-05)",
"ง่าย (เริ่มต้น)",
30),
ArduinoProject("Temperature Monitor",
"Arduino Uno, DHT22, HC-05 หรือ ESP8266",
"Bluetooth หรือ WiFi",
"ง่าย-ปานกลาง",
50),
ArduinoProject("Smart Relay Control",
"Arduino Uno, Relay 4ch, ESP8266, Power Supply",
"WiFi (Blynk App)",
"ปานกลาง",
80),
ArduinoProject("Motor Speed Control",
"Arduino Uno, L298N Motor Driver, DC Motor, HC-05",
"Bluetooth",
"ปานกลาง",
60),
ArduinoProject("Plant Watering System",
"Arduino Uno, Soil Moisture Sensor, Relay, Pump, ESP32",
"WiFi (Blynk Dashboard)",
"ปานกลาง-ยาก",
120),
ArduinoProject("Security PIR Alert",
"Arduino Uno, PIR Sensor, Buzzer, ESP8266",
"WiFi (Line Notify)",
"ปานกลาง",
70),
]
print("=== Arduino Projects ===")
for p in projects:
print(f"\n [{p.name}] Difficulty: {p.difficulty}")
print(f" Components: {p.components}")
print(f" Connection: {p.connection}")
print(f" Code: ~{p.code_lines} lines")
Bluetooth & WiFi Setup

# === ESP32 WiFi + Blynk Setup ===
# // ESP32 + Blynk WiFi Control
# #define BLYNK_TEMPLATE_ID "TMPLxxxx"
# #define BLYNK_TEMPLATE_NAME "Smart Home"
# #define BLYNK_AUTH_TOKEN "YourAuthToken"
#
# #include <WiFi.h>
# #include <BlynkSimpleEsp32.h>
# #include <DHT.h>
#
# char ssid[] = "YourWiFi";
# char pass[] = "YourPassword";
#
# #define DHTPIN 4
# #define DHTTYPE DHT22
# DHT dht(DHTPIN, DHTTYPE);
#
# #define RELAY_PIN 5
#
# // Blynk Virtual Pin V1 = Relay Control
# BLYNK_WRITE(V1) {
# int value = param.asInt();
# digitalWrite(RELAY_PIN, value);
# }
#
# void setup() {
# Serial.begin(115200);
# pinMode(RELAY_PIN, OUTPUT);
# dht.begin();
# Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
# }
#
# void loop() {
# Blynk.run();
# // Send temperature every 2 seconds
# static unsigned long lastSend = 0;
# if (millis() - lastSend > 2000) {
# float temp = dht.readTemperature();
# float humid = dht.readHumidity();
# Blynk.virtualWrite(V2, temp); // Temperature
# Blynk.virtualWrite(V3, humid); // Humidity
# lastSend = millis();
# }
# }
@dataclass
class ConnectionMethod:
method: str
module: str
range_distance: str
speed: str
best_for: str
connections = [
ConnectionMethod("USB OTG",
"สาย USB OTG + USB Cable",
"สายยาว ~1m",
"เร็วมาก (Upload Code)",
"เขียน Code + Upload จากมือถือ"),
ConnectionMethod("Bluetooth Classic",
"HC-05 / HC-06",
"10-15 เมตร",
"115200 baud",
"ควบคุมใกล้ๆ ส่งข้อมูลน้อย"),
ConnectionMethod("BLE (Bluetooth Low Energy)",
"ESP32 (Built-in) / HM-10",
"30-50 เมตร",
"ช้ากว่า Classic แต่ประหยัดไฟ",
"IoT Sensor Battery-powered"),
ConnectionMethod("WiFi",
"ESP8266 / ESP32",
"30-50m (WiFi Range)",
"เร็วมาก (Mbps)",
"IoT Smart Home ควบคุมจากทุกที่"),
ConnectionMethod("WiFi + Cloud (Blynk)",
"ESP8266/ESP32 + Blynk Server",
"ทุกที่ (ผ่าน Internet)",
"เร็ว (ผ่าน Cloud)",
"ควบคุมจากนอกบ้าน Dashboard"),
]
print("=== Connection Methods ===")
for c in connections:
print(f" [{c.method}] Module: {c.module}")
print(f" Range: {c.range_distance} | Speed: {c.speed}")
print(f" Best: {c.best_for}")
Wiring Guide
# === Wiring Diagrams ===
@dataclass
class WiringGuide:
project: str
connections: str
power: str
notes: str
wirings = [
WiringGuide("HC-05 Bluetooth",
"HC-05 VCC→5V, GND→GND, TX→Pin10(RX), RX→Pin11(TX) ผ่าน Voltage Divider",
"5V จาก Arduino",
"RX ของ HC-05 ต้องลดเป็น 3.3V ใช้ Voltage Divider 1K+2K"),
WiringGuide("DHT22 Temperature",
"DHT22 VCC→3.3V, GND→GND, DATA→Pin4 + Pull-up 10K",
"3.3V จาก Arduino",
"ใช้ Pull-up Resistor 10K ระหว่าง DATA กับ VCC"),
WiringGuide("Relay Module 4ch",
"Relay IN1→Pin5, IN2→Pin6, IN3→Pin7, IN4→Pin8, VCC→5V, GND→GND",
"5V แยก Power Supply สำหรับ Relay",
"ห้ามจ่ายไฟ Relay จาก Arduino โดยตรง ใช้ Power Supply แยก"),
WiringGuide("ESP32 + OLED",
"OLED SDA→Pin21, SCL→Pin22, VCC→3.3V, GND→GND",
"3.3V จาก ESP32",
"ใช้ I2C Address 0x3C สำหรับ SSD1306"),
WiringGuide("PIR Motion Sensor",
"PIR VCC→5V, GND→GND, OUT→Pin2 (Interrupt)",
"5V จาก Arduino",
"ปรับ Sensitivity และ Delay บน Potentiometer"),
]
print("=== Wiring Guides ===")
for w in wirings:
print(f"\n [{w.project}]")
print(f" Connections: {w.connections}")
print(f" Power: {w.power}")
print(f" Notes: {w.notes}")
เคล็ดลับ
- USB OTG: ใช้ USB OTG สำหรับ Upload Code จากมือถือโดยตรง
- ESP32: ใช้ ESP32 แทน Arduino + Module มี WiFi BLE ในตัว
- Blynk: ใช้ Blynk สร้าง IoT Dashboard ง่ายที่สุด
- Power: แยก Power Supply สำหรับ Relay Motor ไม่จ่ายจาก Arduino
- Debug: ใช้ Serial Bluetooth Terminal ดู Debug Log บนมือถือ
เขียน Arduino บนมือถือได้อย่างไร
ArduinoDroid USB OTG Compile Upload Web Editor Blynk RemoteXY MIT App Inventor Bluetooth WiFi ESP32 HC-05 Library Serial Monitor
เนื้อหาเกี่ยวข้อง — อ่านต่อ: Apache Arrow Remote Work Setup
อ่านเพิ่ม: Home Lab 2026 คู่มือสร้างห้อง Server ที่บ้าน ครบทุกอย่าง · อ่านเพิ่ม: Rust คืออะไร? สอน Rust Programming ภาษาที่เร็วและปลอดภัยที่ส · อ่านเพิ่ม: Mobile App Performance Optimization สอนทำแอปเร็วขึ้น ลด Cras
แนะนำเพิ่มเติม — คู่มือเทรดจาก SiamCafeBook
เนื้อหาเกี่ยวข้อง — ทำความเข้าใจ Rof คืออะไร — คู่มือฉบับสมบูรณ์ 2026





