วันพฤหัสบดีที่ 23 สิงหาคม พ.ศ. 2561

GSM sim 900 Learn AT command made Flooding and Raining Alert



คลิ้กดูรายละเอียดครับ

รายละเอียด New SIM900A V4.0 Kit Wireless Extension Module GSM GPRS Board Antenna Tested Worldwide Store - intl

  • 100% brand new
  • High quality & professional
Features:
The onboard two set power supply interface VCC5 5V power supply, VCC4 interface, 3.5--4.5V power supply, optional power on self starting (default) and control start.
The onboard SMA (default) and IPXmini antenna interface, SIM900A interface reserved reset.
The size of the module is 49*50, all the new and original device.
The computer can give early computer debugging USB module power supply, a very large amount of data under the condition of the recommended current more than 1A. Standby dozens of MA data can be set to provide dormancy, dormancy of 10MA low power. Support 2, mobile phone 3,4G card.
The serial port circuit: support for 3.3V single chip microcomputer. TTL serial port support
3.3 and 5V single chip microcomputer.
The SIM card circuit to increase the SMF05C ESD chip.
Antenna circuit: guarantee short and straight, so as to ensure the signal strength.
PCB display screen printing mark: each interface, convenient development two times, the SIM900/A hardware is completely follow the design when the design manual.
Two power supply interface: VCC5, 5V DC above 1A. Computer 5V power supply can be early computer USB. DC long data circuit over larger recommended 5V1A. VCC4, 3.5--4.5V power supply, ibid., suitable for lithium battery.
Control pin all leads.
A TTL level, compatible with 3.3V and 5V.
The two antenna interface, the default SMA straight head, connector for IPXmini antenna.
One way of speech interface, the way Mike interface.
The control interface of each pin description:
GND - GND
SIMR SIM900A RXD, TTL level, can not be directly connected to the 232 level
SIMT SIM900A TXD, TTL level, can not be directly connected to the 232 level
RST - SIM900A reset, active low
VCC_MCU when the SIM900A module and 5V TTL level communication, this pin is connected to DC 5V; when the level of communication of SIM900A and 3.3V TTL, this pin is connected to DC 3.3V.
VCC5----DC 5V input.
VCC4------DC3.5--4.5 input

Onboard Resources:
Serial port circuit(with protection)
Antenna interface circuit(SMA bend female port)
SIM card circuit(flip SIM slot)
4*3.5 fixture hole 4pcs
SIM900A serial port output terminal

Specifications:
Size:49mm x 47mm
Net Weight:28g
Weight: 38g


Wiring 



A TTL level, compatible with 3.3V and 5V.
The two antenna interface, the default SMA straight head, connector for IPXmini antenna.
One way of speech interface, the way Mike interface.
The control interface of each pin description:
GND - GND
SIMR SIM900A RXD, TTL level, can not be directly connected to the 232 level
SIMT SIM900A TXD, TTL level, can not be directly connected to the 232 level
RST - SIM900A reset, active low
VCC_MCU when the SIM900A module and 5V TTL level communication, this pin is connected to DC 5V; when the level of communication of SIM900A and 3.3V TTL, this pin is connected to DC 3.3V.
VCC5----DC 5V input.
VCC4------DC3.5--4.5 input

Green wire : RX
Gray wire   : TX




 External power  supply





RX,TX  connect to 2,3 

External power supply 5 volt

///////////////////////////////////AT command\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Link here is AT command  document 👇👇



****************CODE****************

Test send message using AT command  


#include <SoftwareSerial.h>
SoftwareSerial sim900a(7, 8); // 7=RX, 8=TX  // GSM TX SHOULD CONNECT TO 2, GSM RX SHOULD CONNECT TO 3


