AM2301 W Picaxe

Axel87

Senior Member
Attempted to connect this last night AM2301- http://meteobox.tk/files/AM2301.pdf


Entered a code from the manual Tutorial 8- sertxd

Main:
readtemp c.1,b0
sertxd ("the value is",#b.0,cr,lf)
wait 5
goto main

Once I change the baud rate to 4800, the debug is readable. But "Value is 0" is all I get back in debug.
Any ideas/hints?
 

premelec

Senior Member
You need to read up on I2C serial communications and read the data sheet for the device several times as to what the data format is etc. The READTEMP PICAXE function is for the DS18B20 temperature unit - not at all like the AM2301. This will be a learning experience! :)
 

westaust55

Moderator
You need to read up on I2C serial communications and read the data sheet for the device several times as to what the data format is etc. The READTEMP PICAXE function is for the DS18B20 temperature unit - not at all like the AM2301. This will be a learning experience! :)
i2c comms will not help as the AM2301 is a form of 1-Wire serial comms module. There is a data line and no clock line. It is NOT the Dallas style 1-Wire comms ( as used by the DS18B20) and more like an asynchronous serial comms with a start pulse and initial handshaking pulses before the serial comms is commenced.

The dataline needs a pull up resistor:
usually require an external about 5.1kΩ pull-up resistor
 

srnet

Senior Member
Try putting 'AM2301' in the forum search, several results are returned, some appear to have working code for the device.
 

Axel87

Senior Member
Ya I think I threw myself into a brick wall on this one lol
I did look through the data sheet, but egyptian. Thought this was a one wire com device.
Is the DHT11 similiar to the AM2301?
 

Axel87

Senior Member
Apologize. I see in on forum one answered that question.
I am going to attempt the 555 circuit, as I dont have a 74HC221 on hand.
Yay! for creating more work for myself? lol
Sure theres a hundred temp/hum sensors out there that the picaxe could read, I chose the one that it isnt?
 

westaust55

Moderator
I recall that on the French part of the PICAXE forum there may have been a thread where a solution had been found without the need for external chips. Cannot spot at the moment (using iPhone) but would be worth some extra searching. Recall Goeytex have then used the same concept - but in the absence of a good search, I may be wrong in my recollection :-O
 

Axel87

Senior Member
I recall that on the French part of the PICAXE forum there may have been a thread where a solution had been found without the need for external chips. Cannot spot at the moment (using iPhone) but would be worth some extra searching. Recall Goeytex have then used the same concept - but in the absence of a good search, I may be wrong in my recollection :-O
Hello again all,
Sorry for the delay, had to walk away from this project for a while.
Think I got the circuit all set up and ready to go, I built the 555 monostable circuit as I dont have any 74hc221 lying around.

Ran into my first snag when I ran into trying to upload the code.
Code found here-
http://www.picaxeforum.co.uk/showthread.php?19459-DHT11-Humidity-Sensor&highlight=AM2301

Program is set for 20x2, i am using a 8m2
Changed to #picaxe 08m2
Next errors "cant use #no_table with this device"
"Unknown symbol m-64"

Errors just continue. I tried to look in manual 2 to see if there are any updates for this coding but couldent find anything.
Have anywhere you can point me guys?
Thanks!
 

srnet

Senior Member
Errors just continue. I tried to look in manual 2 to see if there are any updates for this coding but couldent find anything.
Have anywhere you can point me guys?
There can be problems when a program written specifically for one PICAXE type, is used on another.

The manuals often will not include code to drive specific devices, but manual2 does have information on the two 'errors' you are seeing;

cant use #no_table with this device
If you do a search on #no_table in the manual it points out that its a directive to do with the table command, which is not supported on the 08M2

Unknown symbol m-64
Did you mean, m64, if so the m64 command is not supported on the 08m2, as it will not run at 64mhz.
 

hippy

Technical Support
Staff member
Program is set for 20x2, i am using a 8m2 ...
"Unknown symbol m-64"
It may not be possible to get an AM2301 / DHT11 working with an M2 and you have to use an X2. There is some discussion about timing in the forum, such as below -

http://www.picaxeforum.co.uk/showthread.php?22382-DHT11-DHT22-on-a-PICAXE-Solved-in-software

The hardware pulse-stretching is required because PULSIN on a 20X2 at 64MHz is a few microseconds too slow compared to a 28X2/40X2 with external resonator.

If it requires 64MHz speed to be quick enough it seems 32MHz won't be, and that's the maximum speed for an M2.
 
Top