am2315 for raspberry pi in python

Our weekly LIVE video chat. Every Wednesday at 8pm ET!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
ydna
 
Posts: 15
Joined: Sun Jul 21, 2013 7:47 pm

am2315 for raspberry pi in python

Post by ydna »

Is there any way you can use the am2315 sensor with the Pi in python?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: am2315 for raspberry pi in python

Post by adafruit_support_rick »

It's a simple I2C device, so there's no reason why you can't use it. We don't have specific library code for it, but we do have I2C python drivers in our Raspberry Pi library. You can refer to the Arduino library for the logic needed to communicate with the am2315:
https://github.com/adafruit/Adafruit_AM ... AM2315.cpp

User avatar
ydna
 
Posts: 15
Joined: Sun Jul 21, 2013 7:47 pm

Re: am2315 for raspberry pi in python

Post by ydna »

Thank you, we will work on it but can you give a basic code to show how to use it in python.(Just the actual command to request the data not a whole program. similar to the how the BMP085 has bmp.readTemerature) My dad and I are working on Raspi Weather station and think this sensor is perfect for outdoor use. Thanks again for your help

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: am2315 for raspberry pi in python

Post by adafruit_support_rick »

There's no simple command. You'll have to get the logic from the arduino library, and code that up in python.

User avatar
ydna
 
Posts: 15
Joined: Sun Jul 21, 2013 7:47 pm

Re: am2315 for raspberry pi in python

Post by ydna »

Sorry that I keep asking but i'm new to this whole thing and i'm only 11, but can you write an example code if you can? Thank You :D

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: am2315 for raspberry pi in python

Post by adafruit_support_rick »

Okay, I'll see what I can do.
I don't have an am2315 right now - I'll have to order one, so it'll be a few days...

User avatar
ydna
 
Posts: 15
Joined: Sun Jul 21, 2013 7:47 pm

Re: am2315 for raspberry pi in python

Post by ydna »

Thanks so much! :D

Vince8134
 
Posts: 13
Joined: Wed Dec 25, 2013 4:38 pm

Re: am2315 for raspberry pi in python

Post by Vince8134 »

Hello,

I'm stuck too with the AM2315, but I spotted this : https://code.google.com/p/am2315-python ... b9cbd19a3c

Not sure yet how it works since I'm a noob too, but I hope it helps.

User avatar
ydna
 
Posts: 15
Joined: Sun Jul 21, 2013 7:47 pm

Re: am2315 for raspberry pi in python

Post by ydna »

I just got the AM2315 in the mail and the code doesn't work for my arduino uno. here is the code what is wrong?
#include <Wire.h>
#include <Adafruit_AM2315.h>

/***************************************************
This is an example for the AM2315 Humidity + Temp sensor

Designed specifically to work with the Adafruit BMP085 Breakout
----> https://www.adafruit.com/products/1293

These displays use I2C to communicate, 2 pins are required to
interface
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/

// Connect RED of the AM2315 sensor to 5.0V
// Connect BLACK to Ground
// Connect WHITE to i2c clock - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 5
// Connect YELLOW to i2c data - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 4

Adafruit_AM2315 am2315;

void setup() {
Serial.begin(9600);
Serial.println("AM2315 Test!");

if (! am2315.begin()) {
Serial.println("Sensor not found, check wiring & pullups!");
while (1);
}
}

void loop() {
Serial.print("Hum: "); Serial.println(am2315.readHumidity());
Serial.print("Temp: "); Serial.println(am2315.readTemperature());

delay(1000);
}}

User avatar
ydna
 
Posts: 15
Joined: Sun Jul 21, 2013 7:47 pm

Re: am2315 for raspberry pi in python

Post by ydna »

I also cant get any trinkets working...(Windows 8 not 8.1)

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: am2315 for raspberry pi in python

Post by adafruit_support_rick »

ydna wrote: here is the code what is wrong?
What errors are you getting?

User avatar
ydna
 
Posts: 15
Joined: Sun Jul 21, 2013 7:47 pm

Re: am2315 for raspberry pi in python

Post by ydna »

my error is "Adafruit_AM2315 does not have a name type" the line with the error shows "Adafruit_AM2315 am2315;" :(

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: am2315 for raspberry pi in python

Post by adafruit_support_rick »

You haven't installed the AM2315 library. This tutorial explains how to install Arduino libraries:
http://learn.adafruit.com/adafruit-all- ... nstall-use

User avatar
ydna
 
Posts: 15
Joined: Sun Jul 21, 2013 7:47 pm

Re: am2315 for raspberry pi in python

Post by ydna »

It works now i'm going to try it with my Pi, any luck with your code?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: am2315 for raspberry pi in python

Post by adafruit_support_rick »

Sorry - haven't got to it yet.

Locked
Please be positive and constructive with your questions and comments.

Return to “Ask an Engineer! VIDEO CHAT (closed)”