build 70: HC-SR04 random values

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
ambassadoro
Normal user
Posts: 40
Joined: 17 Nov 2015, 15:58

build 70: HC-SR04 random values

#1 Post by ambassadoro » 23 Jan 2016, 15:07

Hi,

I connected a HC-SR04 via a level shifter (like this). I have connected it via gpio4,5. Other devices I have is a DS18B20 and a light sensor, they both deliver good values. But the distance sensor show me values like 0.17 (when its meters, its ok from my desk to the ceiling) and often values like: Distance: 30488558.00, 22212420.00 or 16005333.00.

I am testing build 70 with this setup.

chrille
Normal user
Posts: 88
Joined: 26 Aug 2015, 15:11
Location: Horsens, Denmark

Re: build 70: HC-SR04 random values

#2 Post by chrille » 23 Jan 2016, 20:01

ambassadoro wrote:Hi,

I connected a HC-SR04 via a level shifter (like this). I have connected it via gpio4,5. Other devices I have is a DS18B20 and a light sensor, they both deliver good values. But the distance sensor show me values like 0.17 (when its meters, its ok from my desk to the ceiling) and often values like: Distance: 30488558.00, 22212420.00 or 16005333.00.

I am testing build 70 with this setup.
Using a levelshifter is way overkill for this purpose. The TRIGGER input on the HC-SR04 can be triggered with the 3.3V output from the ESP8266. For the ECHO signal, you can just use a voltage divider - for instance 680R + 1k. Remember that the HC-SR04 needs 5V.

- Jan
Jan Chrillesen, Denmark

BerndJ
Normal user
Posts: 84
Joined: 28 Sep 2015, 06:57

Re: build 70: HC-SR04 random values

#3 Post by BerndJ » 23 Jan 2016, 20:30

Hi,

had the same problem using these part.

It´s right, the trigger could be connect direct.

I used also resistor network (4K7 and 10K) and that´s bullshit because we init a war between the Pull´s:

an Down in your RNetwork
an Up activted via Software (see the script to the HC04)

first dead: the digital communication.

Solution:
i used a pnp BC557
echo output --> 47K --> to it´s B
Emitter to 5V VCC from HC-SR04
Kollektor --> 47K --> npn, found a BC547 on B
Emitter to gnd
Collector direct to your input Port on ESP (no Resistor needed, we use the internal PullUp)

Runs fine.

I think your buyed solution is also shit (see only one transistor per channel) just the part that i had buyed.

best wishes

Bernd

PS: BTW, we should added these information to

http://www.esp8266.nu/index.php/DistanceSensor

chrille
Normal user
Posts: 88
Joined: 26 Aug 2015, 15:11
Location: Horsens, Denmark

Re: build 70: HC-SR04 random values

#4 Post by chrille » 24 Jan 2016, 12:21

BerndJ wrote:Hi,

had the same problem using these part.

It´s right, the trigger could be connect direct.

I used also resistor network (4K7 and 10K) and that´s bullshit because we init a war between the Pull´s:

an Down in your RNetwork
an Up activted via Software (see the script to the HC04)
I have been using a voltage divider with a 680 ohm and 1k ohm resistor for a month and it's been very reliable.

- Jan
Jan Chrillesen, Denmark

BerndJ
Normal user
Posts: 84
Joined: 28 Sep 2015, 06:57

Re: build 70: HC-SR04 random values

#5 Post by BerndJ » 24 Jan 2016, 15:51

Hi,

yes, it´s runs. Youre resistors are low enought. The internal Pullup had round about 40KOhm.

But my schematics had the better energy bilance.

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests