Tutorial on ADC posted
Oldbitcollector (Jeff)
Posts: 8,091
I spent some time working with the 3208 ADC chip and did a quick tutorial on it.
http://www.gadgetgangster.com/tutorials/397
Feel free to point out an obvious flaws or errors if spotted.
Hope it helps someone.
Thanks!
OBC
http://www.gadgetgangster.com/tutorials/397
Feel free to point out an obvious flaws or errors if spotted.
Hope it helps someone.
Thanks!
OBC
Comments
'
I need all the help I can get with Spin.
Two notes:
1) For safety sake, it's a good idea to connect DOUT and DIN via a 3.3K (or higher) resistor; this prevents collisions [due to programming error] from ever causing a problem with the Propeller IO pin (which is connected to DIN).
2) When porting code to the 3202 there is one less mux bit and one less data bit. A few of us have been caught out by the latter. I've recently updated my object 3202 code (in ObEx) to correct this "gotcha."
I think there should also be a resistor, >> R_dark (220k-470Ω),
from Ch_0 to GND.
[Otherwise it's a variable resistor that's always pulled-high/up.]
PE -- 10k between +V and Ch_0, and the photocell between Ch_0 and GND would be better yet.
Click the above image for a legible version. The forum software made it minuscule.
I checked the page source to see if it was an encoding issue, but they're questions marks there too.
I also see that error. I wonder if GG actually tested his tutorial before posting it? That is kinda a critical flaw in the circuit (from a functionality perspective)
I appreciate the comments and will look at that potential issue. Any circuit published in my material is built and tested before publishing. In this case, an identical breadboard was assembled and used for testing.
This may be another case (like many I've discovered) where the components are forgiving. It's one of the more interesting things I've found where you can get away with breaking the rules. (Doesn't make the engineers happy, and defies the datasheets, but there it is.)
Either way, I'll give it a good looking over.
Thanks Guys
OBC
It probably wouldn't be a bad idea to include a schematic for the circuit in addition to the breadboard and platform pictures.
Tutorials like this provide a good opportunity for people to start to learn to read schematics since they can compare them to the breadboarded circuit.
What does the voltmeter tell you?
I don't want to be characterised as mean or insensitive or any of that rot, but feel free. If I'm the Antichrist for it then make the most of it.
If you'd simply preface your stuff as "Doing 'Tronix For Propheads" or "Electronics-free Zone" then that'd be cue enough for me to simply not care. That's not education, it's "doing stuff", but there it is.
I would suggest that when creating tutorials we are all more stringent lest newbies adopt bad habits that will bite them later.
The circuit should resemble a pot with the wiper connected to the 3208. One leg of the pot should be high and the other low. This way the wiper voltage changes.
The photo resistor should be connected as if one of its leads is the wiper of a pot. The other lead should be either high or low. A normal reistor is used to make the rest of the voltage divider with one lead acting as a pot wiper and the other connected high or low (but opposite of the photo resitor's second lead).
I hope that makes sense.
Jeff, this isn't a "potential issue" it's a "critical flaw" as groggory noted. (That's not supposed to sound a rude as it might.) I think these tutorials are a great idea.
Duane
But, I agree that the resistor needs to be there in the tutorial.
I've stirred a hornets nest..
I've been on the road most of the day so I won't get a chance to dissect this until later tomorrow. I'm sure some resistors will find their way into the document.
OBC
Excellent suggestion! I'll add a link to the datasheet and see if I can generate a schematic as well.
OBC
Yep...here's why it works. (from the MCP3208 datasheet)
The ADC samples with effectively a 1k resistor to ground as its reference point. There's some other hoo ha going on too...but that's the key element on how you got away with that working.
If you wanted to do a follow up ADC tutorial you could also go into how to convert high impedance sources into low impedance sources so ADC circuits can be used to their full potential with sensors like the flexiforce (and other high impedance sensors).
Or follow up tutorials with a series of nodal analysis equations. I love nodal analysis. It does pretty much everything for telling you what a simple circuit will do. And as a bonus, it only requires algebra. :-)
I'm using the one which is included in the Propeller Tool. You are right, it should be notated and a link posted.
I tend to gravitate toward using tools which are already in the hands of the user as much as possible. So while there is an improvement posted in OBEX, anyone who has installed Propeller Tool will have the one I've used by default.
OBC
What you and Nick are doing with the tutorials is great. Ok, they need a little tweaking, but it is better than nothing. I really appreciate the effort. Don't stop.
Thanks
Gary Lake
Nick and I both have thick skin.. No worries! We both know that positive and critical responses mean readers!
We are expanding our efforts and continuing forward!
My approach to learning the Propeller is from the eyes of a beginner, not an EE. I have experience is teaching and instruction so I'm exploiting my unique position to help others who will hopefully enjoy this hobby as much as I am. I dare to make mistakes publicly and learn from them
What is interesting is that so many times I'm finding so many times the Propeller will allow breaking the rules and still work perfectly and consistently. It appears that the Propeller has spoiled me a little, and I'll have to tighten up the belt so to speak when moving into the Propeller II as well as other less well designed chunks of silicon.
To put ones self out there is a truly challenging act, and I highly recommend it. It is both rewarding and an opportunity to grow. There is an amazing knowledge pool here, I want to encourage others who have the knowledge to take the time to share it! JonnyMac is an excellent example of this.
If you can write a little, then create a small tutorial for others and post it! If you can speak a little, attend a UPE event and present your project and knowledge!
OBC
I want to recommend you and everyone else who hasn't gone through formal electronics education to buy a read a book... "Practical Electronics for Inventors." It goes over everything from basic theory to AC theory to signals to every type of passive and many types of actives and many common IC's. Then it has lots of common circuits and clear explanations for each.
The book was required reading at MIT for my friend who got a degree in Aerospace Engineering...which means he wasn't an electronics junkie and they just wanted him to learn enough to get it done and fast!
This book is the cliff's notes to an EE's knowledge. :-) It's my favorite book when I'm working on electronic stuff and forget how to work say a Triac into my circuit. Or how to work the flip flops and discrete logic the way I want it to. :-)
Edit: Changed book to 2nd edition
Purchased moments ago and added to my reading list!
OBC
It looks like that link is to the first edition. There is a second edition:
http://www.amazon.com/Practical-Electronics-Inventors-Paul-Scherz/dp/0071452818/ref=tmm_pap_title_0
It's thicker and heavier but I've never compared the two to see what the differences really are. I have both.
I'm sure either will come in handy..
Now, can I count on you "experts" to assist me in getting this tutorial corrected?
OBC
My bad. I have the 1st edition. My friend has the 2nd edition. Here were my quick notes between the two.
The first edition had many hand drawn drawings to go over ideas. The 2nd edition had much more 'professional looking' drawings.
The second edition had a larger selection of circuits and added some circuits and explanations to certain sections.
The second edition has many corrections to incorrect formulas.
I revise my earlier recommendation a bit. Cancel your order and place the order for the 2nd edition book. Good catch Schill.
Thanks
OBC
Parallax's "Robotics with the Boe-Bot" has some information on using a photoresistor in a voltage divider circuit on page 197. Chapter 6 (page 193) is titled "Light Sensitive Navigation with Photoresistors."
I think the e-book is available for download for free. I'll check. Hang on for a second.
Here it is http://www.parallax.com/Portals/0/Downloads/docs/books/edu/Roboticsv3_0.pdf
I just noticed my book is version 2.2. So it might be on a different page.
Wow! Big difference between versions 2.2 and 3.0. Chapter 6 (page 169) is now titled "Light-Sensitive Navigation with Phototransistors." I think photoresistors aren't ROHM compliant.
They still use a voltage divider but I don't see the same box explaining what a voltage divider is. Anyway, It could be something to read while you wait for your book.
Voltage dividers are an important electronics principle.
I have a pdf file of version 2.2, if anyone whats it and can't find it online.
Edit: Version 2.2 can be found here http://www.parallax.com/tabid/535/Default.aspx
I think the interface between the Propeller and the 3208 is fine. But that's not the issue, your "configuration" of the ADC's input is. The ADC's input impedance is forming the other leg of the voltage divider and you get some variation only on account of that. The Propeller is not allowing you to break the rules and to contend otherwise is an unsound inference.
On the one hand you admit your ignorance, but on the other you flout it. That's amazing.
The thing is -- there's no priesthood of EEs out to keep you down, stifle your progress, or dampen your spirit, man. To proceed, sometimes a guy has to go with his schema , but when he finds that it's not in keeping with the facts then he must amend it.
I can understand your passion to evangelise the world to the Propeller, but this isn't the way to do it. If tutorials such as this are to be the Propeller's clarion then its future looks bleak, the road to its oblivion paved by its enthusiasts with such good intentions.
Have a good day.