<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[4-20 mA Unit with wemos S2 mini ESP32]]></title><description><![CDATA[<p dir="auto">Hello,<br />
I want to use the 4-20 mA unit with a wemos S2 mini with ESP32 chip but I am not able to get some data from it.<br />
I had a look at the github examples and made a program to show the current on a display. Display is working and I can find the unit with an i2c scanner.<br />
Arduino gives no mistakes during compiling but it doesn`t work. Any ideas ?<br />
Thank you</p>
<p dir="auto">Here is my code:</p>
<pre><code>#include &lt;Wire.h&gt;
#include &lt;Arduino.h&gt;
#include &lt;U8g2lib.h&gt;

#include "MODULE_4_20MA.h"

U8G2_SSD1309_128X64_NONAME2_F_HW_I2C u8g2(U8G2_R0,U8X8_PIN_NONE);

const byte led_gpio = 15;   // LED GPIO 15

MODULE_4_20MA cr;

void setup() {
  Wire.begin(33, 18);  // SDA pin 33, SCL pin 18
  u8g2.begin();
  pinMode(led_gpio, OUTPUT);
}
 
void loop() {
  float current = cr.getCurrentValue(0);

  u8g2.firstPage();
  do {

    u8g2.setFont(u8g2_font_ncenB10_tr);
    u8g2.drawStr(0,20,"Strom:");
    u8g2.setCursor(0, 40);
    u8g2.print(current);
  } while ( u8g2.nextPage() );
  
  digitalWrite(led_gpio, HIGH);
    delay(1000);
  digitalWrite(led_gpio, LOW);
  delay(1000);   
}
</code></pre>
]]></description><link>https://community.m5stack.com/topic/7450/4-20-ma-unit-with-wemos-s2-mini-esp32</link><generator>RSS for Node</generator><lastBuildDate>Sun, 08 Mar 2026 23:47:08 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/7450.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 28 Mar 2025 13:54:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 4-20 mA Unit with wemos S2 mini ESP32 on Mon, 07 Apr 2025 06:44:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/255838">@obstbauer</a> TBH if you are using M5Stack modules/units with not M5Stack controllers maybe its worth to have at least one M5Controller (atom?stick? )to be able to check module functionality</p>
]]></description><link>https://community.m5stack.com/post/28825</link><guid isPermaLink="true">https://community.m5stack.com/post/28825</guid><dc:creator><![CDATA[robski]]></dc:creator><pubDate>Mon, 07 Apr 2025 06:44:43 GMT</pubDate></item><item><title><![CDATA[Reply to 4-20 mA Unit with wemos S2 mini ESP32 on Sun, 06 Apr 2025 21:44:30 GMT]]></title><description><![CDATA[<p dir="auto">thank you, but I am still not able to read out or to set the cal current<br />
M5Stack support doesn`t answer my mails... and it seems that there is nobody from the company around here, I think I will change to another board with better support</p>
]]></description><link>https://community.m5stack.com/post/28820</link><guid isPermaLink="true">https://community.m5stack.com/post/28820</guid><dc:creator><![CDATA[obstbauer]]></dc:creator><pubDate>Sun, 06 Apr 2025 21:44:30 GMT</pubDate></item><item><title><![CDATA[Reply to 4-20 mA Unit with wemos S2 mini ESP32 on Fri, 04 Apr 2025 14:05:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/255838">@obstbauer</a> this is uiflow example with raw value and float too</p>
<p dir="auto"><img src="/assets/uploads/files/1743774556921-ain21.png" alt="ain21.PNG" class=" img-fluid img-markdown" /> <img src="/assets/uploads/files/1743774556941-ain20.jpg" alt="ain20.jpg" class=" img-fluid img-markdown" /><img src="/assets/uploads/files/1743775530854-ain22.png" alt="ain22.PNG" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/post/28798</link><guid isPermaLink="true">https://community.m5stack.com/post/28798</guid><dc:creator><![CDATA[robski]]></dc:creator><pubDate>Fri, 04 Apr 2025 14:05:33 GMT</pubDate></item><item><title><![CDATA[Reply to 4-20 mA Unit with wemos S2 mini ESP32 on Fri, 04 Apr 2025 12:38:29 GMT]]></title><description><![CDATA[<p dir="auto">change to a raspberry PI4 seems to be no solution too.....<br />
it woud be nice if there would be a better documentation for people who want to use the units outside the m5stack universum....</p>
]]></description><link>https://community.m5stack.com/post/28797</link><guid isPermaLink="true">https://community.m5stack.com/post/28797</guid><dc:creator><![CDATA[obstbauer]]></dc:creator><pubDate>Fri, 04 Apr 2025 12:38:29 GMT</pubDate></item><item><title><![CDATA[Reply to 4-20 mA Unit with wemos S2 mini ESP32 on Fri, 04 Apr 2025 12:27:43 GMT]]></title><description><![CDATA[<p dir="auto">I see really strange behaviour and I don't know the reason and I get no answers from the support.....<br />
The example code from M5Stack say that the currentvalue should be divided by 100:</p>
<pre><code>canvas.printf("Current:%.2fmA", (float)(meter.getCurrentValue(0)) / 100.0);
</code></pre>
<p dir="auto">The values I get I have to divide by 10 to get the right current in mA.... and the other issue is that I can only use half of the measurement range, at 12.5 mA the ADC sends 65520...</p>
<p dir="auto">maybe someone has an idea ?</p>
]]></description><link>https://community.m5stack.com/post/28796</link><guid isPermaLink="true">https://community.m5stack.com/post/28796</guid><dc:creator><![CDATA[obstbauer]]></dc:creator><pubDate>Fri, 04 Apr 2025 12:27:43 GMT</pubDate></item><item><title><![CDATA[Reply to 4-20 mA Unit with wemos S2 mini ESP32 on Thu, 03 Apr 2025 07:54:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/5596">@robski</a> yes maybe in uiflow2 but the function for the c program asks for an index and a value</p>
]]></description><link>https://community.m5stack.com/post/28768</link><guid isPermaLink="true">https://community.m5stack.com/post/28768</guid><dc:creator><![CDATA[obstbauer]]></dc:creator><pubDate>Thu, 03 Apr 2025 07:54:55 GMT</pubDate></item><item><title><![CDATA[Reply to 4-20 mA Unit with wemos S2 mini ESP32 on Thu, 03 Apr 2025 07:49:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/255838">@obstbauer</a> haven't used index value</p>
<p dir="auto">in uiflow2 ..ain4_20ma_0.set_cal_current(10)    to set 10mA<br />
ain4_20ma_0.set_cal_current(20)   to set  20mA</p>
]]></description><link>https://community.m5stack.com/post/28767</link><guid isPermaLink="true">https://community.m5stack.com/post/28767</guid><dc:creator><![CDATA[robski]]></dc:creator><pubDate>Thu, 03 Apr 2025 07:49:06 GMT</pubDate></item><item><title><![CDATA[Reply to 4-20 mA Unit with wemos S2 mini ESP32 on Thu, 03 Apr 2025 07:31:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/5596">@robski</a> what value do you take for "index" in the function</p>
<pre><code>void MODULE_4_20MA::setCalCurrent(uint8_t index, uint16_t value)
</code></pre>
]]></description><link>https://community.m5stack.com/post/28766</link><guid isPermaLink="true">https://community.m5stack.com/post/28766</guid><dc:creator><![CDATA[obstbauer]]></dc:creator><pubDate>Thu, 03 Apr 2025 07:31:47 GMT</pubDate></item><item><title><![CDATA[Reply to 4-20 mA Unit with wemos S2 mini ESP32 on Tue, 01 Apr 2025 12:58:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/255838">@obstbauer</a> yeah thats the registers table, I used Uiflow2 with calibration block but you are using not M5Stack controller I see</p>
]]></description><link>https://community.m5stack.com/post/28743</link><guid isPermaLink="true">https://community.m5stack.com/post/28743</guid><dc:creator><![CDATA[robski]]></dc:creator><pubDate>Tue, 01 Apr 2025 12:58:29 GMT</pubDate></item><item><title><![CDATA[Reply to 4-20 mA Unit with wemos S2 mini ESP32 on Tue, 01 Apr 2025 12:56:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/5596">@robski</a> ok I think I found it:</p>
<p dir="auto">thank you I will try tomorrow</p>
<p dir="auto"><img src="/assets/uploads/files/1743512155280-0d731077-cf0a-4752-ae2d-318aa42b8f92-grafik.png" alt="0d731077-cf0a-4752-ae2d-318aa42b8f92-grafik.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/post/28742</link><guid isPermaLink="true">https://community.m5stack.com/post/28742</guid><dc:creator><![CDATA[obstbauer]]></dc:creator><pubDate>Tue, 01 Apr 2025 12:56:11 GMT</pubDate></item><item><title><![CDATA[Reply to 4-20 mA Unit with wemos S2 mini ESP32 on Tue, 01 Apr 2025 12:20:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/255838">@obstbauer</a> thats what i did with mine initially, calibrate with known current value</p>
]]></description><link>https://community.m5stack.com/post/28741</link><guid isPermaLink="true">https://community.m5stack.com/post/28741</guid><dc:creator><![CDATA[robski]]></dc:creator><pubDate>Tue, 01 Apr 2025 12:20:58 GMT</pubDate></item><item><title><![CDATA[Reply to 4-20 mA Unit with wemos S2 mini ESP32 on Tue, 01 Apr 2025 12:11:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/5596">@robski</a> thanks for the answer</p>
<p dir="auto">so you mean if I measure with multimter 4.0 mA (which is true for the sensor) and the unit shows me 7.2 mA I should set the calibrated value to 4.0 ?</p>
<p dir="auto">Because this is not mentioned anywhere in a readme file or manual or in the description of the device, and it is not made in the example file at github<br />
but I am a beginner....</p>
]]></description><link>https://community.m5stack.com/post/28740</link><guid isPermaLink="true">https://community.m5stack.com/post/28740</guid><dc:creator><![CDATA[obstbauer]]></dc:creator><pubDate>Tue, 01 Apr 2025 12:11:00 GMT</pubDate></item><item><title><![CDATA[Reply to 4-20 mA Unit with wemos S2 mini ESP32 on Tue, 01 Apr 2025 10:51:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/255838">@obstbauer</a> try calibration function based on what you see with multimeter</p>
]]></description><link>https://community.m5stack.com/post/28739</link><guid isPermaLink="true">https://community.m5stack.com/post/28739</guid><dc:creator><![CDATA[robski]]></dc:creator><pubDate>Tue, 01 Apr 2025 10:51:44 GMT</pubDate></item><item><title><![CDATA[Reply to 4-20 mA Unit with wemos S2 mini ESP32 on Tue, 01 Apr 2025 10:36:30 GMT]]></title><description><![CDATA[<p dir="auto">it seems that I still have a problem....<br />
I have a current reading but the value is wrong,<br />
I get soemthing around 7.2 mA instead of 4 mA.<br />
I can measure the 4 mA with a multimeter in the circuit and the sensor should send 4 mA, so this is ok, but the M5Stack unit shows 7.2 mA and I don't understand why ? Any ideas ?<br />
My sensor is passive, I connected 24 V to the 4-20mA unit and all three jumpers are installed<br />
What is the meaning of the function "getCalCurrent" ? It is neessary for the current measurement ? It is necessary to set a "ref current" ?</p>
<p dir="auto">Thank you!</p>
]]></description><link>https://community.m5stack.com/post/28738</link><guid isPermaLink="true">https://community.m5stack.com/post/28738</guid><dc:creator><![CDATA[obstbauer]]></dc:creator><pubDate>Tue, 01 Apr 2025 10:36:30 GMT</pubDate></item><item><title><![CDATA[Reply to 4-20 mA Unit with wemos S2 mini ESP32 on Sat, 29 Mar 2025 20:51:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/4037">@felmue</a> Hello,<br />
thank you very much, it works !<br />
I added</p>
<pre><code>cr.begin(&amp;Wire, MODULE_4_20MA_ADDR, 33, 18, 100000UL);
</code></pre>
<p dir="auto">to void setup</p>
]]></description><link>https://community.m5stack.com/post/28714</link><guid isPermaLink="true">https://community.m5stack.com/post/28714</guid><dc:creator><![CDATA[obstbauer]]></dc:creator><pubDate>Sat, 29 Mar 2025 20:51:46 GMT</pubDate></item><item><title><![CDATA[Reply to 4-20 mA Unit with wemos S2 mini ESP32 on Fri, 28 Mar 2025 15:00:21 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/255838">@obstbauer</a></p>
<p dir="auto">I think you might want to call <code>cr.begin()</code> in setup to set stuff like the proper I2C address for the library to use. See <a href="https://github.com/m5stack/M5Module-4-20mA/blob/main/examples/ModuleAIN4-20mA/ModuleAIN4-20mA.ino#L34" target="_blank" rel="noopener noreferrer nofollow ugc">here</a>.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/28704</link><guid isPermaLink="true">https://community.m5stack.com/post/28704</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Fri, 28 Mar 2025 15:00:21 GMT</pubDate></item></channel></rss>