Shop OBEX P1 Docs P2 Docs Learn Events
How to start Microcontrolling using the Parallax Propeller — Parallax Forums

How to start Microcontrolling using the Parallax Propeller

deSilvadeSilva Posts: 2,967
edited 2008-03-17 17:29 in Propeller 1
Dear All,
during the last months I have collected a lot of material wrt how to teach "microcontrolling".

My classes were quite simple: I told the students what they ought to know and showed them what to do, and then I pulled my hair out when they didn't.

Interaction was most important. Being a group was also.

This all does not apply to a book. A book is a very, very lonesome thing.
So there is much work in front of me, but I would like all of your opinions about the contents before...

What you read here is my twenty first draft, so I already invested some thinking in it. But there is always this infamous "change of paradigm". Maybe I am perfectly wrong?
But I also appreciate the smalles improvement.

Please understand I shall NOT respond immediately...
Thank you

======================================

How to start Microcontrolling using the Parallax Propeller
Made easy in 24 chapters
by deSilva

Preface

Your son just finished his M.Sc.. in E.E.? Your wife works as a senior programmer in one of the Forbes Top 100 Companies? Grandpa was First Degree Telephone Technician?

And you? Well, you have SOME idea of voltage and current, maybe work an electrical toy-train, and do not short-circuit your household fuses by wires…. Although no, you would never say to be a Radio Amateur or such… You have not even a soldering iron…

And programming? Well, your wife starts laughing each time you say “BASIC” or “GOTO”, but you even attended an adult education course for a programming language some years ago.. was it C#? Or VBASIC? But is was fun – and you still have the manuals…

And now: You do not want to be the only computer illiterate in the household! A Microcontroller, that’s what you want to have! A Microcontroller!

Then rejoice, because this book was written just for you! Proceed straight forward to the cash point and take it home. You will need some more things but this book, but we shall come to that slowly…

But what if you have no electrical toy-train, have no training manuals for a programming language, and your son has become a football star rather an E.E.?

Well, I should be an idiot to loose business….. Maybe we can come to an agreement: You do a little bit of programming on the PC before? Using one of the many books that promise to teach it to you?

You see, you have to LOVE programming to do microcontrolling; otherwise it wouldn’t work out. Microcontrolling – in some way - is doing electronics by software.

Yes, I said ELECTRONICS. This is your other weak spot? Not just sure how to calculate the resistor needed for an LED? There are also books (and internet sites) about these topics. Go to that first.

You have to be realistic: No skiing, no shooting, and starting Biathlon?

Of course you can succeed – but there is A LOT of work before you…
In any case…

I shall help as much as I can!
deSilva


Table of Contents

1. Electronics
-a. All these funny little parts (Resistors, caps, diodes, LEDs, CMOS SSI chips)
-b. But where comes all the power from? Rechargeables and other ways to shine a light.
-c. Oh dear: Kirchhoff’s rules, Ohm’s law, and then those darn caps….

2. Using Breadboards: Soldering? No, thank you!
-a. But we need some tools anyhow: Tweezers, side cutters, pliers, some small turnscrews, and a multimeter

3. What some CMOS chips can do.. So why do we need a microcontroller in the first place??
-a. Oscillator, Counter, Decoder
-b. Pull-Ups and -Downs, ESD diodes, and limited current

4. Parallax Propeller
-a. What? That’s all? But It took me just 10 minutes!
-b. Installing the PropellerTool
-c. A first program

5. SPINNING your way through the Processor
-a. DIR, IN, OUT
-b. Loops
-c. Ifs
-d. Data

6. Your first three programs – And don't look at the Sample Solutions smile.gif
-a. Switching LEDs (Pull-Ups again, Debouncing)
-b. Dimming LEDs (PWM)
-c. But is that music? (Computing a Scale)

7. Using Libraries
-a. Ariba’s PropTerminal
-b. Having a look at Numbers, Serial, and the like

8. More Complex Hardware
-a. Multiplexing a 4x 7-segment display
-b. Using a 2x16 alphanumeric display
-c. More about SPIN

9. Digital view and real world
-a. What a resistor really does
-b. What a cap really does
-c. Two ways to DAC
-d. Some ways to ADC

10. Back to the roots: What’s all inside a Propeller?
-a. Timers and Counters
-b. COGS
-c. Machine Language (a somewhat longer chapter)
-d. What makes the Propeller so singular?

11. Interfacing more hardware
-a. Soldering “modules” for our breadboard
-b. PS/2
-c. TV
-d. Audio

