Unknown i2c device - 4-20 mA measurement M5stack

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
obstbauer
Normal user
Posts: 59
Joined: 25 May 2023, 15:46

Unknown i2c device - 4-20 mA measurement M5stack

#1 Post by obstbauer » 26 Mar 2025, 09:36

Hello,
I would like to use this 4-20 mA measurement device with i2c but I don't know how to communicate with it to get the current values

https://docs.m5stack.com/en/unit/AIN4-20mA%20Unit

I think it is not included up to now to the plugin list? Is it possible to talk to it with esp easy ? i2c protocol can find at the end of the link.
With i2c scan I can find the device (adress 0x55) and my display.
At the moment I use a wemos s2 mini with ESP_Easy_mega_20241222_normal_ESP32s2_4M316k_CDC Dec 22

Thank you!
Regards

TD-er
Core team member
Posts: 9855
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Unknown i2c device - 4-20 mA measurement M5stack

#2 Post by TD-er » 26 Mar 2025, 10:05

This is not currently supported via any plugin right now.
It looks like this is a separate processor running some proprietary code and wired as an I2C device.
So this is not an actual part which we could implement based on some datasheet, but it is a small microprocessor running code from M5Stack.

Not sure if they use a somewhat 'generic' protocol, so we could add a 'generic' plugin for these kinds of parts M5stack made.
There are others, like a module with several rotary encoders, also using a similar approach where they added a small microcontroller to make it communicate with I2C.

User avatar
Ath
Normal user
Posts: 4319
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Unknown i2c device - 4-20 mA measurement M5stack

#3 Post by Ath » 26 Mar 2025, 11:12

Instead of this specific device, you can also use one of the INA219 or INA3221 I2C voltage/current sensors, that are supported by ESPEasy. Both plugins are in the Energy builds. Those plugins won't support that M5Stack device though.
/Ton (PayPal.me)

obstbauer
Normal user
Posts: 59
Joined: 25 May 2023, 15:46

Re: Unknown i2c device - 4-20 mA measurement M5stack

#4 Post by obstbauer » 26 Mar 2025, 11:27

Ok thank you, but now I have the m5 ones and it would be nice to use them...

User avatar
Ath
Normal user
Posts: 4319
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Unknown i2c device - 4-20 mA measurement M5stack

#5 Post by Ath » 26 Mar 2025, 11:32

Hm, well, depending on the level of software engineer you are, you could write a plugin for the device. We have a Developers Getting Started guide ;)
I can reserve a new PluginID if needed.
/Ton (PayPal.me)

obstbauer
Normal user
Posts: 59
Joined: 25 May 2023, 15:46

Re: Unknown i2c device - 4-20 mA measurement M5stack

#6 Post by obstbauer » 26 Mar 2025, 11:58

ok.. not nice news, I don't think that I am able to write a plugin... I thought that there is maybe a solution with a rule or something else to build an i2c communication with the mentioned protocol

the resolution of the INA devices are not so good with 0,4 mA and 0,8 mA, the m5 devices are really nice for measuring 4-20 mA,
I will try to read it out with a python programm and then I try to send the values to my mqtt server, maybe this works better

obstbauer
Normal user
Posts: 59
Joined: 25 May 2023, 15:46

Re: Unknown i2c device - 4-20 mA measurement M5stack

#7 Post by obstbauer » 26 Mar 2025, 12:04

there is code available for communication

https://github.com/m5stack/M5Module-4-20mA

User avatar
Ath
Normal user
Posts: 4319
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Unknown i2c device - 4-20 mA measurement M5stack

#8 Post by Ath » 26 Mar 2025, 12:06

The device is rather simple to read data from, we just don't have a generic I2C plugin to retrieve that data from a device. We're already discussing about how to implement that 8-) To be continued...
/Ton (PayPal.me)

User avatar
Ath
Normal user
Posts: 4319
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Unknown i2c device - 4-20 mA measurement M5stack

#9 Post by Ath » 26 Mar 2025, 12:36

I have assigned Plugin ID P180 for a generic I2C interface plugin.
/Ton (PayPal.me)

TD-er
Core team member
Posts: 9855
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Unknown i2c device - 4-20 mA measurement M5stack

#10 Post by TD-er » 26 Mar 2025, 12:48

Ath wrote: 26 Mar 2025, 12:36 I have assigned Plugin ID P180 for a generic I2C interface plugin.
Yay!
Finally :)

