Page 1 of 1

Re: HC-SR04+ and wemos d1 mini pro

Posted: 15 Jan 2018, 19:13
by Shardan
karadn wrote: 15 Jan 2018, 18:31 Capture.PNG

Are this settings for GPIO 12 and 13 are ok, or I must set something?
Just leave them untouched - it's OK.

Re: HC-SR04+ and wemos d1 mini pro

Posted: 15 Jan 2018, 19:14
by Shardan
NDR008 wrote: 15 Jan 2018, 18:57 I have a 3.3v version. But couldn't get it to work.
Please give some more info.

Re: HC-SR04+ and wemos d1 mini pro

Posted: 16 Jan 2018, 08:49
by NDR008
I will take photo later.

Re: HC-SR04+ and wemos d1 mini pro

Posted: 16 Jan 2018, 11:57
by NDR008
This is the one I had purchased:
https://www.ebay.de/itm/Micro-Mini-3-3- ... 2749.l2649

I cannot describe why it did not work well.
I should try again and document my steps.

I hada LoLin NodeMCU working with a contact switch input and I2C BMP-sensor.
Later I added the ultrasonic thingy and things stopped to work, but it may be a result of my non-linear trial and error.
(It was my first time working with ESP, and I was doubting if I had enough power, and all sorts of factors).

Re: HC-SR04+ and wemos d1 mini pro

Posted: 16 Jan 2018, 14:00
by Shardan
THe nodeMCU's have a voltage regulator 5V -> 3.3V. Usually this is a LM1117-3.3 or an even smaller one.
These regulators can take some current, it should be enough for a HC-SR04.
With the widespread WeMOS D1 Mini it might be near to limits as they use a very small regulator.

Anyways, together with nodeMCU it should work.
Another problem: Powering via USB cable? Try a short and thick cable!
Most cheaper USB cables have wires like a hair... if the HC-SR04 starts sending pulses it might be too much.

Another possible reason:
The US breakout you use is "like HC-SR04" but it obviously uses another circuit inside.
The HC-SR04 has a crystal onboard and another layout, this one has no crystal.
So it is questionable if they are really compatible to eachother.

Re: HC-SR04+ and wemos d1 mini pro

Posted: 16 Jan 2018, 16:11
by NDR008
Yeah, unfortunately the seller contacted me to recommend this one (as I bought the NodeMCU at the same time).

I agree with you on USB cables.

I had my raspberry Pi indicating power issues even though I tried 3 USB power sources including a 3A capable block.
Finally I found the cable was the limiting factor.

1st cable: always caused power problems.
2nd cable: caused occasional problems.
3rd cable: raspberry pi has not once throttled due to power shortage.

Re: HC-SR04+ and wemos d1 mini pro

Posted: 16 Jan 2018, 16:45
by karadn
My sensor HC-SR04 still not working. I try with sepparate power the ultrasonic, but no luck.
Can you please check my connections and settings, now I power Wemos via USB adapter (5V).
20180116_163958.jpg
20180116_163958.jpg (973.34 KiB) Viewed 28019 times
Capture.PNG
Capture.PNG (13.76 KiB) Viewed 28019 times

Re: HC-SR04+ and wemos d1 mini pro

Posted: 16 Jan 2018, 18:48
by Shardan
Hm.. looks good to me, as far as i can see.

That was my testing setup:
.
HC-SR04_on_Breadboard.jpg
HC-SR04_on_Breadboard.jpg (460.82 KiB) Viewed 28012 times
.
It's same and worked, powered with a thick USB cable from my computer.
So what to do?
Check all cables first, a digital ohm meter helps a lot.
I've seen alot of these cheap DuPont cables having slack joints or no connection at all.
Breadboards are somewhat susceptible for bad contacts too.

Regards
Shardan

Re: HC-SR04+ and wemos d1 mini pro

Posted: 16 Jan 2018, 19:27
by Shardan
Just for the record:

I've assembled my test setup again, uploaded the actual v2.0-20180116 for testing.
It worked out of the box.

Re: HC-SR04+ and wemos d1 mini pro

Posted: 16 Jan 2018, 21:07
by karadn
So in settings must be:
- 1st GPIO set to GPIO-13, where Trig is connected.
- 2nd GPIO set to GPIO-12, where Echo is connected.

Is that ok?

Re: HC-SR04+ and wemos d1 mini pro

Posted: 16 Jan 2018, 21:13
by Shardan
Yep..
Just it does not hurt if you swap accidentally, the device will just show 0.00.
If you doubt about that, swap the cables for a test.

Re: HC-SR04+ and wemos d1 mini pro

Posted: 17 Jan 2018, 18:54
by karadn
The voltage that come from wemos 5v pin is 4.830V, it seams that is not enough for HC-SR04, because if I separate power 5V to ultrasonic it works now.
Is 4.8V realy too low for this sensor? So I must buy HC-SR04+ or P version?

Re: HC-SR04+ and wemos d1 mini pro

Posted: 17 Jan 2018, 20:13
by Shardan
I didn't have a problem using the 5V from the WeMOS D1 or nodeMCU.

Anyways, the nodeMCU has a diode separating the 5V output from the 5V input from USB.
Diodes have a forward-loss so this might be a problem.

This is difficult to decide without hands-on on your device at a well equipped test site.

It might be a problem of the HC-SR04 itself also, tolerances of parts or something.
These boards are cheapest china made stuff so this might occur.
I'd get some HC-SR-04 from a cheap source like AliExpress and check them out.
5 pieces come around 3,50€ at AliExpress.

Re: HC-SR04+ and wemos d1 mini pro

Posted: 17 Jan 2018, 20:19
by TD-er
karadn wrote: 17 Jan 2018, 18:54 The voltage that come from wemos 5v pin is 4.830V, it seams that is not enough for HC-SR04, because if I separate power 5V to ultrasonic it works now.
Is 4.8V realy too low for this sensor? So I must buy HC-SR04+ or P version?
Like Shardan already mentioned. If the wires powering the device are too thin, then the voltage may drop when trying to use more power.
It is then simply a resistor with a voltage drop over the wire which will increase when the current increases.

Re: HC-SR04+ and wemos d1 mini pro

Posted: 17 Jan 2018, 21:27
by karadn
I have 3 sensors and with all is the same. I test sensor also with Wemos D1 pro and also not working.

Re: HC-SR04+ and wemos d1 mini pro

Posted: 17 Jan 2018, 21:43
by Shardan
Then it gets difficult to check what's the reason without hand-on on a test site.

I suspice there is a problem with power supply, but honestly that's applied prophecy.
How do you supply power to the circuit? USB cable and power from PC?