• Home
  • Robotics
  • 3D Printing
  • Web
  • Microcontrollers
  • Frameworks
  • Protocols
  • Other
  • Explore knowledge
  • Loading graph.
    Depth
    …
    … visible
  • Home
  • Robotics
  • 3D Printing
  • Web
  • Microcontrollers
  • Frameworks
  • Protocols
  • Other
Tools
    Pages
    • Microcontrollers
      • ESP32
        • C3 Dev Kit M1
        • Datasheets
        • Debug
        • ESP-Mesh
        • ESP-Now
        • ESP32 C3 DevKit M1
        • ESP32 D1 Mini
        • ESP32-C3 0.42 Oled
        • FireBeetle
        • M5 Atom Lite
        • M5 Stick C Plus
        • m5 stick V
        • Round Display
        • S2 Saola 1
        • Software
        • Thermostat Control
        • Timer Cam OV3660
        • TTGO T-Display
        • TTGO T5-EPaper
        • Wall Display
        • Waveshare S3 3.5 Inch display
      • nRF52
        • nRF52832 UART dongle
        • nRF52840 USB dongle
        • Simple Mesh SensorTag
        • Thread SensorTag
        • Trick Tracker
        • UWB DWM1001 dev
        • UWB DWM3001 cdk
      • nRF53
        • thingy53
      • Risc-V
      • STM32
        • Black Pill
        • Blue Pill
        • Dev EBox F407
    Pages
    • Microcontrollers
      • ESP32
        • C3 Dev Kit M1
        • Datasheets
        • Debug
        • ESP-Mesh
        • ESP-Now
        • ESP32 C3 DevKit M1
        • ESP32 D1 Mini
        • ESP32-C3 0.42 Oled
        • FireBeetle
        • M5 Atom Lite
        • M5 Stick C Plus
        • m5 stick V
        • Round Display
        • S2 Saola 1
        • Software
        • Thermostat Control
        • Timer Cam OV3660
        • TTGO T-Display
        • TTGO T5-EPaper
        • Wall Display
        • Waveshare S3 3.5 Inch display
      • nRF52
        • nRF52832 UART dongle
        • nRF52840 USB dongle
        • Simple Mesh SensorTag
        • Thread SensorTag
        • Trick Tracker
        • UWB DWM1001 dev
        • UWB DWM3001 cdk
      • nRF53
        • thingy53
      • Risc-V
      • STM32
        • Black Pill
        • Blue Pill
        • Dev EBox F407
    Home/Microcontrollers/ESP32/m5stack-atom
    Metadata
    description
    Smallest tiny ESP32 pico with button and RGB LED
    date
    2021-03-12
    tags
    Board
    draft
    false
    features
    ["Tiny 24 x 24 x 10 mm","User Button + Reset","RGB Led SK6812","IR Led"]

    Overview

    image-m5-atom-lite.webp
    ×
    • Tiny 24 x 24 x 10 mm

    • User Button + Reset

    • RGB Led SK6812

    • IR Led

    Pinout

    image-m5-atom-pinout.webp
    ×

    Links

    Product Page

    schematics

    image-atom_lite_simple_circut_20200514.webp
    ×

    Application - Serial to MQTT

    • The serial to MQTT App creates a request and response topics that will propagate through a second Serial interface

    image-atom-serial-mqtt.png
    ×
    • Although the board is available on platform-espressif32 it was not avialable on platformio release as of Today, therefore the board is stored locally.
      board on platform-espressif32

    Application repo

    ESP32 Program Github Repo

    Application Details

    main.cpp
    C++
    #include <Arduino.h>
    #include <ArduinoJson.h>
    #include <MQTT.h>
    #include "WiFi.h"
    #include "M5Atom.h"
    ...
    const char* host = "10.0.0.42";
    int port = 1883;
    const char *mqtt_client_id = "light_dimmer_mqtt";
    
    const char* rx_topic = "esp/dimmer/request";
    const char* tx_topic = "esp/dimmer/response";
    const char* main_topic = "esp/dimmer";
    
    MQTTClient mqtt(1024);// 1KB
    WiFiClient wifi;//needed to stay on global scope
    
    //      G
    //      5V
    #define TX_PIN 25
    #define RX_PIN 21
    ...
    void mqtt_loop(){
      mqtt.loop();
      if (!mqtt.connected()) {
        connect();
      }
    }
    
    void process_serial_2_mqtt(String str_message){
      mqtt.publish(tx_topic, str_message);
      Serial.println("\nSerial > MQTT");
      Serial.println(str_message);
    }
    void messageReceived(String &topic, String &payload) {
      Serial1.println(payload);
      Serial.println("\nMQTT > Serial");
      Serial.println(payload);
    }
    
    void setup() {
      
      M5.begin(false, false, true);
      delay(50);
      M5.dis.drawpix(0, CRGB(0,50,0));
    
      Serial.begin(115200);
      Serial1.begin(115200, SERIAL_8N1, RX_PIN, TX_PIN);
      WiFi.begin(ssid, password);
    
      mqtt.begin(host,port, wifi);
      mqtt.onMessage(messageReceived);
    
    }
    ...
    void loop() {
      mqtt_loop();
      if (M5.Btn.wasPressed()){
        switch_led();
      }
    
      delay(50);
      M5.update();
      if(Serial1.available()>0){
        String msg = Serial1.readString();
        process_serial_2_mqtt(msg);
      }
    }
    Build info...
    Bash
    PACKAGES:
     - framework-arduinoespressif32 3.10005.210308 (1.0.5)
     - tool-esptoolpy 1.30000.201119 (3.0.0)
     - toolchain-xtensa32 2.50200.97 (5.2.0)
    ...
    Dependency Graph
    |-- <ArduinoJson> 6.16.1
    |-- <MQTT> 2.4.7
    |-- <M5Atom> 0.0.1
    |   |-- <FastLED> 3.4.0
    |   |-- <Wire> 1.0.1
    |-- <FastLED> 3.4.0
    |-- <WiFi> 1.0
    Platformio ini file ...
    Ini
    [env]
    board = m5stack-atom
    framework = arduino
    lib_deps =
        ArduinoJson@6.16.1
        617@2.4.7   #MQTT 256dpi/arduino-mqtt
        M5Atom
        fastled/FastLED @ ^3.4.0
    lib_ldf_mode = deep+
    [env:m5stack-atom]
    platform = espressif32
    monitor_speed = 115200
    ← PreviousFireBeetleNext →ESP32 C3 DevKit M1
    On this page
    • Overview
      • Pinout
      • Links
      • schematics
    • Application - Serial to MQTT
      • Application Details
    Open page ×