Forum Replies Created

Viewing 15 posts - 886 through 900 (of 1,020 total)
  • Author
    Posts
  • in reply to: E90-DTU (400SL22P) #9992
    Renzo Mischianti
    Keymaster

      Hi ludopot,
      for the compatibility I write to EByte, when i receive a response i write here.

      But you can do all with a microcontroller some e22 and a max3485 ic.

      To implement rs485 communication refer to this article

      How to interface Arduino, esp8266 or esp32 to RS-485.

      Pratically microcontroller retrieve information with max485 ic and send these with e22 device.

      Bye Renzo

      in reply to: PCF 8574 example from nopnop #9988
      Renzo Mischianti
      Keymaster

        Don’t worry Turnoff,
        for every doubt or qwestion write a topic without problems.
        Bye Renzo

        in reply to: port 587 with ssl ANS TLS not working #9987
        Renzo Mischianti
        Keymaster

          Hi Pim,
          Wich platform do you use??
          Bye Renzo

          in reply to: PCF 8574 example from nopnop #9984
          Renzo Mischianti
          Keymaster

            Hi Turnoff,
            you can understand the syntax when you check the structure of the PCF8574 class:

            
            class PCF8574 {
            [...]
            		struct DigitalInput {
            			uint8_t p0;
            			uint8_t p1;
            			uint8_t p2;
            			uint8_t p3;
            			uint8_t p4;
            			uint8_t p5;
            			uint8_t p6;
            			uint8_t p7;
            		} digitalInput;
            [...]
            }
            

            there is a structure DigitalInput declared inside the PCF8574 class declaration, so to reference the Object inside It you must use :: notation.

            PCF8574::DigitalInput

            I hope I was clear.

            Bye Renzo

            Renzo Mischianti
            Keymaster

              Hi Pedja,
              You can use a pcf8591 that have 4 analog input and one analog output (256 position).

              PCF8591 i2c Analog I/O Expander

              You can connect the IC to the same i2c pin with a different address.

              I think it’s sufficient to do the work.

              Bye Renzo

              Renzo Mischianti
              Keymaster

                Hi Pedja,

                pcf8574 is a digital I/O expander, analogWrite work only for analog expander or PWM pin, so can’t work with pcf8574.

                Bye Renzo

                Renzo Mischianti
                Keymaster

                  Hi Gilles,
                  I try to do a fix and i write here when ready.
                  Bye Renzo

                  in reply to: Applying TImeZone functionality (ESP8266 Ntp ) #9673
                  Renzo Mischianti
                  Keymaster

                    Hi Cameron,
                    I understand what you want to do, but It’s discouraged because you lost some information (GTM for example), but here the code modified.
                    I advise you to use strftime that offer a lot of features here a list.

                    I update local time directly when the value is returned because if you call the functione more than one time you apply N time the DST and you lost control of the time.

                    
                    		unsigned long epoch = tz.toLocal(timeClient.getEpochTime());
                    		setTime(epoch);
                    

                    and use a strftime like so

                    
                    	Serial.println(getEpochStringByParams(now(), "%H:%M:%S %d.%m.%Y It's a beautiful %A of %B"));
                    
                    

                    and the complete sketch
                    pay attention I add my timezone:

                    
                    
                    /*
                     * Simple NTP client update system time with DST applyed (discouraged)
                     * http://mischianti.org/
                     *
                     * The MIT License (MIT)
                     * written by Renzo Mischianti 
                     */
                    
                    #define DEBUG
                    
                    const char *ssid = "";
                    const char *password = "";
                    
                    #include 
                    // change next line to use with another board/shield
                    #include 
                    //#include  // for WiFi shield
                    //#include  // for WiFi 101 shield or MKR1000
                    #include 
                    #include 
                    #include 
                    #include     // https://github.com/JChristensen/Timezone
                    
                    /**
                     * Input time in epoch format and return tm time format
                     * by Renzo Mischianti 
                     */
                    static tm getDateTimeByParams(long time) {
                    	struct tm *newtime;
                    	const time_t tim = time;
                    	newtime = localtime(&tim);
                    	return *newtime;
                    }
                    /**
                     * Input tm time format and return String with format pattern
                     * by Renzo Mischianti 
                     */
                    static String getDateTimeStringByParams(tm *newtime, char *pattern =
                    		(char*) "%d/%m/%Y %H:%M:%S") {
                    	char buffer[90];
                    	strftime(buffer, 90, pattern, newtime);
                    	return buffer;
                    }
                    
                    /**
                     * Input time in epoch format format and return String with format pattern
                     * by Renzo Mischianti 
                     */
                    static String getEpochStringByParams(long time, char *pattern =
                    		(char*) "%d/%m/%Y %H:%M:%S") {
                    //    struct tm *newtime;
                    	tm newtime;
                    	newtime = getDateTimeByParams(time);
                    	return getDateTimeStringByParams(&newtime, pattern);
                    }
                    
                    WiFiUDP ntpUDP;
                    
                    // By default 'pool.ntp.org' is used with 60 seconds update interval and
                    // no offset
                    // NTPClient timeClient(ntpUDP);
                    
                    // You can specify the time server pool and the offset, (in seconds)
                    // additionaly you can specify the update interval (in milliseconds).
                    int GTMOffset = 0; // SET TO UTC TIME
                    NTPClient timeClient(ntpUDP, "europe.pool.ntp.org", GTMOffset * 60 * 60,
                    		60 * 60 * 1000);
                    
                    // Central European Time (Frankfurt, Paris)
                    TimeChangeRule CEST = { "CEST", Last, Sun, Mar, 2, 120 }; // Central European Summer Time
                    TimeChangeRule CET = { "CET ", Last, Sun, Oct, 3, 60 }; // Central European Standard Time
                    Timezone tz(CEST, CET);
                    
                    
                    //// US Pacific Time Zone (Las Vegas, Los Angeles)
                    //TimeChangeRule usPDT = {"PDT", Second, Sun, Mar, 2, -420};
                    //TimeChangeRule usPST = {"PST", First, Sun, Nov, 2, -480};
                    //Timezone tz(usPDT, usPST);
                    
                    void setup() {
                    	Serial.begin(115200);
                    	WiFi.begin(ssid, password);
                    
                    	while (WiFi.status() != WL_CONNECTED) {
                    		delay(500);
                    		Serial.print(".");
                    	}
                    
                    	timeClient.begin();
                    	delay(1000);
                    	if (timeClient.update()) {
                    		Serial.print("Adjust local clock");
                    //		unsigned long epoch = timeClient.getEpochTime();
                    		unsigned long epoch = tz.toLocal(timeClient.getEpochTime());
                    		setTime(epoch);
                    	} else {
                    		Serial.print("NTP Update not WORK!!");
                    	}
                    
                    }
                    
                    
                    void loop() {
                    // I print the time from local clock but first I check DST
                    // to add hours if needed
                    //	Serial.println(getEpochStringByParams(tz.toLocal(now())));
                    	Serial.println(getEpochStringByParams(now(), "%H:%M:%S %d.%m.%Y It's a beautiful %A of %B"));
                    	Serial.print("MyCrummyCode:");
                    	digitalClockDisplay();
                    
                    	delay(1000);
                    }
                    
                    tmElements_t tm;
                    
                    time_t current_time() {
                    	return make_unixtime(tz.toLocal(second()), tz.toLocal(minute()),
                    			tz.toLocal(hour()), tz.toLocal(day()), tz.toLocal(month()),
                    			tz.toLocal(year()));
                    }
                    
                    time_t make_unixtime(uint8_t sec, uint8_t mn, uint8_t hr, uint8_t dy,
                    		uint8_t mon, uint16_t yr) {
                    	tm.Second = sec;
                    	tm.Hour = hr;
                    	tm.Minute = mn;
                    	tm.Day = dy;
                    	tm.Month = mon;
                    	tm.Year = yr - 1970;
                    	return makeTime(tm);
                    }
                    
                    void digitalClockDisplay() {
                    // digital clock display of the time
                    #ifdef DEBUG
                    		yield();
                    		Serial.print(hour());
                    		yield();
                    		printDigits(minute());
                    		yield();
                    		printDigits(second());
                    		yield();
                    		Serial.print(" ");
                    		yield();
                    		Serial.print(day());
                    		yield();
                    		Serial.print(".");
                    		yield();
                    		Serial.print(month());
                    		yield();
                    		Serial.print(".");
                    		yield();
                    		Serial.print(year());
                    		yield();
                    		Serial.print(" ");
                    		yield();
                    		Serial.println(dayStr(weekday()));
                    #endif
                    }
                    
                    void printDigits(int digits) {
                    // utility for digital clock display: prints preceding colon and leading 0
                    	yield();
                    	Serial.print(":");
                    	if (digits < 10)
                    		Serial.print('0');
                    	yield();
                    	Serial.print(digits);
                    }
                    
                    
                    

                    and here the result

                    
                    MyCrummyCode:7:26:58 3.2.2021 Wednesday
                    07:26:59 03.02.2021 It's a beautiful Wednesday of February
                    MyCrummyCode:7:26:59 3.2.2021 Wednesday
                    07:27:00 03.02.2021 It's a beautiful Wednesday of February
                    MyCrummyCode:7:27:00 3.2.2021 Wednesday
                    07:27:01 03.02.2021 It's a beautiful Wednesday of February
                    MyCrummyCode:7:27:01 3.2.2021 Wednesday
                    07:27:02 03.02.2021 It's a beautiful Wednesday of February
                    MyCrummyCode:7:27:02 3.2.2021 Wednesday
                    07:27:03 03.02.2021 It's a beautiful Wednesday of February
                    MyCrummyCode:7:27:03 3.2.2021 Wednesday
                    
                    

                    Bye Renzo

                    Attachments:
                    You must be logged in to view attached files.
                    in reply to: ESP32 S2 SAOLA 1R ND… IDE compiling Problems. #9665
                    Renzo Mischianti
                    Keymaster

                      Hi Rainer,
                      It’s stragne, check again all the steps, then try to enable verbose debug

                      File->Preferences->Show verbose output during:. Tick boxes for compilation and upload.

                      Arduino IDE options

                      And tell us the result.
                      Bye Renzo

                      in reply to: pcf8574 not work with multiple input pull up and output #9658
                      Renzo Mischianti
                      Keymaster

                        Hi Jorn,
                        to manage pull up and pull down change in debounce, you must specify (like the Arduino pin) if the initial state is in pull up or pull down.

                        By default It’s pull down.

                        The library has an internal state that memorizes the value change, and though you don’t use an interrupt you can read the button change.

                        So initialization of your pin to work must be

                        
                        unit->pinMode(3, INPUT_PULLUP);
                        

                        Bye Renzo

                        Renzo Mischianti
                        Keymaster

                          Hi tpapas,

                          glad to have been helpful.

                          If you need more help write a topic.

                          Bye Renzo

                          Renzo Mischianti
                          Keymaster

                            Hi tpapas,

                            first, check the code I commend the static IP Ethernet initialization, so to restore It you must uncomment

                            
                            // start the Ethernet connection and server
                            //	  Ethernet.begin(mac, ip, myDns, gateway, subnet);
                            

                            and comment the dhcp initialization

                            
                            	  if (Ethernet.begin(mac) == 0) {
                            	    Serial.println(F("Failed to configure Ethernet using DHCP"));
                            	    if (Ethernet.hardwareStatus() == EthernetNoHardware) {
                            	      Serial.println(F("Ethernet shield was not found.  Sorry, can't run without hardware. :("));
                            	    } else if (Ethernet.linkStatus() == LinkOFF) {
                            	      Serial.println(F("Ethernet cable is not connected."));
                            	    }
                            	    // no point in carrying on, so do nothing forevermore:
                            	    while (true) {
                            	      delay(1);
                            	    }
                            
                            	  }
                            
                            

                            to change the debounce you must change this define

                            
                            #define EMAIL_SEND_DEBOUNCE 5*60*1000
                            

                            Try to change the variable like so (to activate immediately the email send)

                            
                            unsigned long timeElapsed = millis()-EMAIL_SEND_DEBOUNCE;
                            

                            and fix this

                            
                            
                            
                            // Check if value > 30 and check if you already send this email
                            	if (sensors.getTempCByIndex(0) > 30 && emailSended == false){
                            		emailSended = true;
                            		// check if you had already send an email in the last 5 minutes
                            		if (timeElapsed+EMAIL_SEND_DEBOUNCE < millis()){
                            			timeElapsed = millis();
                            			sendEmail();
                            		}
                            	}else if (sensors.getTempCByIndex(0) < 30  && emailSended == true){
                            		// The value return ok and so if you are going over 30 again new notification was sended
                            		emailSended = false;
                            	}
                             

                            Give me a feedback, bye Renzo

                            in reply to: Suggestion for EmailSender Tutorial #9600
                            Renzo Mischianti
                            Keymaster

                              Hi Arthur,

                              thanks for suggestion, It’s very interesting.

                              I must find some time, but surely I add this section.

                              Thank Renzo

                              Renzo Mischianti
                              Keymaster

                                Hi VeloTobi,

                                I also update the github project, now there is the simple version and the more complex.

                                Bye Renzo

                                Renzo Mischianti
                                Keymaster

                                  Hi VeloTobi,

                                  please check the core and library version, I test the sketch width these and It’s work

                                  • Using board d1_mini
                                  • Using core esp8266 2.7.4
                                  • [ESP8266WiFi@1.0]
                                  • [ESP8266WebServer@1.0]
                                  • [WebSockets@2.1.4]
                                  • [WebSockets@2.1.4]
                                  • [Hash@1.0]
                                  • [DHT12_sensor_library@0.9.0]
                                  • [Wire@1.0]
                                  • [ArduinoJson@6.13.0]

                                  Bye Renzo

                                Viewing 15 posts - 886 through 900 (of 1,020 total)