void setup() {
  Serial.begin(9600);
sim900a.begin(9600);
}
void loop()
{
  delay(1000);
  send_test_sms();// SEND TEST SMS

  
}
void send_test_sms()
{
sim900a.print("AT\r");// 
delay(500);
sim900a.print("AT+CMGF=1;\r");       // select message mode
delay(500);
sim900a.print("AT+CMGS=\"0843545xxx\";\r");            // ENTER YOUR RECEIVER PHONE NO 
delay(500);
sim900a.print("I AM GSM AND SENDING SMS TEST SMS");// message data , you can send variables , strings or any kind of other data 

sim900a.print("\r");
    delay(1000);
sim900a.println((char)26);

sim900a.write(0x1a);// CTRL+Z SENDING CODE CTRL+Z=0x26
}



😃😃😃😃😃😃😃😃😃😃Add sensor 😃😃😃😃😃😃😃😃





#include <SoftwareSerial.h>

SoftwareSerial sim900a(7, 8); // 7=RX, 8=TX  // GSM TX SHOULD CONNECT TO 7, 

GSM RX SHOULD CONNECT TO 8

//   wet sensor para

const int analogInPin = A0;  // Analog input pin that the potentiometer is attached to
const int analogOutPin = 9; // Analog output pin that the LED is attached to

int sensorValue = 0;        // value read from the pot
int outputValue = 0;        // value output to the PWM (analog out)


///////////////////////////////////////////////////

void setup() {
  Serial.begin(9600);
sim900a.begin(9600);



}
void loop()
{
  delay(1000);
  send_test_sms();// SEND TEST SMS
//WetSensor();
  
}
void send_test_sms()
{
sim900a.print("AT\r");// 
delay(500);
sim900a.print("AT+CMGF=1;\r");// select message mode
delay(500);
sim900a.print("AT+CMGS=\"your phone no. \";\r");// RECEIVER PHONE NO HERE

delay(500);

// read the analog in value:
  sensorValue = analogRead(analogInPin);
  // map it to the range of the analog out:
  outputValue = map(sensorValue, 0, 1023, 0, 255);
  // change the analog out value:
  analogWrite(analogOutPin, outputValue);

  // print the results to the Serial Monitor:
  Serial.print("sensor = ");
  Serial.print(sensorValue);
  Serial.print("\t output = ");
  Serial.println(outputValue);

  // wait 2 milliseconds before the next loop for the analog-to-digital
  // converter to settle after the last reading:
  delay(100);

if(sensorValue < 500)  //  

{

sim900a.print("Flooding warnign !!! ");

sim900a.print("\r");
    delay(1000);
sim900a.println((char)26);

sim900a.write(0x1a);// CTRL+Z SENDING CODE CTRL+Z=0x26
}

}



วันเสาร์ที่ 28 เมษายน พ.ศ. 2561

Arduino Hydroponic

      เมื่อเราต้องการที่จะปลูกผัก H้ydroponic ด้วยเหตุผลอะไรก็สุดแล้วแต่ไม่ว่าจะเพื่อกินเองหรือเพื่อขาย หรือเพื่อเป็นการผ่อนคลายยามว่ามันก็จะต้องมาพิจารณาว่าเราจะมีเวลาที่จะปลูกแค่ไหนหรือ  เราจะปลูกมันอย่างไร จากวัสดุอะไร ในยุคปัจจุบันผม ได้เห็นแล้วว่าเมื่อเราอยุ่ในเมืองมันมีข้อจำกัดจริงๆในการที่จะปลูกอะไรซักอย่างมันมีทั้งพื้นที่และเวลา ในการดูแลที่จำกัดเมื่อเราคิดว่าจะทำก้ต้องลองดูซักตั้งเพื่อเป็นการพิสูจน์ว่าเราไม่ใช่คนไก่กา  แต่พอมาลองจะทำดูก็จะมีเหตุให้เป็นอันทำไม่เสร็จซื้อของมาไม่ครบ ต้องวิ่งรถไปร้านขายหลายรอบ บางทีอาจยกเลิกไปเลยเสียเงินเสียเวลา โดยเฉพาะในยุคนี้ยุคที่เวลามีค่ามากกว่าเงินทอง เรายอมจ่ายเงินค่าธรรมเนียมต่างๆแลกกับการเสียเวลารอคิวถูกไหมครับนั่นแหละที่เขาเรียกว่าเวลาเป็นเป็นทอง  ผมเลยอยากแนะนำเพื่อนๆ ถ้าคิดจะทำลองพิจารณาซื้อชุดสำเร็จรูปตัวนี้ไปใช้ได้เลยตามลิ้งข้างล่าง  ครบชุดพร้อมปลูก


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










