User:WillWare/Electronics

From Wikipedia, the free encyclopedia

Contents

[edit] A renaissance for electronics hobbydom

I was an electronics hobbyist in the 1970s and an EE in the 1980s and 1990s. There was a long history of tubes, discrete transistors, and dual inline packages and wire wrap, that brought us to the 1980s when surface-mount technology took off, and like many hobbyists, I figured that was the end of electronics as a hobby. As I got older, my eyesight wasn't getting any better and my hands weren't getting any steadier.

Now three things allow almost ANY hobbyist to build very complex boards on a very small budget.

  1. Printed circuit CAD packages like Cadsoft Eagle are getting more affordable - in particular, they have free versions that can do remarkable things.
  2. Printed circuit board houses have very affordable deals on small runs of prototypes. In the next few years, more inexpensive PCB houses will come on line, and these deals will get even better.
  3. Homebrew assembly techniques make it possible to solder fine-pitch surface-mount parts on a shoestring budget, without superhuman hand-eye coordination.

These are technologies that empower the little guy, just like Neil Gershenfeld's Fab lab project. Electronics is not something that only huge corporations can do. The next big fun gadget might come out of a high school kid's garage, the way the first Apple computers did.

I would like to see a lot of open-source and public-domain hardware designs out there. That could help to start a new generation of electronics hobbyists.

[edit] My radio board from a year ago

This is intended to be a cheap software radio board, available in time to have some useful impact on the legal fight of EFF vs. Broadcast Flag (July 1st 2005). I hope to make it very affordable (sub-$100 if possible) and use some of the same parts and ideas that go into the Universal Software Radio Peripheral. So it will be like the USRP for high school and college kids. This board is being designed by Will Ware N1IBT, reachable at mailto:wware@alum.mit.edu.

  • Cypress CY7C68013 USB microcontroller, which is an 8051 core with a USB2 interface and various I/O, I hope I can get these for about ten bucks
  • Xilinx XC3S400-4TQ144C FPGA for quadrature demodulator, $22 from Xilinx online store
  • Analog Devices AD9225 A/D converter, 12 bits, 25 MSPS (sampling at 24 MHz because the 68013 likes a 24 MHz clock), $23 at Digikey
  • Two-layer PC board, http://ecommerce.pcbfabexpress.com/preview_specs.jsp, $13
  • Soldering parts onto board, maybe $10
  • Assorted odds and ends, $10-ish
  • Total for the board, $90-ish

When I've gotten some boards assembled, I'll post a more accurate breakdown of prices. I'm using Eagle Light for Linux to do the schematic and PCB layout. The version I'm using is free/gratis, not free/libre, but when I start selling boards, I'll need to pay a $50 registration fee.

Tarball of Eagle design files and custom library, and Gerber files and drill info: http://users.rcn.com/wware1/n1ibt.zip

In the past I've done boards using ExpressPCB but their business model is to lock you into their service by encrypting the Gerber files used to make the PCB, so you can't get the board made by anybody else. Gerber files are a text-based file format, and once produced with any layout software (free or not), the Gerber file itself can be freed under the GNU Free Documentation License or one of the Creative Commons licenses. The Gerber files in the zip archive above are free under the GFDL, until somebody convinces me a CC license is a better idea.

Handy dimensional info about standard machine screw sizes: http://www.on-b.com/thrd/inch.htm

Even at baseband this will be a fun little radio. Plug a long wire into the antenna connector, plug the USB cable into your laptop, install the software, and you should be able to pick up AM, a lot of shortwave, and a number of ham bands with no RF board. Later I might whip up a little DAC daughterboard to allow it to transmit QRP. Then it could do spread-spectrum transmit and receive, making it the cereal-box secret decoder ring for the 21st century.

There's a fair chance that the board will be ready by the end of April. I'll provide as much information as I can to help people make their own boards. If you're reading this and like the idea of making and selling boards, please be aware that you have my encouragement and support. Once I've got a working design, the things you'll need to make boards are:

  • What parts do I need, and where to buy them? [Parts list] and vendor info
  • How do I get printed-circuit boards made up? I've googled for a few of these, and http://www.pcbfabexpress.com looks good to me.
  • How do I get the parts soldered onto the board?
    • Personally I go to a place called [Contract Assembly] here in the Boston area. If you're not near Boston, go to [Google Local], plug in "PCB Assembly" and your town and state, and see what you can find. This approach makes plenty of sense for large runs (dozens or more) but a possible alternative exists for itty-bitty prototype runs.
    • I have also been collecting some links about HomebrewSurfaceMountConstruction, which describe daring feats with toaster ovens and hot air blowers. I am going to try some of these tricks. They look pretty straightforward and inexpensive, and going to a pro assembly house can rack up the bucks pretty quickly.

I've gotten all the parts to build ten of these boards, and populated one successfully. When I learned that there were design imperfections in the analog area, I didn't want to get all ten built. It ended up making more sense doing homebrew surface-mount construction than going to the assembly house.

The FPGA chip in the lower right is assembled WRONG in this picture! If you could unsolder it, rotate it clockwise 90 degrees, and resolder it, that would be correct.

