Relé GSM autónomo con inversor fabricado con componentes prefabricados

Con este relé GSM podrá encender cualquier carga nominal de 220 V y una potencia no superior a 2 kW, en cualquier rincón de la Tierra donde exista una red celular.

Relé GSM autónomo con inversor fabricado con componentes prefabricados
Este dispositivo está controlado por arduino nano a través del módulo gsm SIM800L. A continuación se proporciona un diagrama funcional con una lista de componentes. Puede funcionar con baterías integradas o con una red de 220 V. Cuando funciona desde la red, la carga puede consumir hasta 2 kW de electricidad. De baterías, potencia máxima de salida 300 W.

Relé GSM autónomo con inversor fabricado con componentes prefabricados
Brevemente sobre el esquema.

Hay 4 bloques en este dispositivo:

  • unidad inversora
  • controlador y unidad de batería
  • unidad de fuente de alimentación ininterrumpida
  • Bloque de control.

La unidad inversora es un inversor de coche normal de 500t. También funcionará con menos potencia, pero la potencia máxima de salida también disminuirá en proporción a la potencia del inversor.

La unidad de controlador y batería es un controlador BMS S3 normal y económico diseñado para conectar 3 baterías de iones de litio. Las baterías son de alta corriente. Pueden entregar una corriente de 35 amperios. Si tiene menos energía, puede comprar baterías más baratas con una corriente máxima más baja.

La unidad de alimentación ininterrumpida está fabricada con transistores VT3, VD4, R4, R5, R3. El cátodo del diodo Zener VD4 está conectado directamente a la fuente de alimentación y cuando se aplica energía, el transistor VT3 se abre. Después de que se abre, llega un potencial negativo a todas las entradas del relé y los relés cambian al modo de suministro de energía del circuito desde la fuente de alimentación. Una característica importante de los conjuntos de relés prefabricados: algunos de ellos funcionan cuando llega un potencial positivo a la entrada y otros, cuando uno negativo. Si tiene la primera opción, entonces debe mover R3 al espacio del emisor del transistor VT3 y conectar la entrada del relé al emisor del mismo transistor.

La unidad de control está ensamblada sobre un módulo SIM800 y un arduino nano.

Relé GSM autónomo con inversor fabricado con componentes prefabricados

Así es como se ve el circuito ensamblado.Relé GSM autónomo con inversor fabricado con componentes prefabricados

Así se ve cuando está empacadoRelé GSM autónomo con inversor fabricado con componentes prefabricados

Relé GSM autónomo con inversor fabricado con componentes prefabricados

Relé GSM autónomo con inversor fabricado con componentes prefabricados

Para que el dispositivo comience a recibir SMS desde su teléfono, debe escribir su número de teléfono en la variable your_phone. También es posible conectar una pantalla LCD al Arduino, por ejemplo wh1601 o wh0802, pero deberá descomentar todas las líneas con la inscripción lcd.

código

char your_phone = "+79148389933";

#include <SoftwareSerial.h>                                          // Подключаем библиотеку SoftwareSerial для общения с модулем по программной шине UART
SoftwareSerial softSerial(8,9);                                      // Создаём объект softSerial указывая выводы RX, TX (можно указывать любые выводы Arduino UNO)
// include the library code:
//#include <LiquidCrystal.h>

// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
//const int rs = 12, en = 11, d4 = 5, d5 = 6, d6 = 7, d7 = 10;
//LiquidCrystal lcd(rs, en, d4, d5, d6, d7);                                                               // В данном случае вывод TX модуля подключается к выводу 2 Arduino, а вывод RX модуля к выводу 3 Arduino.
//  Инициируем работу шин UART с указанием скоростей обеих шин:      //
String buf2,buf3;
int g=0;

    String cmd1;