12. But is there also C?
-a. We’ll see…

13. Project A: Receiving IR from all our RCs – the cheapest input of them all
-a. The theory of 36 to 40 kHz infrared communication
-b. All the protocols….

14. Project B: Interfacing I2C
-a. As always: Some theory
-b. Accessing the ERPOM
-c. Accessing a “Port Expander”
-d. Accessing an ADC

15. Project C: When I2C is overkill.. More ways to expand your ports
-a. Shift registers chips
-b. Multiplexer chips
-c. Decoder chips

16. Project D: MMC/SD Cards

17. Project E: Is TV really a black art?

18. Project F: Motors
-a. Cheap Servos
-b. Stepper Motors

19. Project G: Doing True Graphics
-a. Drawing, lines, arcs, shapes
-b. The art or XORing
-c. Do we have some libraries? (Images, Buttons, Widges?)

20. Project H: I still have to see that 160 MIPS!
-a. Divide and Conquer
-b. The Mandelbrot Set
-c. Artificial LIFE and other CAs
-d. Using Floating Point for a simple simultation

Note: Still 4 chapters spare smile.gif
=========================================

Post Edited (deSilva) : 3/13/2008 8:20:52 PM GMT

Comments

  • HarleyHarley Posts: 997
    edited 2008-03-13 20:38
    deSilva,

    I don't have suggestions for your book at this moment, but am glad to see you didn't just slink off. Good to see your request for suggestions.

    Looking forward to the completed book. Such a task to take on. Such energy. Busy task writing.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Harley Shanko
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2008-03-13 21:23
    deSilva,

    I would like to read this book when completed·

    I like the idea.gifs that you have so far

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them

    ·
    ·
    ·
    ·
    Sam
  • Mike HuseltonMike Huselton Posts: 746
    edited 2008-03-13 22:35
    deSilva,

    Thank you for sharing this information. I'm looking forward to seeing the completed book, or at least some first drafts.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    JMH
  • Shane De CataniaShane De Catania Posts: 67
    edited 2008-03-13 23:24
    Hi DeSilva,

    With regards to this book, some friendly banter in the preface is always nice and definitely worth putting some effort into. Also the mix of practical electronics and programming should make the book a complete resource, allowing newcomers to complete projects with a real understanding of the software, as well as the hardware. I assume you will be writing this book in English, so of course it’s important to get your thoughts onto the page with something close to proper English grammar. I’m sure you won’t be offended when I tell you that sometimes Your English is a little bit like Yoda English – not quite right it isn’t. You’re obviously quite understandable and enjoyable to read, but I do occasionally find myself having to re-read sentences in order to grasp your intended meaning. That is certainly true for what you have written above. That is of course not a problem, because it can all be easily fixed by one of the many friendly, helpful and willing volunteer editors here on this forum!

    Good luck, I look forward to seeing more.

    Cheers,
    Shane.
  • AbelAbel Posts: 15
    edited 2008-03-13 23:35
    deSilva is back, deSilva is back (....dancing around the room)

    "
    19. Project G: Doing True Graphics
    -a. Drawing, lines, arcs, shapes
    -b. The art or XORing
    -c. Do we have some libraries? (Images, Buttons, Widges?)
    "

    -b.· The art of XORing "?"

    ·lol.gif
  • RinksCustomsRinksCustoms Posts: 531
    edited 2008-03-13 23:44
    I vote complete the book! Understanding EE is esential if you want to program successfully, of course you know this, but you were thoughtful enough to include at least some EE theory/labs. That alone will make this book invaluable, i still refer to Forest M. Mims III Mini Notebook series from time to time as it is still easier for me at this point to just construct a LP/HP/BP audio filter and connect it, rather than try and hash it out in code. And having all this mutually related information in one big book (perhaps as large as the HYDRA book) is like having a bible of electronics/MCU'ing right there at your fingertips. The layout of the book is well thought out and smooth in transition, keep at it, it'll be a great book.



    A though for later down this road, package a proto board & maybe a starter parts kit with the book, like a Whats A Microcontroller kit (BS2).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    E3 = Thought

    http://folding.stanford.edu/·- Donating some CPU/GPU downtime just might lead to a cure for cancer! My team stats.
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-03-14 06:03
    deSilva, the book looks great. Does this mean that I am going to have to finish the graphics driver and actually put comments that make sense in it? smile.gif

    Just one question, who is the book aimed at? From your preface it looks like older people that would like to play around with microcontrollers but who don't have much (or any) experience with electronics or microcontrollers. But then you say that they should know about programming and basic electronics. What level of understanding are you aiming at? Also, a couple of the last chapters look they could include some pretty heavy maths. Personally I would enjoy this but will your target audience have the background to handle mandelbrot sets and AI?

    If you write an English version I will almost certainly buy one. smile.gif

    Edit: Oh, and I should say welcome back even if you aren't answering questionssmile.gif
  • deSilvadeSilva Posts: 2,967
    edited 2008-03-14 09:23
    Thank you for your remarks so far. I had hoped for a little bit more critical postings wrt (obviously?) MISSING things....

    * I left things out for three reasons:
    - It had turned out that they were not needed to know to DO things; maybe I shall add an appendix containing a snapshot of some wikipedia articles ("What is FLASH memory, and other more or less useful things to know...")
    - This will be not a book about the Propeller! To my opinion the Propeller is the best possible way to get into contact with this fascinating matter at the moment; but this can easily change smile.gif Note e.g. that the Propeller II will be extremely inappropriate to START with microcontrolling...
    - Sensors! This is a never ending story, deserving a library of its own. But I shall add one or two projects (temperature, light, magnetic field)

    * The audience: To know them makes certainly the difference between success and failure. I will request some pre-knowledge. So the very young are out. Missing the environment of a "class", a certain background in the neighbourhood will help enormiously - that was the obviously unclear scenario I sketched in my preface...

    * The size: I do not want it to become the size of the Hydra book.....

    * The language: Oops, I thought I made it clear I shall do it in German smile.gif One reason is that there is no other chance for Parallax to sell any single Propeller chip in Germany without it. The second reason: It is unavoidable that - be it by Parallax itself, Parallax induced, or for other reasons (cf. Martin Hebel) English books will turn up soon, as they did for the BasicStamp.
  • Nick MuellerNick Mueller Posts: 815
    edited 2008-03-14 11:06
    As a plot for such a book, I'd browse again through the book "Mit dem PIC-Controller erfolgreich arbeiten" by K
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-03-14 11:36
    Like Nick said a bit on op-amps or other types of signal conditioning would be good. Maybe some really basic filter circuits (you may be planning to cover these in one of the sections on caps but I'm not sure).

    If you want to do something more advanced how about a Kalman filter, fourier analysis or some matrix solvers/multipliers. Only problem is that these will require a fair bit of maths to understand...

    Looks like I may have to get someone to translate it for me smile.gif
  • Christof Eb.Christof Eb. Posts: 1,173
    edited 2008-03-14 11:40
    Hello deSilva,

    questions are going through my head:
    1. This seems to be a REALLY big project? (For me (300 pages, 3 pages per day????) it would be a fultime job for several months, perhaps it's possible to split it?)
    2. Is the propeller the optimum chip to "start microcontrolling"?
    3. For completeness, what about the counter system?

    It looks like a very interesting book. (There is a severe lack of information in german language. Kids, who are in a good age, have difficulities reading the english texts fast enough.....)

    Christof
  • hippyhippy Posts: 1,981
    edited 2008-03-14 13:16
    Looks good, but I am intrigued as to its scope and the target audience, it runs from having little clue about electronics, "All these funny little parts (Resistors, caps ... )" to some quite complex projects. I wonder if it would not be better in two parts or separate books, taking your audience from novice to competent then competent to expert ?

    For a book which isn't Propeller specific, missing chapters would seem to be an introduction to microcontrollers and their various architectures ( von Neumann and Harvard ), single core, multi-core and multi-processor systems, plus an introduction to the concept of programming and the wealth of programming languages. Debugging could well deserve a chapter of its own.

    Another question is what skills does someone need to do successful "microcontrolling" ? Posters here have varying views; strong EE skills, a good understanding of digital electronics, good understanding of maths. I'm not sure anything other than a superficial understanding of any of that is necessary but it depends what one means by microcontrolling.

    I'm not sure about your, "you have to LOVE programming to do microcontrolling", either; I'm thinking of those who have tinkered with analogue or digital circuitry but have never touched a micro before. A love of programming will undoubtedly come but I don't see it as a pre-requisite.

    In your preface you suggest your reader should already understand how to calculate the resistance for a LED, but if they have reached that skill level already it seems to make the first three chapters largely redundant.

    Too wide in scope is what I think is the biggest risk to success of the book. Beginners may be put off by the speed it moves from simple to complex, those already with some skills may find the book to be mostly unfulfilling, the few who can go from near nothing to skilled microcontrolling will be the minority.

    You've had the practical experience whereas I have not, and not least it's your book ( and your target audience may be different to what my target audience would be ), so good luck with it no matter what form it finally takes.
  • Nick MuellerNick Mueller Posts: 815
    edited 2008-03-14 14:21
    > I'm not sure about your, "you have to LOVE programming to do microcontrolling", either; I'm thinking of those who have
    > tinkered with analogue or digital circuitry but have never touched a micro before. A love of programming will undoubtedly
    > come but I don't see it as a pre-requisite.

    It takes a lot more nerves, experience and skill to find a bug in a µC program compared to debugging on the PC with
    * no time constrains
    * singlestep-vartracing-whistleAndBells-debuggers, simulator, PC-lint, bounds-checker, stack-trace, post-mortem-debugger, ...


    I don't remember that I ever debugged on the PC needing a scope therefore.


    Maybe you forgot all that already. smile.gif

    Nick

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never use force, just go for a bigger hammer!

    The DIY Digital-Readout for mills, lathes etc.:
    YADRO
  • steve_bsteve_b Posts: 1,563
    edited 2008-03-14 14:39
    It'll be interesting to see how your wording comes out....

    Your preface looks good....I like the "loose" feeling of "buddy" written books. What I mean is the side bars and jokie anecdotes you sometimes associate with "..for Dummies" books.
    If you can keep this feeling through the book, I think most people will find a 300 page book a JOY to read.
    My favorite book is my "MAC OSX for Dummies" and "Garageband for Dummies"....incidentally the only dummy books I own. They include nice "sidebars" with tips and warnings. (another good book is EcoHolic; great use of "note blocks" and web addresses)

    I think your list is a good first step... The scope is somewhat wide and you may find you need to chop it in to 3 books (beginner/intermediate/semi-pro...pro's don't need a book..do they? [noparse];)[/noparse]
    You'll never quite get all the information in to it that you may want....so include references to websites for added material (the bugger here is that those sites might die off and leave your URL useless...perhaps a google reference).

    I've neglected to jump in to the Propellor (I have purchased a kit) is the real "NEED" for something done on the propellor that would get me over the learning hump (and lack of resources like the stamps have -- literature-wise). A hard thing to include in a book of this scope is troubleshooting....I believe there's a debug "module" that might be worth a reference but some sidebars listing how to "check" circuits with DMM's and Scope's might be worth something to the begginer/intermediate students.

    (if you need some help with english grammar, I would offer help, although I'm sure there are many here with the same/better credentials)

    Cheers

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <FONT>Steve



    What's the best thing to do in a lightning storm? "take a one iron out the bag and hold it straight up above your head, even God cant hit a one iron!"
    Lee Travino after the second time being hit by lightning!
  • Beau SchwabeBeau Schwabe Posts: 6,562
    edited 2008-03-14 16:54
    DeSilva,
    ·
    I too enjoy·your humor, and would think that it would be a joy to read through a book if it kept with that style of presentation throughout the book.· I also agree that it might be beneficial to go over various methods of debug that might appeal to the beginner or intermediate student.· For example: Most everyone starts out with simple light-bulb or LED type debugging indicators, and then perhaps an audio indicator of some kind, eventually moving on to a LCD, scope, TV, etc.· For the beginner, using test equipment beyond an LCD can become quite expensive and in some cases not obtainable.· For further example.... suppose that a not so green beginner "really" wanted to do something with IR or ultrasonic, but didn't have a scope?· How do you know that you even have signal?· A debugging "trick" could be to use a frequency generator (<- simple adjustable oscillator type of circuit) to heterodyne with the 38 kHz or 40 kHz to bring the signal into a perceivable audible range to the user.· A "trick" that even has some educational benefit for·much more advanced applications.
    ·
    ·
    ·- Ich bin froh, daß Sie sind zurück !



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.

    Post Edited (Beau Schwabe (Parallax)) : 3/14/2008 5:00:49 PM GMT
  • deSilvadeSilva Posts: 2,967
    edited 2008-03-17 09:40
    Again, thanks for all your remarks! (Hope I can repeat this many more times smile.gif )

    (1) Indeed "real-time debugging" needs more attention... I shifted it to "Machine Language" and Ariba's excellent PASD. However his cannot work... Some very good ideas from Beau!

    (2) "Signal Conditioning" will be handled more systematically (which also means: more boring). I see the confusion arising with so called "H-bridges" all the time, which brings many things up to the point... In my original concept (and the basic classes) , transistors and opamps were out for some reasons, but that cannot be in the book ...

    (3) I still do not know how to handle "complex protocols". By this I mean anything based upon bi-directional data transmission. Note this already starts with PS/2 mice...

    (4) I think I cannot stick to I2C only, which was my pet idea. Most high speed devices use a simpler SPI-like approach, which is NOT a standard. This will lead deeply into "How to read a data sheet"

    (5) I have a good idea about and material for the main part. But I am neither sure where this book should start nor where it should stop. I am quite good with the Socrates method ("re-activating and re-wiring hidden knowledge"). I am not so good with a "blank mind"...

    (6) "... to love programming...." The book will have to presume (any kind of) programming skills. This has become much clearer for me during the past weeks. A book about microcontrollers for the electronic wizzard will look completely different....
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-03-17 10:30
    A lot of the programming textbooks that I have seen have a very small section at the start of the book about using pseudo code and flowcharts. They say how everyone should use them and then for the rest of the book never use pseudo code of a flowchart once. I know that a lot of people don't do flowcharts or pseudo code because they are lazy but are the programming text books encouraging this by not using them throughout the book?

    So, I guess what I am trying to say is try to install good habits in people by using good programming habits (like doing flowcharts and pseudo code) in your book. I know you would do this anyway but as I have seen it in many textbooks I thought that I would bring it up.
    deSilva said...
    This will lead deeply into "How to read a data sheet"
    This is a most important skill and applies not just to communication standards but also things like learning new programming languages, using electrical components, using mechanical components etc. How to teach this is beyond me though. It almost means learning a different way to thinking.

    Communication protocols are interesting. I would start with uart as that is easy to understand and experience with that can be applied to spi. Then do TWI as this seems to be used a lot and is fairly difficult protocols to learn without help.
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2008-03-17 13:28
    Looks really good, it's general in that it covers a wide range of subjects but specific in that it concentrates on using a particular processor. To me this is a real strength, it is like having a friendly expert on tap giving you the inside story on how to do things.

    I really like the less formal approach which in fact was often taken in older scientific papers, rather than trying to sound clever and scientific they would try to give the reader the required knowledge and were not afraid to give practical advice but all backed up with rigor, none of those pop science non-explanations.

    I'll buy it and I don't think you should be afraid to ask for advice from the forum on particular topics as they come up.

    Graham
  • liljoentxliljoentx Posts: 25
    edited 2008-03-17 14:08
    What a terrific venture! I wish you well and look forward to the finished product.

    Just a catalogued collection of your multitude of helpful hints and answers to people questions here would probably suffice....seems as if much of this forum's contents and many additions to the Object Exchange are your contributions anyway! Danke sehr!

    Und viel Erfolg!

    Lil'Joe in Texas
  • The MuleThe Mule Posts: 9
    edited 2008-03-17 16:01
    deSilva,

    I've been trying to avoid learning programming for several years--too much else to do and learn--but am now at a point where I absolutely, positively must (and will) learn itnd since I've recently had quite a bit of exposure to the Prop, I need to learn Spin, and probably PASM.

    My problem is than my programming experience is limited to one class of Business BASIC in 1987 or so, and it was the most difficult class I took in college (had to take it twice to pass [noparse]:p[/noparse]· )

    If you want a willing and motivated student as a test-monkey, I'm interested!

    To Everyone else:· I'm open to suggestions as to books to get to lay a foundation for coding in Spin/PASM. What other common programming language would be the closest to Spin?
  • potatoheadpotatohead Posts: 10,261
    edited 2008-03-17 17:29
    DeSilva,

    "But I am neither sure where this book should start nor where it should stop. I am quite good with the Socrates method ("re-activating and re-wiring hidden knowledge"). I am not so good with a "blank mind"..."

    Yeah, this one is tough --damn tough.

    I've a coupla ideas that help me when I'm blocked. Not always, as I am blocked RIGHT NOW, but that's another post, I guess. Here they are, for what they are worth.

    Tell a story. The most compelling read is that spark of discovery and it's most bright when put into some greater context.

    Another good one is write to a good friend, who you know would enjoy the text. That method is extremely helpful where keeping style and overall continuity within limits that others can relate to.

    There is a connection between reader and author that story and some light drama enables. If you've got some greater theme, and I suggest technology empowerment, then a story can fall around that, with the bits of info sprinkled liberally throughout.

    Have a student that would really enjoy that text? Write it to them, as an alternative to the good friend.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!

    Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
Sign In or Register to comment.