Analog input cape/wiring scheme

49 views
Skip to first unread message

Heinz Hummel

unread,
Feb 13, 2017, 4:03:32 AM2/13/17
to BeagleBoard
Hi,

I want to use the analog inputs of the BBB but not with a range of 0..1,8 V but with 0..5V (which is more "natural" for most applications). Software side is not a problem, but for hardware side I'm not sure how to deal with AIN, AGND and ADC.

So my question: is there a open-hardware-cape or a reference schematic available where I could have a look into?

Thanks

Heinz

evilwulfie

unread,
Feb 13, 2017, 7:01:29 AM2/13/17
to beagl...@googlegroups.com
I use a single rail opamp to level convert and protect the analog input.
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/493bceb5-5665-469f-9151-4481ce92cfd4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rob van der Putten

unread,
Feb 13, 2017, 7:21:28 AM2/13/17
to beagl...@googlegroups.com
Hi there


On 13/02/17 13:01, evilwulfie wrote:

> I use a single rail opamp to level convert and protect the analog input.

It's probably easier to use an SPI ADC (EG: MCP3201) running on 5V and
then do the level translation in the digital signal.


Regards,
Rob



William Hermans

unread,
Feb 13, 2017, 12:10:50 PM2/13/17
to beagl...@googlegroups.com
Probably not. With the onchip ADC, all the software( drivers etc ) are already written for you. Using an external SPI ADC you have to deal with additional costs, additional circuitry, and additional software, which is on you to create. Not only that, you will probably still have to level convert, in order to make sure the input on the ADC does not swing too high. You also need to isolate the pin.

I'd say an I2C ADC would be a better choice, and it would be except. You would have to deal with everything i mentioned about an SPI ADC. Except writing the "driver" software would be much easier to deal with.

Rob van der Putten

unread,
Feb 13, 2017, 1:44:55 PM2/13/17
to beagl...@googlegroups.com
Hi there


On 13/02/17 18:10, William Hermans wrote:

> Probably not. With the onchip ADC, all the software( drivers etc ) are
> already written for you. Using an external SPI ADC you have to deal with
> additional costs, additional circuitry, and additional software, which is
> on you to create.

There is already a SPI interface. Simply hook it up.

Level translating the analog signal is much more complicated. You would
have to buffer the 0 to 5 volt signal. Then feed it to a resistor
divider with a pot to calibrate. And then buffer it again (use fixed font);

Opamp

+ |\
In >-------| \
0 | >---*------+
to +---| / | |
5V | - |/ | +++
| | | |
+----------+ | |
| |
+++
| Opamp
+++
| | + |\
| |<-------| \
| | | >---*----> Out
+++ +---| / | 0
| | - |/ | to
+++ | | 1.8V
| | +----------+
| |
| |
+++
|
|
/ \
GND

The positive supply voltage of the opamps would have to more then five
volt. The negative less then zero. So you need to clamp the output
voltage of the second opamp. Without limiting the full 0 to 1.8 volt
range. -0.1 to 1.9 volt is probably safe, but you need to check the
specs to be shure. Something with two (NPN and PNP) emitter followers
would probably work. Just tie the emiters to the output of the second
opamp. Assuming the the opamp is short cirquit proof of course. And you
may need to calibrate.

And why is getting data from the SPI interface more difficult then
getting it from the buildin ADC? You have to write the software to
process the data anyway.

> Not only that, you will probably still have to level
> convert, in order to make sure the input on the ADC does not swing too
> high. You also need to isolate the pin.

Not at all. Simply power whatever inputs the 0 to 5V to the ADC from the
same sypply.
Of cource, if this not possible, you will have to clamp the voltage.
And if you really need to isolate, this is easier with a digital the an
analogue signal.

> I'd say an I2C ADC would be a better choice, and it would be except. You
> would have to deal with everything i mentioned about an SPI ADC. Except
> writing the "driver" software would be much easier to deal with.

