Read analog values
I want to read values from current sensor connected to ADC, the question is what are the omega onion pins that will be connected to the output of the ADC to read the values ? , and do I need to use SPI or I2c protocols and how to implement them if I need to.
@yaseen-almanna The Omega does not have any direct facilities for reading analog values.
The Arduino Dock which is basically just an Arduino into which the Omega plugs can read analog values but you then need to implement the code to communicate between the Omega and the Arduino for the Omega to get access to these values. Best way of communicating between the Omega and the Arduino is to use I2C. However, note that when the Omega is plugged in to the Arduino Dock, you no longer have access to the Omega GPIO pins. See https://wiki.onion.io/Tutorials/Arduino-Dock/Initial-Setup and https://wiki.onion.io/Tutorials/Arduino-Dock/Using-the-Arduino-Dock for use of the Arduino dock.
It has been suggested that there should be an ADC Expansion for the Omega to address this lack of analog access but such an Expansion is not forthcoming yet.
Consequently, I have constructed one on a Omega Prototype Expansion (see https://store.onion.io/collections/onion-omega-expansions/products/proto-expansion) using a Adafruit ADS1015 12-Bit ADC - 4 Channel (see https://www.adafruit.com/products/1083) Communication is via I2C - code adapted for the Omega from the Arduino code that is covered in the above reference from Adafruit
Hi @Kit-Bishop thanks for your reply. THe thing is I know that the omega don't have analog pins therefore I am reading the current sensor values throw a separate ADC, however I don't know exactly how can I use the omega SPI interface software protocol to communicate with the ADC.
@yaseen-almanna The Onion wiki has an article on using SPI from the command line: https://wiki.onion.io/Tutorials/Using-SPI
If you're using I2C, you can use the
i2c-toolssoftware package from the command line. The commands are
i2csetand you can find the man pages on http://linux.die.net/man/
Then when you've figured out what you need to do, you can write a program in C, C++, or Python to automate the readings: https://wiki.onion.io/Documentation/Libraries/I2C-Library
It really depends on the ADC that you're using, you'll find the supported protocols in the datasheet.
@Lazar-Demin Thanks that was very helpful.