Page 2 of 2

Re: Wemos D1 Mini + AM2320

Posted: Fri Jan 26, 2018 4:25 am
by cefn
The headers have been hand-soldered in place by you, right? Have you checked the relevant headers have a good joint like...

https://learn.adafruit.com/adafruit-gui ... n-problems

Re: Wemos D1 Mini + AM2320

Posted: Fri Jan 26, 2018 1:49 pm
by br0t
cefn wrote:
Fri Jan 26, 2018 4:25 am
The headers have been hand-soldered in place by you, right? Have you checked the relevant headers have a good joint like...

https://learn.adafruit.com/adafruit-gui ... n-problems
Thanks for your response. I have not soldered anything yet, should I? I just plugged the headers through the chip, no soldering. I thought that is supposed to be the way to use them while prototyping. Is there a chance the board's Pins are not properly connected that way?

Re: Wemos D1 Mini + AM2320

Posted: Fri Jan 26, 2018 2:12 pm
by Roberthh
Is there a chance the board's Pins are not properly connected that way?
The chance is more to the opposite. For almost sure you have connection problems, if you
do not solder the headers to the Wemos board.

Re: Wemos D1 Mini + AM2320

Posted: Fri Jan 26, 2018 3:46 pm
by br0t
Roberthh wrote:
Fri Jan 26, 2018 2:12 pm
Is there a chance the board's Pins are not properly connected that way?
The chance is more to the opposite. For almost sure you have connection problems, if you
do not solder the headers to the Wemos board.
Oh, okay sounds like I have something to do on the weekend then ^^. Will report back, thank you!

Re: Wemos D1 Mini + AM2320

Posted: Fri Jan 26, 2018 9:03 pm
by cefn
Aha, I did suspect that was the one thing which wasn't visible, and which a newbie may not have realised from diagrams.

Yes, the soldering is absolutely fundamental and it is extremely unlikely to work otherwise.

"Hammer headers" are an intriguing workaround, which I would like to have in my toolbox...
https://shop.pimoroni.com/products/gpio-hammer-header
https://www.sparkfun.com/products/retired/10527 (discontinued)
...but I can't recommend them from first hand experience, yet.

Re: Wemos D1 Mini + AM2320

Posted: Sat Jan 27, 2018 4:39 am
by mcauser
Soldering the pins would ensure a good electrical connection.
Inserting the headers with legs that are smaller than the holes may mean they are sometimes connected.

For testing, you may get away with pushing the headers to the sides so the legs touch the metal in the holes, or using jumper wires with thicker pins, or insert the jumpers at an angle so they touch.

Re: Wemos D1 Mini + AM2320

Posted: Sat Jan 27, 2018 1:32 pm
by br0t
Well what can I say, it works :D ! Hard to say how happy that makes me right now! After soldering I just let it run for about 15 mins measuring every 3 seconds and always got a correct response from the AM2320, using the D3 and D4 pins. Thank you everyone for your help :) and especially mcauser for the driver! Will use this thread to document my progress on this little side project.

Re: Wemos D1 Mini + AM2320

Posted: Sun Jan 28, 2018 10:42 pm
by br0t
I have done two more tests letting the sensor measure once every minute: The first time it hung up after 39 measurements, the second time after 51. I havent checked the concrete error on the board yet, but I assume I am just getting some cryptic error code meaning "cant find/talk to device".

As far as I understood, I2C is stateful and can get into a state where it waits for some input that never comes? I dont know yet why the hangups occur, but I guess it can have multiple reasons and I would like to be able to recover from it.

Is there any good practice to handle this? Can I just stop/reset the I2C bus somehow or should I do a soft/hard restart of the board? Reading up on the topic it seems to be more complicated then I had first assumed (http://www.forward.com.au/pfod/ArduinoP ... index.html)...

Re: Wemos D1 Mini + AM2320

Posted: Mon Jan 29, 2018 6:29 am
by Roberthh
Sometimes a gc.collect() call in repeated actions helps. In your case, try to call gc.collect() befofe the i2C communication.
The esp8266 has a built-in module for the DHTxx modules, so it should be easy to use.