Wemos D1 I2C Befehl senden
Moderators: grovkillen, Stuntteam, TD-er
-
- Normal user
- Posts: 13
- Joined: 15 Sep 2020, 18:14
Wemos D1 I2C Befehl senden
Hallo,
Ich bin noch neu hier, bitte seid gnädig
Also die Idee ist über FHEM einen Wemos D1 (auf dem ESPEasy läuft) anzusteuern und dieser sendet über I2C zu einem Arduino Nano z.B. eine Integer Zahl.
Am besten wäre es wenn der Wemos auch intervallweise eine Statusabfrage startet.
Hat da jemand von euch eine Idee wie man das umsetzt?
Gruß Adrian
Ich bin noch neu hier, bitte seid gnädig
Also die Idee ist über FHEM einen Wemos D1 (auf dem ESPEasy läuft) anzusteuern und dieser sendet über I2C zu einem Arduino Nano z.B. eine Integer Zahl.
Am besten wäre es wenn der Wemos auch intervallweise eine Statusabfrage startet.
Hat da jemand von euch eine Idee wie man das umsetzt?
Gruß Adrian
Re: Wemos D1 I2C Befehl senden
There is no "generic I2C plugin", but if you can use some UART protocol then maybe ser2net plugin may be useful here?
-
- Normal user
- Posts: 13
- Joined: 15 Sep 2020, 18:14
Re: Wemos D1 I2C Befehl senden
I found that https://github.com/letscontrolit/ESPEasy/issues/2344, is it possible to finish the request?
Alternative: How can use the UART, I didn't found that plugin (Ser2Net)?
Alternative: How can use the UART, I didn't found that plugin (Ser2Net)?
Re: Wemos D1 I2C Befehl senden
Depends on what you need.
For example there is the "ser2net" plugin.
See this (dated and limited) description on the Wiki: https://www.letscontrolit.com/wiki/index.php/Ser2Net
If you only need to receive strings from the connected device and occasionally send some (ASCII) lines terminated with a line ending, then you can also try the (experimental) P087 SerialProxy.
This plugin allows to receive ASCII strings (terminated with a line ending) and send them to a connected MQTT controller.
For example there is the "ser2net" plugin.
See this (dated and limited) description on the Wiki: https://www.letscontrolit.com/wiki/index.php/Ser2Net
If you only need to receive strings from the connected device and occasionally send some (ASCII) lines terminated with a line ending, then you can also try the (experimental) P087 SerialProxy.
This plugin allows to receive ASCII strings (terminated with a line ending) and send them to a connected MQTT controller.
-
- Normal user
- Posts: 13
- Joined: 15 Sep 2020, 18:14
Re: Wemos D1 I2C Befehl senden
Ok, the plugin P087 sounds promising. How do I install this on my Wemos D1. Neither ser2net nor P087 is listed under Task Settings -> Device. Overall, there are very few plugins.
Thanks for your help
Thanks for your help
- Attachments
-
- Screenshot 2020-09-28 143805.jpg (256.2 KiB) Viewed 28865 times
Re: Wemos D1 I2C Befehl senden
Due to its expermental stage, it is not included in the regular builds, but I guess it may be in the "custom" builds that are included in the nightly builds.
-
- Normal user
- Posts: 13
- Joined: 15 Sep 2020, 18:14
Re: Wemos D1 I2C Befehl senden
Where can I find the nightly builds? Or if I have the .ino how can I install / load it?
Re: Wemos D1 I2C Befehl senden
See here for the nightly builds: https://github.com/letscontrolit/ESPEasy/releases
-
- Normal user
- Posts: 13
- Joined: 15 Sep 2020, 18:14
Re: Wemos D1 I2C Befehl senden
Ok there is the _P087_SerialProxy.ino how can I load it?
Re: Wemos D1 I2C Befehl senden
Have you looked into the ZIP files, where all the bin files are?
You need to flash a bin file and then look into the plugin list to see if it is there.
I just looked into the ZIP file of the last build and the custom build doesn't include this plugin.
What build size (flash size) do you need, I can make a test build for you.
What is the filename of the bin you currently have flashed?
You need to flash a bin file and then look into the plugin list to see if it is there.
I just looked into the ZIP file of the last build and the custom build doesn't include this plugin.
What build size (flash size) do you need, I can make a test build for you.
What is the filename of the bin you currently have flashed?
-
- Normal user
- Posts: 13
- Joined: 15 Sep 2020, 18:14
Re: Wemos D1 I2C Befehl senden
How do I see in the BIN file whether the plugin is included (where is the plugin list)?
I have ESP_Easy_mega_20200812_normal_ESP8266_4M1M flashed this version.
I have ESP_Easy_mega_20200812_normal_ESP8266_4M1M flashed this version.
Re: Wemos D1 I2C Befehl senden
Here is the plugin list, but it is not 100% accurate anymore as the last few plugins are not all included in the "test" builds.
https://espeasy.readthedocs.io/en/lates ... al-plugins
Problem is we're simply running out of space on the flash, so there must be a new set definition of plugins per build, or a build environment where someone only has to click the plugins needed.
I just made a test build for you including the P087 serial proxy plugin
https://www.dropbox.com/s/1afyc9wrdxeku ... M.bin?dl=0
But remember, it is highly experimental.
The command for this plugin to write something to it is "serialproxy_write"
https://espeasy.readthedocs.io/en/lates ... al-plugins
Problem is we're simply running out of space on the flash, so there must be a new set definition of plugins per build, or a build environment where someone only has to click the plugins needed.
I just made a test build for you including the P087 serial proxy plugin
https://www.dropbox.com/s/1afyc9wrdxeku ... M.bin?dl=0
But remember, it is highly experimental.
The command for this plugin to write something to it is "serialproxy_write"
-
- Normal user
- Posts: 13
- Joined: 15 Sep 2020, 18:14
Re: Wemos D1 I2C Befehl senden
How I define a new set of plugins. How I get the BIN file by my self?
Your BIN file is working fine, but how do I get the plugin to work? Is there any documentation here?
Thanks for all your help
Your BIN file is working fine, but how do I get the plugin to work? Is there any documentation here?
Thanks for all your help
Re: Wemos D1 I2C Befehl senden
Of course there is some documentation on that (although it could be improved as this is a frequently returning question)
For using PlatformIO: https://espeasy.readthedocs.io/en/lates ... ormIO.html
For using Arduino IDE: https://espeasy.readthedocs.io/en/lates ... noIDE.html
IMHO the preferred way is PlatformIO, but there are lots of users to disagree with me.
For using PlatformIO: https://espeasy.readthedocs.io/en/lates ... ormIO.html
For using Arduino IDE: https://espeasy.readthedocs.io/en/lates ... noIDE.html
IMHO the preferred way is PlatformIO, but there are lots of users to disagree with me.
-
- Normal user
- Posts: 13
- Joined: 15 Sep 2020, 18:14
Re: Wemos D1 I2C Befehl senden
ok I think that is the answer for the question "How I build my own BIN file". Thanks for that.
But I can't get the plugin to run. The Command "http://<espeasyip>/control?cmd=serialproxy_write,5" is doing nothing.
Can you help me with that problem?
But I can't get the plugin to run. The Command "http://<espeasyip>/control?cmd=serialproxy_write,5" is doing nothing.
Can you help me with that problem?
Re: Wemos D1 I2C Befehl senden
What is not working?
Remember the "serialproxy_write" does write the literal string including a line termination (CRLF) to the serial port.
So it does not send the byte 5, but the characters "5<CR><LF>"
Remember the "serialproxy_write" does write the literal string including a line termination (CRLF) to the serial port.
So it does not send the byte 5, but the characters "5<CR><LF>"
-
- Normal user
- Posts: 13
- Joined: 15 Sep 2020, 18:14
Re: Wemos D1 I2C Befehl senden
If I type in the command it says:
Unknown or restricted command!
sending the character "5<CR><LF>" would be fine for the first step.
Unknown or restricted command!
sending the character "5<CR><LF>" would be fine for the first step.
Re: Wemos D1 I2C Befehl senden
From where do you send the command?
-
- Normal user
- Posts: 13
- Joined: 15 Sep 2020, 18:14
Re: Wemos D1 I2C Befehl senden
Ok I don't know what I did differently this time, but now the command is working.
How I can receive data?
How I can receive data?
Re: Wemos D1 I2C Befehl senden
You can feed the received strings to an MQTT controller.
Currently the "String" type of data is not yet supported in a lot of places in ESPEasy.
It can be used to send to a MQTT controller, but it is also possible to send it to a display ("[task#varname]" also supports strings) or use it in rules to send to an HTTP server in an URL.
It is not yet possible to compare strings in rules, but you can create substrings and if you know the characters at some position in a line will be numerical you can convert them to an int.
This can even be done if you receive HEX data.
See:
- https://espeasy.readthedocs.io/en/lates ... #substring
- https://espeasy.readthedocs.io/en/lates ... ing#strtol
Currently the "String" type of data is not yet supported in a lot of places in ESPEasy.
It can be used to send to a MQTT controller, but it is also possible to send it to a display ("[task#varname]" also supports strings) or use it in rules to send to an HTTP server in an URL.
It is not yet possible to compare strings in rules, but you can create substrings and if you know the characters at some position in a line will be numerical you can convert them to an int.
This can even be done if you receive HEX data.
See:
- https://espeasy.readthedocs.io/en/lates ... #substring
- https://espeasy.readthedocs.io/en/lates ... ing#strtol
-
- Normal user
- Posts: 13
- Joined: 15 Sep 2020, 18:14
Re: Wemos D1 I2C Befehl senden
First of all thanks for all your help and time
To be concrete with my problem:
I'm sending with an Arduino a number (803) to the ESPeasy. In the end, I need the number on my FHEM Server.
At the moment I don't know where I receive the message on the ESPeasy.
How can I send on the number to the FHEM server?
If I have to config the Serial Proxy receives rules.
To be concrete with my problem:
I'm sending with an Arduino a number (803) to the ESPeasy. In the end, I need the number on my FHEM Server.
At the moment I don't know where I receive the message on the ESPeasy.
How can I send on the number to the FHEM server?
If I have to config the Serial Proxy receives rules.
Re: Wemos D1 I2C Befehl senden
Not tested it, but I guess you could do something like this in the rules.
Assume the task running serialproxy is called "proxy" and the value it returns is "v"
So you may need to change that to match your setup.
The idea is to store the received value in a dummy task at task 3, variable 1 (you may need to change that too)
Assume the task running serialproxy is called "proxy" and the value it returns is "v"
So you may need to change that to match your setup.
The idea is to store the received value in a dummy task at task 3, variable 1 (you may need to change that too)
Code: Select all
on [proxy#v] do
taskvalueset,3,1,[proxy#v]
endon
Re: Wemos D1 I2C Befehl senden
You might want to remove the square brackets from the line with 'on ... do'
/Ton (PayPal.me)
Re: Wemos D1 I2C Befehl senden
Aren't they removed in the parser to find the on...do line?
Re: Wemos D1 I2C Befehl senden
I would expect the [device#variable] to be replaced by the current sensor value, so, no event would trigger that piece of code?
/Ton (PayPal.me)
Re: Wemos D1 I2C Befehl senden
Hmm good point... I thought that was why it stripped off the square brackets first, but may have to check in the code if that's still the current situation here.
-
- Normal user
- Posts: 31
- Joined: 24 Oct 2020, 15:18
Re: Wemos D1 I2C Befehl senden
i hope its ok to repoen this thread.
also i hope some can give me some pointers.
i do want to send a value (or 2, in fact co2 and temp) to a arduino by using the hardware serial.
i have never worked with the rules set of espeasy so forgive my stupidness.
as i understood one way to achieve my goal would be.
using the serial proxy with "serialproxy_write".
-setup a dummy device, forware the values to this device by a rule.
-in the newly created device we use "serialproxy_write" on every update or may every second or 2 periodically.
is there any example written somewhere?
i found these.
https://www.letscontrolit.com/wiki/inde ... rial_Rules
but there is no specific example for "serialproxy".
also i hope some can give me some pointers.
i do want to send a value (or 2, in fact co2 and temp) to a arduino by using the hardware serial.
i have never worked with the rules set of espeasy so forgive my stupidness.
as i understood one way to achieve my goal would be.
using the serial proxy with "serialproxy_write".
-setup a dummy device, forware the values to this device by a rule.
-in the newly created device we use "serialproxy_write" on every update or may every second or 2 periodically.
is there any example written somewhere?
i found these.
https://www.letscontrolit.com/wiki/inde ... rial_Rules
but there is no specific example for "serialproxy".
-
- Normal user
- Posts: 31
- Joined: 24 Oct 2020, 15:18
Re: Wemos D1 I2C Befehl senden
have played around a bit to get a better picture.
maybe i could filter the output.
just havent found the any usable log entry/setting so far.
basically i just need the CO2 value, the temp reading of the mhz19b sensor seems unsuable anyway and its not important.
is there any precompiled version offering the serialproxy as also the normal plugins?, i would need the dummy devices as the mh-z19b, a bme280 gy7021 maybe also (so nothing too fancy needed).
otherwise i prob have to compile myself, just wanna ask if there is something ready.
other question would be, is there maybe a commnad i could send from the arduino to request a value from the esp8266 (co2) and it get publsihed by serial or at least show up in some log entry?
maybe i could filter the output.
just havent found the any usable log entry/setting so far.
basically i just need the CO2 value, the temp reading of the mhz19b sensor seems unsuable anyway and its not important.
is there any precompiled version offering the serialproxy as also the normal plugins?, i would need the dummy devices as the mh-z19b, a bme280 gy7021 maybe also (so nothing too fancy needed).
otherwise i prob have to compile myself, just wanna ask if there is something ready.
other question would be, is there maybe a commnad i could send from the arduino to request a value from the esp8266 (co2) and it get publsihed by serial or at least show up in some log entry?
Re: Wemos D1 I2C Befehl senden
Right now there is no ready made build including all those plugins.
You can just send data from an Arduino to the ESP via serial, like any command that's present in ESPEasy. See: https://espeasy.readthedocs.io/en/lates ... mmand.html
As long as the "Enable Serial port" (Tools => Advanced) is enabled.
Right now we don't have a command to fetch, but I guess you may try to send a command like this:
This will show something like this:
N.B. "temp2" is a Dallas sensor task at my node and "T1" is the first temperature variable name.
I added some marker "Bla" so you could try to filter out the values.
This is all part of any build, so you don't need to make your own to get this.
Just make sure you're logging with loglevel "info" to the serial port.
You can just send data from an Arduino to the ESP via serial, like any command that's present in ESPEasy. See: https://espeasy.readthedocs.io/en/lates ... mmand.html
As long as the "Enable Serial port" (Tools => Advanced) is enabled.
Right now we don't have a command to fetch, but I guess you may try to send a command like this:
Code: Select all
logentry,"Bla [temp2#T1]"
Code: Select all
346701 : Info : Bla 22.19
I added some marker "Bla" so you could try to filter out the values.
This is all part of any build, so you don't need to make your own to get this.
Just make sure you're logging with loglevel "info" to the serial port.
-
- Normal user
- Posts: 31
- Joined: 24 Oct 2020, 15:18
Re: Wemos D1 I2C Befehl senden
thats very helpfull, esspecially with the code example.
i will try tomorrow after some sleep.
i do have my values send to the espeasy from the arduino by using the taskvalueset command and this is working flawless with a half dozen values at 115200baud.
it should be doable to fish the value from the log, its really just one so far, good to learn a bit.
and thanks again for the detailed explanation, also for naming the log level.
i will try tomorrow after some sleep.
i do have my values send to the espeasy from the arduino by using the taskvalueset command and this is working flawless with a half dozen values at 115200baud.
it should be doable to fish the value from the log, its really just one so far, good to learn a bit.
and thanks again for the detailed explanation, also for naming the log level.
-
- Normal user
- Posts: 31
- Joined: 24 Oct 2020, 15:18
Re: Wemos D1 I2C Befehl senden
your hint where very helpfull.
i can now receive my co2 value on the arduno by filtering the data from the info log.
if its any help to someone.
my Rule:
my Arduino code:
based on these examples
https://forum.arduino.cc/index.php?topic=288234.0
its working ok, but i needed to go down with the baudrate, just sending with the arduino is possible with 115200 baud.
i can now receive my co2 value on the arduno by filtering the data from the info log.
if its any help to someone.
my Rule:
Code: Select all
on CO2#ppm do
logentry,"| [CO2#ppm] $"
endon
Code: Select all
boolean newData = false;
int co2 = 0;
void setup() {
Serial.begin(19200);}
void loop() {
recvWithStartEndMarkers();
//showNewData();}
}
void recvWithStartEndMarkers() {
const byte numChars = 64;
char receivedChars[numChars];
boolean newData = false;
static boolean recvInProgress = false;
static byte ndx = 0;
char startMarker = '|';
char endMarker = '$';
char rc;
while (Serial.available() > 0 && newData == false) {
rc = Serial.read();
if (recvInProgress == true) {
if (rc != endMarker) {
receivedChars[ndx] = rc;
ndx++;
if (ndx >= numChars) {
ndx = numChars - 1;
}
}
else {
receivedChars[ndx] = '\0'; // terminate the string
recvInProgress = false;
ndx = 0;
newData = true;
}
}
else if (rc == startMarker) {
recvInProgress = true;
}
}
co2 = 0;
co2 = atoi(receivedChars);
}
void showNewData() {
if (newData == true) {
Serial.print("This just in ... ");
// Serial.println(receivedChars);
newData = false;
}
}
https://forum.arduino.cc/index.php?topic=288234.0
its working ok, but i needed to go down with the baudrate, just sending with the arduino is possible with 115200 baud.
Re: Wemos D1 I2C Befehl senden
You can set the baud rate on the Tools => Advanced page
I think it will be best to either make the SerialProxy plugin a bit more user friendly, or make a command to actually send data to the serial port (just any serial port)
N.B. this is a mental ToDo for me
I think it will be best to either make the SerialProxy plugin a bit more user friendly, or make a command to actually send data to the serial port (just any serial port)
N.B. this is a mental ToDo for me
-
- Normal user
- Posts: 31
- Joined: 24 Oct 2020, 15:18
Re: Wemos D1 I2C Befehl senden
a real command would be very helpfull, while it looks i got away with this aproach, icould i magine this solution could fail in more complex scenarios.
i am using a lower baudrate allready atm 19200.
i would need to make more and longer tests to determine what really works.
could be i still had some unecessary garbage on the serial from the arduino, i need another testrun, will report what baud i could achieve.
may can push it higher now, 38k baud maybe.
9600 is quite safe, obviously, 19200 is fine too (even with a little unnecesaary garbage on the serial).
i also increased the receive buffer from 32 to 64, this seemed to help too.
i am using a lower baudrate allready atm 19200.
i would need to make more and longer tests to determine what really works.
could be i still had some unecessary garbage on the serial from the arduino, i need another testrun, will report what baud i could achieve.
may can push it higher now, 38k baud maybe.
9600 is quite safe, obviously, 19200 is fine too (even with a little unnecesaary garbage on the serial).
i also increased the receive buffer from 32 to 64, this seemed to help too.
Last edited by hereiam991 on 21 Nov 2020, 11:24, edited 1 time in total.
Re: Wemos D1 I2C Befehl senden
Keep in mind that lowering the baud rate will also delay the output of all logs.
The logs can sometimes be quite verbose and at lower baudrate the buffers for the log may fill up the memory.
There are some checks to throw out messages if the buffer fills up all memory, but this also means the message you try to send may get lost or at least delayed.
It is even possible a message may be cut off half way if the memory runs low.
The logs can sometimes be quite verbose and at lower baudrate the buffers for the log may fill up the memory.
There are some checks to throw out messages if the buffer fills up all memory, but this also means the message you try to send may get lost or at least delayed.
It is even possible a message may be cut off half way if the memory runs low.
-
- Normal user
- Posts: 31
- Joined: 24 Oct 2020, 15:18
Re: Wemos D1 I2C Befehl senden
i am testing today with 57600 baud and it seems to be ok after i cleaned the garbage, thinking 38400 should be kinda safe.
i also rasied the buffer of the receiving arduino to 128 byte.
think i saw him once skipping a beat, but overall it not so unstable and prbalby usable for just displaying a value.
edit: back to 19200 and wil see, think its more stable.
thinking of it, a "taskvalueget" command would kinda nice to have.
like the set command just that the value is printed once on the serial in return.
i also rasied the buffer of the receiving arduino to 128 byte.
think i saw him once skipping a beat, but overall it not so unstable and prbalby usable for just displaying a value.
edit: back to 19200 and wil see, think its more stable.
thinking of it, a "taskvalueget" command would kinda nice to have.
like the set command just that the value is printed once on the serial in return.
-
- Normal user
- Posts: 15
- Joined: 21 Feb 2020, 17:33
Re: Wemos D1 I2C Befehl senden
Hello and good Morning,
i have try evry thnink but i cant send and/or recive.
i What to send AT commands a a gsm module to get GPWS Location and so on. The Module is connected to a WEMOS D1 mini on port D1 and D2
Wemos D1 mini --- sim800l
D1 --- RXD
D2 --- TXD
i have connected the stuff to a Battery becouse the gsm module have Curent peaks on 2A
when i write in the TOOLS-the Comand AT i must get from the SIM module the text OK but i dont get it.
Can some one please help me please ?
Thank
i have try evry thnink but i cant send and/or recive.
i What to send AT commands a a gsm module to get GPWS Location and so on. The Module is connected to a WEMOS D1 mini on port D1 and D2
Wemos D1 mini --- sim800l
D1 --- RXD
D2 --- TXD
i have connected the stuff to a Battery becouse the gsm module have Curent peaks on 2A
when i write in the TOOLS-the Comand AT i must get from the SIM module the text OK but i dont get it.
Can some one please help me please ?
Thank
- Attachments
-
- 4.png (100.79 KiB) Viewed 23817 times
-
- 3.png (83 KiB) Viewed 23817 times
-
- 2.png (105.56 KiB) Viewed 23817 times
-
- 1.png (111.36 KiB) Viewed 23817 times
-
- Normal user
- Posts: 15
- Joined: 21 Feb 2020, 17:33
Re: Wemos D1 I2C Befehl senden
If someone can help me today to bring the communication with the sim module to run i can pay for your time.
-
- Normal user
- Posts: 15
- Joined: 21 Feb 2020, 17:33
Re: Wemos D1 I2C Befehl senden
It is not possible with the esp to send and get Commands from a gsm module?
Re: Wemos D1 I2C Befehl senden
Yep, we don't have a plugin or controller to interact with a mobile.
It is possible to receive commands via the serial port of the ESP, but I have no idea how to send just those ESPEasy commands from a mobile.
It is possible to receive commands via the serial port of the ESP, but I have no idea how to send just those ESPEasy commands from a mobile.
Who is online
Users browsing this forum: Google [Bot] and 130 guests