Wemos D1 Mini + AM2320

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
cefn
Posts: 230
Joined: Tue Aug 09, 2016 10:58 am

Re: Wemos D1 Mini + AM2320

Post by cefn » 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

br0t
Posts: 12
Joined: Tue Dec 05, 2017 1:23 pm

Re: Wemos D1 Mini + AM2320

Post by br0t » Fri Jan 26, 2018 1:49 pm

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?

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Wemos D1 Mini + AM2320

Post by Roberthh » 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.

br0t
Posts: 12
Joined: Tue Dec 05, 2017 1:23 pm

Re: Wemos D1 Mini + AM2320

Post by br0t » Fri Jan 26, 2018 3:46 pm

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!

cefn
Posts: 230
Joined: Tue Aug 09, 2016 10:58 am

Re: Wemos D1 Mini + AM2320

Post by cefn » Fri Jan 26, 2018 9:03 pm

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.

User avatar
mcauser
Posts: 507
Joined: Mon Jun 15, 2015 8:03 am

Re: Wemos D1 Mini + AM2320

Post by mcauser » Sat Jan 27, 2018 4:39 am

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.

br0t
Posts: 12
Joined: Tue Dec 05, 2017 1:23 pm

Re: Wemos D1 Mini + AM2320

Post by br0t » Sat Jan 27, 2018 1:32 pm

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.

br0t
Posts: 12
Joined: Tue Dec 05, 2017 1:23 pm

Re: Wemos D1 Mini + AM2320

Post by br0t » Sun Jan 28, 2018 10:42 pm

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)...

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Wemos D1 Mini + AM2320

Post by Roberthh » Mon Jan 29, 2018 6:29 am

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.

Post Reply