Why is I2C a better choice then SPI?
The BBB has both.


Regards,
Rob



William Hermans

unread,
Feb 13, 2017, 8:37:42 PM2/13/17
to beagl...@googlegroups.com
On Mon, Feb 13, 2017 at 11:44 AM, Rob van der Putten <r...@sput.nl> wrote:
Hi there
Why is I2C a better choice then SPI?
The BBB has both.


Regards,
Rob

From a software developers perspective, I2C is far simpler. One call to ioctl() to set the mode of the file descriptor, then you simply start reading from whichever registers you need. Also, since the onboard PMIC, and EEPROM both use I2C interfaces. The buses already exist, are in use, the drivers, and software *have* to work. Otherwise the board does not function at all. Can we simply "plug in" to one of these two I2C buses to save pins ? I do believe so yes. It's been a while since I've looked into that. I think one can use i2c-2 for sure, but I'm not sure if one can also tie into the I2C bus which the PMIC is connected to or not.

SPI conversely is not required for the board to function. So drivers are not necessarily already loaded, and functioning. SPI also uses at minimum 3 pins. 2 data lines, and a CS pin. I have heard of, and seen 1 "wire" SPI implementations, but I'm not sure that could be made to work easily in Linux. Since most software implementations use SPIDev. Which is master mode only SPI. Not that this matters for using an externally interface device, such as an ADC.

I still think it's much easier to use the on chip ADC. We're using it here for a custom cape. Using one opamp, and a voltage divider. Input is 0-10v dc, and the resistor network limits the voltage to 1.5v max, Which does limit the resolution *some*, but you most definitely do not want to go over 1.8v on the ADC. As stated in the TRM.
 

William Hermans

unread,
Feb 13, 2017, 9:01:50 PM2/13/17
to beagl...@googlegroups.com
By the way, the whole software interface for the on chip ADC is already in place, and functional. You simply need to load the driver, or have a device tree overlay do that for you. Then you setup the IIO driver to tell it if you would rather operate in single-shot, or continuous mode. Then you simply read from the "buffer file". If you're still unconvinced. Google "beaglebone ADC" and learn how simple the software side really is. There are many blogposts out there on the subject. One of which is mine, but seems to be down at this moment.

woody...@yahoo.com

unread,
Feb 13, 2017, 11:35:50 PM2/13/17
to beagl...@googlegroups.com

--------------------------------------------
On Tue, 2/14/17, William Hermans <yyr...@gmail.com> wrote:

Subject: Re: [beagleboard] Re: Analog input cape/wiring scheme
To: beagl...@googlegroups.com
Date: Tuesday, February 14, 2017, 4:01 AM
--

For more options, visit http://beagleboard.org/discuss

---

You received this message because you are subscribed to the
Google Groups "BeagleBoard" group.

To unsubscribe from this group and stop receiving emails
from it, send an email to beagleboard...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/CALHSORqpyFekypMA3xWFoWQ%3DLbydW%3DBSdz%2BAdCf9_cn3P1ns8A%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.
rasaturile generale aie regimului politic Sistemul vietii politice a avutia za un regim democratic instaurat prin legea fundamentala din 1866. smocratizarea societatii romanesti a avut loc insa lent caci limitele reformei rare din 1864 au dat nastere unor grave probleme sociale. Mentinerea votului nzitar a fost o piedica de seama pe drumul catre o evolutie democratica in litele inerente epocii acceptata ca masura de prevedere a unei posibile anipulari a votului omului neinstruit politic.

Heinz Hummel

unread,
Feb 14, 2017, 1:47:18 AM2/14/17
to BeagleBoard
Thaks for all the ideas what perhaps could be done different. But to come back to my original question: is there an open-hardware-cape or a wiring schematic available somewhere which utilitises the ADC inputs and I could use as starting point for my own layout?
Reply all
Reply to author
Forward
0 new messages