obstbauer
Normal user
Posts: 59
Joined: 25 May 2023, 15:46

Re: Unknown i2c device - 4-20 mA measurement M5stack

#11 Post by obstbauer » 26 Mar 2025, 13:02

woah this was fast, how can I get the plugin to test it ?

TD-er
Core team member
Posts: 9855
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Unknown i2c device - 4-20 mA measurement M5stack

#12 Post by TD-er » 26 Mar 2025, 14:55

it is planned, not done yet

obstbauer
Normal user
Posts: 59
Joined: 25 May 2023, 15:46

Re: Unknown i2c device - 4-20 mA measurement M5stack

#13 Post by obstbauer » 27 Mar 2025, 16:10

First question: How can I find out if the generic i2c interface plugin is available ?

Second question: Is ESP-now available meanwhile? Then I could use on ESP for the i2c communication with a simple C programm and sent the values to another ESP which shows the values on a display and communicate to my mqtt server

User avatar
Ath
Normal user
Posts: 4319
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Unknown i2c device - 4-20 mA measurement M5stack

#14 Post by Ath » 27 Mar 2025, 16:27

obstbauer wrote: 27 Mar 2025, 16:10 First question: How can I find out if the generic i2c interface plugin is available ?
There will be a notification in this thread
obstbauer wrote: 27 Mar 2025, 16:10 Second question: Is ESP-now available meanwhile? Then I could use on ESP for the i2c communication with a simple C programm and sent the values to another ESP which shows the values on a display and communicate to my mqtt server
ESP-now is not released yet, for several (mostly technical) reasons.
For communication between ESP nodes on the same WiFi or Ethernet network, you can use the ESPEasy P2P network to transfer data from one unit to the other, either by using the SendTo command, and/or by configuring the P2P Controller. Alternatively, you can use http commands to send data to a remote ESPEasy unit.
/Ton (PayPal.me)

obstbauer
Normal user
Posts: 59
Joined: 25 May 2023, 15:46

Re: Unknown i2c device - 4-20 mA measurement M5stack

#15 Post by obstbauer » 31 Mar 2025, 09:58

is there a simple wired communication possible between two ESP32, one with espeasy? Over UART for example ?
I had an ESP32 running now with the M5Stack device and I get the current values, I want so sent them wired to another device with espeasy which makes the communication to wifi and show values on a display

User avatar
Ath
Normal user
Posts: 4319
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Unknown i2c device - 4-20 mA measurement M5stack

#16 Post by Ath » 31 Mar 2025, 11:09

Do you need it to be wired, or are the ESPs both connected to the same WiFi network? As in the case of single-network, you can easily pass data via the P2P network (via SendTo command and optionally using the P2P Controller). P2P is enabled by default on ESPEasy (using the IANA-registered UDP port 8266). Important requirement: All units must have a unique Unit number, not being 0 or 255.

Edit:
You can connect a serial-out from a non-ESPEasy device to the console port of ESPEasy (115200 baud, 8N1), and send commands, just like in Rules, to the device for setting values f.e. to a Dummy device, using TaskValueSet. Those values can then be displayed or sent to a Controller.
/Ton (PayPal.me)

obstbauer
Normal user
Posts: 59
Joined: 25 May 2023, 15:46

Re: Unknown i2c device - 4-20 mA measurement M5stack

#17 Post by obstbauer » 31 Mar 2025, 12:03

it would be nice to have an easy wired serial connection, because I have no experience with c++ and wifi and I want to keep it as simple as possible, both devices are close together

the sender is the ESP with my own software, the receiver ist espeasy, one value around every 5 seconds

User avatar
Ath
Normal user
Posts: 4319
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Unknown i2c device - 4-20 mA measurement M5stack

#18 Post by Ath » 10 Apr 2025, 23:38

obstbauer wrote: 26 Mar 2025, 13:02 ... how can I get the plugin to test it ?
I've created PR #5296 to add P180 - Generic - I2C Generic to enable to read I2C devices 'manually', by getting the required command sequence from the data sheet.

I'll add a command sequence for your M5Stack sensor soon, and also a binary to upload to your ESP32-S2.
Last edited by Ath on 11 Apr 2025, 08:23, edited 1 time in total.
/Ton (PayPal.me)

obstbauer
Normal user
Posts: 59
Joined: 25 May 2023, 15:46

