1

I'm building a thermostat control with a Wemos D1 Mini. The ILI9341 display uses almost all the pins, and all I have left are the RX, TX, A0 and D0 pins. However I can't get any valid readings from these pins. According to the various wemos pinouts, I should be able to use RX/TX as onewire pins. As soon as I set the pin to a different one, and replace the wire there, I have correct readings. What am I missing with using these pins?

I'm connecting the display as stated in this arcticle: link

I also found this site which shows that I should be able to set these two pins as IO pins.

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <OneWire.h>
#include <DallasTemperature.h>

#ifndef STASSID
#define STASSID "wifiname"
#define STAPSK  "password"
#endif

const char* ssid = STASSID;
const char* password = STAPSK;

ESP8266WebServer server(80);

OneWire oneWire(1);
DallasTemperature sensors(&oneWire);

void handleRoot() {
  sensors.requestTemperatures();
  server.send(200, "text/plain", String(sensors.getTempCByIndex(0)));
}

void setup() {
  pinMode(1, FUNCTION_3);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
  }

  server.on("/", handleRoot);
  server.begin();
  sensors.begin();
}

void loop() {
  server.handleClient();
}
3
  • 1
    The documentation of the Wemos D1 mini states that the IO pins except the D0 pin have one wire functionality. I looked into the official PINout wiki.wemos.cc/products:d1:d1_mini and found that TX and RX are not marked as IO pins. A0 is only marked analog. Your code does not contain any lines for the ILI display so I don't know how you used the other pins. Perhaps you could use the D0 pin instead of one of the others, that would then be free to use for the one wire access. Feb 18 '20 at 16:34
  • Yeah, but the same site says, that it has 11 IO pins, and this matches with this pinout diagram: luisllamas.es/wp-content/uploads/2018/09/… I'll update my question with containing the display pinout as well.
    – Rothens
    Feb 19 '20 at 11:08
  • I do not trust that pin out diagram very much. They marked the 5V pin as GND. ;-) Seriously: I'm not an Wemos mini expert, so I hardly can argue against the 11 IO-Pin claim. But from the observation you told us, I would say, the RX and TX Pin might be unusable for your purposes. As the mini uses the ESP8266 in it's own context (i.e with an USB to Serial converter) which connects the RX/TX pins to another chip (CP2104 or so), this could/would make the RX/TX pins unusable for purposes other than UART communication. You can find schematics here escapequotes.net/wemos-d1-mini-pro Feb 20 '20 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.