Al Williams (WD5GNR)'s newest electronic column about electronic design, embedded systems, ham radio, and other geeky things.
Monday, February 18, 2008
Is it Basic or is it C? Its SEABASS
Personally, I like to program in C. Luckily, there is pretty good C language support for most modern microprocessors. However, if you don't know C, its a pretty steep learning curve. Sometimes you just want to bang something out quick.
If your processor wants you to use C but you want to use Basic, you might try Seabass. Seabass is a BASIC compiler that outputs C code. So anywhere you can compile a C program (even on Linux or Windows) you can write BASIC programs. Even better, Seabass integrates with existing C libraries and you can even embed C code in your program.
The link shows an entire article about using Seabass to produce some Morse code on an Atmel AVR and a PIC. Here's the first part of the AVR program:
include "avrio.bh" ` get I/O routines cinclude "app4delay.h" ` get delay routines (from C) #link "app4delay.c" ` include C library
` Define a string type deftype string char *
` Speed of a dot in milliseconds Const speed=200
The first line includes a basic header file (by convention, these files have a .bh extension). This is a SeaBass file (included on the CDROM) that provides some common I/O routines for the APP-IV (the target board). This line allows us to use things like HIGH and LOW to affect the I/O pins.
The second line includes a C file, not a SeaBass file. This file is one that the APP-IV kit supplies and provides an easy way to write delays. Notice the line just under this tells the compiler where to find the associated C file. If you are manually compiling SeaBass' output, this isn't necessary, but if SeaBass controls the build process, this will allow it to automatically bring in the correct C code that your program needs.
Type names in SeaBass have to be a single word. However, many C types use multiple words (or even symbols). For example, if you want to deal with a string, in C you use a character pointer represented by "char *". The SeaBass DefType statement allows you to make a SeaBass type that represents a complex C type:
` Define a string type deftype string char *
The final part of the initial part of the program sets a constant using Const. In this case, the speed value is set to 200 (this will be the number of milliseconds to delay for a dot).
Now it is very simple to understand the main code:
` Main program function main() as int dim text as string dim i text="-.-. --.-" ` message to send ` Set LED to output OUTPUT(B,0)
The first two lines in the function define variables (notice one of them is a string).
Here's the main loop:
` Main code top: for i=0 to strlen(text)-1 ` walk through text ` do the right thing if text[i]='.' then dot() end if if text[i]='-' then dash() end if if text[i]=' ' then space() end if next
Notice that the program uses the C library call strlen to find the length of the string. Of course, you could write a version of strlen in SeaBass, but since the C compiler already has this function, why not use it?
I've been lucky enough to own two hot air stations. An Edsyn Atmoscope which I loved to use but had some limitations on larger parts and a Aoyue hot air station which is more flexible, but not the build quality of the Edsyn.
However, because I like to tinker I've also tried a few home-grown solutions. Most of these center on an aquarium pump for air and steel wool for a heat exchanger. I haven't had good luck with these -- maybe because I don't have the right components or maybe because I'm "spoiled" with real tools.
The truth is, the best "cheap" results I've had have been with an $20 embossing gun I got on sale for $10 at Hobby Lobby. If you are handy enough with metal working to get it to accept they cheap Aoyue tips, I think it would be good enough for just about everything and they are cheap enough to replace if you burn one up.
Here's a homebrew station that looks promising though. It uses part of an old hair dryer and a soda bottle for the air source. I haven't tried it, but surely it would produce more air flow than what I've done in the past.
Another idea is to hack up a "heat gun". Here's at least one (plenty of other homebrew SMD irons on the same site).
This little robot is made with two perf boards from Radio Shack (one of them cut into two for the sides). This board is easy to work with because it has a grid of holes. It is very easy to make nice straight cuts (or even just score and snap). It is also perfect for drilling exact holes. Basswood and polyurethane glue holds it all together (along with a few screws).
The drive consists of two Futuba RC servos modified for continuous rotation and a caster wheel from Home Depot in the rear. The tires are 2.25" RC aircraft tires.
A 4xAA holder under the top deck powers the motors. The 9V battery on the top is just for the electronics.
The electronics is the GP3 board which has been programmed by the GP3EZ software so programming the robot is simple point and click.
The sensor is a Panasonic IR sensor tuned for about 38kHz. The IR LED is pulsed through a 2N2222 with the GP3's PWM at 32kHz which is close enough that it works. A piece of antistatic foam pushed into a pin header blocks the sensor from seeing the LED directly. When something is in front of the bot, it sees the IR bounce off of it. It would be easy to add more LEDs (for example, two on the corners). The sensors could be paralleled or just connected to more I/O pins.
Here's the software (dumped out to HTML by GP3EZ; the real software is all constructed using GP3EZ's point and click interface):
Step #
Tag
Condition
Action
Next
Notes
1
Start
Always
LED Off PWM: 200 freq=32766
Start IR and reset LED (for when we finish turning)
2
MainLoop
Input: XXXXXXX0
LED On
object
Check IR sensor
3
Always
Pulse: pin 7 2000
Drive forward
4
Always
Pulse: pin 6 1000
Drive forward
5
After 20 ms
MainLoop
Servo delay (20ms)
6
object
Always
back (set bookmark)
We detected something, so back up a little.
7
turn
Always
Set Loop A to 20
Start turning (just under 1/2 second)
8
turn0
Always
Pulse: pin 7 2000
pulse motors the same way
9
Always
Pulse: pin 6 2000
Inserted step
10
After 20 ms
turn0 (Loop A)
Pause and loop for 2 seconds
11
Input: XXXXXXX1
Start
If sensor shows clear (high) then go back to forward motion
12
Always
turn
Sensor wasn't clear so do some more turns
13
back
Always
Set Loop A to 100
Back up for about 2 seconds
14
back0
Always
Pulse: pin 7 1000
Turn motors in reverse
15
Always
Pulse: pin 6 2000
16
After 20 ms
back0 (Loop A)
Delay and loop
17
Always
{last bookmark}
Go back to caller
The table is easy to understand. The step number should be obvious. The "Tag" is a label that names a particular step so you can refer to it later. Each step has 3 major parts:
Condition - This must be true for the step to execute. Many of the steps are marked "always" and some are marked "After xxx milliseconds". These will always execute, of course. Note the lines that work with the IR sensor, however. They only execute when a specific condition is true.
Action - When the condition occurs, this is what will happen. The GP3EZ can output digital values, PWM, pulses, and do a variety of other tasks as part of the action. If you are connected to a PC (the robot isn't) you can write data to a file or execute external commands.
Next - When a step executes, this column tells the program where to go next (which is usually the next step).
The note field is just a comment and is ignored by GP3EZ.
Note that the GP3EZ supports looping and subroutines. For example, at the "object" tag, there is a transfer (in the next field) to the tab "back". The notation says that a "bookmark" is set. If you find the back label, you'll see it does several steps and then goes to the "last bookmark." This is nothing more than a subroutine call and return. You can see examples of looping in the object and back routines which generate a specific number of motor pulses.
Over at AWC you can find a neat board called a GPMPU40 that allows you to work with just about any DIP CPU ranging from tiny 8 pin CPUs to big 40 pin CPUs (yes, I know the title is about working with surface mount -- I'm getting there).
The board has two patterns of holes -- one for .3 inch chips and one for .6 inch chips. In addition there is a place for a regulated power supply, a ceramic resonator or crystal, a reset circuit and switch (active or passive reset), and the ubiquitous RS232 port with a MAX232. There's also a 40 pin header that brings each pin out to the board edge for interconnect. If you install an upside down header there, you can plug the whole board into a solderless breadboard.
Each section of the board has holes so you connect the sections as you see fit. So if your processor has power on pin 1 and ground on pins 8, 9, and 22, that's how you wire it up. If you put headers everywhere, you can use jumpers to make the connections quickly and non-permanently. If you aren't using a 40 pin chip, you can use the leftover space for a EEPROM or a serial A/D or any other small support chip you might need.
I've used these boards to wire up just about every Microchip PIC you can imagine, 8051 chips from Maxim and Dallas, Zilog Z8s, Ubicom/Scenix/Parallax SX chips, Basic Stamps, Motorola chips, Atmel ATMega chips -- and many more. But lately, more of the interesting CPUs are in surface mount packaging.
The picture above shows the board which is now available with a 28 pin SSOP footprint (the processor is a 50MIPs Ubicom SX). You still have enough room for an 8 pin DIP underneath, although in the picture I used the extra space for jumpers to select an internal clock (the blue resonator) or an external one from an SX-Key (connected to the 4 pins in the top left corner). I didn't install the RS232 components, although they are part of the kit.
If you are wanting to work with surface mount, this is a good way to dip your toe in the water. Even with a regular soldering iron you shouldn't have any trouble with a 28 pin SSOP. You just need a fine tip (I like to use a screwdriver tip on its side) and fine solder or blob solder all along the edge and wick up the excess (use plenty of liquid flux like that from a flux pen). If you use the blob method, you can use an embarrassingly large iron and thick solder!
Of course, there are other ways to solder surface mount. Hot air and paste is good for doing lots of parts at once -- especially ceramic capacitors where sudden heating might crack the component. But for 28 IC pins, I'd just stick with a good old fashioned contact iron and fine solder. If you want to practice get an old board (like a PC network card) that you don't care about anymore. You want a good source of heat like a pencil torch or an embossing gun (get these at a hobby store like Hobby Lobby for less than $20). Heat up the area around a chip until the solder starts to melt and then with tweezers just lift the chip. This is a throwaway, so you don't really care if you damage the chip or not (although with practice you can use either of these tools to do this reliably). Now with a regular iron, flux, and either a wick or a "solder sucker" clean up the pads and IC pins. Now practice putting the chip back where it went. Kind of like being in the Army and digging a hole and then filling it back in! But practice makes perfect.
So don't be afraid of surface mount. You can find the board at the bottom of this page (which mostly talks about the DIP version).
Wow, this looks interesting: http://www.ghielectronics.com/details.php?id=5. For about $30 (chip) or $60 (board) you can get a device that allows you to connect USB devices including storage, printers, and HID devices to any microcontroller that can so serial I/O, SPI, or I2C. It also has a hook up for flash cards. I haven't tried it (yet) but if it works as advertised, its amazing!
I'm not very mechanical, so here's a simple robot chassis I built while teaching a robot class at a local school. The top and sides are Radio Shack perf board. This is great because you can easily cut straight lines in it by just cutting along the holes in the grid. The parts:
The motors are modified RC servos that rotate all the way around.
The angle brackets came from Home Depot in the cabinent section.
There is a brace at the rear made of some scrap lumber.
The front brace is part of an IC tube cut off and hot glued for support.
You can't see it, but Home Depot also provided a small caster at the front (or back depending on your point of view; it is mounted on the wooden brace).
The wheels are actually landing gear for model planes.
The screws at the top are holding a 4xAA battery holder under the chassis and a 9V battery clip. The 9V battery runs the computer and the AA batteries run the motors.
The breadboard is secured with doublestick tape. That's an APP-II running the monster.
If I can make this, anyone can make it. You can connect a Basic Stamp or just about any old processor to the breadboard. Plenty of room to hook up other things too. Let me know if you build anything similar.
I really like the Radio Shack boards that are laid out like a solderless breadboard. This is a "game show" style controller produced for a client with a Basic Stamp. The only downside to these boards is that they are one sided and the copper will very easily delaminate if you get it too hot.
Another client project, this one is an H-bridge for motor control, driven by a Basic Stamp and PAK PWM controller.
A board to control HVAC equipment.
This StarFire board (bare and assembled) was a PIC processor used to gather, store, and transmit model rocketry telemetry. I volunteer with a group that lets high school kids learn about engineering by building quite large rockets. The PIC is riding in a socket that allows an in circuit emulator to attach. Note the two RS-1 serial boards attached to produce RS232 ports. One was socketed, so the board could hook to a PC during development, but a TTL-level GPS in flight, if I recall.
Still working on the best techniques with the new solder paste, so this needs a little work. But not bad. Oh, the pictures (at 10x, 60x, and 200x) were taken with a QX-5 USB microscope. Not essential for SMD work, but nice to have.
Through a long boring story, I wound up without my excellent Edsyn 1036 hot air soldering station. If you haven't used a hot air station to solder surface mount, you don't know what you are missing. Sure, you can use a lot of hand techniques to do surface mount. However, removing SMD is trivially easy with hot air. Also, some delicate components like ceramic capacitors don't like to be suddenly heated up, so hot air is best for those too. Of course, to use hot air, you need paste, and that's a pain because it is hard to buy in small lots and it usually needs refrigeration.
The Edsyn iron I used to have was very well built -- it ought to be; new they cost about $800. I had bought my refurbished, and the vendor did not have any more to sell. The only complaint I ever had about the Edsyn is that it doesn't have the wide variety of tips you can get for some of the other stations (like a Hakko, for example). Well, the air pump's a little noisy too (a diaphragm pump), but that's not a serious problem.
After a little consideration I picked up the station shown from CSI for about $130. I'll have more to say about it later, but here's the quick points.
1) It works fine. The quality doesn't match the Edsyn, but neither does the price tag. The switches are positioned funny and the manual talks about screwing down the soldering iron holder but there is no actual way to do that! A few well-placed magnets took care of that problem, by the way.
2) Reasonably quiet turbine motor. They say these are better for BGA work which I haven't done anyway.
3) The handpiece is a little large, but it takes Hakko tips which means you can get lots of tips for them Ayoue and/or CSI sells compatible tips for lots less than Hakko too (about $8/each). If you buy one, get a smaller tip then the ones that come with it for times when you want very fine control.
4) The digital temperature is only for the hot air. One display is the set point and the other is the actual temperature. There is no temperature readout for the standard iron even though it is temperature controlled through the bottom knob.
But overall it works fine. I'll post more about my SMD experiences soon. The handpiece, by the way, is available by itself for well under $100. You don't need the bulky station. See the handpiece here.
Of course, if you are on a real budget, try this embossing tool. You can find these on sale sometimes for way under $20 and even at full price, its around $20 or $25. The only problem is the nozzle is just a little too fat, so it takes some practice. Also, you can't adjust the air flow. But with some practice, you can solder and desolder pretty well with this cheap gun. The plastic nozzle guard comes off with a set screw and reveals a metal nozzle with some flutes in it. It won't quite fit a Hakko nozzle, but I think you could probably work something out with an intermediate metal tube and a hose clamp. You can always shield nearby PCB areas with foil. And if you are just stripping boards, the large nozzle is a plus anyway.
If you use the Xilinx FPGA tools (or you'd like to) you may have noticed that Xilinx has an "education" link on their home page. Of course, the main purpose of this link is to sell you fairly pricey instructor-led training (actually, it is pretty reasonable for this kind of class, but more than most of us will pony up out of our own pockets).
However, there are several of the shorter classes available online for free. You do have to register, but the price is free. Some pretty good classes on the Xilinx-specific tools. Don't expect the Verilog, VHDL, or even the "designing with FPGA" classes for free, but there are titles regarding usage of constraints, basic FPGA architecture, and several other interesting topics.
Check out this page. It isn't really clear that some of the classes are free until you "drill down a bit," so be sure to explore.
I haven't bought one (yet) but Mattel is selling a toy RADAR Gun for about $25. The idea is to measure the speed of Hot Wheel cars or your buddies on bicycles. At first I thought this couldn't possibly be real RADAR, but the box clearly says 10.5 GHz!
A little searching on the net found this Australian post that has internal pictures and discussion about hacking and modifications.
I'm sure for $25 it isn't going to compete performance-wise with a "real" gun, but it looks like a cheap source of parts for a 10GHz oscillator and detector, along with a PIC FFT circuit!
As you may know, I'm a big fan of simulation software including some online freebies and Linear's LTCSpice which I've blogged about before. However, the Qucs project (http://qucs.sourceforge.net) has improved to the point that it is quite usable and really very slick. The program is made to run under Qt on Linux, but it will also run with Cygwin quite nicely.
Features include:
Simulation not done by Spice (but support for Spice net lists)
Analog and Digital simulation (with support for VHDL and with some wrangling, Verilog)
Command line simulator back end for use with other programs (Qucs uses a GUI)
S-Parameter, AC, DC, Transient, and noise analysis
Very powerful way to create graphs and charts
Filter and attenuator synthesis
Smith charts
The program is actively developed and more features are planned.
If you want a good idea of what it can do, look at this tutorial.
I just posted an article about how I took a $10 Radio Shack wireless doorbell and turned it into a PowerPoint "clicker" for my PC. Includes the software, so check it out.
If you've never worked with CPLDs or FPGAs, it can be quite a steep learning curve to get started. Why bother? Programmable logic lets you build real circuits on silicon instead of simulating them with a microprocessor. For example, suppose you want to build a super alarm system with 100 inputs. With a microprocessor, you'd have to examine all the inputs (probably in groups of 8 or 16 or 32) which means while you are examining one set of inputs, the others aren't being examined. Sure, you could use interrupts, but even then, you'll only really "see" one input at a time and respond to it.
With programmable logic, you can literally look at 100 inputs in parallel and take action on them rapidly. That's because a programmable logic chip produces dedicated hardware that you can reconfigure, not a software simulation.
A while back I put together some slides for the local ham radio club about how to get started with programmable logic. It isn't very in depth (but there are some links to tutorials in it), but it is a good starting point.
By the way, I'm using the excellent ThinkFree Office Online to publish these slides here. Pretty cool, huh?
Want to take an electronics course at MIT? Don't pack up, mortgage the house, and move to Massachusetts! Just download the MIT course on basic electronics. This is part of their Open Courseware initiative I've written about before. Of course there's no instructor support and no credit, but it sounds like a good class if you want to know more about electronics. From the site:
Subject 6.071 Introduction to Electronics provides undergraduate students with both a basic and practical understanding of electricity and electronics. The emphasis is on applications rather than theory. Consequently there is a strong hands-on component to the subject to enable students to gain practical experience. Topics covered in the subject include:
* DC and AC circuits * Diodes, transistors, operational amplifier * Analog and digital electronics * Detectors and transducers * Electronic control * Signal processing and noise
The focus of the subject is understanding the critical issues involved in assembling and using an array of electronic equipment to carry out various missions. Thus, there is more emphasis on the application as opposed to design.
The breadth of topics covered in 6.071 makes this a good choice for those intending to take only one subject in electronic
Join this up with a free circuit simulator (I've talked about some of these before):
I want to make sure you have a copy of The Art of Electronics by Horowitz and Hill.
This is hands-down, the best electronics book I've seen in 25 years. The book is a practical approach to every facet of electronics and taught me more about every aspect of design than I had learned before. Not much math past algebra (pity to waste all my calculus and diffeq) but enough to develop intuition about design. Chapters:
1. Foundations - Ohm's law, voltage dividers, Thevenin's equivalent, capacitors, inductors, transformers, reactance, and diodes 2. Transistors - Switches, amplifier biasing, the Ebers-Moll model, constant current sources, Miller effect, and Early effect 3. FETs - Basic FET circuits, switches, MOSFETs 4. OpAmps - The golden rule of opamps, real-world behavior, single supply operation, feedback, and compensation 5. Active Filters and Oscillators - Active filters, VCVS, state variable, Twin-T, gyrators, switched capacitor, relaxation oscillators, 555, crystal oscillators 6. Voltage Regulators - 723, unregulated supplies, zener diodes, ICs, HV regulators, micropower regulators 7. Precision Circuts and Low Noise Techniques - Precision op amps, amplifier noise, noise measurement, and shielding 8. Digital - TTL, CMOS, Karnaugh maps, sequential logic, one shots, ICs, and pathology 9. Digital Meets Analog - CMOS/TTL interfacing, long wires, A/D and D/A conversion, PLLs. and noise generation 10. Microcomputers - 8086 assembly, I/O, PC bus interfacing, and data communications 11. Microprocessors - 68008 assembly, an analog signal averager design, and support chips 12. Electronic Construction Techniques - Prototyping, PC board fabrication, and housing 13. High-frequency and High-speed Techniques - HF amplifiers, transmission lines, stubs, baluns, AM, SSB, FM, FSK, PWM, and switching 14. Low-Power Design - Batteries, solar cells, micropower regulators, amplifiers, oscillators, and digital design 15. Measurements and Signal Processing - Transducers, standards, bandwidth reduction, and FFTs
The book also contains information on oscilloscopes, math, resistors, schematics, load lines, transistor saturation, LC filters, and some data sheets.
At over 1100 pages this is not light reading, but if you read it, you'll walk away with more than you would at your average 4 year school. Highly recommended. Nothing else even comes close.
I've used a lot of methods to work with surface mount components. I've carefully soldered and I've used the "slop and wick" method to mount tiny ICs to PCBs. I also invested in a hot air station (more on that one day) and I've seen people use toaster ovens for reflow.
I promised a bit more about the computer I've built around the Spartan 3 Starter Kit. Let me tell you a bit about the front panel. The CPU is a 16-bit machine with a 12-bit address bus (4K words or 8K bytes of memory). But the board doesn't have enough I/O to actually support this via the front panel. So a little ingenuity was required.
The board has 4 numeric digital displays. These can display hex (if you provide a hex decoder in the FPGA) so that's enough to show a single 16-bit quantity. Each digit also has a decimal point which will become important later.
The board also has 8 toggle switches, 8 discrete LEDs, and only 4 push buttons that you can use. Let's start with the 4 buttons. The leftmost button is predefined to the FPGA's reset line, so it is the reset button. The next button selects the mode of the front panel (there are 6 modes that you select sequentially -- each button press picks the next mode). The second to last button is an "execute" button that means different things depending on the current mode. The final button works as an "enter button" in all modes. Of the 8 LEDs, 6 are dedicated to showing the current mode.
Mode 0 - Register select In this mode, each press of the enter key changes what register the display shows. The display can show 4 different registers and which one it shows is indicated by which decimal point is turned on. When the rightmost decimal point is on, the display shows the program counter (PC). The next LED signifies the accumulator is displayed. The 3rd LED indicates the "switch" register (more on that in a second). The final LED indicates the instruction register (IR) is displayed.
Note that in all modes, when you press the enter key and hold it down, the front panel does three things:
It shifts the switch register left 8 bits
It puts the current 8 switches into the right 8 bits of the switch register
It displays the switch register (and the corresponding decimal point) until you release the button
So to enter A105 into the switch register, you have to enter A1 into the switches, press enter, and then enter 05 into the switches and press enter again.
Mode 1 - Set PC Pressing execute in this mode transfers the switch register to the program counter.
Mode 2 - Dump In this mode, every press of the execute button puts the contents of the memory at the PC into the accumulator and increments the program counter. You can use this to examine memory.
Mode 3 - Load This is similar to mode 2 except that pressing the execute button puts the contents of the switch register into the memory at PC and increments PC. In addition, in this mode (and assuming the processor is halted) any bytes that show up on the serial port will be entered as though they were entered at the switches. This is a handy way to load an initial program over the serial port (sort of like a paper tape reader).
Mode 4 - Single Step This mode causes the program to step each time you press execute.
Mode 5 - Run When in mode 5, pressing execute will start the processor running (or stop it if it is running already).
The two leftmost LEDs are used to indicate status. The very leftmost LED is the Q LED which the program can turn on and off (useful for debugging). The next LED turns on when the processor is running.
This is surprisingly flexible and is pretty quick to operate once you get the hang of it. Of course, you don't want to enter long programs which is why there is the serial port option.
The switch register can be read and written under program control. The program can also read the raw value of the switch inputs. These are mapped, along with the UART registers, to the top part of the memory (FF0-FFF are reserved for I/O).
So that gives you a little flavor of what I do in my spare time. Next time I'll talk about the instruction set (which includes a stack, indexing, and a few other interesting instructions).
How'd you like a high-quality regulated 5V and 12V bench supply for $8 or less? You have to build it yourself, but you won't even need a soldering iron. Sound interesting? Well, there is one small catch, but read on and you might find you have everything you need already on hand.
Many hams and electronics experimenters have PCs today. An increasing number of these are finding use on the workbench. Many hams program microcontrollers, use a PC-based oscilloscope, or just use the PC to control equipment around the shack. This is becoming even more practical as the resale value of computers keeps dropping. More and more, you'll find it hard to get rid of a PC when you upgrade. You might as well find a use it around the shack.
Inside every PC is a (usually) good quality switching power supply. The exact details depends on the PC, but you can expect to find regulated 5V and 12V often at 200W or more of power. Modern PCs rarely consume that much power, so there is plenty of spare juice for your projects (unless you have a maxed out overclocked supercomputer). The problem is how to get to it.
In this post I'll show you a quick and easy way to gain access to your PCs power supply. Of course, you need to be careful not to exceed the maximum current capacity of the supply--don't run your 100W HF rig from the PC supply! For many projects, however, you can use the +5 and +12 supplies with no ill effects.
Construction is very simple. Just remove an unused drive plate. These plastic plates cover the holes where you would install a floppy disk or a disk drive. I used a 5.25 inch cover, but if you only have a 3.5 inch cover open, that should work just as well. Be sure there isn't a disk drive behind the plate -- sometimes there is a hard drive hiding behind one of these plates.
Using a center punch, mark 4 holes in the plate equally spaced (the picture above has a center line of 21mm and the holes are 30mm apart). Then drill out the holes to fit 4 binding posts. You can use Radio Shack 274-662 (which require a 3/16" hole) or use whatever you have on hand. Mount the binding posts on the drive plate. You should use two black posts in the center 2 holes. It is nice if you can find a red post for the 5V supply and another color post (I used yellow) for the 12V supply. However, if you are buying parts at Radio Shack, you'll probably have to settle for two red posts. My yellow post is a different brand so I had to drill an odd size hole for it.
The next piece of hardware you need is a Y splitter (Radio Shack 278-761, for example). This is a wiring harness that plugs in to the connectors that the power supply provides and ends in two similar connectors. You usually use these when you have run out of connectors and you want to add something else to your PC.
Locate one of the female connectors on the Y splitter and cut it off close to the connector body. Strip the wires back about a half inch. If you are meticulous, you could crimp on some spade lugs or ring terminals to the wires. However, you can also just work with the bare wire. The splitter has two black wires (ground), a red wire (5V) and a yellow wire (12V). Connect these to the appropriate binding posts.
Feed the wiring harness back into the PCs body and reinstall the drive plate. If you can locate a free connector from the power supply, just plug the mating connector on the harness into it and you are set. If you don't have a free connector, don't worry. Find the closest disk drive and gently remove the power connector from it. Replace it with the connector from the wiring harness. Then plug the newly freed connector into the harness. Now the drive has power, and so do the binding posts.
Here's what it looks like ready to install:
Before your button up the PC, take a look at the power supply's label and see if you can get idea of how many amps the supply can handle. Of course, the PC is taking some of this power, but the trend has been towards lower-powered cards and drives, making most PC supplies quite large for their typical load. Turn on your PC and measure the voltage at the binding posts. Voila! Instant power supply.
There are many things you could do spruce this project up. For example, you could mount a cheap digital panel meter in another drive plate to monitor the voltage or current. You could also mount an inline fuse holder in the wires leading to the binding posts. In particular, if you short something accidentally, you run the risk of damaging your PC. Every time I've done this, the power supply just shut down until I cycled the input power (with the short removed) and there was no other harm done.
Whatever you do, you'll get a useful addition to your bench and one other benefit. Everyone who sees those posts sticking out of your PC will want to know what they are for!
By the way, another good way to get a 5V supply is to cut the end off of a USB cable, find the red and black wires (make sure with a voltmeter) and connect them to some sort of connector or binding posts. This has the advantage of being highly portable. Powered USB hubs can provide 500mA at 5V and many are current limited!
I bought a Xilinx Spartan 3 Starter kit awhile back for about $100. Great bargain! This board has an FPGA that can hold 10s of thousands of logic gates. Why use FPGAs instead of microcontrollers? FPGAs are real hardware. Say you design 10 PWM outputs in hardware. Then all 10 run at the same time. In a microcontroller, you have to do a few instructions for one PWM and then a few for the other... and so on (or at least, some variation thereof). So even a fast processor quickly gets divided down. Another way to look at it is that if you have a processor running at 10MHz in a loop with 10 instructions, you are effectively operating at 1MHz! With an FPGA everything happens in hardware all at the same time.
I have a custom CPU I designed working pretty well on the board. I'll occasionaly share a little about some projects I've done with the board here on HotSolder.
Here's a cool Java applet that lets you do pretty sophisticated digital simulation. There's a variety of components available and even a "logic analyzer" that you can use to view the results. You can even hook up switches and LEDs that you can manipulate on the screen.
There are several other similar applets available but this one seems to be the most full featured that I've found.
If you prefer to run on on your own computer, have a look at http://web.mit.edu/ara/www/ds.html which is free for student use, at least, and somewhat shareware (the author solicts a range of contributions) for everyone else. The program is clearly "older", but it functions fine.
One of the hardest things about building prototypes or projects is coming up with a suitable case. The folks at http://www.circuitshell.com think they have the answer.
They sell plastic "shells" in various colors with optional rubber gaskets. You design your board so that the covers screw on and put all the "external" stuff on the edges around the outside of the cover (see picture).
They suggest you put the front on in a "portrait" orientation and the bottom on in a "landscape" orientation. This gives you a right and left edge on the front and top and bottom area underneath on the back. So you might put switches and pots on the front. The rear might have jacks, power connectors, etc.
The only downside I see is they seem to come in a one size (a smaller version is forthcoming), so your PCB has to be pretty big to use the shells (about 6"x5").
Freescale, the Austin, Texas-based spin off of Motorola's semiconductor business, announced their MR2A16A chip, which the company says is the first commercial MRAM, or Magnetoresistive Random Access Memory, device.
MRAM is faster than most other types of computer memory; Freescale's chip promises to read or write data in 35 nanoseconds. MRAM is also nonvolatile. In MRAM, a tiny magnetic field is created inside a memory cell on a chip. The computer then measures the electrical resistance exhibited by the magnetic field at any given moment to determine whether the cell should be read as a "1" or a "0," the binary building blocks of data.
Freescale's MR2A16A chips, however, aren't inexpensive. The 4-megabit part now shipping costs $25 at wholesale and is available in low volumes only.
The 8051 is a popular microcontroller core. In the "old" days we used external EPROMs. Modern versions have onboard EPROM or EEPROM (like flash).
Ramtron recently announced their new 8051 with onboard FRAM (8K worht). FRAM is a nonvolatile memory that is fast to write, byte-writeable, and has virtually unlimited read/write cycles. So you get the advantages of nonvolatile memory without the disadvantages of flash.
FRAM is a ferroelectric-based technology that does not require battery backup like SRAM. Of course, you can get FRAM to include with a traditional microprocessor, but this is the first microcontroller I know of that has FRAM right in the device.
If you like to build RF circuits, you know that you can't usually use those white prototype boards (you know, the kind you shove wires into). These boards have enormous capacitance and other undesirable characteristics. They are OK for simple circuits, but RF circuits need something better.
PC boards are great (wide, thin conductors are good for RF). But who wants to cut a PC board just to try something out. Also, this discourages experimentation since you have to do a lot of work to change a PCB.
Here's an easy way to build simple RF prototypes. First get a shoe box top. You can easily cut holes in it to hold variable capacitors, SO238 connectors, and other panel mounted components. Next, use copper foil tape from any stained glass supply house to form conductors like you would on a PC board. The tape is dirt cheap, has an adhesive backing, and is designed to take heat. You can cut the foil with scissors or an X-Acto knife, and press it down to the shoe box top. Solder your components directly to the foil. Very small pieces may not have enough adhesive to resist the pull of the component leads, but you can usually push it back down if that is a problem. Any where you want the foil to connect to another piece of foil, solder the overlapping pieces to make sure you get good electrical connections (the adhesive isn't conductive). If you want to make changes, heat up the solder joints and remove the parts in question. Then just rip up the foil tape. No big deal.
I've built a couple of transmitters using this technique. I bought 36 yards of 3/16" MasterFoil Plus tape (made by VentureTape) for less than $5. This appears that it will last me for years. Don't waste your money on the kind with the extra color backing. Get the cheap kind. You can get thinner foil, and I keep hoping to find time to try some with some ICs. The .1 inch lead spacing is too close for 3/16". Let me know if you have any luck.
The picture, by the way, is a 40m crystal transmitter I built. I've also built a regenerative receiver this way, so -- in theory -- I could run an entire station on a shoebox.
Of course, Spice is the usual suspect when you want to simulate a circuit. But it isn't quick and easy to set up, and can be hard to use for beginners. Recently, I did a basic electronics class for some students and we used this gem:
This Java applet has lots of illustrative circuits and you can also select a blank circuit and draw your own. In addition to mixed analog and digital simulation, it also shows current magnitude using a unique moving dot display and has a built-in scope function. Great for quick mock ups or teaching situations.
Of course, if you need real Spice, Linear Technology has the excellent free LTSpice (sometimes known as SwitcherCAD; see http://www.linear.com/company/software.jsp). Its for Windows, but it works with Wine under Linux.