Re: Unknown i2c device - 4-20 mA measurement M5stack

#19 Post by obstbauer » 10 Apr 2025, 23:41

woah thank you

User avatar
Ath
Normal user
Posts: 4319
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Unknown i2c device - 4-20 mA measurement M5stack

#20 Post by Ath » 11 Apr 2025, 21:56

I'm thinking of adding this plugin to all ESP32 Collection builds (including Climate, Display, Energy and Neopixel), so I've built an ESP32-S2 Collection_A build for testing: You can add the Generic - I2C Generic plugin to an available task slot, give it a name, set the I2C Address to '0x55', set Output Data Type to 'Single' and enter this for the I2C Commands 1 setting:

Code: Select all

read.u16le.0x20;calc.%value%/100
This will read the 'Current' value from the M5Stack sensor, divide it by 100 to get the mA value, and assign it to the first (and single) Value1 field.

If you also need the raw ADC value, set the Output Data Type to Dual, and enter this for the I2C Commands 2 setting:

Code: Select all

read.u16le.0x0
It will read the raw value from the sensor and set that to the second Value2 field. You can rename those Value names, if desired, of course.


Writing custom commands, like changing the calibration, to the sensor can be achieved via the 'geni2c,cmd,...' command, where for the dots you can add a supported command, as listed in the source (and later in the docs, of course)
/Ton (PayPal.me)

obstbauer
Normal user
Posts: 59
Joined: 25 May 2023, 15:46

Re: Unknown i2c device - 4-20 mA measurement M5stack

#21 Post by obstbauer » 12 Apr 2025, 21:57

I am sorry, I am not able to flash my wemos s2 mini and I don't understand why....
I was able to flash it online with a normal ESPeasy Version, the ESP Easy Flasher find the device as COM4 but there are always errors..

I tried it with two boards. If I try my C++ programs with Arduino IDE the USB connection sound is coming from time to time, it seems that there is no stable seriell connection. Sometines it is COM4 and then COM5.
I push 0 and RST button and then release RST to bring the device in flash mode, then the USB sound appearrs.


Code: Select all

