M5 Stack PROTO Module with Extension & Bus Socket Documentation
The M5 Stack PROTO Module with Extension & Bus Socket is a versatile IoT development module that provides a range of interfaces and features for prototyping and developing IoT projects. This module is part of the M5 Stack series, known for its modular and stackable design, allowing users to easily connect and combine different modules to create complex IoT systems.
PROTO module with extension and bus socket
Compatible with M5 Stack modules
Onboard USB-C interface for programming and power supply
2x10 pin extension socket for connecting sensors, actuators, and other modules
2x5 pin bus socket for connecting other M5 Stack modules
Supports ESP32, ESP8266, and other microcontrollers
Power supply: 5V/3.3V compatible
Operating Voltage: 5V/3.3V
Operating Temperature: -20C to 70C
Dimensions: 54.5 x 54.5 mm (2.15 x 2.15 inches)
Weight: approximately 20g (0.7 oz)
Here are three code examples demonstrating how to use the M5 Stack PROTO Module with Extension & Bus Socket in various contexts:
Example 1: Basic LED Blinking with ESP32
In this example, we'll use the M5 Stack PROTO Module with Extension & Bus Socket to blink an LED connected to the extension socket.
```c
#include <M5Stack.h>
#define LED_PIN 21 // Pin 21 on the extension socket
void setup() {
M5.begin();
pinMode(LED_PIN, OUTPUT);
}
void loop() {
digitalWrite(LED_PIN, HIGH);
delay(1000);
digitalWrite(LED_PIN, LOW);
delay(1000);
}
```
Example 2: I2C Communication with a Sensor Module
In this example, we'll use the M5 Stack PROTO Module with Extension & Bus Socket to communicate with a BME280 temperature and humidity sensor module connected to the bus socket.
```c
#include <M5Stack.h>
#include <Wire.h>
#include <BME280.h>
void setup() {
M5.begin();
Wire.begin();
bme.begin();
}
void loop() {
float temp = bme.readTemperature();
float hum = bme.readHumidity();
Serial.printf("Temperature: %.2fC, Humidity: %.2f%%
", temp, hum);
delay(1000);
}
```
Example 3: Wi-Fi Connectivity with ESP8266
In this example, we'll use the M5 Stack PROTO Module with Extension & Bus Socket to connect to a Wi-Fi network using an ESP8266 microcontroller.
```c
#include <M5Stack.h>
#include <WiFi.h>
const char ssid = "your_wifi_ssid";
const char password = "your_wifi_password";
void setup() {
M5.begin();
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to Wi-Fi...");
}
Serial.println("Connected to Wi-Fi");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
void loop() {
// Your code here
}
```
The M5 Stack PROTO Module with Extension & Bus Socket provides a versatile platform for prototyping and developing IoT projects. With its range of interfaces and features, it can be used in a variety of applications, from simple sensor monitoring to complex IoT systems. The code examples provided demonstrate how to use this module in different contexts, and are meant to serve as a starting point for your own IoT projects.