What are these options for? They don't seem to be documented yet.

Posts made by greenleaf
-
RGB Led Unit "Show" and "show lock" - what do these do?
-
RE: AWS Edukit as normal Core2 for Uiflow
@stanely You are my hero - thanks for figuring this out!
-
RE: AWS IoT Edukit Core M5 - Micropython support?
@rashedtalukder Super! An officially supported MicroPython package for the Core2 for AWS would be amazing.
-
RE: Bitcoin / Multi Crypto Coin Ticker with 24 candlesticks chart
Has anyone been able to port this to the Core 2? I tried but the SD Card library seemed to be incompatible.
-
Atom Echo Voice Recognition Backend?
What service powers the voice recognition for the Atom Echo in the example:
https://docs.m5stack.com/#/en/quick_start/atom/atom_echo_quick_start
Is it Baidu?
-
Building Core2 FactoryDemo in PlatformIO
If anyone else is trying to do this you'll need to fix your partition table to take advantage of the larger memory. The steps how to do this are:
- Go to PIO Home in Visual Studio Code
- Click on
+New Project
- Name it m5core2 or similar. Choose
M5Stack Core ESP32
for the board. - Leave Framework set to Arduino.
- Open your platformio.ini file and replace the text with this:
[env:m5stack-core-esp32] platform = espressif32 board = m5stack-core-esp32 framework = arduino ; [[[for macos]]] ;upload_port = /dev/cu.SLAB_USBtoUART ; [[[fix PSRAM size and you won't need have this file]]] board_build.partitions = default_16MB.csv build_flags = -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue
- Copy the 16MB partition table file into your src directory. You can download this file here:
https://github.com/espressif/arduino-esp32/blob/master/tools/partitions/default_16MB.csv
- In the 'lib' directory you will need three libraries.
FastLED - https://github.com/FastLED/FastLED
M5Core2 - https://github.com/m5stack/M5Core2
ArduinoECCX08 - This one is in a zip file in the M5Core2 library repo:
https://github.com/m5stack/M5Core2/blob/master/examples/core2_for_aws/ArduinoECCX08.zip
Your lib directory should look like this when you're done:
- Now copy everything from the example FactoryTest directory in the M5Core2 library into your
src
folder. The directory files can be viewed here:
https://github.com/m5stack/M5Core2/tree/master/examples/core2_for_aws/FactoryTest
-
Rename FactoryTest.ino to main.cpp
-
Edit main.cpp and comment out these two lines with
//
. These tests will fail if you don't have an SDCard or something plugged into the IO port.
-
Connect your M5Core2 and build/upload. You can do CTRL-Shift-P to find the Platformio:Upload option.
-
Play with the cool factory demo!
Thanks to jokercatz for the tip on fixing the platform:
http://jokercatz.blogspot.com/2020/11/m5stack-core2-build-from-platformio.html -
RE: Control NeoPixels on M5Stack Core2 AWS edukit
It looks like these LEDs are not supported in UIFlow, and the NeoPixel micropython library didn't work.
I was able to build new firmware using PlatformIO and flash the FactoryTest application here:
https://github.com/m5stack/M5Core2/tree/master/examples/core2_for_aws/FactoryTest
This has an example of using the FastLED library to control these RGB LEDs.
-
Control NeoPixels on M5Stack Core2 AWS edukit
I flashed my M5Stack Core2 AWS edukit version with UiFlow.
The docs indicate that the SK6812 LEDs are controlled with GPIO25:
SK6812-LED
ESP32 Chip GPIO25
SK6812-LED DATAI tried this code to test them out, and while the code runs without error, the lights never come on:
from machine import Pin from neopixel import NeoPixel pin = Pin(25, Pin.OUT) # Pin 25 to drive NeoPixels print("Creating NeoPixel object") np = NeoPixel(pin, 10) # create NeoPixel driver on GPIO25 for 10 pixels np[0] = (255, 0, 0) # set first pixel red, full brightness np[1] = (0, 128, 0) # second pixel green, half brightness np[2] = (0, 0, 64) # third pixel blue, quarter brightness np[3] = (255, 255, 255) np[4] = (255, 255, 255) np[5] = (255, 255, 255) np[6] = (255, 255, 255) np[7] = (255, 255, 255) np[8] = (255, 255, 255) np[9] = (255, 255, 255) np.write() # write data to all pixels print("done")
Anyone have ideas how to access these LEDs with micropython?
-
RE: AWS EduKit restore factory firmware
In the meantime if you want to play around with AWS and MQTT I wrote up this how to guide for setting it up in UIFlow:
https://community.m5stack.com/topic/2688/mqtt-config-for-aws-iot-core-solved
You can both publish and subscribe to topics if you follow those steps. You do need to flash your device with the UIFlow image though.
-
RE: Publish mqtt to AWS Iot from UiFlow
I am also stuck trying to get this to work. Some research reveals that there may be a ca_certs parameter required to include Amazon's root CA. I've tried it like this but no luck:
while True: output.setText('Setting up mqtt') m5mqtt = M5mqtt('m5stick', 'a2zey9c7ts6fdf-ats.iot.us-west-2.amazonaws.com', 1883, '', '', 300, ssl = True, ssl_params = {'key': "/flash/res/priv.key", 'cert': "/flash/res/cert.pem", 'ca_certs': "/flash/res/ca.pem"}) m5mqtt.subscribe(str(''), fun__) output.setText('starting mqtt') m5mqtt.start() output.setText('publishing hello world') m5mqtt.publish(str('test'),str('hello world')) output.setText('sent hello world') wait(1) wait_ms(2)
Can anyone from m5stack confirm whether ca_certs is a supported ssl parameter?
-
RE: MQTT config for AWS IoT Core - SOLVED
This took me way too long to figure out so here is a simple step by step guide for anyone else who's struggling with this:
AWS Setup
- Log onto your AWS account and pick a supported region for your IoT device. For example:
https://us-west-2.console.aws.amazon.com/iot/home?region=us-west-2#/thinghub - Click on Secure > Policies.
- Create a new policy and edit it in advanced mode. We're going to create a simple, open policy that is appropriate for development and experimenting. You can name your policy
m5stack
. Fill the policy contents with this JSON:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "iot:*", "Resource": "*" } ] }
- Click on 'Things' and then click 'Create'.
- Click on 'Create a Single Thing'.
- Give your thing a name. Example:
m5stick
- You can leave the type, group, and attributes settings blank for now. Click Next.
- Click on the top 'Create Certificate' button.
- Download the cert file and the private key file. You do not need the public key file. Rename these as simply
cert.pem
andpriv.key
. The shorter names are important as they can't be longer than 10 characters. - Click the 'Activate' button.
- Click 'Attach a Policy'. Attach the m5stack policy you created in the previous step. Click 'Register Thing'.
AWS Monitoring
Now you're ready to monitor for published messages.
- Click on the 'Test' link on the left side of the page.
- Enter
#
in the Subscription topic. This is a wildcard that will receive all messages for all topics. Click 'Subscribe to Topic'. - View your endpoint. You can find it in the pulldown menu on the upper right:
UIFlow configuration
Finally you can upload your cert and key onto your device, and create some UIFlow code.
- Connect your device to UIFlow. Create a new MQTT block that looks like this, using your own URL:
- Change the port to
8883
. This is important, don't forget it. AWS runs MQTT on a non-standard port. - Click on the plus icon to upload your cert.pem and priv.key files onto your device. They will then be available in the pulldown menus.
- Finally, run the code on your device. You will now begin to see "hello world" messages appearing in the queue every second:
Here's one last screenshot that includes an example of how to subscribe to messages on your device. In this example you'd Publish a test message to the 'receive' topic. Just make sure you have a label0 somewhere on the screen.
- Log onto your AWS account and pick a supported region for your IoT device. For example:
-
MQTT config for AWS IoT Core - SOLVED
Does anyone have a working configuration for MQTT and AWS IoT core? Micropython code would be really helpful. I have my certificate and private key uploaded to the device but am not sure where it's failing. Here is how my code looks:
while True: m5mqtt = M5mqtt('m5stack', 'iot.us-west-2.amazonaws.com', 1883, '', '', 300, ssl = True, ssl_params = {'key': "/flash/res/m5.key", 'cert': "/flash/res/m5.crt"}) m5mqtt.start() m5mqtt.publish(str('test'),str('hello world')) wait(1) wait_ms(2) wait(1) wait_ms(2)
-
RE: AWS EduKit restore factory firmware
@ksprayberry I must confess, I stopped the tutorial after getting Blinky Hello World working. I ended up flashing the device with UIFlow instead as it's much more user friendly.
-
RE: AWS EduKit restore factory firmware
@ksprayberry Don't feel bad, I slipped on the exact same banana peel. Writing technical workshop documentation is hard. I've been sending suggestions to the developer on github with some ideas about how to make this easier for new users.
What would be really amazing is the UIFlow experience, but with the AWS features enabled. Maybe someone could whip up a micropython module that would handle the AWS registration and key exchange interactively.
-
RE: AWS EduKit restore factory firmware
@ksprayberry Make sure you are in the correct AWS region. The test button on the MQTT page won't throw any errors or output if you're not in the correct region.
-
Specify nested key in get key > in map
I have some JSON that contains data nested several layers deep. What should I be putting in the 'get key' field? I tried text but it ended up being wrapped in quotes. This is the key I want to specify:
weather_json['properties']['periods'][0]['temperature']
When I go into the source code and delete the quotes it works fine.
-
RE: Using the textwrap micropython module?
I'd be open to any other methods you have for wrapping text. Or even generic instructions for importing external micropython modules...
This works fine in my local python interpreter:
from textwrap import * joke = "This is a really long joke. This is a really long joke.This is a really long joke.This is a really long joke.This is a really long joke." wrapper = textwrap.TextWrapper(width=30) print(wrapper.fill(joke))
But when I try to run it on the m5stack device I get:
'module' object has no attribute 'TextWrapper'
-
Using the textwrap micropython module?
Has anyone tried this?
https://github.com/micropython/micropython-lib/blob/master/textwrap/textwrap.py
I managed to upload textwrap.py to my device and it seems to import fine. But whenever I attempt to use it I get an error. Here is the code I'm trying to work with:
... req = urequests.request(method='GET', url='https://icanhazdadjoke.com/', headers={'Accept':'application/json'}) dad_json = json.loads((req.text)) DadJoke = dad_json['joke'] wrapped = textwrap.fill(str(DadJoke),width=30) dad_joke.set_text_color(0x33ff33) dad_joke.set_text(wrapped)
If I simply set_text(str(DadJoke)) it works but it writes right off the edge of the screen.
-
RE: AWS EduKit restore factory firmware
The ESP-IDF build kit is a beast. It's over a gigabyte in size (!) and contains thousands and thousands of files. Building the AWS Edu IoT firmware is not something I'd recommend for beginners. Some pointers from my experience with it:
- Make sure you install the correct version of ESP-IDF installed on your machine
- Use miniconda to ensure you have the exact right version of python and required modules
- Use
conda activate edukit
to get back into your custom edukit environment - Make sure you have installed all the required modules with
pip3 install -r requirements.txt
- Always load the ESP-IDF environment settings with export.sh (export.ps1 on windows), after you enter the conda environment. These environment scripts are inside of your esp-idf folder.
- Be in the Blinky-Hello-World directory when you run
idf.py build
- Use
idf.py flash monitor COMX
where X is your port
Once you have a working firmware image you can reflash without rebuilding.
-
AWS IoT Edukit Core M5 - Micropython support?
The AWS IoT Edukit Core M5 requires you to build your own firmware using the ESP-IDF build framework.
Will the extra hardware features like the RGB leds, microphone and crypto module be supported with an m5burner micropython image?