Gadget Lab Lecture 6:Sensors and Interfacing…Microcontrollers…More Project Time Dr. Cindy Harnett ECE Dept., U of Louisville Spring 2008
Microcontrollers run the gadget universe • Remember all those “black dots” in our teardowns? Usually there’s a microcontroller underneath. Sometimes a custom made IC. Furby board • A MSP430 microcontroller talks to the 1-wire chips in the sensor project, and to the radio chip. (Texas Inst.) • ARM microcontrollers in cell phones are as powerful as desktop computers of a few years ago, and consume little power. (Made by many companies) • Nowadays: programmable in high level languages like C. • Minimalist chips like some PIC microcontrollers (Microchip) are still programmed in assembly language. • Most microcontrollers are not good at multitasking, but excel at repetitive tasks requiring good timing. ARM MSP430 Microchip PICs
Assembly Language Strict syntax, few commands Commands differ for each controller Can make up variable names Can have subroutines Should have comments! ;-------- ; change LED pattern based on state of digit_index and dot_index ;-------- Display_now movlw 0x05 xorwf dot_index,w ;test for end of digit movlw 0xFF ;pattern for blank column btfsc STATUS,Z goto D_lookup_3 ;it needs a blank bcf STATUS,C ;clear carry before a rotate rlf digit_index,w ;double the index because each addwf PCL,f ;takes two instructions
How do you program microcontrollers? • Get or build a programmer that plugs into a PC. Can program in a ZIF socket or in a circuit. • Get software that “cross-compiles” from your PC to the target chip. Usually sold by the chip maker, sometimes 3rd party • Usually there’s a free development environment that lets you code, compile, and download your code onto the chip • Fancy hardware (debuggers, emulators) is usually available to catch run-time errors.
Learning to use microcontrollers ECE 412, Computer Interfacing (uses 68HC11 chips) • Take ECE course specifically on microcontrollers: • Or pick a starter project like lighting a 7-segment display and learn from examples • Microchip PICs are versatile and cheap--if you stick with assembly language--http://www.phanderson.com • MSP430 tools are also inexpensive ($20-$40) • Or get a module like a Basic Stamp or Arduino, with a large online community and plenty of code
From last time: Computer Interfacing • LabView PCI or PCMCIA cards and connector board very common in research labs • http://www.ni.com • Lower cost: “Phidgets” have analog inputs and USB to PC • http://www.phidgets.com • Even cheaper, dedicated circuits such as the 1-Wire DS2450 converter • http://www.maxim-ic.com • And many more…
From last time: Demos based on lab projects at U of L: 1-Wire and wireless sensor interfacing http://www.maxim-ic.com/products/1-wire/ “1-wire” chips allow multiple sensors to be connected to the same wire for weatherstations and similar devices. (Thermometer Demo) Wireless sensor board can poll multiple sensors on the 1-wire bus. (Flow sensor demo)
Antepenultimate* Slide of the Entire Semester • Thanks for being the Gadget Lab “guinea pigs.” Comments? What should be changed next year? • See IEEE student group for jumper wires/other gadget building tools. • Slides and most websites I mentioned in the course are available on BlackBoard. • Visit ECE labs in BRB/Lutz/Speed! *2 more slides after this one. This word is “drittletzt” in German
Soldering “Tips”Heat the part, then solder will flow onto it. If solder is only going onto your wire but not your motor, you’ve probably noticed that thin wires heat more quickly than chunky motors. Try heating the motor first, then bring the wire in just before soldering.Attach copper foil to your motor: copper solders easilyIs the tip blackened (oxidized) so much that the solder won’t melt? Dip the hot solderingiron in tip-tinner. Avoid touching the soldering iron to the sponge for more than about 1 second. Long contact will oxidize the tip.Work at the lowest temperature you can, to avoid oxidizing the tip.Sandpaper can be used in tough cases (let your tip cool off first), but eventually it will remove the tin plating on the iron.You will need a new tip someday.
Project Time! And A Special Announcement-- Feb. 16: Engineering Day at the • 727 West Main Street • 12:30-4:30 (drop in anytime) • Show off your projects at the ECE table