Forum Replies Created
-
AuthorPosts
-
Hi Mauro,
to remove debug message you must comment this line
#define EMAIL_SENDER_DEBUG
If you have a better think about the structure write here without problem.
Bye Renzo
22 September 2020 at 22:24 in reply to: Is it possible to send an object with LoRa E32 device? #6440Hi 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
21 September 2020 at 22:23 in reply to: Is it possible to send an object with LoRa E32 device? #6424Hi 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.
20 September 2020 at 18:13 in reply to: Is it possible to send an object with LoRa E32 device? #6404Hi 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
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
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
11 September 2020 at 22:37 in reply to: EMailSender-master Library problem to manage email variable #6261Hi 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 formyemail
, change type.Bye Renzo
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 soEMailSender::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
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 Renzo9 September 2020 at 07:49 in reply to: Structural Health Monitoring with Raspberry PI and Arduino with LoRa #6193Hi 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 normalResponseStatus 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
8 September 2020 at 07:31 in reply to: Structural Health Monitoring with Raspberry PI and Arduino with LoRa #6158Hi 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 interface
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
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
6 September 2020 at 23:25 in reply to: esp8266 from stattion mode to access point mode with FtpServer code #6113Hi 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
5 September 2020 at 21:43 in reply to: esp8266 from stattion mode to access point mode with FtpServer code #6103No 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.5 September 2020 at 10:52 in reply to: esp8266 from stattion mode to access point mode with FtpServer code #6099Download attached file, there is the complete sketch.
Bye Renzo
5 September 2020 at 07:28 in reply to: esp8266 from stattion mode to access point mode with FtpServer code #6095Hi 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. -
AuthorPosts