As of this writing I haven't tested it yet. I stupidly failed to check that the SMA connector had the exact footprint that Eagle PCB expected, so gauche-looking wires for now.

I plugged it in and nothing smokes. That's good. But the 3.3 volt regulator gets hot, and it's producing much less than 3.3 volts. I'll tack on an LM317 with appropriate resistors.

When I discussed this project with a co-worker, he mentioned that he'd been involved in something vaguely similar in a professional (non-hobbyist) capacity, and he collected information about a lot of high-performance A/D converters. I don't think he'd mind my sharing his notes here.

[edit] Email, progress (or more accurately, stagnation)

PC Board design and FAB. I use ExpressPCB? and thir system is cumbersome but will yield a Gerber File for $60. I design with their software and have the board made elswhere, primarily because they don't provide routing, so I can snap the boards apart after I assemble them. I use http://standardpc.com/ They do a great job and their prices are great, even for small quantities. Bob is the engineering guy. If I can help, let me know -- joelfrigon-at-yahoo.com

4 July 2005 - I've started to get some recent inquiries about how things are going with the board. Basically things got stalled. In early May, the original BroadcastFlag initiative was defeated, so the original legal/political motivation for making haste was gone. In late May I went out to Hamvention and got to spend some time with Eric and Matt, which was fun and thought-provoking, and we agreed that everybody's interests would be well served if my board could work with USRP daughterboards.

June was a busy month, so only a little work on the board itself got done. I discovered that the too-hot voltage regulators were because (a) my FPGA was ROTATED 90 DEGREES (doh!); and (b) I'd used a 3.3v regulator that was too small. There were also a couple of minor wiring bugs around the CY7C68013. SCL (pin 29) must get a pull-up resistor just like SDA, or the 68013 won't boot. I think the NC pin (pin 27) is supposed to be grounded, though I'm not sure that's strictly necessary.

The rotation issue is just assembly stupidity on my part, the other stuff necessitates a board respin. While I'm at it, the board could use ground planes for the analog and digital parts.

Some of the progress has been fun: I got fxload working on Linux, wrote some simple 68013 code, and got it to load onto the board and run. The 68013 was sending characters out its serial port. But if I hit a part that isn't fun to work on, the work slows down because this is just a hobby project. Now I need to accept a stream of bits over the USB cable and use them to program the FPGA. Figuring out how to get data from the end of the USB hose is confusing. See [section eight]. One person who inquired about the board asked what the ribbon cable connector is for. I could glibly say "future expansion", but I'd like to expand on it a bit. This board is a completely open design, both hardware and software. As a user, you'll be free to reprogram or reconfigure any piece of it. If you reprogram the FPGA, you can use the board to transmit as well as receive. Or you can use it as a handy USB-2 interface for a high-bandwith project of your own, such as an oscilloscope or logic analyzer.

6 August 2005

I've now had three or four inquiries. Some just say "Go go go hurry up go go". Others have been more helpful and are interested in doing some of the work of making the board useable. So I am starting to think about how to involve those people.

I have parts left to build up a few more boards. I've got fixes for the major hardware bugs:

  • The 3.3 volt regulator is too small, so remove it and bolt on a TO-220-packaged regulator.
  • Tie pin 27 of the 68013 to ground (the NC pin).
  • Add a pull-up resistor for pin 29 of the 68013, just like pin 30 (SCL and SDA respectively).
  • Solder on the FPGA with the correct orientation. I'm still feeling very dumb about this.

Maybe I should populate a couple more boards and donate them to people willing to help. I am considering this.

I have one board that's in good enough shape that I can do software development on it. My current stumbling block is the 68013's access to endpoints, which is needed for the host computer to program the FPGA. Once that's figured out, I need to borrow or write Verilog code for the FPGA. At that point finishing up any remaining 68013 code should be pretty straightforward.

7 December 2005

Following a change of jobs, I'm hoping to have a little more time for this project. I've been contacted by a university group in India and they're eager to work with the board.

4 July 2006

Still pretty much completely stalled, but at least I've moved the page to Wikipedia. It previously resided at http://comsec.com/wiki?N1ibtSoftwareRadioBoard, which was made read-only because of wiki spam.

[edit] A change of strategery

Given the problems that have plagued the radio board so far, I think I ought to probably back off to a more manageable task, and reattack the problem in a more measured way. The original idea of quickly going straight to a cheap single board was prompted by the imminent threat of broadcast flag legislation, and if I'm not mistaken, that boat has already sailed.

I think it makes sense to work on one board with the CPU and FPGA, and then later work on the ADC board. My rationale here is that the CPU/FPGA board is useful for many other projects, and it gives me a chance to get familiar with programming the CPU and FPGA.

Hmm. Can't I just do that with the existing board, not populating the ADC part? Yeah, but I can't use it for non-ADC applications so easily, because those pins are wired direct to the ADC. Hmm.

[edit] Programming the FX2

The terms "FX2" and "68013" both refer to the CPU, which is an eight-bit 8051 core with USB slave peripheral hardware on-chip. "FX2" is a marketing name, "68013" is part of the official part number.

