• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Sensor only works with USB connection

Q&A Forum › Category: ESP8266 › Sensor only works with USB connection
0 Vote Up Vote Down
Richard Woerner asked 4 years ago

I am using a Wemos D1 mini clone.  I have connected two DHT11 temperature/humidity sensors and have it displaying output via WIFI (using “Web Server: Display Sensor Readings (Table)” from Build Web Servers as a model).
When connected via USB, it functions properly.  When I disconnect it from USB and power it directly to the 5V pin, the web page is displayed but the readings show NAN.
The data leads from the sensors are hooked to D5 and D6. All positive power leads connected to the 5v pin and ground to gnd.
When off the USB, I am powering with a 3.3v 5v power supply module using the 5v service and connecting to the 5v pin on the board
When using the power supply, the LEDs on the sensors both light and the input voltage seems proper.
Any thoughts on why the sensors work when connected via USB but not when powered over the 5v pin while everything else seems to function fine would be appreciated.
Also, when on the power supply, I get console log messages but no longer can access the serial monitor.  Is there an easy way to access the serial monitor over WIFI when not connected via USB?

8 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi Richard.
 
I think it must be one of the following scenarios: or the sensor is not wired properly, or the power supply is not enough for the sensors (which I don’t think it’s the case).
 
Are you connecting GND to the sensors? There must be something missing in the wiring.
 
The Serial Monitor communicates with the ESP8266 via Serial Communication using the USB cable. When it is not connected to your computer, it can’t establish that connection, so you can’t see the Serial messages. You would need some hardware like a display to be able to see the messages.
 
I hope this helps. 
Regards,
Sara

0 Vote Up Vote Down
Richard Woerner answered 4 years ago

Hi Sara,
Thanks for your thoughts.  I am connecting the GND to the sensors.  This is supported by the fact that they work when powered by USB from the computer and that the LED light come on when connected.  I am more suspicious of the power supply delivering adequate voltage and will do some further testing on that.  It is interesting that the web server works but that the sensors don’t, and especially that everything works when connected via USB.
Rich

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi Richard.
Yes, it is weird. And these issues are complicated to troubleshoot. The most probable reasons are either the power source or the wiring.
Otherwise, without further information, it is very difficult to find out what might be wrong.
Meanwhile, if you find something, please share it.
Regards,
Sara

0 Vote Up Vote Down
Jose M. Escrich answered 4 years ago

Check with a volt meter the real voltage on power supply, when everything should be working without the USB, probably you’ll get a voltage much lower than expected

0 Vote Up Vote Down
Richard Woerner answered 4 years ago

I went back and did some further testing.  I also measured voltages.
First, I hooked it up with the USB.  Everything worked.  Voltages were:
5v/gnd on D1 board – 4.40; vcc/gnd on 1st sensor – 4.48; vcc/gnd on 2nd sensor – 4.47; 5v/gnd on power module – 4.47 (the module is wired in the circuit but no power attached)
Next, I disconnected the USB and added power to the power module.  Now sensor 1 works and the sensor 2 does not.  Voltages were:
5v/gnd on D1 board – 4.68; vcc/gnd on 1st sensor – 4.71; vcc/gnd on 2nd sensor – 4.72; 5v/gnd on power module – 4.72
Next I swapped out sensor 2 for a spare.  Now everything works!
I am at a loss for what happened.  The voltages seem fine from the power supply.  Seems like the sensors may be sensitive to voltages in some way.  Thanks Sara and Jose for your help.  I’m just glad everything is working.

0 Vote Up Vote Down
Jose M. Escrich answered 4 years ago

Good news, nice to read your answer

0 Vote Up Vote Down
Jose M. Escrich answered 4 years ago

Good news, nice to read your answer

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Great!
I’m glad everything is working now.
I’ll mark this issue as resolved. If you need further help, open a new question in our forum.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.