ADC question

Status
Not open for further replies.

Theremingenieur

Senior Member+
First of all, please accept my apologies if my questions have already been answered before, but the search function didn't point me towards the results I am looking for.

My questions are about preferably the use of the two ADCs synchronously (one MUXed on 2 inputs, the other exclusive on 1 input) or one ADC with 3 inputs MUXed in Teensy 3.1. I found the following information on the pjrc homepage:
"Two Analog to Digital Converters
With analogRead(), you can measure many signals, but only 1 at a time. Teensy 3.1 has a second ADC, so you can concurrently measure 2 analog signals. For stereo audio or power monitoring, sampling both left and right, or voltage and current at the same moment is very beneficial.
PJRC is developing an advanced analog read function for Arduino, to make using these new analog input capabilities very easy."


Is this advanced analog read function already available? If yes, where can I find it, please?

I'd like to find simple instructions or functions to set the ADC configuration (inputs, resolution, sampling frequency, interrupt) for use in a Arduino/Teensyduino sketch, if possible without studying the whole 1400 page programming handbook. Is there perhaps a kind of tutorial somewhere on the web which explains the use of the extended functionality, compared to the Arduino standard analog read?

Thank you in advance from France
 
Last edited:
Finally, thank you for nothing... Further Google research led me towards the source code of a "analog.c" file http://hg.cmason.com/teensy3/src/d4eefa8bc59c249aedae2a1f0173a87fad867966/teensy/analog.c?at=default. That showed me at least that simple functions like for example analogReadRes() exist. Just wonder why there is no such elementary documentation on the PJRC's teensy home page while other libraries for more sophisticated projects are well documented with examples... I am actually somewhat disappointed. How shall people start to adopt a new product like the Teensy 3.1 if there is no easily accessible and complete quick reference like the one for the Arduino? (http://arduino.cc/en/Reference/HomePage#.Uw0PqZK9KSM)
 
Thanks for the tip on analog.c.

Have you used it?

Care to share a test .ino file?

I am also interested.

Don't be too down on Teensy 3.1. I think there has been amazing progress and it is so much more capable than Arduino processors.

I look forward to hearing from you,

Richard
 
I haven't used it yet. I'm still in a very early project stage. I have been building analogue circuits for electronic music instruments (Theremins etc.) for years and I thought it was now time to go digital... A rough estimation of the needed computing power made clear that an Arduino would not be sufficient, so I looked for more powerful alternatives. That's how I found Teensy and I decided for the 3.1 because of the proudly announced integrated DAC and the two independent ADCs. Thus I ordered one and I'm currently looking on how to write my code. I had expected that there would also be such a well structured and exhaustive hierarchical quick reference page to have all main functions and libraries with their functions documented within a few mouse clicks as for the Arduino. This expectation actually transforms into disappointment.

I'll for sure need to gather further information during a few weeks before I start coding.

I'm not a programming noob, I've spent the last 20 years writing SQL queries and data access objects, mostly in in PHP, for my day job, but I never learned C or C++.

I remember well the times when I was still a university student. In every bookstore in Germany and France where I grew up there were display stands with small quick reference charts or brochures - for dBase4, Clipper, Turbo Pascal, GW-Basic and so on. About $2/piece each (ok, that was in the late eighties...). But that's exactly what I miss here, a short reference of all functions and constants on a few pages. Do the PJRC guys really expect people to buy their products and then study the 1400 page manual?
As I could see around here in the forums, Mr. Stoffregen seems to be very occupied with that famous audio library. I can see that there is for sure a need for that, but such rather complex functions are the cherry on the cake and some more elementary documentation like an exhaustive and systematic quick reference should IMHO have been done before. It is an effort to condense and break down the 1400 pages of the data book into a downloadable PDF with let's say 20 pages, but I'm sure that people (including me) would be ready to pay for that.
 
In my opinion, Paul is amazing. He has provided a wealth of information and I, having done this for years, am very pleased at how far I have come using Teensy 3.1 in such a short time. The good news is the Teensy 3.1 is a powerful microcontroller. As such, there is a lot of embedded hardware within the chip. One hopes that others will bleed on the cutting edge, and in many cases with Teensy 3.1, this is the case. There are some amazing libraries. Not everything is covered yet. Sometimes we have to dive in.

I am doing quadrature sampling so using the two parallel channels is important to me. I will see what I can come up with.

Perhaps others may be interested, however, simultaneous A/D sampling is probably not a very hot item.

Keep the faith.

Richard
 
Welcome to the forum!

I had to dig around in the Forum for this a little bit my memory served me correctly. The library in THIS thread exposes all functionality the ACD in the Teensy 3 and dual ADCs in Teensy 3.1 have to offer.
 
Theremingenieur, hope your project is coming along well. I initially tried to use the ADC inside the Teensy 3.0 for a dual-channel power-measurement system (muxed) but later settled on using an external ADC instead (bipolar signal, true 16 ENOB, and so on). I too long for more documentation re: the Teensy but then also realize that Paul is pretty much working on his own to design Teensys (hardware), the software they run (the latest big release was the audio library), his web-site, production / testing, and the store.

I hope he gets to sleep from time to time, but I'd wager he's terribly busy.

Best of luck working through the library and if that fails, there is always the chapter inside the Freescale K20 manual that covers the ADCs quite well.
 
Thank you all very much for your help and encouragement!

I'll for sure continue exploring the Teensy 3.1 idea. I just started with the wrong ideas, it seems. I thought that opposed to the Arduino, the Teensy was rather a commercial than a community project and thus I had wrong expectations in the documentation and support. Second, I forgot that PJRC, this forum and most of its users were located on the other side of the big pond, which makes that almost everybody is sleeping while I start my day.
 
Both Arduino and Teensy are commercial in the sense that they both make and sell microcontroller boards. Tensy does not allow cloning, although there are resources available for people who want to make a larger run of special purpose boards to sell. Arduino does allow cloning, including commercial cloning, with their CC-BY license. Although it seems they then complain when people actually do it.

On the software side, Arduino is semi-community in that anyone can make and document a library, although contributions to the core tend to be rejected. Teensy is fully community; people can and do create libraries and contributions to the core are accepted if they are of good quality.

The documentation on Teensy 2 and Teensy++ 2.0 is reasonable; the documentation on Teensy 3.0 and the recently released 3.1 are indeed lacking, being spread all over this forum, github, etc rather than collected together. Hopefully this will change and it would be good to see a more community-driven approach to the documentation here, as Paul is pretty busy on the hardware and support fronts.

We are not all over the pond, no. But perhaps wait more than 9 hours before complaining, next time :)
 
Is this advanced analog read function already available?

No, unfortunately it's only at the planning stage right now.

I'm currently working on the audio library, which is very near to a first 1.0 release.

After the audio library 1.0 release, I'm planning to work on at least an alpha version of a CAN bus library. Many people have expressed a very strong interest in using CAN, so at getting a working library is a pretty high priority.

The advanced analog API is on my development schedule, shortly after CAN bus.

At this point, Pedvide's ADC library is probably your best option, without digging into directly accessing the hardware.
 
.... but then also realize that Paul is pretty much working on his own to design Teensys (hardware), the software they run (the latest big release was the audio library), his web-site, production / testing, and the store.

Actually, Robin and Erin deserve lot of credit. They handle most of PJRC's day-to-day operational stuff, except of course tech questions and IT stuff, which lets me focus on hardware and software development.
 
Status
Not open for further replies.
Back
Top