รายละเอียดสินค้า

ชุดปลูกผักไฮโดรโปนิกส์ รุ่น set12
รายละเอียดสินค้า
ชุดปลูกผักHydroponic รุ่น Hydro12
 โครงโต๊ะ PVC สีขาว ขนาด 50 x 50 x 40 cm
2.รางปลูกผักไฮโดรโปนิกส์ ความยาว 60 cm จำนวน 3 ราง
3.ชุดท่อส่งสารละลายธาตุอาหาร พร้อมวาล์วเปิดปิด 3 ตัว
4.ชุดท่อรวมสารละลายอาหาร
5.สารละลายธาตุอาหาร ปุ๋ย A และ B อย่างละ 500 ซีซี
6.ไซริ้งค์ 1 อัน
7.ถ้วยตวงน้ำ 1 ใบ
8.ถาดเพาะเมล็ด 1 ใบ
9.ฟองน้ำ 1 แผ่น
10.ถ้วยปลูกเขียว 36 ใบ
11.ถ้วยปลูกใช้ซ้ำ 24 ใบ
12.เคเบิ้ลไทด์ 1 เส้น
13.เมล็ดผักสลัด 100 เมล็ด
14.เมล็ดกวางตุ้ง 100 เมล็ด
15.ปั๊มน้ำ 1 ตัว
16.ถังน้ำ 1 ใบ
17.สายยาง 2 เส้น
18.เข็มขัดรัดท่อ 1 ตัว
19.คู่มือการปลูกผักไฮโดรโปนิกส์


เมื่อได้ชุดปลูกแล้วก็เหลือแต่ชุดควบคุมอัตโนมัติ ซึ่งเราจะต้องมาทำกันขึ้นมา โดยแนวคิดคือ เราจะต้องให้ปุ๋ยกับผักอย่างสม่ำเสมอ มีการควบคุมค่า ph จ่ายน้ำเลี้ยงอย่างต่อเนื่อง ทีนี้แต่ละเรื่องที่เราจะต้องจัดการเรามาลำดับกันเป็นขั้นตอนกันดังนี้นะครับ

อุปกรณ์

ESP8266  Node MCU
Solenoid valve
Relay
ph sensor
Conduct sensor





Buy Now




Features:
*Electric solenoid valve, 100% Brand New and durable.
*Material:Metal + plastic
*Color: As Pictures Show
*Screw diameter: approx. 20mm/0.79’’;
Size: approx. 84 * 57mm/3.31’’x2.24’’ (L x H);
Coil size: approx. 34 * 23mm/1.34’’x0.91’’ (W x H)
*Usage: water and low viscosity fluids
Specifications:
*Voltage: DC 12V
*Power: 8W
*Current: 0.6A
*Inlet and outlet: hose barbs for 1/2" (outer diameter) hose
*Pressure: 0.02- 0.8Mpa
*Max fluid temperature: 100°C
*Operation mode: normally closed
Package Contents
1*Electric solenoid valve


VDO How to create BLYNK




Wiring Diagram



Arduino Code

#include <Adafruit_Sensor.h>

