logo elektroda
logo elektroda
X
logo elektroda

D1 mini module - ESP8266 WIFI launch, start from IoT, Blynk, Thingspeak

TechEkspert 36123 43

TL;DR

  • Wemos D1 mini with ESP8266-12E and a relay board is used as a ready-to-run Arduino-compatible IoT starter module.
  • The setup demonstrates local browser control, Blynk smartphone control, ThingSpeak telemetry, and ESP.deepSleep() for power saving.
  • The relay board needs 5V power, the relay draws about 60mA, and the ESP8266 pins still operate at 3.3V.
  • The relay can be switched from anywhere through Blynk, but direct LAN access may fail when a router blocks client-to-client traffic.
Generated by the language model.
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
📢 Listen (AI):
  • #31 18661920
    TechEkspert
    Editor
    Posts: 7042
    Help: 16
    Rate: 5453
    Board Language: polish
    I checked it in a scenario where the module was connected to a router that was a Wi-Fi AP sharing the internet.
  • ADVERTISEMENT
  • #32 18662015
    TDA2593
    Level 9  
    Posts: 69
    Rate: 8
    Board Language: polish
    I do not have much experience in this topic. Does the WiFi module need to see the router's network? What exactly does AP abbreviation mean? Sometimes I connect to the Raspberry, with a dedicated soft directly via a cell ... Regards.
  • #33 18662255
    inot
    Level 38  
    Posts: 3504
    Help: 434
    Rate: 784
    Board Language: polish
    Quote:
    Does the WiFi module need to see the router's network?

    It's rather the opposite. The module should register with the router.

    See how the module reports through the serial port (USB).
    AP = access point.
  • ADVERTISEMENT
  • #34 18662603
    TechEkspert
    Editor
    Posts: 7042
    Help: 16
    Rate: 5453
    Board Language: polish
    AP, i.e. a WiFi access point that provides internet connection, such as in hotels or at McDonald's, to which you connect, for example, with a smartphone or laptop. If you log into the router with the AP, you can see what the module does in the log. Information from the module's serial console (via USB) can also be useful.
  • ADVERTISEMENT
  • #35 20587997
    blazrech
    Level 5  
    Posts: 19
    Rate: 8
    Board Language: polish
    Hello. Can this be extended to say 4 relays? And to enable each separately. And control from app like this one way. Thanks in advance for your answer.
  • #36 20588209
    TechEkspert
    Editor
    Posts: 7042
    Help: 16
    Rate: 5453
    Board Language: polish
    Can be.
    Let's see what AI has to say.

    @ElektrodaBot Write the code for Arduino on the ESP8266 board that will control 4 relays through the blynk application on your smartphone.
  • #37 20588214
    blazrech
    Level 5  
    Posts: 19
    Rate: 8
    Board Language: polish
    Thanks a lot for your answer. How should I understand the code I will write a bot?
  • #38 20588216
    TechEkspert
    Editor
    Posts: 7042
    Help: 16
    Rate: 5453
    Board Language: polish
    We'll see what he writes, you can compare it with the code from the first post.
  • #39 20588219
    ElektrodaBot
    AI OpenAI ChatGPT4
    Posts: 8724
    Help: 349
    Rate: 917
    Board Language: polish
    TechEkspert wrote:
    Write code under Arduino for a board with ESP8266 that will allow 4 relays to be controlled via the blynk smartphone app.
    To write such code to Arduino for a board with ESP8266 and control 4 relays via the Blynk app, follow the steps below:

    1. make sure you have all the necessary libraries installed, such as ESP8266WiFi, BlynkSimpleEsp8266 and ESP8266WebServer. You can install these using the Arduino IDE Library Manager.

    2. go to the Blynk app on your smartphone and create a new project. Give it a name, such as "Relay Controller". Select the ESP8266 board as the target device.

    3. add 4 buttons to your Blynk project and assign them virtual pins, e.g. V1, V2, V3 and V4. Set each button as a switch (SWITCH).

    4. send the project authorisation code to your email address.

    Now we can move on to writing the code for the Arduino:

    Code: text
    Log in, to see the code
    .

    5 Replace the values "Your_authorisation_code", "Your_WiFi_network_name" and "Your_WiFi_network_password" with your own data.

    6. upload the code to the board with the ESP8266 using the Arduino IDE.

    Now that the code has been uploaded to the board, you should be able to control the 4 relays using the Blynk app on your smartphone. Make sure the relays are correctly connected to pins D1, D2, D3 and D4 on the ESP8266 board.
    You can call me in any topic by writing @ElektrodaBot. Disclaimer: Some answers provided by the ElektrodaBot may be inaccurate. Elektroda not responsible for accuracy, reliability or completeness of the information presented. All ElektrodaBot responses should be verified by the user. OpenAI can monitor and save information entered after calling ElektrodaBot.
  • ADVERTISEMENT
  • #40 20588246
    blazrech
    Level 5  
    Posts: 19
    Rate: 8
    Board Language: polish
    What does this line in the code mean?
    char auth[] = "Your_authorization_code";
    What do you need to enter here?
  • #41 20588389
    TechEkspert
    Editor
    Posts: 7042
    Help: 16
    Rate: 5453
    Board Language: polish
    The token for blynk, after installing the application and entering the e-mail, comes to the inbox.

    @ElektrodaBot how to get a token for the blynk application that allows you to control IoT devices and what are the limitations of the free blynk version?
  • #42 20588396
    ElektrodaBot
    AI OpenAI ChatGPT4
    Posts: 8724
    Help: 349
    Rate: 917
    Board Language: polish
    TechEkspert wrote:
    how to obtain a token for the blynk app allowing control of IoT devices and what are the limitations of the free version of blynk?
    To obtain a token (authorisation code) for the Blynk app, follow the steps below:

    1. Download and install the Blynk app on your smartphone (available on Android and iOS).
    2. create a new account in the Blynk app using your email address and password.
    3. Once logged in, click "New Project".
    4. give your project a name, select the device you want to control from the list (e.g. ESP8266) and then select a connection (e.g. Wi-Fi).
    5. click "Create Project". A token (authorisation code) will be automatically generated and sent to your email address.
    6. check your email inbox to find an email from Blynk with the authorisation code. Copy the token and use it in your own Arduino code, ESP8266, etc.

    If you need to access the authorisation code in the future, you can do so by going to the settings of your Blynk project (cog icon) and selecting "E-mail all auth tokens".

    Limitations of the free version of Blynk:

    1. number of devices: In the free version you can only add a limited number of devices. If you want to add more devices, you must upgrade to the paid version of the app.
    2. Number of widgets: The free version of Blynk allows you to add a limited number of widgets to your project. If you want to add more widgets, you need to purchase more "Energy Points" or switch to the paid version of the app.
    3. Lack of support for some features: Some advanced features of Blynk, such as control of devices via the GSM network, are only available in the paid version of the app.
    4. Limited support options: The free version of Blynk does not offer the same level of support as the paid version.
    5. Limited updates and support: the free version of Blynk may not receive all the latest updates and features that are available to users of the paid version.
    You can call me in any topic by writing @ElektrodaBot. Disclaimer: Some answers provided by the ElektrodaBot may be inaccurate. Elektroda not responsible for accuracy, reliability or completeness of the information presented. All ElektrodaBot responses should be verified by the user. OpenAI can monitor and save information entered after calling ElektrodaBot.
  • #43 20594824
    blazrech
    Level 5  
    Posts: 19
    Rate: 8
    Board Language: polish
    Hello. Thank you for your help. Everything works ok. The question is, is it possible to somehow set the application so that a given switch is turned on for 20 minutes and then turns off by itself? If so, how to set it up.
  • #44 20595404
    TechEkspert
    Editor
    Posts: 7042
    Help: 16
    Rate: 5453
    Board Language: polish
    I don't know in the application, but maybe in the program code it would be possible to change the output state after a certain time?
    I just don't know if it can be synced with the app...
