แสดงบทความที่มีป้ายกำกับ nodemcu แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ nodemcu แสดงบทความทั้งหมด

วันจันทร์ที่ 9 ตุลาคม พ.ศ. 2560

Arduino UNO and L293D control speed and direction(bidirection) to 2 DC ...



Arduino UNO and L293D control  speed and direction(bidirection) to 2 DC motors
(Ardino UNO และ L293D ควบคุมความเร็วและทิศทาง ให้กับ 2 DC motors)






L293D in package has darlington pair current sink , each output 600mA(Peak 1A only L293D) and clamp diode (ESD protection and transient suppression)

Vcc1 for internal logic  5V , Vcc2 for 4.6-36V

*Download the related file at the following link. as *.ino sketch, shcematic, L293D datasheet






วันพุธที่ 26 เมษายน พ.ศ. 2560

ทำให้ humax vdsl2+ ของทรู use humax router , working in forward port (assign at virtual server)

/*-----------------------------------------
how toforward port of humax router
Model NameHV100-02
Modem VendorHumax



forware port ของ humax  ให้เลือก ปรับ interface แบบ vdsl ก่อน จะได้ ip อีกชุด เช่น จากเดิม
adsl interface (ip 47.145.145.145) เมื่อเลือก เป็น vdsl interfaceจะได้ (ip 124.120.186.252) ทำให้ ใช้งานผ่าน virtual server mode ได้


select vdsl




set forward port 32000 
เมื่อทำการเซต forward port เรียบร้อย ไม่จำเป็นต้อง restart router ก็ได้
ตอนนี้ จะสามารถเข้าถึง server ของเราในเครือข่ายได้ จากที่ไหนก็ตามผ่าน internet โดยใช้ public ip ดูจาก myipaddress

http://www.myipaddress.com/show-my-ip-address/ 

เช่น http://124.120.186.252:32000  หรือดูจาก router ของเราเอง  เมื่อใช้งานเสร็จอย่าลืมปิดของเราด้วยนะคับ หลังเลิกใช้งาน


/*--------------------------------------

วันศุกร์ที่ 7 เมษายน พ.ศ. 2560

Timer system with nodeMCU (Turn on/off the power by setting the timer) ,...





Timer system with nodeMCU (Turn on/off the power by setting the timer) , 2 periods timer / an relay (1 period = timer_on and timer_off).

The main devices used in the project.
-NodeMCU v2, DS3231, OLED 0.96"
-Relay 2ch opto, Keypad4x4
-PCF8574AT x 2

ชุดควบคุมการเปิดปิดอุปกรณ์โดยการตั้งเวลาเปิดปิด(Timer system)
-ตั้งวันที่และเวลา และ กำหนดเวลาการทำงาน เปิด/ปิด ของอุปกรณ์ไฟฟ้า(โหลด)ที่ต่ออยู่กับ รีเลย์
-ข้อมูลไม่สูญหายเมื่อไม่มีไฟฟ้า(ข้อมูลจัดเก็บไว้ที่ eeprom ของ ds3231)
-1 รีเลย์ ตั้งได้ 2 คาบเวลา (1 คาบเวลา จะมี  เวลาเปิด(timer on)  และ เวลาปิดtimer off) ในโปรเจคนี้จะแสดงการงานใช้เพียง 2รีเลย์
-สามารถเพิ่มจำนวนรีเลย์ได้ภายหลัง (ขึ้นอยู่กับ pcf8574 module ที่มีในระบบ 1 module เพิ่ม 8 ขา(8 รีเลย์))
-ตั้งค่าเวลาเปิดปิดรีเลย์(โหลด) ผ่านหน้าจอ เมนูได้โดยง่าย
-สามารถควบคุมรีเลย์(รีเลย์เชื่อมอยู่บนขาของ PCF8574AT)แต่ละตัวได้โดยตรงและอิสระ(ด้วยการทำงานของโปรแกรมควบคุม)
-แสดงอุณหภูมิห้องในหน่วย C ได้
-สามารถนำไปประยุกต์กับโครงงานอื่นๆได้

Specification
-Set Date and Time manualy with the date/time menu page.
-The data is not lost when there is no power supply.
-Set up 2 periods  for each relays. (Increase the number of relays later with just only copy code.)
( 1 periods   = timer on and timer off, the timer can  be canceled. )
PS. this project will demonstrate with 2 relays.
-Relays can be added with inferface on pcf8574 io pin.
-Setting timer from a  menu page,easily.
-Can control each of relay by directly and  independently with working of aruduino code .
 (Relays connected on the pcf8574 pin)
-Show Temparature in C degree.
-Can be applied with other project.

Download Related files ,the follow link
-https://drive.google.com/drive/folders/0BzjoxIwEMrM-ZnRIb25KME56LW8?usp=sharing


Related Clip
-Arduino+ pcf8574at +keypad+4relay , Read/Write set bit to control independently of each other relay.
https://youtu.be/4xicGKsr4p0

-nodeMCU v2 +Keypad 4x4 + PCF8574AT( io expender), use 2 wires only.
https://youtu.be/lDhUqzp4410






























วันเสาร์ที่ 18 มีนาคม พ.ศ. 2560

Tip arduino esp8266 nodemcu รวมรวมเทคนิคต่างๆ


 Wiring diagrams for PCF8574 and 4x3 keypad can be found under
 *  examples directory. Library runs correctly without cols pull-up
 *  resistors but it's better to use it
R1, R2 and R3 are 10K

Note: Add a 220Ohm resistor in series with each column to avoid possible shorts between a HIGH and a LOW line when pushing multiple keys at a time.
///
Your problem should be solved if you look up this solution at https://sites.google.com/site/kingauswebpage/my-projects/cannot-find-wconstants-h
:)
"When compile an Arduino Library, it fails to compile with the message:

error: WConstants.h: No such file or directory

The solution is to delete the line 

#include "WConstants.h" 

and then in the .h file, add the following:

#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif


/////
I just find the solution.
First, Wire has some new wording...
Wire.send is now Wire.write
Wire.receive is now Wire.read
You must change it on the .cpp file.
Then for the millis error you just need to:
#include <Arduino.h> in the header of the .cpp file again.
And as I'm working with the Arduino UNO the SDA and SCL port are different in the examples here it says:
SCL to port A0
SDA to port A1
And the correct ones (for the UNO) are:
SCL 5
SDA 4
I hope you find this info useful!
Saludos from Chile!
///////////
String IPAddress2String(IPAddress address)
{
 return String(address[0]) + "." +
        String(address[1]) + "." +
        String(address[2]) + "." +
        String(address[3]);
}

  String ipAddress = IPAddress2String(Ethernet.localIP());

//////
void ACROBOTIC_SSD1306::putString(const char *string)
{
    unsigned char i=0;
    while(string[i])
    {
        putChar(string[i]);  
        i++;
    }
}

void ACROBOTIC_SSD1306::putString(String string)
{
    char char_array[string.length()+1];
    string.toCharArray(char_array, sizeof(char_array));
    putString(char_array);
}
///
void ACROBOTIC_SSD1306::sendData(unsigned char Data)
{
     Wire.beginTransmission(SSD1306_Address); // begin I2C transmission
     Wire.write(SSD1306_Data_Mode);            // data mode
     Wire.write(Data);
     Wire.endTransmission();

/////
void printDigits(int digits) {
  Serial.print(":");
  if (digits < 10)
    Serial.print('0');
  Serial.print(digits);
}

วันอังคารที่ 7 มีนาคม พ.ศ. 2560

nodemcu esp8266 error: stray '\302' in program


error ตามด้านล่าง ครั้งเมื่อ upload code ไป nodemcu v2

node_begin1:2: error: stray '\302' in program

 const char* ssidย ย ย ย  = "GTECwifi"; ย ย ย ย ย ย ย ย

 ^

node_begin1:2: error: stray '\240' in program

node_begin1:2: error: stray '\302' in program

node_begin1:2: error: stray '\240' in program

node_begin1:2: error: stray '\302' in program

สาเหตุ
-copy code จากในเวป ดังภาพล่าง มาใส่ ใน sketch   จะสังเกต สีของkeyword จะไม่มี เช่น Serial


-วิธีแก้ไข

1.พิมพเข้าไปใน sketch ใหม่ทั้งหมด
2.หรือค่อยๆลบ อักขระที่มองไม่เห็น ลบไปทีละตัว 

-อีก1วิธีแก้ 
ให้เข้า www.blogger.com เลือกสร้างบทความใหม่ และวาง code ใส่  ให้ใช้เครื่องมือ  ล้างรูปแบบ แล้ว copy code ไปใส่ใน arduino ide



วันอังคารที่ 21 กุมภาพันธ์ พ.ศ. 2560

SDA(tx) SCL(rx) nodemcu

อ้างอิง
http://www.hoaglun.com/blog/2013/1/27/i2c-lcd-challenge

What is SDA and SCL?
SDA = TX Data
SCL = RX Data (Clock) 



nodeMCU
martinayotte wrote:The default pins are defined in variants/nodemcu/pins_arduino.h as SDA=4 and SCL=5, but those are not pins number but GPIO number, so since the pins are D1=5 and D2=4.
Anyway, you can also choose the pins yourself using the I2C constructor Wire.begin(int sda, int scl); - See more at: http://www.esp8266.com/viewtopic.php?f=13&t=10374#sthash.Ahy4UbNy.dpuf