######2025-04-12######
#######0.04.009#######
######FLASH INFO######
BIN file: ESP_Easy_mega_20250411_collection_A_ESP32s2_4M316k_CDC.bin
COM port: (COM4) Generic Serial Port
Baud rate: 115200
######POST FLASH######
No post flash information entered...
######FLASH LOG######
[esptool.exe -vv -cd nodemcu -cb 115200 -cp COM4 -ca 0x00000 -cf "D:\EspEasy\bin\ESP_Easy_mega_20250411_collection_A_ESP32s2_4M316k_CDC.bin"]
[12.04.2025 21:50:53] esptool v0.4.12 - (c) 2014 Ch. Klippel <ck@atelier-klippel.de>
[12.04.2025 21:50:53] 	setting board to nodemcu
[12.04.2025 21:50:53] 	setting baudrate from 115200 to 115200
[12.04.2025 21:50:53] 	setting port from  to COM4
[12.04.2025 21:50:53] 	setting address from 0x00000000 to 0x00000000
[12.04.2025 21:50:53] 	espcomm_upload_file
[12.04.2025 21:50:53] 	espcomm_upload_mem
[12.04.2025 21:50:53] 	setting serial port timeouts to 1000 ms
[12.04.2025 21:50:53] opening bootloader
[12.04.2025 21:50:53] resetting board
[12.04.2025 21:50:53] trying to connect
[12.04.2025 21:50:53] 	flush start
[12.04.2025 21:50:53] 	setting serial port timeouts to 1 ms
[12.04.2025 21:50:53] 	setting serial port timeouts to 1000 ms
[12.04.2025 21:50:53] 	flush complete
[12.04.2025 21:50:53] 	espcomm_send_command: sending command header
[12.04.2025 21:50:53] 	espcomm_send_command: sending command payload
[12.04.2025 21:50:53] 	read 0, requested 1
[12.04.2025 21:50:53] trying to connect
[12.04.2025 21:50:53] 	flush start
[12.04.2025 21:50:53] 	setting serial port timeouts to 1 ms
[12.04.2025 21:50:53] 	setting serial port timeouts to 1000 ms
[12.04.2025 21:50:53] 	flush complete
[12.04.2025 21:50:53] 	espcomm_send_command: sending command header
[12.04.2025 21:50:53] 	espcomm_send_command: sending command payload
[12.04.2025 21:50:53] 	read 0, requested 1
[12.04.2025 21:50:53] trying to connect
[12.04.2025 21:50:53] 	flush start
[12.04.2025 21:50:53] 	setting serial port timeouts to 1 ms
[12.04.2025 21:50:53] 	setting serial port timeouts to 1000 ms
[12.04.2025 21:50:53] 	flush complete
[12.04.2025 21:50:53] 	espcomm_send_command: sending command header
[12.04.2025 21:50:53] 	espcomm_send_command: sending command payload
[12.04.2025 21:50:53] 	read 0, requested 1
[12.04.2025 21:50:53] resetting board
[12.04.2025 21:50:53] trying to connect
[12.04.2025 21:50:53] 	flush start
[12.04.2025 21:50:53] 	setting serial port timeouts to 1 ms
[12.04.2025 21:50:53] 	setting serial port timeouts to 1000 ms
[12.04.2025 21:50:53] 	flush complete
[12.04.2025 21:50:53] 	espcomm_send_command: sending command header
[12.04.2025 21:50:53] 	espcomm_send_command: sending command payload
[12.04.2025 21:50:53] 	read 0, requested 1
[12.04.2025 21:50:53] trying to connect
[12.04.2025 21:50:53] 	flush start
[12.04.2025 21:50:53] 	setting serial port timeouts to 1 ms
[12.04.2025 21:50:53] 	setting serial port timeouts to 1000 ms
[12.04.2025 21:50:53] 	flush complete
[12.04.2025 21:50:53] 	espcomm_send_command: sending command header
[12.04.2025 21:50:53] 	espcomm_send_command: sending command payload
[12.04.2025 21:50:53] 	read 0, requested 1
[12.04.2025 21:50:53] trying to connect
[12.04.2025 21:50:53] 	flush start
[12.04.2025 21:50:53] 	setting serial port timeouts to 1 ms
[12.04.2025 21:50:53] 	setting serial port timeouts to 1000 ms
[12.04.2025 21:50:53] 	flush complete
[12.04.2025 21:50:53] 	espcomm_send_command: sending command header
[12.04.2025 21:50:53] 	espcomm_send_command: sending command payload
[12.04.2025 21:50:53] 	read 0, requested 1
[12.04.2025 21:50:53] resetting board
[12.04.2025 21:50:53] trying to connect
[12.04.2025 21:50:53] 	flush start
[12.04.2025 21:50:53] 	setting serial port timeouts to 1 ms
[12.04.2025 21:50:53] 	setting serial port timeouts to 1000 ms
[12.04.2025 21:50:53] 	flush complete
[12.04.2025 21:50:53] 	espcomm_send_command: sending command header
[12.04.2025 21:50:53] 	espcomm_send_command: sending command payload
[12.04.2025 21:50:53] 	read 0, requested 1
[12.04.2025 21:50:53] trying to connect
[12.04.2025 21:50:53] 	flush start
[12.04.2025 21:50:53] 	setting serial port timeouts to 1 ms
[12.04.2025 21:50:53] 	setting serial port timeouts to 1000 ms
[12.04.2025 21:50:53] 	flush complete
[12.04.2025 21:50:53] 	espcomm_send_command: sending command header
[12.04.2025 21:50:53] 	espcomm_send_command: sending command payload
[12.04.2025 21:50:53] 	read 0, requested 1
[12.04.2025 21:50:53] trying to connect
[12.04.2025 21:50:53] 	flush start
[12.04.2025 21:50:53] 	setting serial port timeouts to 1 ms
[12.04.2025 21:50:53] 	setting serial port timeouts to 1000 ms
[12.04.2025 21:50:53] 	flush complete
[12.04.2025 21:50:53] 	espcomm_send_command: sending command header
[12.04.2025 21:50:53] 	espcomm_send_command: sending command payload
[12.04.2025 21:50:53] 	read 0, requested 1
[12.04.2025 21:50:53] warning: espcomm_sync failed
[12.04.2025 21:50:53] error: espcomm_open failed
[12.04.2025 21:50:53] error: espcomm_upload_mem failed
[2025-04-12 21:50:53] STOPPED due to 2 errors! (try reset on the unit, then start a new flash attempt)

obstbauer
Normal user
Posts: 59
Joined: 25 May 2023, 15:46