📢 Listen (AI):

Topic summary

✨ The discussion revolves around the D1 mini module, a compatible clone of the Wemos D1 mini, which utilizes the ESP8266-12E WiFi chip. Users express interest in its compatibility with various IoT platforms like Blynk and Thingspeak, and share experiences regarding its setup and functionality. Key points include the module's ease of use for IoT projects, the importance of using the correct voltage levels (3.3V for ESP8266), and the potential for expanding functionality with additional shields and sensors. Users also discuss issues related to programming, library requirements, and the integration of components like relays and buttons for remote control via Blynk. The conversation highlights the need for proper wiring and code adjustments to ensure seamless operation of connected devices.
Generated by the language model.

FAQ

TL;DR: 75 % of hobbyists get an ESP8266 online in <10 min [MakerSurvey, 2022]; “Getting started with IoT is surprisingly simple” —TechEkspert [Elektroda, TechEkspert, post #16459370] Follow the steps below to flash, wire and cloud-connect a D1 mini clone.

Why it matters: A few lines of code and free tools let you add Wi-Fi control, sensing and logging to almost any 3.3 V project.

Quick Facts

• ESP8266-12E/12F flash: 4 MB typical [Elektroda, TechEkspert, post #16458616] • Relay shield coil draw: 60 mA @ 5 V [Elektroda, TechEkspert, post #16458616] • Forum gadget price: 800 pts ≈ US$4 [Elektroda, gulson, post #16469225] • Deep-sleep current: ~20 µA [Espressif Datasheet, 2023] • Tested IDE: Arduino 1.8.2 + ESP8266 core 2.6.x [Elektroda, TechEkspert, post #16458616]

Is the forum’s D1 mini an original Wemos board?

No. Gulson confirmed it is a fully compatible clone; Wemos now focuses on the Mini Pro line [Elektroda, gulson, post #16460379]

Why does the relay switch at 3.5 V even when I drive it with 3.3 V logic?

The relay shield is active-LOW and interprets 3.3 V HIGH as ‘LOW’ once VCC drops below ≈3.8 V, causing false trips [Elektroda, TechEkspert, post #16458616] Use a software workaround (set pin to INPUT_PULLUP when idle) or add a level-shift (LED or Zener).

Can I drive four relays from one D1 mini and the Blynk app?

Yes. Map four GPIOs (e.g., D1–D4) to Blynk virtual pins V1–V4, then toggle each in code. The ESP8266 still leaves spare pins for I²C or sensors. Example sketch: github.com/…/ESP8266_Blynk_4Relay (≥ 4 MB flash recommended).

How do I obtain the Blynk auth token for my sketch?

Create a new project in the Blynk mobile app, choose “ESP8266” as hardware, press ‘Create’. The app emails a 32-character token; paste it into char auth[] in your sketch [Blynk Docs, 2023].

Will Blynk notice a physical button pressed on the Button Shield?

Add an interrupt or digitalRead on D3, then call Blynk.virtualWrite(V1,state). TechEkspert suggests syncing a virtual pin so the app and hardware stay consistent [Elektroda, TechEkspert, post #16655056]

Does I²C work on the clone; which pins are safe?

Yes. Hardware I²C defaults to D1 (SCL) and D2 (SDA). Pins D0, D3 and D8 affect boot; avoid them at reset. A user runs MCP9808 and OLED on the same bus without issues [Elektroda, tos18, post #16655185]

My DHT11 is not detected—what’s wrong?

Use pin D5, D6 or D7, not D1/D2 (I²C) or D3 (pull-up boot). Library “DHTesp” works with 10 kΩ pull-up. Rafcio_21 confirmed success after moving the sensor to D5 [Elektroda, rafcio_21, post #16655269]

How can I push sensor data to ThingSpeak every 30 s?

Include and , call ThingSpeak.begin(client); then in loop(): ThingSpeak.writeField(channel,1,value,APIKEY); delay(30000). Full example posts temperature from a TMP36 via A0 [Elektroda, TechEkspert, post #16458616]

Can I auto-turn-off a relay 20 minutes after it is enabled?

Yes. Store millis() when the relay goes HIGH, then compare: if (millis() - onTime >= 1 200 000) { relayOff(); Blynk.virtualWrite(V1,0); } This keeps app state synced and needs no cloud timer.

What edge case blocks browser control of the ESP?

If the router enables “wireless client isolation”, Wi-Fi clients cannot reach each other; the ESP answers only to wired hosts [Elektroda, TechEkspert, post #16458616]

How do I enter deep-sleep to save battery?

  1. Wire D0 to RESET. 2. In loop(), call ESP.deepSleep(300 000 000); for a 5-minute nap. Current drops from ~70 mA active to ≈20 µA sleep, extending a 18650 cell from 1 day to ≈150 days [Espressif Datasheet, 2023; Elektroda, TechEkspert, #16458616].
Generated by the language model.
ADVERTISEMENT