<?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[Atom Matrix with FW 1.13.1 not connecting to AWS]]></title><description><![CDATA[<p dir="auto">Hi all,<br />
I struggle to get my m5stack Atom Matrix to connect to AWS. I double checked the AWS setup including the policy etc. There seem to be a problem with the connection I always get the following error when trying to publish something:<br />
[45944] MQTTException -&gt; [Errno 9] EBADF<br />
reconnect start ...<br />
reconnect finish ...<br />
[48536] MQTTException -&gt; [Errno 9] EBADF<br />
reconnect start ...<br />
reconnect finish ...</p>
<p dir="auto">It also seems there changed some things recently. All examples I find are with a block called "dump to json" but this is no longer available. I work with "create JSON (string) and keys. See the picture.</p>
<p dir="auto"><img src="/assets/uploads/files/1707089785641-aws-m5stack-resized.png" alt="0_1707089783978_aws-m5stack.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Code is here:</p>
<p dir="auto">from m5stack import *<br />
from m5ui import *<br />
from uiflow import *<br />
from IoTcloud.AWS import AWS<br />
from libs.json_py import *<br />
import time<br />
import unit</p>
<p dir="auto">rgb.set_screen([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])<br />
tvoc_0 = unit.get(unit.TVOC, unit.PORTA)</p>
<p dir="auto">eCO2 = None<br />
TVOC = None<br />
H2 = None<br />
Ethanol = None</p>
<p dir="auto">aws = AWS(things_name='CO2Sensor', host='<a href="http://xxxxxxxxxxx-ats.iot.eu-central-1.amazonaws.com" target="_blank" rel="noopener noreferrer nofollow ugc">xxxxxxxxxxx-ats.iot.eu-central-1.amazonaws.com</a>', port=8883, keepalive=60, cert_file_path="/flash/res/co22-certificate.pem.crt", private_key_path="/flash/res/co22-private.pem.key")<br />
aws.start()<br />
print('AWS started')<br />
while True:<br />
eCO2 = tvoc_0.eCO2<br />
TVOC = tvoc_0.TVOC<br />
H2 = tvoc_0.H2<br />
Ethanol = tvoc_0.Ethanol<br />
aws.publish(str('$aws/things/CO2Sensor/co2'),str((py_2_json({'eCO2':eCO2,'TVOC':TVOC,'H2':H2,'Ethanol':Ethanol}))))</p>
]]></description><link>https://community.m5stack.com/topic/6052/atom-matrix-with-fw-1-13-1-not-connecting-to-aws</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 12:21:38 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/6052.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 04 Feb 2024 23:41:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Atom Matrix with FW 1.13.1 not connecting to AWS on Fri, 09 Feb 2024 18:35:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/chr1g1" aria-label="Profile: chr1g1">@<bdi>chr1g1</bdi></a> said in <a href="/post/23726">Atom Matrix with FW 1.13.1 not connecting to AWS</a>:</p>
<blockquote>
<p dir="auto">added it as directed above. Still weird behaviour of the Atom Matrix on FW 1.13.2.<br />
Here is the log:<br />
I print out "submitted to aws" after the publish block in the loop.</p>
<p dir="auto">APIKEY: xxx<br />
submitted to aws<br />
[17797] MQTTException -&gt; 128<br />
reconnect start ...<br />
reconnect finish ...<br />
submitted to aws<br />
submitted to aws<br />
submitted to aws<br />
submitted to aws<br />
submitted to aws</p>
</blockquote>
<p dir="auto">Well there is an improvement as you are no longer getting the <code>[24577] MQTTException -&gt; [Errno 9] EBADF </code><br />
Which means the Atom is now working</p>
<p dir="auto">Error 128 means that it tried to subscribe to the AWS topic before the connection was made.<br />
If you make a subscribe and a call, according to your log it should be present.</p>
<p dir="auto">add a 5 second delay after the AWS start.</p>
]]></description><link>https://community.m5stack.com/post/23730</link><guid isPermaLink="true">https://community.m5stack.com/post/23730</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Fri, 09 Feb 2024 18:35:02 GMT</pubDate></item><item><title><![CDATA[Reply to Atom Matrix with FW 1.13.1 not connecting to AWS on Fri, 09 Feb 2024 15:50:15 GMT]]></title><description><![CDATA[<p dir="auto">and for completness here my working setup with M5StickC / Plus<br />
Will also followup with AWS details.<br />
<img src="/assets/uploads/files/1707493804736-screenshot-2024-02-09-at-16.48.48-resized.png" alt="0_1707493802415_Screenshot 2024-02-09 at 16.48.48.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/post/23729</link><guid isPermaLink="true">https://community.m5stack.com/post/23729</guid><dc:creator><![CDATA[chr1g1]]></dc:creator><pubDate>Fri, 09 Feb 2024 15:50:15 GMT</pubDate></item><item><title><![CDATA[Reply to Atom Matrix with FW 1.13.1 not connecting to AWS on Fri, 09 Feb 2024 15:23:59 GMT]]></title><description><![CDATA[<p dir="auto">okay some more learnings...<br />
All S3 devices are supported by UIFlow 2.0 only. And UIFlow 2.0 is not yet supporting AWS IoT unless I missed something.<br />
M5StickC Plus is working as a charm. Like M5StickC. I guess I stick with those.</p>
<p dir="auto">My summary as of Feb 2024 and Firmware 1.13.2 and UIFlow 2.0 (Alpha 29):</p>
<p dir="auto">Forget all new devices that are supported by UIFlow 2.0 only (e.g. *S3) and the small ATOMs if you wanna do AWS IoT stuff. Hope you find this before you bought too many devices...</p>
]]></description><link>https://community.m5stack.com/post/23728</link><guid isPermaLink="true">https://community.m5stack.com/post/23728</guid><dc:creator><![CDATA[chr1g1]]></dc:creator><pubDate>Fri, 09 Feb 2024 15:23:59 GMT</pubDate></item><item><title><![CDATA[Reply to Atom Matrix with FW 1.13.1 not connecting to AWS on Fri, 09 Feb 2024 14:32:03 GMT]]></title><description><![CDATA[<p dir="auto">added it as directed above. Still weird behaviour of the Atom Matrix on FW 1.13.2.<br />
Here is the log:<br />
I print out "submitted to aws" after the publish block in the loop.</p>
<p dir="auto">APIKEY: xxx<br />
submitted to aws<br />
[17797] MQTTException -&gt; 128<br />
reconnect start ...<br />
reconnect finish ...<br />
submitted to aws<br />
submitted to aws<br />
submitted to aws<br />
submitted to aws<br />
submitted to aws</p>
]]></description><link>https://community.m5stack.com/post/23726</link><guid isPermaLink="true">https://community.m5stack.com/post/23726</guid><dc:creator><![CDATA[chr1g1]]></dc:creator><pubDate>Fri, 09 Feb 2024 14:32:03 GMT</pubDate></item><item><title><![CDATA[Reply to Atom Matrix with FW 1.13.1 not connecting to AWS on Thu, 08 Feb 2024 09:30:23 GMT]]></title><description><![CDATA[<p dir="auto">Nice work keeping at it. there is one more thing I can think of which is basically a last thing to try.</p>
<p dir="auto">Add<br />
<code>import gc</code></p>
<p dir="auto">to the import code and then at the beginning of the loop add</p>
<p dir="auto"><code>gc.collect()</code></p>
<p dir="auto">This forces garbage collection in micropython on each pass emptying the memory on each loop.</p>
<p dir="auto">Look up Micropython Garbage collection function for more information on this.</p>
<p dir="auto">unfortunately I can't get into my AWS account and so haven't been able to test but it could be that you have genuinely found an issue in the Atom firmware.</p>
]]></description><link>https://community.m5stack.com/post/23699</link><guid isPermaLink="true">https://community.m5stack.com/post/23699</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Thu, 08 Feb 2024 09:30:23 GMT</pubDate></item><item><title><![CDATA[Reply to Atom Matrix with FW 1.13.1 not connecting to AWS on Wed, 07 Feb 2024 21:44:44 GMT]]></title><description><![CDATA[<p dir="auto">Okay - testet the very same code with an MStickC. Runs very smooth without issues. Either there are bugs in the code of the Atom Matrix or the device has just too less resources to handle an external sensor along with an IoT connection.</p>
]]></description><link>https://community.m5stack.com/post/23696</link><guid isPermaLink="true">https://community.m5stack.com/post/23696</guid><dc:creator><![CDATA[chr1g1]]></dc:creator><pubDate>Wed, 07 Feb 2024 21:44:44 GMT</pubDate></item><item><title><![CDATA[Reply to Atom Matrix with FW 1.13.1 not connecting to AWS on Wed, 07 Feb 2024 13:25:29 GMT]]></title><description><![CDATA[<p dir="auto">Still have the problem. I rebuilt the whole program to make sure there are no "old" blocks in there. Don't even see a connection attempt on AWS (IoT Core with enabled debug logging)</p>
<p dir="auto">ATOM Matrix<br />
Firmware: 1.13.2</p>
<p dir="auto">Both in Internet and App mode</p>
<p dir="auto">-- Code --<br />
from m5stack import *<br />
from m5ui import *<br />
from uiflow import *<br />
import wifiCfg<br />
import time<br />
from IoTcloud.AWS import AWS<br />
from libs.json_py import *<br />
import unit</p>
<p dir="auto">rgb.set_screen([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])<br />
tvoc_0 = unit.get(unit.TVOC, unit.PORTA)</p>
<p dir="auto">CO2 = None<br />
TVOC = None<br />
H2 = None<br />
Ethanol = None</p>
<p dir="auto">wifiCfg.doConnect('Guest', 'xxx')<br />
wifiCfg.autoConnect(lcdShow=False)<br />
wait(5)<br />
aws = AWS(things_name='CO2SENSOR', host='<a href="http://xxx.iot.eu-central-1.amazonaws.com" target="_blank" rel="noopener noreferrer nofollow ugc">xxx.iot.eu-central-1.amazonaws.com</a>', port=8883, keepalive=500, cert_file_path="/flash/res/certificate.pem.crt", private_key_path="/flash/res/private.pem.key")<br />
aws.start()<br />
while True:<br />
CO2 = tvoc_0.eCO2<br />
TVOC = tvoc_0.TVOC<br />
H2 = tvoc_0.H2<br />
Ethanol = tvoc_0.Ethanol<br />
aws.publish(str('m5stack/bla'),str((py_2_json({'CO2':CO2,'TVOC':TVOC,'H2':H2,'Ethanol':Ethanol}))))<br />
print('submitted to AWS')<br />
wait(5)</p>
<p dir="auto">— Serial Log --</p>
<p dir="auto">submitted to AWS<br />
[10490] MQTTException -&gt; [Errno 9] EBADF<br />
reconnect start ...<br />
reconnect finish ...<br />
[14075] MQTTException -&gt; [Errno 9] EBADF<br />
reconnect start ...<br />
reconnect finish ...<br />
submitted to AWS<br />
[17541] MQTTException -&gt; [Errno 9] EBADF<br />
reconnect start ...<br />
reconnect finish ...<br />
submitted to AWS<br />
[20998] MQTTException -&gt; [Errno 9] EBADF<br />
reconnect start ...<br />
reconnect finish ...<br />
[24577] MQTTException -&gt; [Errno 9] EBADF<br />
reconnect start ...<br />
reconnect finish ...<br />
submitted to AWS</p>
]]></description><link>https://community.m5stack.com/post/23680</link><guid isPermaLink="true">https://community.m5stack.com/post/23680</guid><dc:creator><![CDATA[chr1g1]]></dc:creator><pubDate>Wed, 07 Feb 2024 13:25:29 GMT</pubDate></item><item><title><![CDATA[Reply to Atom Matrix with FW 1.13.1 not connecting to AWS on Wed, 07 Feb 2024 11:48:33 GMT]]></title><description><![CDATA[<p dir="auto">Your setup need to look like this:<br />
<img src="/assets/uploads/files/1707306505682-screenshot-2024-02-07-at-11.47.53-resized.png" alt="0_1707306503809_Screenshot 2024-02-07 at 11.47.53.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/post/23678</link><guid isPermaLink="true">https://community.m5stack.com/post/23678</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Wed, 07 Feb 2024 11:48:33 GMT</pubDate></item><item><title><![CDATA[Reply to Atom Matrix with FW 1.13.1 not connecting to AWS on Wed, 07 Feb 2024 11:45:57 GMT]]></title><description><![CDATA[<p dir="auto">Ah I see the Issue now.<br />
So in Internet mode the WIFI connection is already active because UIFLOW is using it to send and test programs where as in APP mode the WIFI connection is not activated because you haven't opened the connection.</p>
<p dir="auto">In App mode you must add the wifi configuration and setup blocks to the code for the Wireless connection to work.</p>
<p dir="auto">Sorry, I have been battling a chest infection and so wasn't able to clearly see the solution. While I did write the crappy book on IOT found on amazon, things have changed and I am already writing an update while working on the other deep guides.</p>
]]></description><link>https://community.m5stack.com/post/23677</link><guid isPermaLink="true">https://community.m5stack.com/post/23677</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Wed, 07 Feb 2024 11:45:57 GMT</pubDate></item><item><title><![CDATA[Reply to Atom Matrix with FW 1.13.1 not connecting to AWS on Wed, 07 Feb 2024 11:34:15 GMT]]></title><description><![CDATA[<p dir="auto">It is still not working... Due to the fact that I'm not receiving anything on AWS, I believe it is connected to the networking on the device.<br />
I see a number of contradicting information and unclear guidance. Here the current approach and questions:<br />
1/ Internet Mode vs. App Mode. Is MQTT/IOT supposed to work in both modes?<br />
2/ How I'm supposed to configure networking on the new firmwares? I see the following options:<br />
wifiCfg.autoConnect(lcdShow=False)<br />
wifiCfg.reconnect()<br />
wifiCfg.doConnect('', '')<br />
wlan.connect('', '')<br />
3/ Playing with different firmwares because I believe this is buggy.</p>
]]></description><link>https://community.m5stack.com/post/23676</link><guid isPermaLink="true">https://community.m5stack.com/post/23676</guid><dc:creator><![CDATA[chr1g1]]></dc:creator><pubDate>Wed, 07 Feb 2024 11:34:15 GMT</pubDate></item><item><title><![CDATA[Reply to Atom Matrix with FW 1.13.1 not connecting to AWS on Tue, 06 Feb 2024 08:16:38 GMT]]></title><description><![CDATA[<p dir="auto">EBADF means that the client on the atom is trying to send to a closed connection.</p>
<p dir="auto">At one point I had to store the Public and private keys generated by amazon along with the cert on the client to get a connection.</p>
<p dir="auto">Try setting Keep alive to 500.</p>
<p dir="auto">Will need to see the full code to work out what's happening.</p>
<p dir="auto">AWS is constantly changing so my guides are probably out of date and need updating. I hate AWS as it a Pain.</p>
]]></description><link>https://community.m5stack.com/post/23660</link><guid isPermaLink="true">https://community.m5stack.com/post/23660</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Tue, 06 Feb 2024 08:16:38 GMT</pubDate></item><item><title><![CDATA[Reply to Atom Matrix with FW 1.13.1 not connecting to AWS on Tue, 06 Feb 2024 07:24:56 GMT]]></title><description><![CDATA[<p dir="auto">Meanwhile I upgraded to 1.13.2 and still got the same error.<br />
I then added the AWS subscribe block to subscribe to some topic and the error is gone...<br />
However, I don't get any data on AWS IoT Core.<br />
I enabled CloudWatch Log for IoT Core (Settings) and set the log level to debug. I do not see my device connecting?!</p>
]]></description><link>https://community.m5stack.com/post/23658</link><guid isPermaLink="true">https://community.m5stack.com/post/23658</guid><dc:creator><![CDATA[chr1g1]]></dc:creator><pubDate>Tue, 06 Feb 2024 07:24:56 GMT</pubDate></item></channel></rss>