Results 1 to 13 of 13

Thread: Arduino

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User BeTaTesTeR's Avatar
    Join Date: Nov:2006
    Location:
    Posts: 6,693

    Arduino

    , , . , , .
    Ka :

    1. 5V . , 5V, a . 2 . USB . , .

    2. Arduino NANO

    3. DS18B20

    4. Optocoupler , , . , . , a . OLX. . A JDVcc Vcc, , . .1, , , . JDVcc GND , . : Control High Voltage Devices Arduino Relay Tutorial

    5. Grove LED Bar , , a, , Olx . .

    6. A , , . 10 .

    7. RTC DS1307 , , , . 3 . . . DS3231, 2 . - .

    8. . 2kW 10, 3kW 16, - - . , . NO (normal open) , NC normal closed. M Schneider iCT 25A E 100 000 100 . 24 . .

    9. - Omron H3DS-ML To . OLX o 30 . , 2 . 2 , 2 . , , . .4 - - .4

    10. 90-95 , .

    11. , 24 21 21.5 , , , , , ..

    . . , , . , , , , . , , . , , .
    , , . , , . . , .

    Click image for larger version. 

Name:	Boiler_schema.jpg 
Views:	244 
Size:	22.2 KB 
ID:	96548



    . , , . . , . , .

    Code:
    #include <Grove_LED_Bar.h>                 //    
    #include <OneWire.h>                      //   
    #include <DallasTemperature.h>           //   
    #include <Wire.h>                        //  I2C   
    #include <RTClib.h>                     //  DS1307 
    
    #define ONE_WIRE_BUS 6                  //       data    
    OneWire oneWire(ONE_WIRE_BUS);
    DallasTemperature sensors(&oneWire);
    Grove_LED_Bar bar(3, 2, 0); 
    RTC_DS1307 RTC;
    const int button = 5;
    const int powrelay = 4;
    const int startrelay = 7;
    unsigned int state;
    
    void setup() {
      //Serial.begin(115200);
     bar.begin();
     sensors.begin();
     pinMode (button, INPUT);
     pinMode (powrelay, OUTPUT);
     pinMode (startrelay, OUTPUT);
     digitalWrite (powrelay, HIGH);
     digitalWrite (startrelay, HIGH);
     
     Wire.begin();
     RTC.begin();
     //RTC.adjust(DateTime(__DATE__, __TIME__)); //      .           
     
    }
    void loop()
    {  
       if (digitalRead(button) == LOW) buttonclick ();  //            .
        
    DateTime now = RTC.now();               //    
    int h = now.hour();                     //       h
    sensors.requestTemperatures();          //    
    int t = sensors.getTempCByIndex(0);    //    t
     if(t<2 || t>95) fault();    //   -  2   -  95     ( )      .
     
    //Serial.println (h);
    //Serial.print(now.hour(), DEC);
    if (h==3 && t<73) {       //   ,    3      < 73 .
      int mins = calc ();
       poweron ();
      countdown (mins);
    }
    
    if (h==6 && t<73) {       //     6 .
      int mins = calc ();
       poweron ();
      countdown (mins);
    }
    
       if (t<=15) bar.setLevel(1);      //            
        if (t>15 && t<=25) bar.setLevel(2);
        if (t>25 && t<=35) bar.setLevel(3);
        if (t>35 && t<=45) bar.setLevel(4);
        if (t>45 && t<=55) bar.setLevel(5);
        if (t>55 && t<=65) bar.setLevel(6);
        if (t>65 && t<=75) bar.setLevel(7);
        if (t>75 && t<=80) bar.setLevel(8);
        if (t>80 && t<=85) bar.setLevel(9);
        if (t>85 && t<=97) bar.setLevel(10);
       
    }
    
    void countdown (int x) {          //       .         calc().
    
      do {
        sensors.requestTemperatures();
       int t = sensors.getTempCByIndex(0);
        if (t>91) poweroff();
        if (t<=15) bar.setLevel(1);
       if (t>15 && t<=25) bar.setLevel(2);
        if (t>25 && t<=35) bar.setLevel(3);
        if (t>35 && t<=45) bar.setLevel(4);
        if (t>45 && t<=55) bar.setLevel(5);
        if (t>55 && t<=65) bar.setLevel(6);
        if (t>65 && t<=75) bar.setLevel(7);
        if (t>75 && t<=80) bar.setLevel(8);
        if (t>80 && t<=85) bar.setLevel(9);
        if (t>85 && t<=97) bar.setLevel(10);
        x--;
       // Serial.print (t);
       // Serial.println (t);
        delay (60000); }
        while (x>0);
        poweroff();
      }
    
      int calc () {           //             ,     
        sensors.requestTemperatures();
      int t = sensors.getTempCByIndex(0);
      int tdiff = 90 - t;
      int w = (0.0930*tdiff)/3;
      int mins = w*60;
       mins +=2;
       return mins;    
      }
    
    void poweroff () {   //    
      digitalWrite (powrelay, HIGH);
    }
    
    void poweron () {  //    
      digitalWrite (powrelay, LOW);  //  
      digitalWrite (startrelay, LOW); //      
      delay (700);
      digitalWrite (startrelay, HIGH); //   
    }
    
    void fault () {          //           
      
      // Switch on the first two LEDs
      bar.setLevel(2);
    
      // Get the current state (which is 0x3)
      state = bar.getBits();
    
      // Bounce to the right
      for (int i = 0; i < 8; i++)
      {
        // Bit shift left and update
        state <<= 1;
        bar.setBits(state);
        delay(200);
      }
    
      // Bounce to the left
      for (int i = 0; i < 8; i++)
      {
        // Bit shift right and update
        state >>= 1;
        bar.setBits(state);
        delay(200);
      }
    }
    
    void buttonclick () {   //    
      int c=0;
      for(int i=0;i<20;i++) {
    
         if (digitalRead(button) == LOW) c++;
         if (c>8) c=8;
         bar.setLevel(c);
         delay (250);
      }
    
      int count = c * 15;
        
        poweron();
        countdown (count);  
    }
    /Hidden: Source code


    - .

    calc () . . 80 3kW .

    sensors.requestTemperatures();
    int t = sensors.getTempCByIndex(0); -

    int tdiff = 90 - t; -

    int w = (0.0930*tdiff)/3; 4186 J/(kg.C) , 1 1 4186 . 4186J kWh (-) 0.001162778kWh. , 80 0.0930. , kWh. 3, 3kW .
    int mins = w*60; 60 , .
    mins +=2; - 2 . .
    return mins;
    }


    countdown (int x) - , poweroff() . . . progress bar.

    void fault () e . - , Win XP. .

    void buttonclick () . idle , loop , buttonclick (). buttonclick () . . 5 . 15, 15 . 2 30 ., 3 45 ., 4 1 .. 5- , countdown () , .
    , , , .
    Last edited by BeTaTesTeR; 16th October 2018 at 23:43.
    !

  2. #2
    tonerstationbg IgIv's Avatar
    Join Date: May:2005
    Location:
    Posts: 4,090
    !
    :
    , - . , . , .
    - . LCD ( ). , . : - 50 . . - . DS1307 DS3231 . : "" ( ) , .. . .
    , - , - .

  3. #3
    Wall-e delian's Avatar
    Join Date: May:2003
    Location: ::1
    Posts: 4,723
    ESP8266 Wi-Fi NTP.

  4. #4
    Registered User BeTaTesTeR's Avatar
    Join Date: Nov:2006
    Location:
    Posts: 6,693
    Quote Originally Posted by IgIv View Post
    !
    :
    , - . , . , .
    - . LCD ( ). , . : - 50 . . - . DS1307 DS3231 . : "" ( ) , .. . .
    , . 140 , , . :

    Click image for larger version. 

