Wiring OLED and Buttons
281 days
ERC_DRC_Issues set to []).BOM_Issues set to []).Alternate_Parts with active alternates for connectors, pull-ups, and caps.Explicación:Cpp
#include <ESP8266WiFi.h> #include <ESP8266WebServer.h> #include <DNSServer.h> #include <WiFiManager.h> #define GPIO0 0 #define GPIO2 2 ESP8266WebServer server(80); void handleRoot() { server.send(200, "text/plain", "Hello, you can control GPIO here."); } // función para controlar GPIO0 void handleGPIO0On() { digitalWrite(GPIO0, LOW); // activar el pin server.send(200, "text/plain", "GPIO0 is ON"); } void handleGPIO0Off() { digitalWrite(GPIO0, HIGH); // desactivar el pin server.send(200, "text/plain", "GPIO0 is OFF"); } // función para controlar GPIO2 void handleGPIO2On() { digitalWrite(GPIO2, LOW); // activar el pin server.send(200, "text/plain", "GPIO2 is ON"); } void handleGPIO2Off() { digitalWrite(GPIO2, HIGH); // desactivar el pin server.send(200, "text/plain", "GPIO2 is OFF"); } void setup() { pinMode(GPIO0, OUTPUT); pinMode(GPIO2, OUTPUT); digitalWrite(GPIO0, HIGH); // inicialmente desactivado digitalWrite(GPIO2, HIGH); // inicialmente desactivado Serial.begin(115200); WiFiManager wifiManager; // Esta linea eliminará cualquier configuración previa wifiManager.resetSettings(); // Inicia el punto de acceso y solicita los datos de la red wifiManager.autoConnect("AutoConnectAP"); // Una vez recogida la información, se conecta a la red WiFi y se inicia el servidor web Serial.println("Conectado a WiFi!"); server.on("/", handleRoot); // Rutas para controlar GPIO0 server.on("/gpio0/on", handleGPIO0On); server.on("/gpio0/off", handleGPIO0Off); // Rutas para controlar GPIO2 server.on("/gpio2/on", handleGPIO2On); server.on("/gpio2/off", handleGPIO2Off); server.begin(); Serial.println("HTTP server started"); } void loop() { server.handleClient(); }
/gpio0/on, /gpio0/off, /gpio2/on, /gpio2/off).Explicación Adicional:Cpp
#include <ESP8266WiFi.h> #include <ESP8266WebServerSecure.h> #include <IotWebConf.h> // Definir pines #define GPIO0 0 #define GPIO2 2 // Certificado TLS para HTTPS const char* cert = "-----BEGIN CERTIFICATE-----\n" \ "YOUR_CERTIFICATE_HERE\n" \ "-----END CERTIFICATE-----\n"; const char* privateKey = "-----BEGIN PRIVATE KEY-----\n" \ "YOUR_PRIVATE_KEY_HERE\n" \ "-----END PRIVATE KEY-----\n"; // Configuración del servidor ESP8266WebServerSecure server(443); IotWebConf iotWebConf("YourProductName", &server, nullptr); void handleRoot() { server.send(200, "text/html", "<h1>Control de GPIO</h1>"); } // función para controlar GPIO0 void handleGPIO0On() { digitalWrite(GPIO0, LOW); // activar el pin server.send(200, "text/html", "GPIO0 is ON"); } void handleGPIO0Off() { digitalWrite(GPIO0, HIGH); // desactivar el pin server.send(200, "text/html", "GPIO0 is OFF"); } // función para controlar GPIO2 void handleGPIO2On() { digitalWrite(GPIO2, LOW); // activar el pin server.send(200, "text/html", "GPIO2 is ON"); } void handleGPIO2Off() { digitalWrite(GPIO2, HIGH); // desactivar el pin server.send(200, "text/html", "GPIO2 is OFF"); } void setup() { pinMode(GPIO0, OUTPUT); pinMode(GPIO2, OUTPUT); digitalWrite(GPIO0, HIGH); // inicialmente desactivado digitalWrite(GPIO2, HIGH); // inicialmente desactivado Serial.begin(115200); // Inicializa el servidor seguro con el certificado y la clave privada server.getServer().begin(cert, privateKey); // Configuración de IotWebConf iotWebConf.init(); // Definir rutas server.on("/", handleRoot); server.on("/gpio0/on", handleGPIO0On); server.on("/gpio0/off", handleGPIO0Off); server.on("/gpio2/on", handleGPIO2On); server.on("/gpio2/off", handleGPIO2Off); Serial.println("HTTP server started"); } void loop() { iotWebConf.doLoop(); server.handleClient(); }
YOUR_CERTIFICATE_HERE y YOUR_PRIVATE_KEY_HERE con tus propios certificados TLS.Puntos Clave para la Seguridad de Credenciales:Cpp
#include <ESP8266WiFi.h> #include <WiFiManager.h> // Definir pines #define GPIO0 0 #define GPIO2 2 WiFiManager wifiManager; // Servidor HTTP ESP8266WebServer server(80); // Función para manejar la raíz void handleRoot() { server.send(200, "text/html", "<h1>Control de GPIO</h1><br><a href=\"/gpio0/on\">Encender GPIO0</a><br><a href=\"/gpio0/off\">Apagar GPIO0</a><br><a href=\"/gpio2/on\">Encender GPIO2</a><br><a href=\"/gpio2/off\">Apagar GPIO2</a>"); } void handleGPIO0On() { digitalWrite(GPIO0, LOW); // activar el pin server.send(200, "text/plain", "GPIO0 is ON"); } void handleGPIO0Off() { digitalWrite(GPIO0, HIGH); // desactivar el pin server.send(200, "text/plain", "GPIO0 is OFF"); } void handleGPIO2On() { digitalWrite(GPIO2, LOW); // activar el pin server.send(200, "text/plain", "GPIO2 is ON"); } void handleGPIO2Off() { digitalWrite(GPIO2, HIGH); // desactivar el pin server.send(200, "text/plain", "GPIO2 is OFF"); } void setup() { pinMode(GPIO0, OUTPUT); pinMode(GPIO2, OUTPUT); digitalWrite(GPIO0, HIGH); // inicialmente desactivado digitalWrite(GPIO2, HIGH); // inicialmente desactivado Serial.begin(115200); // Resetea las configuraciones anteriores (útil para pruebas) // wifiManager.resetSettings(); // Inicia AP para recoger credenciales if (!wifiManager.autoConnect("AutoConnectAP")) { Serial.println("Falló la conexión, reiniciando..."); delay(3000); ESP.restart(); } Serial.println("Conectado a WiFi!"); // Configuración del servidor HTTP server.on("/", handleRoot); server.on("/gpio0/on", handleGPIO0On); server.on("/gpio0/off", handleGPIO0Off); server.on("/gpio2/on", handleGPIO2On); server.on("/gpio2/off", handleGPIO2Off); server.begin(); Serial.println("Servidor HTTP iniciado"); } void loop() { server.handleClient(); }
wifiManager.resetSettings(); para eliminar configuraciones previas durante las pruebas; asegúrate de comentarlo/tratarlo adecuadamente en producción.wifiManager.autoConnect("AutoConnectAP") crea un punto de acceso para capturar el SSID y la contraseña. Estos datos se almacenan de manera segura en la memoria flash.5V (Pin 1): The input voltage to power the board through a USB connection or an external 5V source.3V3 (Pin 16): 3.3V output that can be used to power external components.GND (Pin 5): Ground.D0 to D8 (Pins 14, 10, 11, 12, 13, 6, 7, 8, 9): These are GPIO pins with specific functions like CS/D8, MOSI/D7, MISO/D6, and SCK/D5 for SPI communication, also SDA/D2, SCL/D1 for I2C communication.A0 (Pin 15): Analog input pin.TX (Pin 4): Transmit pin for serial communication.RX (Pin 3): Receive pin for serial communication.RST (Pin 2): Used to reset the microcontroller.Cpp
#include <ESP8266WiFi.h> #include <ESPAsyncWebServer.h>
Cpp
const char *ssid = "Your_SSID"; const char *password = "Your_PASSWORD"; void setup() { Serial.begin(115200); WiFi.softAP(ssid, password); IPAddress IP = WiFi.softAPIP(); Serial.print("AP IP address: "); Serial.println(IP); }
Cpp
AsyncWebServer server(80); void setup() { // Tu configuración de red aquí server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){ request->send(200, "text/html", "<h1>Captive Portal</h1><p>Usted ha sido redirigido aquí!</p>"); }); server.begin(); }
Cpp
void setup() { // Tu configuración de red y servidor aquí dnsServer.start(53, "*", WiFi.softAPIP()); while (true) { dnsServer.processNextRequest(); } }
Your_SSID y Your_PASSWORD por los datos de tu red. Con esto, cualquier dispositivo que se conecte a tu AP será redirigido a la página que especifiques.dnsmasq si estás manejando un servidor local.192.168.4.1. Puedes intentar ingresar esta dirección en tu navegador para ver si puedes acceder al portal cautivo.192.168.4.1 en la barra de direcciones.192.168.4.1 no funciona, puedes intentar otras direcciones IP comunes, como 192.168.0.1 o 192.168.1.1, aunque es mucho menos probable que sean las configuradas en el modo AP del ESP8266.192.168.4.1. Esto te puede ayudar a verificar si la dirección IP es la correcta.192.168.4.2 es la IP asignada a tu celular por el punto de acceso del ESP8266. Deberías intentar acceder a la IP del punto de acceso, la cual típicamente es 192.168.4.1.192.168.4.1 no te lleva al portal cautivo, aquí hay algunos pasos adicionales para solucionar el problema:Soluciones Adicionales:Cpp
#include <ESP8266WiFi.h> #include <ESPAsyncWebServer.h> const char *ssid = "Your_SSID"; const char *password = "Your_PASSWORD"; // Create an instance of the server AsyncWebServer server(80); void setup() { Serial.begin(115200); // Setting up the WiFi WiFi.mode(WIFI_AP); WiFi.softAP(ssid, password); // Print the IP address IPAddress IP = WiFi.softAPIP(); Serial.print("AP IP address: "); Serial.println(IP); // Define the behavior for when the root URL is accessed server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){ request->send(200, "text/html", "<h1>Captive Portal</h1><p>You have been redirected here!</p>"); }); // Start server server.begin(); } void loop() { // Nothing needs to be done in the loop for this server }
Serial.println() para imprimir mensajes que confirmen que el ESP8266 está configurado correctamente y que el servidor web está corriendo.ESPAsyncWiFiManager para crear un portal cautivo de manera más estructurada y confiable.Cpp
#include <ESPAsyncWebServer.h> #include <ESPAsyncWiFiManager.h> AsyncWebServer server(80); DNSServer dns; void setup() { Serial.begin(115200); // Create an AsyncWiFiManager object AsyncWiFiManager wifiManager(&server, &dns); // Reset saved settings (for development purposes) wifiManager.resetSettings(); // Start the portal wifiManager.autoConnect("AutoConnectAP"); Serial.println("Connected."); } void loop() { // Your code here }
Archivo > Preferencias.Gestor de URLs de placas adicionales, pega la siguiente URL: http://arduino.esp8266.com/stable/package_esp8266com_index.json.OK.Herramientas > Placa > Gestor de placas.esp8266 y selecciona ESP8266 by ESP8266 Community.Instalar.Herramientas > Placa y selecciona LOLIN(WEMOS) D1 R2 & mini.Herramientas > Puerto y selecciona el puerto que corresponda a tu placa (p.ej., COM3 en Windows, /dev/ttyUSB0 en Linux).✓ (verificar) para compilar el código.→ (subir) para cargar el código en tu placa WeMos D1 mini.Herramientas > Monitor Serial.115200 baud, que es la velocidad que configuraste en Serial.begin$$115200$$.AutoConnectAP. Conéctate a este AP utilizando tu dispositivo (teléfono, portátil, etc.).http:///gpio0/onhttp:///gpio0/offhttp:///gpio2/onhttp:///gpio2/offhttp://arduino.esp8266.com/stable/package_esp8266com_index.json
Cpp
#include <ESP8266WiFi.h> // Replace with your network credentials const char* ssid = "YOUR_SSID"; const char* password = "YOUR_PASS"; void setup() { Serial.begin(115200); // Connect to Wi-Fi network Serial.print("Connecting to "); Serial.println(ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(1000); Serial.print("."); } // Print local IP address and start web server Serial.println(""); Serial.println("WiFi connected."); Serial.println("IP address: "); Serial.println(WiFi.localIP()); } void loop() { // Your loop code here }
YOUR_SSID y YOUR_PASS con el nombre de tu red Wi-Fi y la contraseña, respectivamente.WiFiManager, el código inicia un servidor HTTP en el puerto 80 que permite controlar los pines GPIO0 y GPIO2 a través de una interfaz web simple.WiFiManager.http:///gpio0/onhttp:///gpio0/offhttp:///gpio2/onhttp:///gpio2/off192.168.0.10:Descripción del flujo del programaPlaintext
http://192.168.0.10/gpio0/on http://192.168.0.10/gpio0/off http://192.168.0.10/gpio2/on http://192.168.0.10/gpio2/off
WiFiManager para gestionar la conexión WiFi.server.handleClient() para gestionar las solicitudes HTTP entrantes.LED:+ a U1:GPIO0.LED:- a R1:1.R1:2 a U1:GND.Sensor:Data a U1:GPIO2.Sensor:VCC a U1:3V3.Sensor:GND a U1:GND.Diagram
Diagram
Diagram
Thinking...
Reviews
Documents
Documents are markdown text files which describe project goals, capture details, or even simulation outputs.
Assets
wemosd1mini-template.png
wemosd1mini-templateThumbnailWeMos D1 mini template
Properties
[]
- Resistor 4.7kΩ 0603: Yageo RC0603FR-074.7K; Vishay CRCW06034K70FKEAC - Resistor 10kΩ 0603: Yageo RC0603FR-0710KL; Panasonic ERJ-3EKF1002V - Capacitor 0.1µF 0603 16V: Murata GRM188R71H104KA93D; TDK C1608X7R1C104K085AA - Capacitor 100nF 0603 50V: Murata GRM188R71H104KA01D; AVX 0603YC104KAT2A - Connector JST-PH 1x2 2.0mm: Molex PicoBlade 501330-0400; TE Connectivity MicroMatch 1543184-2
[]
Diagram
Pricing & Availability
Distributor | Qty 1 |
|---|---|
Arrow | $0.23 |
LCSC | $0.07 |
Mouser | $0.20 |
Verical | $0.11–$0.40 |
Controls
Welcome 👋
Flux helps you build PCBs faster with an AI teammate!
Create your account to collaborate, stay updated, fork your own version, and get instant answers from our AI agent.
dd33dd33
copilot
Table
dd33dd33
copilot
- The D1 Mini can generate audio waveforms (sine, square, triangle, etc.) digitally using its GPIO pins.
- The frequency of these waveforms can be controlled by digital potentiometers or external control voltage (CV) inputs, which can be interfaced through GPIOs or the ADC (pin A0 for $0-3.3V$ input). However, the $3.3V$ range needs to be scaled appropriately from the Eurorack standard ($-5V$ to $+5V$ or $0$ to $+10V$) for control voltage inputs.
Voltage-Controlled Amplifier (VCA)- While the D1 Mini itself cannot directly act as an analog VCA due to its digital nature, it can control an external analog VCA circuit.
- By using PWM (Pulse-Width Modulation) output capabilities on GPIO pins, it can modulate the amplitude of an audio signal indirectly. Digital control can be implemented to adjust the depth of modulation based on CV inputs.
Digital Signal Processor (DSP) Module- The D1 Mini can process audio signals in the digital domain, acting as an effects processor (delay, reverb, distortion, etc.).
- The ADC can be used for capturing low-frequency audio signals or CVs, while digital processing can modify the signal, which is then output through a DAC (Digital-to-Analog Converter) that must be added externally as the ESP8266 lacks a built-in DAC.
MIDI Interface/Controller- The serial communication capabilities (RX/TX pins) make the D1 Mini suitable for MIDI interfacing, allowing it to act as a bridge between MIDI devices and Eurorack modules.
- It can convert MIDI messages into control voltages or triggers/gates, acting as a versatile controller.
Sequencer- Utilizing its ample GPIOs and the ability to interface with displays, buttons, and additional memory, the D1 Mini can serve as a core for sequencing modules that generate patterns of gates/triggers and CVs.
Connectivity and IoT