Ext. Powering Mini D1 possible?

I see a lot of posts in the past asking about this, unfortunately they're all automatically closed so I can't follow up, so I'm asking here, is it at all possible to power a D1 Mini using 5V on the rail?

I have 4 builds of a HC-SR04 ultrasonic connected to a D1 Mini. They work perfectly well on USB, but powering 5v form a usb charger, or regulator onto the 5V pins causes a lot of read failures.

I'm beginning to think it's a fools errand. I've done the same with a ESP32 WROOM and it works perfectly well powered externally.

The other posts:

Since there are several versions of the Wemos D1 and you did not post a link to your board. Mine works OK but they are not all the same, check the schematic to be sure. This is mine: https://escapequotes.net/wp-content/uploads/2016/02/wemos-d1-mini-shematics.jpg

Thanks, I did have a link in my post to the product I purchased, here it is fully: https://www.robotics.org.za/D1-MINI-V4-USBC

I have 4 of those and 2 of the older micro usb type (can't find a link) and they all fail to read from the ultrasonic sensor when powered on the 5v. I've read somewhere one has to supply 5.5v or even 6v. I haven't tried this, but it's difficult to find a reg of that value.

Please explain what you mean by this.

You should understand that if you power the sensor with 5V, it will probably output 5V, and this could damage the D1 mini's input pins, which are max 3.3V. You could reduce the voltage with a voltage divider. There is also a danger that the 3.3V from the D1 mini's output pins might not be enough to trigger the sensor.

Best solution: use 3.3V sensors with 3.3V Arduino and Arduino compatible boards.

1 Like

There is new 3.3V-5V version of that sensor, sometimes sold as "V2". So you can power it from 3.3V (and not abuse your Esp with 5V data input).

1 Like

Thank you @PaulRB and @kmin I did not realize the data pins on the sensor is also 5V! HC-SR04 User's_Manual - Google Docs

That explains the erratic behaviour!

Found this: https://www.instructables.com/Modify-Ultrasonic-Sensors-for-3-Volts-Logic-prepar/

I'm not saying that using 5V to power the sensor explains your erratic behaviour problem. I'm saying it could be damaging your board. I do not think we know, yet, what is causing your erratic behaviour problem. We need answers from you, and a more complete schematic and maybe some bright, clear photos of the circuit, taken from above, so that each wire can be traced.

Take great care with advice and circuits you see on Instructables site. Many of the articles are written by those with little electronics knowledge, and they are not reviewed by experts for accuracy/correctness.

It is not necessary to modify your sensors with knives and risk damaging then. A voltage divider can easily be added externally, for example on a breadboard.

Thanks for the advice, herewith a picture of one of the 6 builds (I have 6 water tanks). Specific model of D1 might vary. Black and Red lines top right goes to 5v of cell charger and is soldered on the VBUS and GND pins. Pin 4 has a LED, not relevant (problem persists on other builds without the LED).


I agree on the unnecessary cutting, but it will reduce the footprint of the build.

The 5v level from the sensor will have to be fixed first, in my mind it's the #1 suspect. I'm doing the mod now, will let you know of the results.

EDIT: I did the mod, unfortunately it still does not work with external 5v. USB Connection is still ok. I think I'll switch to ESP32, I have such an Ultrasonic thats been happily working for 6 months now, 24/7. Maybe the D1 mini is just not for "production". Here's the home assistance logs on the device:

[15:39:13][D][ultrasonic.sensor:040]: 'Tank 1 Water Level' - Got distance: 0.514 m
[15:39:14][D][ultrasonic.sensor:036]: 'Tank 1 Water Level' - Distance measurement timed out!
[15:39:15][D][ultrasonic.sensor:036]: 'Tank 1 Water Level' - Distance measurement timed out!
[15:39:16][D][ultrasonic.sensor:040]: 'Tank 1 Water Level' - Got distance: 2.202 m
[15:39:17][D][ultrasonic.sensor:036]: 'Tank 1 Water Level' - Distance measurement timed out!
[15:39:18][D][ultrasonic.sensor:036]: 'Tank 1 Water Level' - Distance measurement timed out!
[15:39:18][D][sensor:093]: 'Tank 1 Water Level': Sending state 2.19657 m with 2 decimals of accuracy
[15:39:19][D][ultrasonic.sensor:040]: 'Tank 1 Water Level' - Got distance: 2.201 m
[15:39:20][D][ultrasonic.sensor:036]: 'Tank 1 Water Level' - Distance measurement timed out!
[15:39:21][D][ultrasonic.sensor:036]: 'Tank 1 Water Level' - Distance measurement timed out!
[15:39:22][D][ultrasonic.sensor:036]: 'Tank 1 Water Level' - Distance measurement timed out!
[15:39:23][D][ultrasonic.sensor:036]: 'Tank 1 Water Level' - Distance measurement timed out!
[15:39:24][D][ultrasonic.sensor:040]: 'Tank 1 Water Level' - Got distance: 2.197 m

Vbus pin should be directly connected to usb 5V. So the only explanation I see is that your external 5V psu doesn't give enough stabile voltage.
If you cut usb cable and solder 5V and GND wires to D1 Mini Vbus ang GND and power it from same "working" usb power source, you will find out...

Thanks, I have tried that as well, same result. I've switched all my D1 Minis to ESP32 WROOMs and they work perfectly, powering the 5v pin and the sensor with the 5V charger cable.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.