Name:	IMG_20180720_080725.jpg 
Views:	154 
Size:	43.0 KB 
ID:	96557

    , - - , . 90 . , , - - - . Te , 90 ., , 93-95, .
    , 8 . , , 2 - . . :

    Click image for larger version. 

Name:	IMG_20180720_080653.jpg 
Views:	170 
Size:	49.9 KB 
ID:	96558

    , . ( ) ( ). 3 , 2.5 . 3 .

    . , . . , 85-90 , . , . . , 40 . . if loop .
    . , , . , , . , - , . , , - . , , 21:00 . 21 . . , .

    . , 5-6-7 . , . , , . .



    - - - - - -

    Quote Originally Posted by View Post
    . () . . . , 2 5. . .

    , ? , ? .
    . . , , 10- .
    .
    , . 5-6 , .
    Last edited by BeTaTesTeR; 17th October 2018 at 12:30.
    !

  5. #5
    tonerstationbg IgIv's Avatar
    Join Date: May:2005
    Location:
    Posts: 4,090
    Quote Originally Posted by BeTaTesTeR View Post
    . , , . , , . , - , . , , - .
    . , 5-6-7 . , . , , . .
    , .
    4 (4 ) - 4 . SPI (3 ) I2C ( , , ), . , , . .
    Last edited by IgIv; 17th October 2018 at 15:33.
    , - , - .

  6. #6
    Registered User BeTaTesTeR's Avatar
    Join Date: Nov:2006
    Location:
    Posts: 6,693
    , .
    , . , . .
    !

  7. #7
    MU FOREVER mitaka-bs's Avatar
    Join Date: Sep:2002
    Location: Burgas
    Posts: 3,088
    2-3 ???
    , IgIv ...
    , ...
    "" ..
    , , .
    , .. ! ..
    !
    - !
    -, . + .
    ...
    Last edited by mitaka-bs; 18th October 2018 at 09:09.

  8. #8
    Registered User
    Join Date: Apr:2007
    Location:
    Posts: 89
    Quote Originally Posted by BeTaTesTeR View Post
    , . 140 , , . :
    100 . 100 , . - - .
    , / , , , /, max , - . , -...

    , , . ( ), ...

  9. #9
    Registered User BeTaTesTeR's Avatar
    Join Date: Nov:2006
    Location:
    Posts: 6,693
    Quote Originally Posted by fampi View Post
    100 . 100 , . - - .
    , / , , , /, max , - . , -...

    , , . ( ), ...
    . 50 . . :

    - 145

    145 . . . , . , . , ? . - , ѝ.

    , 16 . , . .
    Last edited by BeTaTesTeR; 18th October 2018 at 14:11.
    !

  10. #10
    Registered User
    Join Date: Apr:2007
    Location:
    Posts: 89
    . , 90-95 . . , .
    - .
    , . -, ...

  11. #11
    Registered User
    Join Date: Dec:2003
    Location:
    Posts: 4,191
    - . . , ( ). .

    . () . . . , 2 5. . .

    , ? , ? .
    !
    , !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |