US-100 ultrasonic distance sensor - 3.3V and 5V with temperature sensor perfect for ESP8266
Вставка
- Опубліковано 18 лют 2019
- US-100 is the perfect ultrasonic distance sensor for all ESP8266 modules. Mainly for two reasons. It runs on 3.3V and it can feed you measurement readings via UART or Serial communication. And also, it measures temperature!
It works excellent with ESP-01, ESP-12E, ESP-12F, ESP-12S, ESP-07, Node-MCU, Wemos and all other ESP8266.
Link to products (Affiliate links)
************************************
US-100
Banggood - www.banggood.com/custlink/Kvv...
Amazon - amzn.to/2X7sXNs
If you are connecting it to a Node-MCU, Wemos or similar you have a 5V pin and can use it. But you are using the ESP-01 or ESP-07 or ESP-12 on a PCB you might not have 5V available. So then the US-100 will fit you project perfectly.
Links to code:
************************************
UART MODE - github.com/DIYTechBros/US100_...
MANUAL MODE - github.com/DIYTechBros/US100_...
Short Guitar Clip by Audionautix is licensed under a Creative Commons Attribution license (creativecommons.org/licenses/...)
Artist: audionautix.com/ - Наука та технологія
Chris is convinced that the diode is a ntc100k thermistor which is used for temperature sensing, especially when it comes to 3D printers. There I go for not checking with him first. Live, learn, make and invent!
Yes I checked it out. If I hold onto the diode, the temp immediately changes and then does the Newton's law of cooling thing when I let go of it.
Thanks TECH BROS! I tried various combinations and found that NodeMCU with US-100 is the perfect one.
Hi, Thank you for your great video and explanation.
Tested with arduino uno : works as expected in the UART mode, this is excellent.
Testted with ESP8266-07 : works in manual mode ie Echo/Trigger, however I didn't success with the jumper on ie in UART mode. I guest ESP8226 07 model doesn't have the UART needed. What I am doing wrong ? Any feedback will be appreciated.
Hello,
In MANUAL MODE (shunt removed), I always get value of 0 returned by ""duration = pulseIn(ECHO, HIGH);". Do you know why? Thanks.
hi sir i want to ask you. excuse me sir, when i flash the manual code. my us-100 sensor always showed 0 value?
Where can I access the schematic diagram of this?
are this coding compatible with esp8266 nodemcu bcs my us100 can only detect distance using this coding
Thanks for the video!! What version of Arduino IDE are you using? What operating system? What version of the required libraries are you using? I have Win7 Arduino IDE version 1.8.13 and esp8266 package from arduino.esp8266.com/stable/package_esp8266com_index.json
and appears to be version 2.7.4.
When I run the code on the esp8266, I ONLY get a "temperature". But I can change the "temperature" by moving my hand around in front of the sonar.
I have two US-100s and both of them work with the exact same code on Arduino IDE, just change board to Nano with the "old bootloader" compiler option.
Great Video! UART MODE doesn't seem to work for me , I have added the jumper & also connected Trigger & Echo to Pin 4 & 5 as per the UART code. But i am not getting distance & temprature value in the serial monitor. Please let me know, is that am doing wrong. Also i have the latest software serial library updated in my IDE "espsoftwareserial"
Hi!
Make sure TX goes to RX, and RX goes to TX :)
hello I tried your example in UART mode with a nodemcu, but it doesn't work. which pin should i connect?
You can use the pins you prefer, just remember that GPIO and D(n) is not the same. You can write D(n) instead of just a number to refer to the pin marked with that label.
I believe GPIO 5 = D1 and GPIO 4 = D2. Just google NodeMCU pinout :)
Let me know if that was the error!
bei mir wird so gezeigt also Fehler , haben Sie eine Lösung ???
VG und Vielen Dannk für einfache Erklärung.
Beim Hochladen des Sketches ist ein Fehler aufgetreten
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x53
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x53
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x53
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x53
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x53
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x53
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x53
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x53
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x53
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x53
What is the reason for using this formula "mmDist = MSByteDist * 256 + LSByteDist" ? why 256?
Hi Lawrence! That's an excellent question! It's simply because we need to do simple bit shifting. Not uncommon when dealing with analog reading from sensors. As an 8-bit number is limited to 255 (or 127 unsigned) we don't want an overflow. Also int in the word of arduino is 16 bit.
Google "bit sifting" and "bit shifting analog sensors" to read more! Happy thinkering :-)
I compiled the code and uploaded to an ESP-12E module and I can ONLY get "temperature". No distance printout. But if I place my hand in front of the sensor, I can make the "temperature" change by moving my hand further from or closer to the sensor. I tried compiling with NodeMCU1.0 board, Generic ESP8266 Module and ESPino board compiler options but behavior does not change. Tx is connected to IO4 (D2) and Rx is connected to IO5 (D1). I tried swapping the lines but then it stopped working. I un-swapped the lines and then it started working again.
BTW, It works great with an Arduino Nano in the Arduino IDE.
That’s very strange... very! I’ll have a look at the code to see if there are anything that can enlighten me!
is there any output on distance? (any of the text?)
@@DIYTECHBROS Thank you kindly for the quick reply!! The "Distance: xxx mm " statement does not print but "Temp: xx C. Does print. AND I can change the Temp by moving my hand around. If I hold my hand about an inch away, I usually get something like "Temp: -11 C". If the sensor is on the floor pointing up at the ceiling, about 8Ft or so, I get "79F" or thereabouts.
@@DIYTECHBROSThe code is a copy and paste of your Github UART mode example. I was REALLY impressed with the accuracy of the sensor in UART mode!
Also I tried it on Ubuntu 18.04 and got the same strange result. But if I use an Arduino Nano, it works fine.
We have had trouble with SoftwareSerial in the past when working with the esp8266, if memory serves.
#1
Is there any chance that we can adjust its frequency? we are using newping library.
That would be awesome! But, sorry, no, not that we are aware of.
@@DIYTECHBROS oh. is that so. i am currently working on an arduino based ultrasonic pest repellent. maybe u can help me out hehe. do you know other ultrasonic devices that can release adjusting frequency?
@@mareiaambrocio9239 If you try searching for ultrasonic speaker you can find several with different ranges :-)
@@DIYTECHBROS Thank you so much!!! :)
@@mareiaambrocio9239 Our pleasure!
:)
Great Arduino nour! The comments are motivating and they help the channel :-)