Page 1 of 1

build 70: HC-SR04 random values

Posted: 23 Jan 2016, 15:07
by ambassadoro
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.

Re: build 70: HC-SR04 random values

Posted: 23 Jan 2016, 20:01
by chrille
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

Re: build 70: HC-SR04 random values

Posted: 23 Jan 2016, 20:30
by BerndJ
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

Re: build 70: HC-SR04 random values

Posted: 24 Jan 2016, 12:21
by chrille
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

Re: build 70: HC-SR04 random values

Posted: 24 Jan 2016, 15:51
by BerndJ
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.