HC-SR04+ and wemos d1 mini pro

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: HC-SR04+ and wemos d1 mini pro

#31 Post by Shardan » 15 Jan 2018, 19:13

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.
Regards
Shardan

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: HC-SR04+ and wemos d1 mini pro

#32 Post by Shardan » 15 Jan 2018, 19:14

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.
Regards
Shardan

NDR008
Normal user
Posts: 35
Joined: 15 Jan 2018, 09:24

Re: HC-SR04+ and wemos d1 mini pro

#33 Post by NDR008 » 16 Jan 2018, 08:49

I will take photo later.

NDR008
Normal user
Posts: 35
Joined: 15 Jan 2018, 09:24

Re: HC-SR04+ and wemos d1 mini pro

#34 Post by NDR008 » 16 Jan 2018, 11:57

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).

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: HC-SR04+ and wemos d1 mini pro

#35 Post by Shardan » 16 Jan 2018, 14:00

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.
Last edited by Shardan on 16 Jan 2018, 20:02, edited 1 time in total.
Regards
Shardan

NDR008
Normal user
Posts: 35
Joined: 15 Jan 2018, 09:24

Re: HC-SR04+ and wemos d1 mini pro

#36 Post by NDR008 » 16 Jan 2018, 16:11

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.

karadn
Normal user
Posts: 14
Joined: 22 Nov 2017, 14:59

Re: HC-SR04+ and wemos d1 mini pro

#37 Post by karadn » 16 Jan 2018, 16:45

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 27034 times
Capture.PNG
Capture.PNG (13.76 KiB) Viewed 27034 times

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: HC-SR04+ and wemos d1 mini pro

#38 Post by Shardan » 16 Jan 2018, 18:48

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 27027 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
Regards
Shardan

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: HC-SR04+ and wemos d1 mini pro

#39 Post by Shardan » 16 Jan 2018, 19:27

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.
Regards
Shardan

karadn
Normal user
Posts: 14
Joined: 22 Nov 2017, 14:59

Re: HC-SR04+ and wemos d1 mini pro

#40 Post by karadn » 16 Jan 2018, 21:07

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?

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: HC-SR04+ and wemos d1 mini pro

#41 Post by Shardan » 16 Jan 2018, 21:13

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.
Regards
Shardan

karadn
Normal user
Posts: 14
Joined: 22 Nov 2017, 14:59

Re: HC-SR04+ and wemos d1 mini pro

#42 Post by karadn » 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?

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: HC-SR04+ and wemos d1 mini pro

#43 Post by Shardan » 17 Jan 2018, 20:13

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.
Regards
Shardan

TD-er
Core team member
Posts: 8748
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: HC-SR04+ and wemos d1 mini pro

#44 Post by TD-er » 17 Jan 2018, 20:19

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.

karadn
Normal user
Posts: 14
Joined: 22 Nov 2017, 14:59

Re: HC-SR04+ and wemos d1 mini pro

#45 Post by karadn » 17 Jan 2018, 21:27

I have 3 sensors and with all is the same. I test sensor also with Wemos D1 pro and also not working.

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: HC-SR04+ and wemos d1 mini pro

#46 Post by Shardan » 17 Jan 2018, 21:43

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?
Regards
Shardan

Post Reply

Who is online

Users browsing this forum: No registered users and 46 guests