One source of good ideas is the CVS repository for USRP firmware. Once the FX2 is programmed, it programs the FPGA by feeding it a sequence of bits or bytes that configure all the gates and datapaths and doohickeys inside.

SDCC is a good C compiler for programming the FX2.

[edit] Some examples I found, including communicating via bulk endpoints

Wolfgang Wieser is a gentleman and a scholar, as well as a rocket scientist.

This page has two "hello world" examples. In one, text is written into the FX2's on-chip RAM and read back over the USB while the FX2 is held in reset. In the next test, a "hello world" message is transmitted by the host to the FX2 over bulk endpoint 2, and returned to the host over bulk endpoint 6. Very cool.

This page discusses interaction with hardware FIFOs.

These others may also be helpful.

[edit] A test I did with the old board

On the 2004 radio board, I programmed the FX2 to repeatedly send the ASCII character 'A' from its serial port. I verified the serial port transmission with an oscilloscope. This demonstrated that renumeration was working correctly, and that SDCC was a good compiler for the FX2.

[edit] Renumeration

The FX2 is configured over the USB cable using a process called renumeration (see section 3.6 of the data sheet).

In the past I used a program called fxload to program the FX2. The setup for doing this was complicated and obtuse. I have since switched to Wolfgang Wieser's much more straightforward and more capable CycFX2Prog tool. Grab the source tarball, build it, and put cycfx2prog in /usr/local/bin.

Now use SDCC to build a *.ihx file, and then load it like this.

sudo cycfx2prog prg:foo.ihx run

This works fine with the "hi.c" example packaged with SDCC, so the command line argument is "hi.ihx". You need the "sudo" because talking directly to the USB port can only be done as root. Read the command summary to see other things cycfx2prog can do. It can communicate with USB endpoints.

I am currently stuck on Wolfgang's hello_world_ram example. It's not working for me, and I have no idea why not. From the host's perspective, my board shouldn't differ enough from his to make a difference.

[edit] Programming the FPGA

Once the FX2 is programmed, it will program the FPGA. It doesn't have enough memory to hold the FPGA's program, which must be shipped down from the host computer over the USB cable.

I haven't done much work on this yet, here are a few links. Full disclosure: I have not yet gotten an FPGA working in this setup. I have full confidence that it's doable, I just haven't done it yet.

Xilinx ISE development environment

A few notes on my blog.

[edit] The USB/FPGA board, October-December 2006

Earlier I wrote about a "board with the CPU and FPGA", and I've finally got that designed, and hope to assemble it in the next couple of weeks. I am being assisted in its fabrication by a fellow in Bangalore who is keenly interested in the software-defined radio application. But a board like this can have other applications as well - it can be used for instruments like oscilloscopes and logic analyzers, and possibly a medical ultrasound device.

The board will be 3.2 inches by 2.7 inches, with an estimated manufacturing cost of $70. As a free and open design, its price to a user should be very little more than that. The USB link can theoretically transfer data at 56 megabytes per second, but that's probably a peak rate. So I hope this will provide a high-speed interface that will address a lot of hobbyist needs. I laid out the mounting holes and the 26-pin connectors on the USB/FPGA board to fall on a 0.1-inch grid, since so much prototyping hardware here in the U.S. uses that grid size. The board is open source hardware; the design is in the public domain.

Once it's up and running, I will post the Gerber and drill files and parts list on the web somewhere. I'll probably sell some boards myself, but others will be encouraged to make (and sell, if they wish) their own boards.

[edit] Separate A/D board

To address the original intent of providing a software-defined radio receiver, we need an A/D board that plugs together with this board. Here are a couple of good choices for A/D converters available from Digikey at reasonable prices. Both are 12-bit converters in 28-pin TSSOP packages with 3.3 volt supply voltages.

Putting the A/D converter on a separate board should make this a much quieter radio than the original board would have been. The ground planes can be connected by an inductor to further isolate the digital circuit noise from the analog input. It's probably good to create the A/D's supply with a separate 3.3 volt regulator, maybe from the USB-supplied 5 volts if there is enough current.

As far as I am aware, the AD9235 and AD9236 differ only in their price and their sampling rate, so maybe the same printed circuit board will work for either one. That would be good.

[edit] Two-layer prototype

I found the least expensive approach was to make up a two-layer prototype with these guys:

Imagineering,Inc.
180 Martin Lane
Elk Grove Village, IL 60007
Phone: 847-806-0003 Fax: 847-806-0004
http://www.PCBnet.com

You can get a two-layer board made up for a flat rate of $25. Expedited shipping is another $25. For that price you can go up to 60 square inches, but my board's probably only about ten. This is just a check for correctness of the schematic. The four-layer layout will be more carefully done and electrically quieter, so more suitable for radio work. I'll get the four-layer boards done by http://pcbex.com, and probably have twenty made.

The two-layer board pictured on the right has passed all the tests to show that the FX2 is working. I have not yet programmed the FPGA. There are two LEDs so I can flash some recognizable pattern to verify that the FPGA is doing the right thing.