Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A20 => Topic started by: sanzoghenzo on November 20, 2013, 12:56:51 PM

Title: analog input?
Post by: sanzoghenzo on November 20, 2013, 12:56:51 PM
Hi all, given that I'm not so electronic savvy, is better to start with something simpler than interfacing a macbook lcd ;)

I just found this post (http://denishennessy.com/2012/04/08/measuring-battery-capacity-with-an-arduino/) that shows how to measure the capacity of a battery using arduino. It simply discharges the battery with a fixed load (some resistors) and logs the voltage every second. once the data is collected, it's just a matter of doing some math to know the maximum capacity.
The thing is, it uses arduino that has analog input pins. I saw A20 has LRADC1, but with only 6bit resolution and 2V max.
Should I use an external ADC connected to some GPIO ports and poll all of them? Is it the best way to do that? Note that I can be interested in using a similar setup to log temperature and humidity for another project.
Thanks for the attention, cheers from Italy!
Title: Re: analog input?
Post by: sanzoghenzo on November 22, 2013, 10:03:49 PM
I found something... (http://learn.adafruit.com/send-raspberry-pi-data-to-cosm?view=all) basically an external ADC connected to SPI (one of the two UEXT) interface and some python should do the job ;)
I see in the wiki
QuotepyA20 is Python library for access to A20-OLinuXino-MICRO GPIOs, I2C, SPI
but in pyA20.c I see only GPIO 1,2 and 3 pins definition. Can someone tell me if is there a way to use UEXT's SPI? or should I simply use some GPIOs like adafruit does?
Title: Re: analog input?
Post by: blejku on November 25, 2013, 01:18:12 AM
I think, however, you can simply use I2C. There are a lot of A / D according to the needs, measurement tempraretury and humidity is also not a problem.
For Python need to install python-smbus for I2C
There is no need to use the GPIO. I2C is in the ports Uext
I use mostly Maxim Integrated circuits but it's a lot.


Pozdrowienia z Polski :-)