Forum Replies Created

Viewing 15 posts - 961 through 975 (of 1,012 total)
  • Author
    Posts
  • in reply to: Is it possible to send an object with LoRa E32 device? #6440
    Renzo Mischianti
    Keymaster

      Hi Ludophot,

      yes, I think you can refer this post to create the array of element/structure

      More than one pcf8574 expander

       

      I think It’s quite difficult to lost packet, because E32 have 512byte of buffer and the max packet size is 58byte, and when you read the buffer you remove the messages from that, so you can grab 512/58 >= 8 messages before read the buffer.

      I’m quite sure that you read the message in less than millisecs.

      Bye Renzo

      in reply to: Is it possible to send an object with LoRa E32 device? #6424
      Renzo Mischianti
      Keymaster

        Hi Ludopoth,

        first you can’t create a structure with pointer

        
        struct Badge_Transmition{
        const char *type=NULL;
        String *message = NULL;
        };
        

        but size must be fixed

        
        struct Badge_Transmition{
        char[10] type;
        char[20] message;
        };
        

        the pointer size is about 2byte, but the content is in another area.

        The receive device must have the same fixed size structure.

        The rest of the code seems correct.

        Give me a feedback Bye Renzo.

        in reply to: Is it possible to send an object with LoRa E32 device? #6404
        Renzo Mischianti
        Keymaster

          Hi Ludophot,

          you can send a structure that in C is the equivalent of an object.

          For example

          
              struct Message {
                  char type[5] = "TEMP";
                  char message[8] = "Kitchen";
                  byte temperature[4];
              } message;
           
              *(float*)(message.temperature) = 19.2;
           
              ResponseStatus rs = e32ttl.sendFixedMessage(0,3,4,&message, sizeof(Message));
              Serial.println(rs.getResponseDescription());
          
          

          I think this is what you need.

          you can find more information in this article, with a complete sender sketch and receiver.

          Ebyte LoRa E32 device for Arduino, esp32 or esp8266: power saving and sending structured data Part 5

          pay attention to the receive of part of the strucure, very usefully to manage different type of object.

           

          Bye Renzo

          in reply to: EMail distribution list – more than one recipient #6390
          Renzo Mischianti
          Keymaster

            Hi Mauro,

            sorry if I response so late, but I have a lot of think to follow…

            I implement multiple recipient, you can find a beta version on branch

            Github

            You can use like so, to sent do 3 email

            
                EMailSender::EMailMessage message;
                message.subject = "Soggetto";
                message.message = "Ciao come stai
            io bene.
            www.mischianti.org";
            
                const char* arrayOfEmail[] = {"mischianti@gmail.com", "smtp.mischianti@gmail.com", "renzo.mischianti@gmail.com"};
                EMailSender::Response resp = emailSend.send(arrayOfEmail, 3, message);
            

            or to send to 2 email as principal and 1 as CC

            
                EMailSender::EMailMessage message;
                message.subject = "Soggetto";
                message.message = "Ciao come stai
            io bene.
            www.mischianti.org";
            
                const char* arrayOfEmail[] = {"mischianti@gmail.com", "smtp.mischianti@gmail.com", "renzo.mischianti@gmail.com"};
                EMailSender::Response resp = emailSend.send(arrayOfEmail, 2, 1, message);
            
            

            or to sent first to principal one to cc and one to CCn

            
                EMailSender::EMailMessage message;
                message.subject = "Soggetto";
                message.message = "Ciao come stai
            io bene.
            www.mischianti.org";
            
                const char* arrayOfEmail[] = {"mischianti@gmail.com", "smtp.mischianti@gmail.com", "renzo.mischianti@gmail.com"};
                EMailSender::Response resp = emailSend.send(arrayOfEmail, 1, 1, 1, message);
            
            

            Give me a feedback…

            Bye Renzo

            in reply to: EMailSender-master Library problem to manage email variable #6261
            Renzo Mischianti
            Keymaster

              Hi Adnan,

              sorry if I response only now.

              You can use a char array pointer

              const char* emailToSend = "renzo.mischianti@gmail.com";
              EMailSender::Response resp = emailSend.send(emailToSend, message);

              I think you use a String variable for myemail, change type.

              Bye Renzo

              in reply to: EMailSender new Line Character in the message #6209
              Renzo Mischianti
              Keymaster

                I think that I undestand the problem.
                In my library I try to give all the possibility, and as default the body of email si in HTML format, for example you can write a text like so

                    EMailSender::EMailMessage message;
                    message.subject = "Soggetto";
                    message.message = "<img src='http://mischianti.org/wp-content/uploads/2020/01/logo256.jpg'/><br><br>Ciao come stai<br>io bene.<br>Login set ok;<br>This is my link <a href='mischianti.org'>Mischianti's Blog</a>";
                
                the result is an email like this

                but if you want sent a simple email in TEXT format you must specify the correct mime type, so you must write an email like so

                    EMailSender::EMailMessage message;
                    message.subject = "Soggetto";
                    message.message = "Ciao come stai\nio bene.\nLogin set ok;";
                    message.mime = MIME_TEXT_PLAIN;
                

                 

                And in TEXT format line feed and carraige return work fine.

                Give me a feedback, but I think the problem is this, you can try to use text line feed with HTML format.

                Bye Renzo

                in reply to: EMailSender new Line Character in the message #6206
                Renzo Mischianti
                Keymaster

                  Hi kamranrasul,
                  with kind of character you use? \r \n??
                  You can also use HTML notation and you can obtain the same result with that.
                  Bye Renzo

                  Renzo Mischianti
                  Keymaster

                    Hi Ricardo,

                    first of all, I forgot to advise you to use a device with 3.3v logic, even if the e32s still need to be powered at 5v, but the communication logic is at 3.3v, and your connection scheme will be simpler.

                    Than, here some pieces of code of one of my project:

                    Here I put my esp8266 and the E32 in sleep mode:

                    
                    
                    	if (e32ttl.available()){
                    		SERIAL_DEBUG.println("Start reading!");
                    
                    		ResponseContainer rs = e32ttl.receiveMessage();
                    		String message = rs.data;
                    
                    		SERIAL_DEBUG.println(rs.status.getResponseDescription());
                    
                    		SERIAL_DEBUG.println(message);
                    		deserializeJson(doc, message);
                    
                    		String type = doc["type"];
                    		SERIAL_DEBUG.print("type --> ");
                    		SERIAL_DEBUG.println(type);
                    
                    		operationalSelected = static_cast((int)doc["mode"]);
                    
                    		ResponseStatus rsW;
                    
                    		if (type=="start"){
                    			pumpIsActive = true;
                    
                    			SERIAL_DEBUG.print(rsW.getResponseDescription());
                    			SERIAL_DEBUG.println("Operation complete!!");
                    
                    			if (batteryLevel>1){
                    				batteryTimePassed = 0;
                    				btSended = false;
                    			}
                    
                    		}else if(type=="stopp"){
                    			batteryTimePassed = 0;
                    
                    			pumpIsActive = false;
                    			ResponseStatus rsUpdate = sendUpdate(PACKET_PUMP_LEVEL);
                    			SERIAL_DEBUG.println(rsUpdate.getResponseDescription());
                    			rsW = setModeSleep();
                    			SERIAL_DEBUG.print(rsW.getResponseDescription());
                    			SERIAL_DEBUG.println("Operation complete, go to sleep!!");
                    		}else if (type=="ackpa"){
                    			needAck = false;
                    		}
                    
                    		ResponseStatus rsUpdate = sendUpdate(PACKET_PUMP_LEVEL);
                    		SERIAL_DEBUG.println(rsUpdate.getResponseDescription());
                    
                    		SERIAL_DEBUG.println("Update complete!!");
                    
                    		timePassed = millis();
                    	}
                    
                    
                    

                    To send the update message sendUpdate you must set mode normal

                     ResponseStatus rs;
                    rs.code = e32ttl.setMode(MODE_0_NORMAL);

                    than start to send message

                    
                    	ResponseStatus rsSend = e32ttl.sendFixedMessage(SERVER_ADDH, SERVER_ADDL, SERVER_CHANNEL, buf, size);
                    	SERIAL_DEBUG.println(rsSend.getResponseDescription());
                    
                    	if (rsSend.code==SUCCESS && needAckParam){
                    		ackStartTime = millis();
                    		needAck = true;
                    	}
                    
                    	return rsSend;
                    
                    

                    I think It’s what you want to know.

                    Bye Renzo

                     

                     

                    Renzo Mischianti
                    Keymaster

                      Hi Ricardo,

                      EByte E32 are suitable for your pourpuse.

                      I create a little project with WeMos D1 mini (esp8266) and LoRa E32 to control and fill water tank that have similar behaivor:

                      • a master with relay to activate pump, a simple oled display to show status an encoder to manage menù;
                      • a client that is powered by battery that are in sleep mode and have 2 water sensor level.

                      This devices communicate in this manner

                      • master send a wake message to a remote E32 that wake up;
                      • client check water level sensors;
                      • send current level to the master and go to sleep;
                      • master receive message and if te tank is not full start pump;
                      • when client is waked up by max level sensor send a new message to master with the new status and wait for ACK message;
                      • master receive message stop pump and send ACK.

                      To manage wake of an Arduino up you can refer to this article Ebyte LoRa E32 device for Arduino, esp32 or esp8266: WOR (wake on radio) microcontroller and new Arduino shield

                       

                      For Raspberry I don’t have a library, and you have 2 way:

                      • implement base serial command in Raspberry and use a EByte USB TTLlike so (code is not functional example)
                        #!/usr/bin/env python
                        import time
                        import serial
                        ser = serial.Serial(
                        port='/dev/ttyS0', #Replace ttyS0 with ttyAM0 for Pi1,Pi2,Pi0
                        baudrate = 9600,
                        parity=serial.PARITY_NONE,
                        stopbits=serial.STOPBITS_ONE,
                        bytesize=serial.EIGHTBITS,
                        timeout=1
                        )
                        ser.write('')
                      • but I’m going to release a REST server implemented in an esp8266 or esp32 that you can control via GET and POST in this way, and receive messages in realtime via WebSocket
                        REST server on esp8266 and esp32: introduction
                        with this base I create this web interfaceEByte LoRa E32 Manager Custom Home Page

                      I think the second way simplify your work a lot, but you must have patience, because I need more time to publish that.

                      But I’m here if you need more information.

                      Bye Renzo

                      in reply to: Can’t use the NeoSWSerial library #6127
                      Renzo Mischianti
                      Keymaster

                        Hi ddv_adm,

                        no sorry, the support for that library is not implemented, I don’t use original Stream because I need more method to put on work the device.

                        When I’m more free I take a look to the integration.

                        Bye Renzo

                        Renzo Mischianti
                        Keymaster

                          Hi Kemran,

                          It’s strange I repeat test with my WeMos D1 mini and works correctly

                          AP IP address: 192.168.4.1
                          SPIFFS opened!
                          Ftp server waiting for connection on port 21
                          Client connected!
                          USER esp8266
                          PASS esp8266
                          OK. Waiting for commands.
                          CWD /
                          PWD
                          TYPE I
                          PASV
                          Connection management set to passive
                          Data port set to 50009
                          MLSD
                          ftpdataserver client....
                          TYPE A
                          PASV
                          Connection management set to passive
                          Data port set to 50009
                          STOR wp-signup.php
                          ftpdataserver client....
                          Receiving wp-signup.php
                          

                          Check if you are doing all steps to configure FileZilla..
                          and try to give better power supply..

                          Bye Renzo

                          Renzo Mischianti
                          Keymaster

                            No no don’t worry the sketch is ready, but I check and I post an esp32 version, here the esp8266 version

                            Attachments:
                            You must be logged in to view attached files.
                            Renzo Mischianti
                            Keymaster

                              Download attached file, there is the complete sketch.

                              Bye Renzo

                              Renzo Mischianti
                              Keymaster

                                Hi Kemran,

                                yes, It’s possible, I attach a simple sketch that do this work.

                                Respect the code from the article

                                FTP server on esp8266 and esp32

                                I add this part

                                // Connect to Wi-Fi network with SSID and password
                                Serial.print("Setting AP (Access Point)…");
                                // Remove the password parameter, if you want the AP (Access Point) to be open
                                WiFi.softAP(ssid, password);
                                
                                IPAddress IP = WiFi.softAPIP();
                                Serial.print("AP IP address: ");
                                Serial.println(IP);
                                
                                
                                Attachments:
                                You must be logged in to view attached files.
                                Renzo Mischianti
                                Keymaster

                                  I think there Is no way tuo check that the buffer retrieved Is correct.

                                  I only check if there are data to buffer but It isn’t a solution maybe.

                                  Bye Renzo

                                Viewing 15 posts - 961 through 975 (of 1,012 total)