Re: Unknown i2c device - 4-20 mA measurement M5stack

#22 Post by obstbauer » 12 Apr 2025, 22:34

I tried it with an ESP32 C3 super mini too, it doesn't work....

Code: Select all

######2025-04-12######
#######0.04.009#######
######FLASH INFO######
BIN file: ESP_Easy_mega_20250411_collection_A_ESP32s2_4M316k_CDC.bin
COM port: (COM6) Generic Serial Port
Baud rate: 115200
######POST FLASH######
No post flash information entered...
######FLASH LOG######
[esptool.exe -vv -cd nodemcu -cb 115200 -cp COM6 -ca 0x00000 -cf "D:\EspEasy\bin\ESP_Easy_mega_20250411_collection_A_ESP32s2_4M316k_CDC.bin"]
[12.04.2025 22:32:14] esptool v0.4.12 - (c) 2014 Ch. Klippel <ck@atelier-klippel.de>
[12.04.2025 22:32:14] 	setting board to nodemcu
[12.04.2025 22:32:14] 	setting baudrate from 115200 to 115200
[12.04.2025 22:32:14] 	setting port from  to COM6
[12.04.2025 22:32:14] 	setting address from 0x00000000 to 0x00000000
[12.04.2025 22:32:14] 	espcomm_upload_file
[12.04.2025 22:32:14] 	espcomm_upload_mem
[12.04.2025 22:32:14] 	setting serial port timeouts to 1000 ms
[12.04.2025 22:32:14] opening bootloader
[12.04.2025 22:32:14] resetting board
[12.04.2025 22:32:14] trying to connect
[12.04.2025 22:32:14] 	flush start
[12.04.2025 22:32:14] 	setting serial port timeouts to 1 ms
[12.04.2025 22:32:14] 	setting serial port timeouts to 1000 ms
[12.04.2025 22:32:14] 	flush complete
[12.04.2025 22:32:14] 	espcomm_send_command: sending command header
[12.04.2025 22:32:14] 	espcomm_send_command: sending command payload
[12.04.2025 22:32:14] 	serialport_receive_C0: 20 instead of C0
[12.04.2025 22:32:14] trying to connect
[12.04.2025 22:32:14] 	flush start
[12.04.2025 22:32:14] 	setting serial port timeouts to 1 ms
[12.04.2025 22:32:14] 	setting serial port timeouts to 1000 ms
[12.04.2025 22:32:14] 	flush complete
[12.04.2025 22:32:14] 	espcomm_send_command: sending command header
[12.04.2025 22:32:14] 	espcomm_send_command: sending command payload
[12.04.2025 22:32:14] 	serialport_receive_C0: 30 instead of C0
[12.04.2025 22:32:14] trying to connect
[12.04.2025 22:32:14] 	flush start
[12.04.2025 22:32:14] 	setting serial port timeouts to 1 ms
[12.04.2025 22:32:14] 	setting serial port timeouts to 1000 ms
[12.04.2025 22:32:14] 	flush complete
[12.04.2025 22:32:14] 	espcomm_send_command: sending command header
[12.04.2025 22:32:14] 	espcomm_send_command: sending command payload
[12.04.2025 22:32:14] 	serialport_receive_C0: 30 instead of C0
[12.04.2025 22:32:14] resetting board
[12.04.2025 22:32:14] trying to connect
[12.04.2025 22:32:14] 	flush start
[12.04.2025 22:32:14] 	setting serial port timeouts to 1 ms
[12.04.2025 22:32:14] 	setting serial port timeouts to 1000 ms
[12.04.2025 22:32:14] 	flush complete
[12.04.2025 22:32:14] 	espcomm_send_command: sending command header
[12.04.2025 22:32:14] 	espcomm_send_command: sending command payload
[12.04.2025 22:32:14] 	serialport_receive_C0: 32 instead of C0
[12.04.2025 22:32:14] trying to connect
[12.04.2025 22:32:14] 	flush start
[12.04.2025 22:32:14] 	setting serial port timeouts to 1 ms
[12.04.2025 22:32:14] 	setting serial port timeouts to 1000 ms
[12.04.2025 22:32:14] 	flush complete
[12.04.2025 22:32:14] 	espcomm_send_command: sending command header
[12.04.2025 22:32:14] 	espcomm_send_command: sending command payload
[12.04.2025 22:32:14] 	serialport_receive_C0: 30 instead of C0
[12.04.2025 22:32:14] trying to connect
[12.04.2025 22:32:14] 	flush start
[12.04.2025 22:32:14] 	setting serial port timeouts to 1 ms
[12.04.2025 22:32:14] 	setting serial port timeouts to 1000 ms
[12.04.2025 22:32:14] 	flush complete
[12.04.2025 22:32:14] 	espcomm_send_command: sending command header
[12.04.2025 22:32:14] 	espcomm_send_command: sending command payload
[12.04.2025 22:32:14] 	serialport_receive_C0: 30 instead of C0
[12.04.2025 22:32:14] resetting board
[12.04.2025 22:32:14] trying to connect
[12.04.2025 22:32:14] 	flush start
[12.04.2025 22:32:14] 	setting serial port timeouts to 1 ms
[12.04.2025 22:32:14] 	setting serial port timeouts to 1000 ms
[12.04.2025 22:32:14] 	flush complete
[12.04.2025 22:32:14] 	espcomm_send_command: sending command header
[12.04.2025 22:32:14] 	espcomm_send_command: sending command payload
[12.04.2025 22:32:14] 	serialport_receive_C0: 20 instead of C0
[12.04.2025 22:32:14] trying to connect
[12.04.2025 22:32:14] 	flush start
[12.04.2025 22:32:14] 	setting serial port timeouts to 1 ms
[12.04.2025 22:32:14] 	setting serial port timeouts to 1000 ms
[12.04.2025 22:32:14] 	flush complete
[12.04.2025 22:32:14] 	espcomm_send_command: sending command header
[12.04.2025 22:32:14] 	espcomm_send_command: sending command payload
[12.04.2025 22:32:14] 	serialport_receive_C0: 30 instead of C0
[12.04.2025 22:32:14] trying to connect
[12.04.2025 22:32:14] 	flush start
[12.04.2025 22:32:14] 	setting serial port timeouts to 1 ms
[12.04.2025 22:32:14] 	setting serial port timeouts to 1000 ms
[12.04.2025 22:32:14] 	flush complete
[12.04.2025 22:32:14] 	espcomm_send_command: sending command header
[12.04.2025 22:32:14] 	espcomm_send_command: sending command payload
[12.04.2025 22:32:14] 	serialport_receive_C0: 30 instead of C0
[12.04.2025 22:32:14] warning: espcomm_sync failed
[12.04.2025 22:32:14] error: espcomm_open failed
[12.04.2025 22:32:14] error: espcomm_upload_mem failed
[2025-04-12 22:32:15] STOPPED due to 2 errors! (try reset on the unit, then start a new flash attempt)

