Hi tscott,
Just a quick idea, have you activated the I2C hardware on your pi? Check out adafruits-raspberry-pi-lesson-4-gpio-setup, it has a section on setting it up to work with I2C.
Kev
MPL115A2 calculating coefficients
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- tscott
- Posts: 2
- Joined: Fri Nov 08, 2013 2:25 pm
Re: MPL115A2 calculating coefficients
YES! That was it. Thank you so much!
-
- Posts: 2
- Joined: Sun Jan 12, 2014 1:21 pm
Re: MPL115A2 calculating coefficients
Hi guys,
Much like gvsu, I'm also getting issues with the testcode.py file.
I've used the "Select Code" to paste the codes to files using nano in the terminal. I've named them MPL115A2_class.py and testcode.py (just like kkkkkbruce told gvsu). I've posted a copy of Adafruit_I2C.py in the same folder as these 2.
When trying to run testcode.py I get:
File "./testcode.py", line 9
SyntaxError: Non-ASCII character '\xc2' in file ./testcode.py on line 9, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
I tried adding # -*- coding: utf-8 -*- and I get:
File "./testcode.py", line 10
rList = mp.getPT()
^
SyntaxError: invalid syntax
Any ideas on what the issue might be?
Much like gvsu, I'm also getting issues with the testcode.py file.
I've used the "Select Code" to paste the codes to files using nano in the terminal. I've named them MPL115A2_class.py and testcode.py (just like kkkkkbruce told gvsu). I've posted a copy of Adafruit_I2C.py in the same folder as these 2.
When trying to run testcode.py I get:
File "./testcode.py", line 9
SyntaxError: Non-ASCII character '\xc2' in file ./testcode.py on line 9, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
I tried adding # -*- coding: utf-8 -*- and I get:
File "./testcode.py", line 10
rList = mp.getPT()
^
SyntaxError: invalid syntax
Any ideas on what the issue might be?
-
- Posts: 2
- Joined: Sun Jan 12, 2014 1:21 pm
Re: MPL115A2 calculating coefficients
Alright so I found the issue, apparently strange characters were placed inside the system when pasting.
I switched to connecting to the RPi through my windows computer using Putty.
I also had to make changes to the MPL115A2_class.py. I kept getting errors because of the self.wakeup():
Traceback (most recent call last):
File "./testcode.py", line 9, in <module>
rList = mp.getPT()
File "/home/pi/Kim/MPL115A2_class.py", line 85, in getPT
self.wakeup() # Start conversion
AttributeError: MPL115A2 instance has no attribute 'wakeup'
However these issues were cleared by removing self.wakeup() from the code.
I switched to connecting to the RPi through my windows computer using Putty.
I also had to make changes to the MPL115A2_class.py. I kept getting errors because of the self.wakeup():
Traceback (most recent call last):
File "./testcode.py", line 9, in <module>
rList = mp.getPT()
File "/home/pi/Kim/MPL115A2_class.py", line 85, in getPT
self.wakeup() # Start conversion
AttributeError: MPL115A2 instance has no attribute 'wakeup'
However these issues were cleared by removing self.wakeup() from the code.
-
- Posts: 1
- Joined: Wed Apr 09, 2014 10:42 am
Re: MPL115A2 calculating coefficients
HI
I new whit the raspberry a I have some problems whit the programation, when i compile the program, I had an error
_MPL115A2_Padc_MSB = (0x00)
IndentationError: unindent does not mach any outer indentation level
what can I do for fixed?
I new whit the raspberry a I have some problems whit the programation, when i compile the program, I had an error
_MPL115A2_Padc_MSB = (0x00)
IndentationError: unindent does not mach any outer indentation level
what can I do for fixed?
-
- Posts: 4
- Joined: Wed May 14, 2014 6:14 pm
Re: MPL115A2 calculating coefficients
Hi all,
New to this but with your help I have got my sensor working (somewhat anyway) with my RPi. However, when I run the tester posted earlier I get "Error accessing 0x60: Check your I2C address" printed out five times before the temperature and pressure values. The temperature and pressure values are way wrong too. The Pressure is 440hPa and the temperature is -73C any idea what could be going wrong? I haven't changed any of the code from what was posted here.
Thanks
New to this but with your help I have got my sensor working (somewhat anyway) with my RPi. However, when I run the tester posted earlier I get "Error accessing 0x60: Check your I2C address" printed out five times before the temperature and pressure values. The temperature and pressure values are way wrong too. The Pressure is 440hPa and the temperature is -73C any idea what could be going wrong? I haven't changed any of the code from what was posted here.
Thanks
- kkkkkbruce
- Posts: 13
- Joined: Thu Mar 07, 2013 6:02 pm
Re: MPL115A2 calculating coefficients
Hi crow90
One thing that pops into my mind is how up to date is your clone of the Adafruit i2c code? I got my MPL115A2 out again the other day and when I first tried it I also got a bunch of i2c errors, but after getting a fresh clone of the Adafruit-Raspberry-Pi-Python-Code it worked fine.
Kev
One thing that pops into my mind is how up to date is your clone of the Adafruit i2c code? I got my MPL115A2 out again the other day and when I first tried it I also got a bunch of i2c errors, but after getting a fresh clone of the Adafruit-Raspberry-Pi-Python-Code it worked fine.
Kev
-
- Posts: 4
- Joined: Wed May 14, 2014 6:14 pm
Re: MPL115A2 calculating coefficients
Hi Kev,
I just installed everything today so everything should be up to date but I'll try reinstalling the adafruit i2c code. I am new to this but have some experience with programming. I find it really odd that five error messages would display and then a results (a wrong one mind you) even tho there is no loop...
thanks
I just installed everything today so everything should be up to date but I'll try reinstalling the adafruit i2c code. I am new to this but have some experience with programming. I find it really odd that five error messages would display and then a results (a wrong one mind you) even tho there is no loop...
thanks
- kkkkkbruce
- Posts: 13
- Joined: Thu Mar 07, 2013 6:02 pm
Re: MPL115A2 calculating coefficients
Another thought I had was that it could be a loose connection to the Pi giving trouble. Have you run the "sudo i2cdetect -y 1" does the device show up there correctly?
-
- Posts: 4
- Joined: Wed May 14, 2014 6:14 pm
Re: MPL115A2 calculating coefficients
I am not sure what correct is. But this is what I get.
pi@raspberrypi ~ $ sudo i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
I don't have a soldering iron (yet) so I just placed the chip on the pins it seemed like it made a reasonable connection but maybe not. I'll have to try fixing that and maybe my problems will be fixed.
pi@raspberrypi ~ $ sudo i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
I don't have a soldering iron (yet) so I just placed the chip on the pins it seemed like it made a reasonable connection but maybe not. I'll have to try fixing that and maybe my problems will be fixed.
- kkkkkbruce
- Posts: 13
- Joined: Thu Mar 07, 2013 6:02 pm
Re: MPL115A2 calculating coefficients
ok, you used:
are you sure you don't need?
The only difference is the 1 at the end instead of a 0
You should see in the 0x60 column/row a 60 and not -- if it is detecting the chip correctly.
It should look like this:
Code: Select all
sudo i2cdetect -y 0
Code: Select all
sudo i2cdetect -y 1
You should see in the 0x60 column/row a 60 and not -- if it is detecting the chip correctly.
It should look like this:
Code: Select all
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: 60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
-
- Posts: 4
- Joined: Wed May 14, 2014 6:14 pm
Re: MPL115A2 calculating coefficients
Thanks for your suggestions. It was a loose connection in the end. I fixed it and all seems to be working now :-)
Please be positive and constructive with your questions and comments.