Do you like programming? Do you like electronics? Do you like Windows? Wouldn’t it be nice to combine all three?! That’s what I was thinking when I went looking for a solution that would maximize my motivation for evolving my Windows programming skills.
You might think that should be easy enough to manage – there’s plenty of electronics in the world, and plenty of programming options, and Windows is almost universal, so how hard could it be? But the problem with the world of electronics is that they seem to assume you’re doing it on a large scale and almost certainly have electronic engineering training. Either that or you’re a kid and thus are impressed by a few LEDs, resisters, and the simplest of integrated circuits.
So you can find lots of simple kits, and lots of standalone electronics solutions (especially based on microcontrollers). If Windows is involved it’s to help design printed circuit boards or to download microcontroller programs to the microcontrollers. Windows programming isn’t an option.
A further complication is that modern computers only have USB ports (not RS-232 or parallel ports), and thus electronics solutions built more than 5 years ago are almost impossible to use. And you’ll need a power supply, which means more wires and/or batteries, which only messes things up.
So go ahead and search for good solutions. You’ll find various close alternatives, but I only found one that really meets the above key requirements. Fortunately I stumbled upon http://www.smileymicros.com/, which has what they call the “USB thingie” or “BBUSB” (breadboard USB). It’s the FTDI FT232R chip mounted on a little breadboard-compatible circuit board and a USB connector. By default it offers RS-232 output (for those old solutions) but also an 8-bit “D” bus and a 4-bit “C” bus. And it has 5 volt and 3.3 volt power for your components. And it’s compatible with lots of operating systems. So you’re all set!
SmileyMicros is clearly a small company, and my impression is that they built a good set of products a few years ago but haven’t evolved them since then. I do suggest you consider their products but be prepared to do a little work to make them work as you’ll probably expect. Hopefully this blog and similar resources will make that practical.
In my case I considered all the SmileyMicros products carefully and went with the “USB Virtual Serial Port Cookbook – Parts Kit and Source Code CD”. That includes 2
“thingies”, a breadboard, some simple electronics, wiring, source code, and a book. So far I’ve only used one “thingie”, but someday I’ll need another so I’m glad to have two. I now have 3 breadboards and need more so it was good to add one. The electronics and wiring are definitely handy (I got more of each later). The source code is critical to getting started but in reality is a bit buggy and a bit crude – I’ll go into more details later. The book wasn’t as helpful as I had hoped, but has a little added value. In the end I think that product was the right choice for me but if dollars are tight then you could realistically just get one “thingie” and the rest everywhere else (if you’re willing to do some legwork). But in the end that won’t save you a lot.
The “thingie” is primarily based on a chip called “FT232” (particularly the FT232R) from a company called FTDI (http://www.ftdichip.com/). (Actually, I wonder if it isn’t OEMed by them). I’ve been thoroughly impressed by FTDI – their drivers, tools, and documentation are all first-rate, and completely up-to-date. Most of the times when I couldn’t figure something else from the SmileyMicros materials I could figure it out from the FTDI materials. So you’ll definitely want to check them out.
Because the “thingie” is based on the FT232, and the FT232 really does all the real work, that’s what I actually prefer to call it. There’s also at least a few other solutions out there based on the FT232, and much of what I post on the topic should be applicable to them.
And now that I’m into it, I realize there’s one more reason why Windows and electronics don’t seem to go together – Windows is not a real-time operating system! In fact, user-oriented operating systems are not normally real-time, and don’t need to be. But electronics are generally VERY fast, and thus real-time interfacing is important. And as it turns out, the brilliant FTDI guys handled this for us as well. The FT232 is not simply a USB-to-bus (or USB-to-RS232) interface – it actually has some smarts on it. I’m not sure how smart it is (just yet) but at the very least it will take not just straight USB input (one byte at a time), but in fact whole buffers. So you might only be able to send bytes to it once every 20 milliseconds or so, but you can send thousands of bytes at a time. So now you’re at well below millisecond speeds on a bytes/second basis. We can do interesting electronics stuff with it as we’ll see in this blog later.