User avatar
Ath
Normal user
Posts: 4319
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Unknown i2c device - 4-20 mA measurement M5stack

#23 Post by Ath » 12 Apr 2025, 22:38

For flashing via an external tool, the .factory.bin file must be uploaded. For flashing from the Tools page (Firmware Update button) you can use the 'regular' .bin file.

If ESPEasy is still usable from the browser, please use the Firmware Update button to upload the .bin file (without .factory in the name!). If not, then you can use https://td-er.nl/ESPEasy/latest to upload an S2 build, and after, that upload the new & improved version (with P180 included) I have here: NB: You can't upload an ESP32-S2 build to a C3, that's never going to work because of different CPU architectures :o
/Ton (PayPal.me)

obstbauer
Normal user
Posts: 59
Joined: 25 May 2023, 15:46

Re: Unknown i2c device - 4-20 mA measurement M5stack

#24 Post by obstbauer » 12 Apr 2025, 23:42

ok I can use it now... thanks
for a simple first test without current source I want to read out the i2c adress, is this command correct ?

Code: Select all

read.u8le.0xFF;
or to get the calibration current

Code: Select all

read.u16le.0x30;
?
Because for both values I get 0 at the moment
I2c scan finds the device at 0x55

User avatar
Ath
Normal user
Posts: 4319
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Unknown i2c device - 4-20 mA measurement M5stack

#25 Post by Ath » 13 Apr 2025, 13:45

There is currently no support for u8le, as little endian doesn't apply to a single-byte value :? Using u8 there will probably work better. When never set, and there's no real reason to change, it might return 0 though.
Alternatively you could read the firmware version at register 0xFE using the command read.u8.0xfe

