Nodemcu-เลี้ยงไก่-ปลูกผักกินเอง(ตอน2)

เปลี่ยนมาใช้ได้ก็ดีแต่ต้องโยก library หลายตัวให้รองรับ esp32 ดูว่าอันไหนง่ายกว่ากัน ถ้าเน้นต่อยอดไปเรื่อยๆ ก็เปลี่ยนดีกว่า เพราะ มันเร็วว่า

ไฟเลื่องเราใช้อะไรเลี้ยงครับ ย่านทำงานมัน 3.3 - 5V อยู่แล้ว ต้องเอา led มาเสียบดูก่อนว่ามัน on/off ตามที่สั่งหรือไม่ถ้าได้ก็ปกติ

ถ้า ic เสียมัน upload ไม่ได้แน่ๆ

ใส่แล้วครับ

ตอนนี้ serial monitor ไม่แสดงอะไรออกมาครับ

ถ้าตั้งupload speed ที่9600 จะerror



.error: failed sending 1044 bytes

.error: failed sending 1040 bytes

.error: failed sending 1040 bytes

.error: failed sending 1066 bytes

.error: failed sending 1069 bytes

.error: failed sending 1087 bytes

.error: failed sending 1060 bytes

.error: failed sending 1091 bytes

.error: failed sending 1087 bytes

.error: failed sending 1092 bytes

.error: failed sending 1045 bytes

.error: failed sending 1068 bytes

.error: failed sending 1048 bytes

.error: failed sending 1079 bytes

.error: failed sending 1050 bytes

.error: failed sending 1065 bytes

.error: failed sending 1054 bytes

.error: failed sending 1062 bytes

warning: espcomm_send_command: didn't receive command response

warning: espcomm_send_command(FLASH_DOWNLOAD_DATA) failed

warning: espcomm_send_command: wrong direction/command: 0x01 0x03, expected 0x01 0x04

error: espcomm_upload_mem failed

error: espcomm_upload_mem failed



Invalid library found in C:\Users\abee\Documents\Arduino\libraries\arduino-library-files-master: no headers files (.h) found in C:\Users\abee\Documents\Arduino\libraries\arduino-library-files-master

Invalid library found in C:\Users\abee\Documents\Arduino\libraries\ArduinoCore-avr-master: no headers files (.h) found in C:\Users\abee\Documents\Arduino\libraries\ArduinoCore-avr-master

Invalid library found in C:\Users\abee\Documents\Arduino\libraries\examples: no headers files (.h) found in C:\Users\abee\Documents\Arduino\libraries\examples

ถ้าตั้ง upload speed 57600 ก็ปกติ
ผมลอง sketch ง่ายๆ เพื่อดูใน serial monitor

unsigned long time1;
void setup() {
  Serial.begin(9600);
}
void loop() {
  time1 = millis();
  Serial.println("Hello World");
  while(millis() < time1+5000);
}

แต่ใน serial monitor ขึ้น


เพราะอะไรครับ

ใช้ไฟจาก Vusb และ GND จาก Base nodemcuครับ
มี capacitor 2200 uF คร่อมด้วย

ขออ้างอิงจากที่เคยทำผ่านมาแล้วครับ


ใช้driver ch340 ครับ
ลงแบบcpxxแล้ว แต่มันจะเลือกใช้ driverนี้ทุกครั้ง
ก่อนหน้านี้ ก็ออกทาง serial ปกติ ครับ
เมื่อกี้ลอง uninstall/install arduino ide ใหม่ก็เหมือนเดิม
serial ขึ้นแบบนี้ครับ

เปลี่ยน baud ความเร็วแล้ว ดีที่สุด ที่ 9600 แต่มันขึ้น ตัวอักษรที่ไม่ต้องการ ด้วย

ทำตามแล้วครับ

เห็นด้วยครับ อย่างน้อย I/O ใช้งานได้ 20 จุด / ESP32 1 ตัว

ตอนนี้เสียเวลากับปัญหาพื้นฐานกับ ออกผลทางserial monitorครับ
ผมลอง nodemcu ตัวใหม่ สายusbอันใหม่
ผลยังเป็นแบบนี้ครับ

เคสนี้เป็นกรณีโปรแกรมทำงานช้าในบ้าง loop ครับ ตัว chip มันจับ wifi ไม่ทัน มีนจะสั่งให้บอร์ด รีเเซตตัวเองเพื่อจับ wifi ให้ได้

วีธีแก้ไขคือ ไล่ดูจุดที่คิดว่าโปรแกรมไปทำงานตรงนั้นๆ เช่นหน่วงนานไป ใส่ วายลูป วนไม่ออก ก็ต้องเขียนแตกออกไปให้โปรแกรมวิ่งง่ายๆ

ช่วยแนะนำแตกตรงไหนบ้างครับ

นี้เป็นข้อมูลที่ผมรวบรวมไว้ ศึกษานานแล้ว ผมก็เจอบ่อย

ต้องเอาโค้ตเต็มมาดูกันทีละจุดครับ

สุดท้ายหนีไม่พ้น esp32
อาจเป็นเพราะรู้น้อย ที่ไม่สามารถเอาชนะอุปสรรคการเพิ่มขาnodemcu ด้วยการใช้mcp23017
ไปต่อไม่ได้จริงๆ ในอนาคตไม่แน่
เสียดายที่ทำไปเยอะแล้ว
จนมันรวนไปจุดเริ่มต้นที่ ต้องแก้ปัญหา การแสดงผลออกทางจอ serial monitor เหมือนกับตอนเริ่มต้นใหม่ตอนเล่น
nodemcu 555

ค่อยเพิ่มความรู้ครับ ผมก็เริ่มจาก 8266 สุดท้ายโปรแกรมมันขยายไปเรื่อยๆ ซับซ้อนขึ้น ก็ต้องขยับไป esp32

ตามที่ผมรู้ตอนนี้ nodemcu ไม่เหมาะที่จะขยายขา ขาที่เหลือใส่nodemcu ตัวใหม่
เพราะต้องเรียนรู้กับmcp สักพัก
เอาเป็นว่า บริหารpin ให้อยู่ในnodemcuเดียวกัน
ถ้าแก้เรื่อง mcpเดี๋ยวค่อยว่ากันใหม่
และเรื่อง esp32ด้วย ต้องแก้หลายจุด
ขืนช้า ไก่ตายพอดี 555

1 Likes

ตย.ที่2

ผมไม่ได้ใส่ตัวR ที่D1,D2 แต่ในตย.มีอยู่


พอวัดตัว Rได้ 4.7k ohmเป๊ะเลย คร่อมระหว่าง sda,scl น่าจะเป็นbuilt in resistorในบอร์ดแล้ว
เจอตัวอย่างที่เหมือนแล้ว

สงสารไก่ 555

เลี้ยงกี่ตัวครับนี้

ไก่โร้ด 3ตัว
ไก่บ้าน 8ตัวครับ