🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    AWS IoT Edukit Core M5 - Micropython support?

    Core2 for AWS
    6
    12
    16.8k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • greenleafG
      greenleaf
      last edited by

      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?

      1 Reply Last reply Reply Quote 1
      • ZontexZ
        Zontex
        last edited by

        Yes it's supported, you could use the Core2 AWS like a normal version core2

        1 Reply Last reply Reply Quote 0
        • R
          rashedtalukder
          last edited by

          @greenleaf, after doing some initial quick testing I found that many of the features are in parity, but things like the RBG LED is not functional because the pins are different from the M5Stack Fire. You might be able to take the existing M5Stack MicroPython library and update the pins to work with it.

          The crypto module isn't supported. However, you can use the Adafruit Crypto library for the secure element.

          M5Stack and AWS are working together to explore an option to deliver a MicroPython package specifically for the Core2 for AWS IoT EduKit.

          Head of the AWS IoT EduKit program and AWS employee. Not an M5Stack employee.

          greenleafG F 2 Replies Last reply Reply Quote 1
          • greenleafG
            greenleaf @rashedtalukder
            last edited by

            @rashedtalukder Super! An officially supported MicroPython package for the Core2 for AWS would be amazing.

            1 Reply Last reply Reply Quote 0
            • F
              flex @rashedtalukder
              last edited by

              @rashedtalukder said in AWS IoT Edukit Core M5 - Micropython support?:

              Adafruit Crypto library

              waiting for that MicroPython package specific for the Core2 for AWS... When?

              1 Reply Last reply Reply Quote 1
              • greenleafG
                greenleaf
                last edited by

                Hi @rashedtalukder - it's been a while. Is AWS still committed to bringing Micropython to this device?

                ajb2k3A R 2 Replies Last reply Reply Quote 0
                • ajb2k3A
                  ajb2k3 @greenleaf
                  last edited by

                  @greenleaf I haven't heard anything but there are functions in UIFlow provided for this and I have written and published a guide but am rewriting and updating a guide to AWS using UIFlow.

                  UIFlow, so easy an adult can learn it!
                  If I don't know it, be patient!
                  I've ether not learned it or am too drunk to remember it!
                  Author of the WIP UIFlow Handbook!
                  M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

                  greenleafG 1 Reply Last reply Reply Quote 0
                  • greenleafG
                    greenleaf @ajb2k3
                    last edited by

                    @ajb2k3 Thanks. Yes, it looks like UIflow has evolved quite a bit since last year. I'm happy to see you can execute custom code now, and that there are some dedicated hooks for things like AWS IoT.

                    1 Reply Last reply Reply Quote 1
                    • R
                      rashedtalukder @greenleaf
                      last edited by

                      @greenleaf I recently left Amazon. I don’t know what their plans are.

                      Head of the AWS IoT EduKit program and AWS employee. Not an M5Stack employee.

                      ajb2k3A greenleafG 2 Replies Last reply Reply Quote 0
                      • ajb2k3A
                        ajb2k3 @rashedtalukder
                        last edited by

                        @rashedtalukder just spent the last 7 days hacking the code and making progress.

                        UIFlow, so easy an adult can learn it!
                        If I don't know it, be patient!
                        I've ether not learned it or am too drunk to remember it!
                        Author of the WIP UIFlow Handbook!
                        M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

                        1 Reply Last reply Reply Quote 0
                        • K
                          kulmam92
                          last edited by

                          I was able to send data to AWS IoT Core using the below code. If you want to run this code from VScode + Pymakr, follow this guide: MicroPython: Program ESP32/ESP8266 using VS Code and Pymakr

                          import network
                          from umqtt.simple import MQTTClient
                          import time
                          import sys
                          import os
                          import json
                          
                          # configure your wifi credentials
                          WIFI_SSID = "<YOUR_WIFI_SSID_GOES_HERE>"
                          WIFI_PASS = "<YOUR_WIFI_PASSWORD_GOES_HERE>"
                          
                          # configure your iot credentials
                          MQTT_ENDPOINT = "XXXXXX.iot.XXXXX.amazonaws.com"
                          MQTT_PORT = 8883
                          MQTT_QOS = 0
                          # thing-id
                          MQTT_CLIENT = "mycore2"
                          
                          THING_CLIENT_CERT = "/flash/res/core2-certificate.pem.crt"
                          THING_PRIVATE_KEY = "/flash/res/core2-private.pem.key"
                          
                          # topic
                          MQTT_TOPIC = "mycore2/env"
                          MQTT_SUB_TOPIC = "mycore2/command"
                          
                          info = os.uname()
                          
                          def connect_to_wifi(ssid, password):
                              sta_if = network.WLAN(network.STA_IF)
                              if not sta_if.isconnected():
                                  sta_if.active(True)
                                  sta_if.connect(ssid, password)
                                  while not sta_if.isconnected():
                                      pass
                              ip_address = sta_if.ifconfig()[0]
                              return ip_address
                          
                          def get_key(key_path):
                              with open(key_path, "r") as f:
                                  key = f.read()
                              return key
                          
                          def connect_to_mqtt():
                              print("CONNECTING TO MQTT BROKER...")
                              global client
                              client = MQTTClient(
                                  client_id=MQTT_CLIENT,
                                  server=MQTT_ENDPOINT,
                                  port=MQTT_PORT,
                                  keepalive=0,
                                  ssl=True,
                                  ssl_params={
                                      "cert": get_key(THING_CLIENT_CERT),
                                      "key": get_key(THING_PRIVATE_KEY),
                                      "server_side": False
                                  }
                              )
                              client.set_callback(subscription_call_back)
                              try:
                                  client.connect()
                                  print("MQTT BROKER CONNECTION SUCCESSFUL")
                              except Exception as e:
                                  print("MQTT CONNECTION FAILED: {}".format(e))
                                  sys.exit()
                              client.subscribe(MQTT_SUB_TOPIC)
                              print("SUBSCRIBED TO TOPIC: {}".format(MQTT_SUB_TOPIC))
                              return
                          
                          def subscription_call_back(topic, msg):
                              # confirm state update
                              print("RECEIVING MESSAGE: {} FROM TOPIC: {}".format(
                                  msg.decode("utf-8"), topic.decode("utf-8")))
                              return
                          
                          def publish_message(topic, msg, qos=MQTT_QOS):
                              client.publish(
                                  topic=topic,
                                  msg=msg,
                                  qos=qos)
                              print("PUBLISHING MESSAGE: {} TO TOPIC: {}".format(msg, topic))
                              return
                          
                          # connect to wifi
                          print("CONNECTING TO WIFI NETWORK")
                          ip_address = connect_to_wifi(WIFI_SSID, WIFI_PASS)
                          print("CONNECTED SUCCESSFULLY")
                          print("YOUR IP ADDRESS IS: {}".format(ip_address))
                          
                          # connect to mqtt
                          print("CONNECTING TO MQTT BROKER")
                          connect_to_mqtt()
                          print("SUBSCRIBED TO TOPIC")
                          while True:
                              client.check_msg()
                          
                              tf = power.getTempInAXP192()
                              msg = str(json.dumps({
                                  "client": MQTT_CLIENT,
                                  "device": {
                                      "uptime": time.ticks_ms(),
                                      "hardware": info[0],
                                      "firmware": info[2]
                                  },
                                  "sensors": {
                                      "TempInAXP192": tf
                                  },
                                  "status": "online",
                              }))
                              publish_message(MQTT_TOPIC, msg)
                              time.sleep(5)
                          
                          1 Reply Last reply Reply Quote 1
                          • greenleafG
                            greenleaf @rashedtalukder
                            last edited by

                            @rashedtalukder Congrats, hope you are on to somewhere that appreciates your skills!

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post