320 likes | 339 Views
Design Realization lecture 17. John Canny 10/21/03. Last Time. Electronics: A/D boundary. This time. Processors and networks Printed-circuit board design Sensors. The art of electronics. Practical electronics departs in several ways from the ideal model:
E N D
Design Realization lecture 17 John Canny 10/21/03
Last Time • Electronics: A/D boundary
This time • Processors and networks • Printed-circuit board design • Sensors
The art of electronics • Practical electronics departs in several ways from the ideal model: • There is no perfect wire. Every connection has finite resistance and finite inductance. If either high current, or high frequency current passes through a connection, it will cause a voltage drop. • This is particularly acute for power supply wires.
Stray capacitance • There is no perfect connection point. Any two conductors near each other form a capacitor. Such stray capacitance can be strong between nearby conductors on either side of a PC board, or between pins on a chip. • These effects are worst at high frequencies, and with high voltages.
Feedback and isolation • For both these reasons it’s a good idea to physically separate large signals from small ones, especially if the system does large amplification (say 100-1000 times) – because the large signals are controlled by the small ones, which can lead to feedback and uncontrolled oscillation. • Don’t try for too much gain from a single stage amplifier.
Power supply bypass • Capacitors (and inductors or resistors) can be used to isolate component power supplies:
Printed circuit boards • The most widely-used connection system for electronics. • Typically epoxy or other plastic board with copper conductors. • Usually two or more layers of conductor. • Holes are drilled and copper-plated to allow component insertion + connects between layers. • There are other prototyping systems for circuits, but its often best to go straight to board design: • Start dealing with layout issues immediately. • Avoids difficulties due to the prototyping hardware.
PCB tips • Main idea is to join the component pins that need to be joined, but there are some tips: • Ground and power conductors should be large, as straight and direct as possible. • All conductors should be as short and direct as possible (avoid sharp turns which increase inductance). • For two-sided boards, it often helps to prefer horizontal runs on one side, vertical on the other.
PCB tips • Keep large signals away from small ones. • Place bypass capacitors physically close to the pins being bypassed. • Use sockets for expensive components, or components that may need to be replaced.
PCB systems • ExpressPCB is a software system for fabricating small boards, which can be sent directly to the vendor for fab. • Also draws schematics. • EX USB and serial sensor boards.
Processors and networks • For a device to be “intelligent” it needs some computation (a processor) and some communication (a network). • In the simplest case, the “processor” only provides communication between some sensors and a remote computer. • This is the idea behind the “1-wire” system.
1-wire system • The “wire” carries both power and communication, hence 1-wire. • You still need a ground wire, so this is really a 2-wire system. • You talk to 1-wire devices directly through an interface chip, either serial or USB.
1-wire system • DS2480B: a serialto 1-wire interface. • TXD and RXD areserial data (POL setspolarity) • GND, VDD, VPP arepower lines. • 1-wire goes to the bus.
1-wire system • On a 1-wire bus, you can add: A/D and D/A converters, thermometers, timers,… • Each device has a unique address. The main processor can query the bus to find all the devices on it. Then it calls them individually. • Example
1-wire advantages • Simplest hardware, cheap, small devices. Two or 3-wire bus possible. • High-level drivers already written (in C, Java and MS Com). • Interfaces for serial or USB.
1-wire disadvantages • Slow: hard to achieve more than 30kb/s (although 100k is theoretically possible). Only useful for slow sensors: temp., light, etc. • Missing interfaces: PWM, r/c servo control • Low quality software: speed and reliability issues • Some software only available for PCs (no source code).
Single-chip microcontrollers • Microchip’s PIC chips (also Atmel) • Virtually everything is on one chip (PIC specs): • Processor (8/16-bit) • Program memory (512 – 32k words) • Data memory (80 – 3k bytes) • A/D converters (up to 16 x 10-bit channels) • PWM converters (up to 14 x 10-bit channels) • Standard serial bus up to 6Mb/s (RS232-RS485) • Two-wire industrial bus (CAN bus, up to 2Mb/s) • Hardware timers (real-time program threads) • PIC pin counts range from 8 to 80 pins.
PIC programming • Simple to program – available C compilers • Some not reprogrammable, but many have either flash or UV-erasable program memory • Limited program/data memory but seems to match typical PIC applications well. • Arithmetic performance weak, most don’t have hardware multiply – but new generation of PIC/DSPs have much more arithmetic power.
PIC advantages • Very wide range of applications, low cost (~$10) • Often a one-chip solution (plus timing crystal). • Increasingly sophisticated network support (integrated CAN bus). • Programming is quite easy (C compilers or assembly code).
PIC disadvantages • Limited memory for program or data. • Slow arithmetic. • High-level network support missing (e.g. ethernet or USB).
SOC “Systems on a Chip” • More powerful processor + ethernet controller, e.g. Gridconnect GC-LX-001 ($25) • Communicate with other chips using SPI (Serial Peripheral Interface): a short-range serial protocol with a speed of 10 Mb/s. • Can be used with a PIC chip for other I/O. • Is it really a “system-on-a-chip”? (board costs $300, chip has 180 pins!!). Complex supporting hardware.
SBC: Single-Board Computers • Applications that are too large for one or more chips fall in the single-board computer realm (note: a multi-PIC solution will often be cheaper than an SBC). • There are many options here. CPUs range from simple 8-bit (68HC11) to Pentium IV PCs. • Cheapest option (?) the Dallas TINI board – ethernet, Java, 1-wire, CAN-bus, ~ $100
SBCs • If you need an SBC beyond TINI you probably already know why . • Too many choices to summarize here, but be sure to consider using a PDA: • Price/performance very good compared to OEM SBCs • You get a screen, pointer and some interface buttons • “Performance primitives” for Intel chipset hardware, useful for cryptography, signal and image processing.
Networking • Simplest way to communicate with a small CPU: serial port or “RS232”. • One transmit wire, one receive wire, plus ground – 3 wires only are sufficient. • Flow control wires in both directions (4 total), need these if software expects them. • Traditional RS232 works up to 115kb/s
Serial Networking • Slight tweaks on RS232: RS422 and RS485. • RS422 is a faster version of RS232: individual signal wires are replaced by twisted pairs, which can be driven faster (10Mb/s, up to 40 ft). • RS485 is a multi-drop version of RS422: in “half duplex” mode, many nodes can send and receive on the same twisted pair (10 Mb/s). RS485 is a true “network” and a good choice for networks of simple devices.
Control Networking • For industrial control, several bus standards exist, including CAN (Controller Area Network) and LIN (Local Interconnect Network). • CAN has a full “protocol stack” like TCP/IP, for packet communication, routing, and error recovery. Hardware built into some PICs. • It is a true multi-drop 2-wire standard, like RS485, no hubs are needed. • CAN is designed to be reliable in very noisy environments (automobiles and industry), but is rather slow (1 Mb/s) and code is complex.
USB • USB or Universal Serial Bus is a popular option for external device communication. USB 2.0 is very fast (480 Mb/s), USB 1.1 is 12 Mb/s. • It’s a 4-wire system, which is really point-to-point. A “network” is built using hubs. • Tricky to use for small networks, because of topology constraints (limited depth -> limited nodes in a chain), and the need for many hubs.
Ethernet • Like USB, really a point-to-point topology, so hubs needed to build networks. • Ethernet driver chips relatively complex and expensive and the protocol (TCP/IP) is complex. • Still the best way to put a device “on the network” without a supporting computer.
Irda • Infrared protocol based on serial communication. Many serial modules (e.g. the ones in PICs) support Irda. • 2 Mb/s common. • Very limited range, high power required.
Bluetooth • Very popular wireless standard. • Class 2 Bluetooth (20m range) available via compact (1” x ½”) modules for $60-70. • Communication via fast serial or USB. 768 kb/s typical. • Some support for analog data,including speech. • See http://www.btdesigner.com/
Summary • PC board design and layout issues. • Processor classes: 1-wire, single-chip micro-controllers, systems-on-a-chip, single-board computers, and PDAs. • Networks: RS232 and its variants, CAN-bus, USB, ethernet, Irda, Bluetooth.