Additional data point. I downloaded iot-devkit-201510010757-mmcblkp0-galileo.direct , ran opkg update/upgrade and the same output . As an aside, the number of releases on the Galileo with little easy to find information on what differentiates them is ... confusing.
root@galileo:~# uname -a
Linux galileo 3.8.7-yocto-standard #1 Tue Sep 29 22:16:33 GMT 2015 i586 GNU/Linux
root@galileo:~# cat /etc/version
Analog Read: 372.0
Temperature F: 269.0
Hmm the mystery continues. I uploaded a sketch to read the temperature and the output is fine via the serial console. The code I used was from an Adafruit example: https://learn.adafruit.com/tmp36-temperature-sensor/using-a-temp-sensor .
I also tried a second TMP36 I had with identical results, So I am pretty sure it is something I am doing on the Python/Linux side.
Any thoughts would be appreciated.
Now that you have one working code, you could start comparing step by step both codes
For example, check the ADC lectures from both codes, step by step of all the operations used in the code and finally the result. There could be an error in one of the operations, it could be with a parenthesis or something related.
Hey Charlie - Thanks for responding. I think I explained poorly, the arduino code works, not the python code. If I needed Arduino code to work I would just use a $19 Arduino
My impression was I could access the value of an analog sensor by using the mraa library via python without having to load a corresponding sketch.
The python code is unchanged, I copied it from one SD card to the other. The output of mraa.Aio read() on the Iot-DevKit image is not the same as that on the SD-Card.1.0.4.tar.gz image with the same wiring, hardware and code. I can literally power off, switch SD cards and reboot and get different results just because of the distribution.
Maybe it is uncommon to use python to read analog sensors on the Galileo?
Is there a method similar to the Arduino Yun's bridge to communicate between the sketch output and the linux side?
What I wanted to say is that you could start checking the differences in the lines of both codes. For example you can put a print statement after every data acquisition and after every operation in order to debug step by step of your code. With this you could see where the error is.
You should be able to read analog values using the Galileo and the MRAA library.
I saw you have: voltage = (tempMV * 5.0) / 1024.0. Are you using the Galileo Gen2? If you do, add in your python code the line: tempPin.setBit(10), if you are on Galileo Gen1, add tempPin.setBit(12). You should have something like:
#!/usr/bin/env python import mraa import sys import time tempPin = mraa.Aio(0) print(mraa.getVersion()) tempPin.setBit(10) # If you are using Galileo Gen2 ....
Let us know if this works.
Hey Charlie - Thanks for the idea. Unfortunately this doesn't work for me. I am using a Gen 2 Galileo. I guess the more appropriate question is "How to read analog values with iot dev kit image and python?" I should start a new thread.
As an additional data point I tried this with a traditional LM335 as well as the TMP36. Both times I can read from an Arduino sketch fine, but not python. But still confused as to why the SDCard image read fine and the iot dev kit one did not.