/*************************************************************
  Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Follow us:                  http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************

  This example shows how value can be pushed from Arduino to
  the Blynk App.

  WARNING :
  For this example you'll need Adafruit DHT sensor libraries:
    https://github.com/adafruit/Adafruit_Sensor
    https://github.com/adafruit/DHT-sensor-library

  App project setup:
    Value Display widget attached to V5
    Value Display widget attached to V6
 *************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <SPI.h>
//#include <Ethernet.h>
#include <ESP8266WiFi.h>  
//#include <BlynkSimpleEthernet.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);




// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "6dfbf92a8cdd4f18b30347ee9ed1789e";
char ssid[] = "santi";  //user WIFI 
char pass[] = "santi12345678"; // password WIFI 


#define DHTPIN D3          // What digital pin we're connected to

// Uncomment whatever type you're using!
#define DHTTYPE DHT11     // DHT 11
//#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21   // DHT 21, AM2301



DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.


void sendSensor()
{
  float s = analogRead(A0);
  float h = dht.readHumidity();
  float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
lcd.begin();
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("Humi:");
lcd.setCursor(5,0);
lcd.print(h);
lcd.setCursor(0,1);
lcd.print("Temp:");
lcd.setCursor(5,1);
lcd.print(t);
lcd.setCursor(8,0);
lcd.print("Soi:");
lcd.print(s);
  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V5, h);
  Blynk.virtualWrite(V6, t);
}

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);

  dht.begin();

  // Setup a function to be called every second
  timer.setInterval(10000L, sendSensor);
  lcd.begin();
  lcd.backlight();
  
  
  
}

void loop()
{
  Blynk.run();
  timer.run();



  
}







วันอาทิตย์ที่ 22 เมษายน พ.ศ. 2561

Smart home Energy conservation .






Equipment

1. Arduino NANO




2.HC-06 Bluetooth module




3. 4 relays







code

#include<SoftwareSerial.h>
SoftwareSerial mySerial(10,11);//rx,tx
//const int LDR=A0;
//int xx;

int Light   = 2;
int Loundry  = 3;
int TV   = 4;
int Radio   = 5;
char  receivedChar;


void setup() {
 // Serial.begin(19200);
  mySerial.begin(9600);
  pinMode(Light,OUTPUT);
  pinMode(Loundry,OUTPUT);
  pinMode(TV,OUTPUT);
  pinMode(Radio,OUTPUT);

             digitalWrite(Light,HIGH); 
             digitalWrite(Loundry,HIGH);//setting motorA's directon
             digitalWrite(TV,HIGH);
             digitalWrite(Radio,HIGH);//setting motorB's directon
  
  
}

void loop()

{

  

// xx = analogRead(LDR); 
// mySerial.print(xx);

//Serial.println(xx);
 // delay(500);

   while (!mySerial.available());   // stay here so long as COM port is empty

  receivedChar = mySerial.read();

  if (receivedChar == 'A') {

            //digitalWrite(ENA,LOW);
            // digitalWrite(ENB,LOW);// High is start driving car
              
             digitalWrite(Light,LOW);
             Serial.println(receivedChar);
            
  }
              
  if (receivedChar == 'B') {

             // digitalWrite(ENA,LOW);
             // digitalWrite(ENB,LOW);// High is start driving car
              
              
                    
             digitalWrite(Loundry,LOW);
            
                         
  }      
  if (receivedChar == 'C') 
  
              {

             // digitalWrite(ENA,LOW);
             // digitalWrite(ENB,LOW);// High is start driving car
  
             digitalWrite(TV,LOW);
            
             

  } // if it is a 3 flash the LED

  if (receivedChar == 'D') {
  
              //digitalWrite(ENA,LOW);
              //digitalWrite(ENB,LOW);// High is start driving car
              
                          
             digitalWrite(Radio,LOW);
             

  } // if it is a 4 print out lots of sensor data


  if (receivedChar == 'E') {
  
             
             digitalWrite(Light,HIGH); 

  }

   if (receivedChar == 'F') {
  
             
             digitalWrite(Loundry,HIGH);//setting motorA's directon

  }

   if (receivedChar == 'G') {
  
             
             digitalWrite(TV,HIGH);

  }


   if (receivedChar == 'H') {
  
             
             digitalWrite(Radio,HIGH);//setting motorB's directon

  }
             
             
             
  
  }




mit