I’ve referenced Toolduino before. Now I use Firmata more (upon which Toolduino is based). It turns the Arduino into a simple interface, rather than letting it think at all. I find this handy for prototyping up custom interfaces and checking the low level electronics. It’s cross-platform, of course.
These screw shields make it simple to connect a bunch of stranded wire to an Arduino. This one is available here, or here. It’s a little thing, but it saves a lot of soldering.
As previously noted, homemade cables are to be avoided. However, stock cables are not always up to spec. For example, if one wants to drive stepper motors using a 9-pin serial cable, are the individual conductors able to carry the 1 A of current required? What about high frequencies over repurposed speaker cables?
The chart above (larger version) should help you decide what gauge of wire to look for in a particular application. Note that these are relatively conservative engineering specs, so in practice you can get away with underspec’ing a bit.
The maximum current is the current that, if sustained, won’t result in too much heating. The maximum frequency is the signal frequency at which there is 100% skin depth– i.e., the entire cross section of the wire is carrying the signal. At frequencies higher than this, the effective resistance of the wire increases.
To answer to the above questions: Yes, a 9-pin serial cable will work fine for driving steppers if the duty cycle is low (i.e., the stepper motors are typically not moving). Get a heavier guage if you can (e.g., 20 or 22 AWG), but since the currents are fairly brief the wires won’t heat up much even if you underspec them. However, with high frequencies through speaker cables, there might be problems. Even with 1 MHz signals through 18 AWG wire, there will be significant signal degredation.
Recently I needed a 3.5 mm TRS (tip-ring-sleeve, aka 3-conductor) phono cable that would carry fairly high sustained currents. Typically these types of cables are used to plug iPods and similar devices into the Aux inputs of car and home stereos. In that application, fairly light gauge wire is ideal since the currents are small. However, I was able to find a heavier gauge cable assembly from an audiophile shop.
Data source file (tab-delimited text, note that gauges 00, 000, 0000 are recorded as -1, -2, -3, to get the chart to plot properly) via
CircuitLab is an online circuit design tool. This is my new favorite way to jot down circuits. The interface is clean and simple and even has some test/simulation facilities. It also has a sharing/GoogleDocs type feature.
Hopefully they’ll add circuit board layout to their list of features at some point. Fritzing is great, but still not quite as clean as CircuitLab. Perhaps someone can write a CircuitLab-to-Fritzing bridge in the future.
This is an iOS/iPhone app that uses the camera to optically recognize resistor color code bands. I find this interesting because I tried writing something like this one time. I couldn’t sleep at 3am after a London-Tokyo flight. I wanted to make an augmented reality app that would let the user scan the camera over a bunch of resistors or a circuit and the resistor values would be overlaid on each one. About 5 minutes into coding, I realized that it’s a significant image segmentation problem, with a non-trivial color recognition problem given different white balances, contrasts, and colors of paint. That wasn’t going to help me sleep.
The author of Resistor Photo ID simply makes the user take photographs in a stereotyped way with particular kind of background, thus limiting the variability. The program also makes the user do the image segmentation by dragging little ROIs to cover the color bands. These are clever compromises, and in the final analysis, it works. Not without errors, but it works.
Yes, you’re right, it takes almost no time to simply measure a resistor using a multimeter. You’re very clever. But what if the resistor is already in a circuit, and thus cannot be measured in isolation? Yes, yes, like you, I also enjoy the mild, learned synesthesia that comes with internalizing the resistor color code. But what if, like this author, you’re colorblind?
One of Josh Trachtenberg’s rules that I have adopted is “No Homemade Cables”. It’s so natural to think that this is the best solution to hook two things up: “Wire and bare connectors are so cheap, let’s just make our own cables.” However, homemade cables, even when made with great care, are usually of poor quality compared to commercial cables. As a result, you’re just giving yourself something else to repair in the future.
Option 1
Adapter boxes, aka breakout boxes, are more reliable than homemade cables. If you take this route, put it in a transparent, easy to open box so that you can quickly see (a) how things are wired up, and (b) whether there are any loose connections.
Option 2
Another option is to have custom cables made. I started doing this in London for a rig where I needed two fairly long 48-conductor cables. Custom cables are actually not that expensive and are of very high quality. It’s practical because you don’t have to buy an entire spool of 48-conductor wire (or whatever the job requires); nor do you have to source obscure connectors, strain reliefs, jackets, and whatnot. Not to mention time saved soldering.
Fritzing is PCB design software (EDA) in the spirit of Arduino and Processing. It’s open source, cross-platform, streamlined, and simple to use. It doesn’t do simulations, but you can lay out your circuit in a GUI that looks like a prototyping board, then move to circuit layout, and finally PCB design. Check out the video above to get an idea of the workflow of Fritzing.
PCB manufacturing is something that I haven’t covered in Labrigger before. Partially because I didn’t think there were good free software tools to use. I’ve used proprietary stuff in the past (Tanner EDA, due to my background in MEMS), and the free (as in beer, not speech) version of EAGLE is popular. But most of the GNU-licensed PCB design software was not quite ready for primetime in my opinion. Fritzing is the first thing I’ve seen that is really well done and has the potential for wide adoption.
Anyways, now that Fritzing is here, it’s worth mentioning how affordable it is to have a custom board house make your custom PCB. It’s so cheap, I really don’t recommend making PCBs at home or in the lab, although there are plenty of ways to do so. This isn’t anything new, cheap custom PCBs have been available for decades, but not a lot of people who make their own gadgets in biomedical research know how easy it is.
Fritzing has their own fabrication, named Fritzing Fab. They’re based in Germany. But Fritzing will output files that you can send to other board houses. A Google search for “custom PCB” will return a hot mess of hits. I recommend you look for one in your geographical area. If you’re in the US, this list is a good start. I’ve used Advanced Circuits before, but any of these firms are probably solid.
Should I make a PCB?
If you’ve got more than 20 interconnects to do, then it’s probably worth making a PCB. However, if you’re really unsure of your design and might need to make several changes, then maybe the threshold should be closer to 30 interconnects. Because although PCBs can be minimally modified (cutting traces, making jumpers), they’re harder to change.
Turn around time is another consideration. Custom PCB houses are built for short turn around, but they’re still 1-5 days, typically. So if you need it right now, you’re better off wiring it yourself. Especially if there is a low number of interconnects.
BTW, Fritzing is selling some nice Arduino kits as well (link).
In many rigs, multiple computers are used, and they need to talk to each other. For example, one computer handles the imaging, another the electrophysiology, and yet another handles the sensory stimulation; and they all need to be synchronized. There are several ways to handle this.
Digital I/O via DAQs
This is typically the most straightforward solution, but requires that there is some sort of DAQ for each computer. You can use something very simple, like a parallel port interface. Parallel ports are very old fashioned, but they’re still standard issue on most full-sized motherboards (see image above). Wire up the each data pins to a separate BNC and you have an extremely inexpensive digital I/O (the pinout is on Wikipedia and elsewhere on the net). The logic is a TTL-like 0-5v, however, beware that motherboards will vary quite a bit in their logic-high voltage level, and they typically can only source a small amount of current, 10-20 mA. So don’t try to split the signal to a bunch of different devices. (more info).
Alternatively, you can buy an inexpensive USB DAQ. For example, Measurement Computing‘s boxes are supported by MATLAB’s DAQ Toolbox. On that topic, let me briefly mention Dennis Pelli’s excellent MATLAB toolbox for controlling Measurement Computing’s USB-1208FS. It’s one of the simplest ways to do data acquisition in OSX using MATLAB. And be sure to read his explanation about why he programmed it up. It has more to do with the Second Amendment than you might expect. (link)
Ethernet connections
This approach has the advantage of using something that most computers have built in: an ethernet port. There are several protocols that ride on IP networks. You’re probably most familiar with TCP, but only slightly less well known is this: UDP. This is the protocol used for DNS queries. This is a leaner, faster way to send short messages to synchronize computers in an experimental setup. It’s not as tight as using a direct pulse to a DAQ, but it’s fast enough for most applications. The big advantage is that it’s pretty simple to send configuration data in addition to a simple trigger pulse via UDP. Several scientific software packages directly support UDP (e.g., here’s MATLAB’s UDP function).
Single computer solution
Getting programs to talk to each other
Even when a single computer is used, there may be multiple programs that need to talk to each other. In the first intrinsic imaging rig I built, I wrote my own OpenGL-based visual stimulation program which ran on the same computer as the imaging software (pdf). Both programs were written in C++ using Visual Studio. In order to get the two computers to talk to each other, I used custom Windows messages. Most modern operating systems have a messaging system where individual processes can send and receive messages. I was able to use this to pass messages between the two programs. If you want to do the same thing, and are already comfortable dealing with Windows messages in C++, this link can get you started.
Here are some ideas for project enclosures. The stock enclosures from Mouser, Digikey, and others are generally serviceable, but are rarely the perfect size. In addition, making the required cutouts can be inconvenient. Here are a couple of alternatives.
Laser cut an enclosure out of plastic
I’ve done this for several projects. It’s cheap, the cutouts are perfect, and there are many different materials that can be used. The downside is that you get 2D panels that you must fasten together. I often use superglue to put the parts together. I’ve also used magnetic strips for panels that need to be removed often. When the material was thick enough, I used screws. Another option is mounting screws and nuts in slots, pictured blow and briefly detailed here.
This method offers a way to use screws even when the material is thin. I’m not a big fan of it though, because there are a lot of screws that can easily get loose. Superglue or properly tapped screws are more heavy duty.
Protocase for small run, custom cases
Protocase will make completely custom, sheet metal enclosures with cutouts, painting, and silkscreening. It’s a lot more expensive than laser cutting plastic pieces, but there’s less assembly to be done and they’re more durable. They can make all sorts of shapes, including very nice rackmount chassis.