Prompt Details
Model
(gemini-3.1-pro)
Token size
358
Example input
[Microcontroller]: ESP32 NodeMCU
[Sensors_Actuators]: BME280 Temperature and Humidity Sensor
[Cloud_Preference]: Send data to a local MQTT Mosquitto broker
Example output
### 🔌 1. Hardware & Wiring Blueprint
The BME280 uses the I2C protocol. The ESP32 operates at 3.3V logic, which perfectly matches the BME280. No logic level converters are needed.
* **BME280 VIN** -> ESP32 3V3 Pin
* **BME280 GND** -> ESP32 GND
* **BME280 SCL** -> ESP32 GPIO 22 (Default I2C SCL)
* **BME280 SDA** -> ESP32 GPIO 21 (Default I2C SDA)
### 💻 2. Embedded Core Code
```cpp
#include <WiFi.h>
#include <PubSubClient.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
const char* ssid = "YOUR_SSID";
const char* password = "YOUR_PASSWORD";
const char* mqtt_server = "192.168.1.100"; // Local Mosquitto IP
WiFiClient espClient;
PubSubClient client(espClient);
Adafruit_BME280 bme; // I2C
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) delay(500);
client.setServer(mqtt_server, 1883);
if (!bme.begin(0x76)) { // Default I2C address for BME280
Serial.println("Could not find a valid BME280 sensor!");
while (1);
}
}
void loop() {
if (!client.connected()) {
// Reconnect logic here
client.connect("ESP32Client");
}
client.loop();
float temp = bme.readTemperature();
client.publish("home/livingroom/temperature", String(temp).c_str());
delay(5000); // Read every 5 seconds
}
By purchasing this prompt, you agree to our terms of service
GEMINI-3.1-PRO
Bridge the gap between hardware and software. This Principal IoT Architect prompt designs your complete hardware ecosystem. It provides exact GPIO pin wiring guidelines, generates highly optimized embedded code (C++/MicroPython), and architectures the cloud backend to visualize your sensor data.
...more
Added 4 hours ago
