am2315 for raspberry pi in python
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- ydna
- Posts: 15
- Joined: Sun Jul 21, 2013 7:47 pm
am2315 for raspberry pi in python
Is there any way you can use the am2315 sensor with the Pi in python?
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: am2315 for raspberry pi in python
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
https://github.com/adafruit/Adafruit_AM ... AM2315.cpp
- ydna
- Posts: 15
- Joined: Sun Jul 21, 2013 7:47 pm
Re: am2315 for raspberry pi in python
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
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: am2315 for raspberry pi in python
There's no simple command. You'll have to get the logic from the arduino library, and code that up in python.
- ydna
- Posts: 15
- Joined: Sun Jul 21, 2013 7:47 pm
Re: am2315 for raspberry pi in python
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
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: am2315 for raspberry pi in python
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...
I don't have an am2315 right now - I'll have to order one, so it'll be a few days...
- ydna
- Posts: 15
- Joined: Sun Jul 21, 2013 7:47 pm
Re: am2315 for raspberry pi in python
Thanks so much!
-
- Posts: 13
- Joined: Wed Dec 25, 2013 4:38 pm
Re: am2315 for raspberry pi in python
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.
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.
- ydna
- Posts: 15
- Joined: Sun Jul 21, 2013 7:47 pm
Re: am2315 for raspberry pi in python
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);
}}
#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);
}}
- ydna
- Posts: 15
- Joined: Sun Jul 21, 2013 7:47 pm
Re: am2315 for raspberry pi in python
I also cant get any trinkets working...(Windows 8 not 8.1)
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: am2315 for raspberry pi in python
What errors are you getting?ydna wrote: here is the code what is wrong?
- ydna
- Posts: 15
- Joined: Sun Jul 21, 2013 7:47 pm
Re: am2315 for raspberry pi in python
my error is "Adafruit_AM2315 does not have a name type" the line with the error shows "Adafruit_AM2315 am2315;"
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: am2315 for raspberry pi in python
You haven't installed the AM2315 library. This tutorial explains how to install Arduino libraries:
http://learn.adafruit.com/adafruit-all- ... nstall-use
http://learn.adafruit.com/adafruit-all- ... nstall-use
- ydna
- Posts: 15
- Joined: Sun Jul 21, 2013 7:47 pm
Re: am2315 for raspberry pi in python
It works now i'm going to try it with my Pi, any luck with your code?
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: am2315 for raspberry pi in python
Sorry - haven't got to it yet.
Please be positive and constructive with your questions and comments.