void setup(){                                                        //
init_port();
      // lcd.begin(16, 2);
  // Print a message to the LCD.
  //lcd.clear();
  //  lcd.setCursor(0, 0);
 /// lcd.print("VKL");
 // lcd.setCursor(0, 1);
 /// lcd.print("ZHDITE");

        /// init_port();// Инициируем передачу данных по аппаратной  шине UART на скорости  9600 (между Arduino и компьютером)
    softSerial.begin(9600);                                         // Инициируем передачу данных по программной шине UART на скорости 38400 (между модулем и Arduino)
        Serial.begin(9600);   
        delay(30000);

  //  cmd1 ="AT+CMGF=1rn";
  softSerial.print("AT+CMGF=1rn"); 
  ///  print_lcd(cmd1);
delay(1000);
       dellAllSMS();  
//  cmd1 ="AT+CMGDA="DEL ALL"rn";
    // print_lcd(cmd1);
//cmd1="AT+CPAS";
  ///   print_lcd(cmd1);
}                                                                    //
      
   
      char c;  
      int m=0;
      int i=0;//
      int n=0;
//  Выполняем ретрансляцию:                                          // Всё что пришло с модуля - отправляем компьютеру, а всё что пришло с компьютера - отправляем модулю

void dellAllSMS(){
  /* This deletes all sms in memory  
  
  */

  softSerial.print("AT+CMGDA="DEL ALL"rn"); // set sms to text mode

delay(3000);
}
void pin_on_setb()
{
 digitalWrite(2,1);
  digitalWrite(13,1);
}
void pin_off_setb()
{
 digitalWrite(2,0);
  digitalWrite(13,0);
}
void pin_on_inv()
{
 digitalWrite(3,1);
  //  digitalWrite(13,1);
}
void pin_off_inv()
{
 digitalWrite(3,0);
   // digitalWrite(13,0);
}
void init_port()
{
pinMode(2,1);
pinMode(3,1);
    pinMode(13,1);
}
String readData(){
   // this function just reads the raw data
   uint16_t timeout=0;
   while (!softSerial.available() && timeout<10000)
   {
     delay(10);
     timeout++;
   }
   if(softSerial.available())
   {
     String output = softSerial.readString();
     //if(DEBUG)
    ///   Serial.println(output);
     return output;
   }
 }
String buf, bufferIndex; 
int tempIndex=0;
int messageIndex;
int prev=0;
int power=0;
void loop(){                                                         //
   /* if(softSerial.available()){    Serial.write(softSerial.read());} // Передаём данные из программной шины UART в аппаратную  (от модуля     через Arduino к компьютеру)
    if(    Serial.available()){softSerial.write(    Serial.read());} // Передаём данные из аппаратной  шины UART в программную (от компьютера через Arduino к модулю    )*/

         //   lcd.clear();
     //  lcd.setCursor(0, 0);
     //  lcd.print("Nagruzka");
            //  lcd.setCursor(0, 1);
           //   if (power==1)
          //    {
         //              lcd.print("VKL");
     //         }
         //     else {lcd.print("VIKL");}
      softSerial.print(F("AT+CMGL="ALL",0"));
  softSerial.print("r");
  buf = readData();
 // Serial.println(buf);
tempIndex = buf.lastIndexOf("+CMGL: ");
tempIndex = tempIndex + 6;
    bufferIndex = buf.substring(tempIndex);
    bufferIndex = bufferIndex.substring(1,(bufferIndex.indexOf(",")));
    messageIndex = bufferIndex.toInt();
    ///Serial.println(messageIndex);
    if(prev!=messageIndex)
    {
      tempIndex = buf.lastIndexOf(your_phone);
     //  lcd.clear();
     //  lcd.setCursor(0, 0);
     //  lcd.print("SMS READ");

     if((digitalRead(4))&&(tempIndex!=-1))
     {
      pin_on_inv();
      delay(2000);
      pin_off_inv();
     // i=1;
   //  power=1;
     }
     else 
     {
     pin_on_setb();
           delay(2000);
     pin_off_setb();
  //   i=1;
 //         power=1;
     }
        //    send_sms(number3);

     
    prev++;
    
    }
if(messageIndex>=2)
{
 dellAllSMS();
// lcd.clear();
     //   lcd.setCursor(0, 0);
     //  lcd.print("SMS READ");
     //   lcd.setCursor(0, 1);
// lcd.print("SMS DEL");
 //  cmd1 ="AT+CMGDA="DEL ALL"rn";
   //  print_lcd(cmd1);
prev=0;
}
delay(10000);

}

Puede encontrar el archivo STL para imprimir la caja. aquí.

Vídeo del trabajo:



Fuente: habr.com

Añadir un comentario