You can access the lectures of the ADC by reading the files in /sys/bus/iio/devices/iio:device0/
In this folder you have access to the raw lectures and the scale needed for converting the values in Volts.
I hope this helps.
Thanks for your reply CMata_Intel. I will check that out. Could you elaborate it further? There are four different sensors connected with the board. Will all theses sensors reading comes through that bus? Is mara library is enough to Access that bus? and Is there any link where I can study the bus structure of Galileo? The problem with the novice embedded programmers like me is that, we don't understand the internal working of the board architecture and what kind of bus is used in Galileo to connect with the sensors and how it does it. I have searched the internet but didn't found any useful links. I Know it's a beginners question but if you know any resources or link where I can read about it further, that will be very helpful for me or any other beginner interested in studying it more.
I found these links
but I am not sure know how to relate them with mara or any other Galileo library. Specially at the page 18 of schematics talks about SPI ADC and Flash.
In /sys/bus/iio/devices/iio:device0 you have access to the 6 analog inputs on the board, these files are the access to the ADC
in_voltageX_raw shows the value of the ADC
in_voltageX_scale shows the scale required to translate the raw readings from the ADC to mV
For example if you have a sensor in the pins A0 and A1, you can read them with the commands:
Let’s say that you obtain as result the values, 340 and 2405 respectively
Now, you have to obtain the scale for this pins:
You should get as result 1.220703125, applying these values:
Scale * RawReading = 1.220703125 * 340 = 415.039mV
Scale * RawReading = 1.220703125 * 2405 = 2935.791mV
You can use the MRAA library to read values from the ADC. In order to have the latest MRAA version you have to run the following commands:
echo "src mraa-upm http://iotdk.intel.com/repos/3.0/intelgalactic/opkg/i586" > /etc/opkg/mraa-upm.conf
opkg install mraa
You can find more information about MRAA in (Check the analog references):
With MRAA you can use the pins 0,1,2,3,4 and 5; these are the physical pins on the board and you don’t need to do anything else to route or map the pins to the code, just initializing the library and functions, check some examples in here: mraa/examples at master · intel-iot-devkit/mraa · GitHub
On Page 18, The ADC (AD7298) has an output to the Quark, this output is generated with SPI. Once the Quark receives the information, it is processed according to the different tasks that the board is running regarding those pins.
The access to this bus from Terminal console is /sys/bus/spi/devices/spi0.0
Let me know if this helps.
I'm glad to know that my post has been helpful. I checked the document you posted and indeed is very useful. If you want to use another programming language or you have more questions in the future don't hesitate to open a thread with the question, we will be glad to help you.