NB: you are putting these commands in the I2C commands field, I presume? Then the Interval should also be changed from 0 to f.e. 10 to have a repeated read, or a taskrun should be applied on the (enabled) task, to get the value updated.

Edit: Corrected Version register to 0xFE (first edit was from memory ;))
/Ton (PayPal.me)

User avatar
Ath
Normal user
Posts: 4319
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Unknown i2c device - 4-20 mA measurement M5stack

#26 Post by Ath » 13 Apr 2025, 20:46

Commands and data format options are described in the PR #5296, and also some examples are shown
/Ton (PayPal.me)

obstbauer
Normal user
Posts: 59
Joined: 25 May 2023, 15:46

Re: Unknown i2c device - 4-20 mA measurement M5stack

#27 Post by obstbauer » 13 Apr 2025, 22:31

for a first test to read out the firmware version, I get value 0, so I think it is wrong

at the moment it is difficult to make tests with this wemos device because I loose the connection a lot of times, don't know if it is a problem of my wifi or of the device....

Code: Select all

126438: WD : Uptime 2 ConnectFailures 0 FreeMem 99220 WiFiStatus: WL_CONNECTED 3 ESPeasy internal wifi status: Conn. IP Init
156438: WD : Uptime 3 ConnectFailures 0 FreeMem 99808 WiFiStatus: WL_CONNECTED 3 ESPeasy internal wifi status: Conn. IP Init
try more tests tomorrow with a second device....
Attachments
i2c_espeasy2.jpg
i2c_espeasy2.jpg (85.27 KiB) Viewed 802 times
i2c_espeasy.jpg
i2c_espeasy.jpg (71.94 KiB) Viewed 802 times

User avatar
Ath
Normal user
Posts: 4319
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Unknown i2c device - 4-20 mA measurement M5stack

#28 Post by Ath » 13 Apr 2025, 23:17

The log you show is the normal WatchDog (WD) INFO level log that is output every 30 seconds, that's been there since forever... Not an indication of a bad connection or whatever, the WiFi status info in that log isn't accurate, though :shock: nothing to worry about, work is underway to have that fixed.
/Ton (PayPal.me)

obstbauer
Normal user
Posts: 59
Joined: 25 May 2023, 15:46

Re: Unknown i2c device - 4-20 mA measurement M5stack

#29 Post by obstbauer » 14 Apr 2025, 22:43

I have two esp32-s2 boards here (wemos s2 mini) and both loose the connection all the time... I don't know why but I cannot test with these boards, I ordered new ones today. I have here in the same room and around 4 other ESP8266 running with no connection losses, never, so I guess wifi is ok and the boards have a whatever problem

TD-er
Core team member
Posts: 9855
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Unknown i2c device - 4-20 mA measurement M5stack

#30 Post by TD-er » 14 Apr 2025, 23:27

Purple boards looking like those old Wemos D1 mini boards?
Those for the S2 are really hit-or-miss.
Quite a lot of them have really really poor WiFi.
I assume they have for some batches placed the wrong components for the antenna matching circuit.

You can try to reduce max. TX power on the tools->Advanced page to see if that makes the connection more stable.

User avatar
Ath
Normal user
Posts: 4319
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Unknown i2c device - 4-20 mA measurement M5stack

#31 Post by Ath » 14 Apr 2025, 23:31

Would be better not to order ESP32-S2 (or C2) boards, as that's somewhat of an 'in between' model, better opt for ESP32, ESP32-C3, ESP32-C6 or ESP32-S3 boards, as that are the most stable ESP32 MCUs. And when selecting a board, the ones with 8MB or 16MB Flash are preferred, so you can use a MAX build, with all plugins and features enabled.

With your current S2 boards, also check the cable used to power the board. If that's using a micro-USB connector, often the wires in the cable are rather thin, causing unstable power to the board. When powering the ESP on a breadboard, using breadboard patch wires, please use thicker wires, as that's often causing similar power-issues.
/Ton (PayPal.me)

User avatar
Ath
Normal user
Posts: 4319
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Unknown i2c device - 4-20 mA measurement M5stack

#32 Post by Ath » 21 Apr 2025, 22:45

I've fixed some issues, one of which explains why you didn't get a value from your device... (you could call that a bug, in fact).

Here's a new ESP32-S2 Collection A build for you to test: To get the result available, the I2C Commands should be set to (same as before):

Code: Select all

read.u16le.0x20;calc.%value%/100
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest