Shop OBEX P1 Docs P2 Docs Learn Events
Tutorial on ADC posted - Page 2 — Parallax Forums

Tutorial on ADC posted

2»

Comments

  • TtailspinTtailspin Posts: 1,326
    edited 2011-03-17 16:12
    Thank's OBC, this is good stuff.

    I think some mention of what needs to be done to make a 3204 and the 3202 work, would be even better stuff.

    Also, using a variable resistor in combo with the LDR is much more fun than just the LDR..(more knobs to twiddle):smile:
    I realize simplicity is important, It's just that I feel like I am "doing something" with that kind of interaction,
    Plus it kind of ties into moving a servo around with a potentiometer..

    As a thick headed newbie, I beleive I am qualified to make these newbie comments...

    Anyway thanks for the good work, and look forward to the finished tutorial..
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2011-03-17 16:15
    PJ Allen wrote: »

    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.

    Have a good day.

    I'll bite.. The ADC Tutorial will be "amended" with the excellent feedback I've received in this thread, including yours. The advantage that I might have is that I have a layman's view of the Propeller which is helpful in explaining the material to other layman. If I'm find to be in error somewhere, I don't have any problem with admitting it and making corrections. My initial post asked for the kind of positive feedback I've received.

    One of the areas where the "other" microprocessors have had opportunity to pull ahead of the Propeller is in their perceived accessibility to artists, tinkerers, and other non-engineering types. My material and approach is designed to be inviting to those users. Combined with the knowledge pool which is accessible to this forum, I believe that the final product with be a positive addition. There is room in the Propeller world for both engineer and tinkerer alike. Regardless of their experience.

    I'm having a great day, Thank you!

    OBC
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2011-03-17 17:13
    Ttailspin wrote: »

    Also, using a variable resistor in combo with the LDR is much more fun than just the LDR..(more knobs to twiddle):smile:
    I realize simplicity is important, It's just that I feel like I am "doing something" with that kind of interaction,
    Plus it kind of ties into moving a servo around with a potentiometer..

    As a thick headed newbie, I beleive I am qualified to make these newbie comments...

    Anyway thanks for the good work, and look forward to the finished tutorial..


    You know it really never hit me to grab a variable resistor when I jumped over to the servo. Excellent (and DUH obvious) suggestion. I look at adding to to the revision.

    Thanks
    OBC
  • base2designbase2design Posts: 78
    edited 2011-03-19 08:00
    Thanks OBC!

    If I'm reading from a potentiometer, is this an acceptable circuit?

    myadc.png
    464 x 657 - 33K
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-03-19 09:59
    base2design,

    As JonnyMac pointed out, it's a good idea to have a resistor (I think 2k would be enough) between DOUT and DIN.

    If you use a 5V 3208 you'd want the DOUT going through the resistor be reaching the Prop.

    I don't think you need the 220 ohm resistors. Did you see those in the Boe-Bot book? I'm pretty sure you don't need to worry about limiting current to the 3208. As long as the voltage isn't more than Vdd (which I just noticed you have incorrectly labeled Vss (Vss is ground)).

    I'm by no means an expert on this stuff by I do use the MCP3208 chip a lot.

    Duane
  • base2designbase2design Posts: 78
    edited 2011-03-19 14:37
    Thank Duane... I'll correct the Vss / Vdd error and the placement of the 220ohm resistors. Yes I did copy this from the BoBot schematic (good catch).

    I'm using GoogleDocs to create this schematic, so any suggestions for a better light-weight schematic tool that runs on my Mac is appreciated!

    Regards,

    -joe
  • base2designbase2design Posts: 78
    edited 2011-03-19 14:38
    Oh... I believe I'm using a 3.3V 3208... at least that's how I'm powering it. I guess I need to check.
  • SSteveSSteve Posts: 808
    edited 2011-03-19 14:56
    I'm using GoogleDocs to create this schematic, so any suggestions for a better light-weight schematic tool that runs on my Mac is appreciated!

    Have you ever checked out OmniGraffle? If you just need a drawing program and not something to convert from a schematic to a PCB it would work great. I've always been tempted but have never had enough need to justify the cost.

    And then there's DipTrace, but it runs under WINE so I haven't been very attracted by it.
  • base2designbase2design Posts: 78
    edited 2011-03-19 16:19
    SSteve wrote: »
    Have you ever checked out OmniGraffle? If you just need a drawing program and not something to convert from a schematic to a PCB it would work great. I've always been tempted but have never had enough need to justify the cost.

    And then there's DipTrace, but it runs under WINE so I haven't been very attracted by it.

    D'OH! I have OmniGraffle and hadn't even though of looking for schematic symbols!
  • SSteveSSteve Posts: 808
    edited 2011-03-19 17:34
    D'OH! I have OmniGraffle and hadn't even though of looking for schematic symbols!

    There are schematic symbols at www.graffletopia.com. If you have OmniGraffle 5 the stencil search feature automatically searches Graffletopia.
  • JonnyMacJonnyMac Posts: 9,208
    edited 2011-03-20 10:51
    As JonnyMac pointed out, it's a good idea to have a resistor (I think 2k would be enough) between DOUT and DIN.

    If you're running the '3208 at 5v then you should use a 2.8K or higher resistor -- 3.3K is the next size up that is standard. 4.7K is fine, too.

    The math:
    (5v - (3.3v + 0.3v)) / 0.0005A = 2800

    The 0.3v is the drop across the pin protection diode, the 0.0005A is the maximum current through that diode.
  • JonnyMacJonnyMac Posts: 9,208
    edited 2011-03-20 11:05
    Thanks OBC!

    If I'm reading from a potentiometer, is this an acceptable circuit?

    myadc.png

    You should move the resistor between the DOUT and DIN pins, then connect the Propeller to the DIN pin (which is an input). Change the resistor size to 3.3K or higher; this will work with 3.3 or 5v circuits. I've written objects and demo code for all three models that you can find here:

    http://obex.parallax.com/objects/625/

    All in Spin; very easy to use and understand.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2011-03-20 14:18
    Based on the input I've received here, corrections are in the works.

    Here are a few graphics which are undergoing transformation for the review of the "experts" here.

    A quick and dirty correct schematic for the photocell circuit:
    corrected_schematic_adc_2_cds_cell.PNG



    A revised breadboard layout for the photocell circuit:
    corrected_breadboard_adc_2_cds_cell.PNG



    A new breadboard layout for connecting a 10k variable resistor:
    corrected_adc_2_pot.PNG



    Comments, revision suggestions, and barbs all welcome.


    Thanks!
    OBC
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-03-20 16:53
    JonnyMac wrote: »
    If you're running the '3208 at 5v then you should use a 2.8K or higher resistor -- 3.3K is the next size up that is standard. 4.7K is fine, too.

    The math:
    (5v - (3.3v + 0.3v)) / 0.0005A = 2800

    The 0.3v is the drop across the pin protection diode, the 0.0005A is the maximum current through that diode.

    I apologize for contradicting your earlier advice.

    Thank you very much for clarifying why you chose the resistor value you did.

    I realized now I don't understand the Propeller as well as I thought I did.

    I found the reference to 500 uA in the datasheet (page 26):
    Max. DC current into an input pin with internal protection diode forward biased: +/- 500 uA

    Immediately below this characteristic is:
    Max. allowable current per I/O pins: 40 mA

    I had thought this was the current one needed to worry about. Now I see this value only applies to the pin in the output state(right?). Thanks for setting me straight.

    Duane
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-03-20 17:34
    OBC,

    What's the range of the photoresistor?

    The ones that used to come with the Boe-Bot were 50k in total darkness and about 1k in "full light exposure."

    The voltage out VO of a voltage divider is:

    VO = Vdd * (R1 / (R1 + R2))

    R1 is the resistor connected to Vdd and R2 is the resistor connected to ground.

    I'd think you'd want resistor values that give a wide range VO.

    With the resistor values you have and assuming a similar photoresistor as the Boe-Bot ones, I get 2.06V in complete darkness and 2.97V in the light.

    If you eliminate the 10k resistor and change the 100k to 10k, VO varies from 0.55V to 3.00V. I think you'd want a relative large difference in voltage between dark and light.

    The resistor values should be based on what the value of your photoresistor.

    Duane
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2011-03-20 18:06
    @Duane

    Think I'll dump out my drawer of Photocells and check to see what the typical ranges are. I couldn't pass up on them when the local rat shack dumped them from inventory. Heck the packages were so yellow that they were probably on the shelf for the last 10-20 years.

    I'm probably not going to worry as much about precision with the photocell experiment. Folks who have a photocell or two might not have consistent values. The variable resistor experiment is providing a nice 3-4000 range with 2000 right around dead center.

    OBC
  • base2designbase2design Posts: 78
    edited 2011-03-21 12:59
    Based on the input I've received here, corrections are in the works.

    Thanks for getting this thread started OBC! I've had fun messing with this one... many thanks to the "reviewers" too!
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2011-03-21 15:33
    I'm pleased to have been the catalyst to the creation of more beginner information for this ADC chip.
    High praise to all who assisted in finding the errors in the document. There is now good information all the way around.
    (ADC update to be posted soon.)

    More on the way.

    OBC
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2011-03-22 10:15
  • SSteveSSteve Posts: 808
    edited 2011-03-23 21:39
    2nd edition on it's way..

    I picked up a copy too. On Amazon there are a few commenters who have found errors. McGraw Hill doesn't have an errata but I found one from an instructor who used the book in an Applied Electronics course: http://www.eg.bucknell.edu/physics/ph235/errata.pdf
  • Tony B.Tony B. Posts: 356
    edited 2011-03-24 00:44
    Thank you for your work.

    I was wondering how you created the excellent breadboard graphics?
  • garylakegarylake Posts: 41
    edited 2011-03-24 04:32
    He used a free software called Fritzing
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2011-03-24 08:02
    @SSteve: My copy hasn't gotten here yet, but thank you! I'll print it out and stick a copy in the back.

    @Tony: I use a combination of tools to create graphics for my articles. The ADC article uses a combination of PEBBLE, Diptrace, Fritzing, and MSPAINT. Those who have followed my work from earlier documents know that I've been pretty fond of MSPAINT for a long time, but I'm slowly making the transition to more professional tools.

    OBC
  • tdlivingstdlivings Posts: 437
    edited 2011-03-24 17:31
    Jeff
    Thank's for the info on how you do your excellent drawings. Somewhere I saw, maybe it was one of your posts, an MSPAINT templete for drawing circuits using cut and paste.
    I tried it and had no success, I will stick with the cadd programs.
    I tried PEBBLE and it comes up but if I try and select another board it populates the pop up window with text and after I click on LOAD it just lays there until I dump the window.
    Maybe it needs an older version of IE, I am using IE 8.

    Tom
Sign In or Register to comment.