Wanted: An EPROM Programmer that Works on a Mac

December 28th, 2012 by Keith Neufeld

And Linux. And old, high-programming-voltage EPROMs. And USB, naturally. If you know of such a thing, give me a shout in the comments — I can’t find any on Google, and I find plenty of links to other people who also couldn’t find them.

6502 Microprocessor, Apple ][, and Asteroids

A couple of weeks ago, I went to an annual holiday lunch with former coworkers and got to visit with an old friend. He was reminiscing about 6502 assembly programming on the Apple ][ and wondered whether I'd know where he could get one. I told him that I could probably loan him one or two; but (with a mischievous glint in my eye) that I have a couple of upright Asteroids arcade games and they run on 6502s and I’ve always wanted to reprogram one and write my own game.

Bump, set, spike. Yeah, he’s interested.

It’s not a completely impractical idea. I have a large schematic set that includes the addressing of the memory-mapped I/O and some rudimentary information on the operation of the vector generator board. There’s even a project to comment the disassembled ROM, which would give further hints about how to interface to the hardware.

If one were to undertake such a project, one would really like to use a USB-attached EPROM emulator so one could dump new code into the machine frequently and rapidly for testing and development. But at a bare minimum, one would need a stack of EPROMs and a programmer and ideally a ZIF-socket daughterboard to fit into the original EPROM socket and make it easy to swap EPROMs. As I have no Windows machines and do my electronics development on a synchronized fleet of Mac and Linux machines, a commercial EPROM programmer that I can use is going to be a little bit hard to come by.

Yes, I could run Windows under virtualization on my Mac; I think I may even be able to get a legal copy through my campus’s license agreement. But I’m not interested in going that direction unless I have to.

Isn’t it about time the world had a cross-platform EPROM programmer?

72G or Larger SCSI-2 Fast/Wide Hard Drives?

November 26th, 2012 by Keith Neufeld

Anyone know where to find new, large-capacity SCSI-2 fast/wide hard drives? A computer I supported at a hospital a long time ago has a failing hard drive and I’m happy to assist with replacement but I’m not coming up with any sources for the hardware.

New Arrival

September 3rd, 2012 by Keith Neufeld

computer

Yes, it is what it looks like.

I’m the second owner.

It hasn’t been powered on in 36 years.

I’ll post more pictures as I share the story and test it carefully to make sure it’s safe to power on.

OS X ATtiny25 Programming Walkthrough

July 7th, 2012 by Keith Neufeld

A while back I bought a batch of ATtiny25 microcontrollers and today I finally put one to use and got it programmed. MIT’s High-Low Tech group has put together a really nice package for programming ATtiny45s and ATtiny85s from the Arduino IDE, but it doesn’t support ATtiny25s, presumably because the limited memory doesn’t leave enough space after the bootloader is installed. I had a dickens of a time trying to find instructions to walk through programming an ATtiny25, much less on OS X; but it turned out to be pretty easy after pulling together a few separate resources. Here’s the path to blinkemness.

ATtiny25 board with USBtinyISP and Saleae Logic, overhead view

Read the rest of this entry »

Hand-Soldering SOIC

July 2nd, 2012 by Keith Neufeld

I wouldn’t want to do it for a living, but it’s an enjoyable diversion once in a while, particularly as a favor for a friend.

Breakout boards with SOIC

I aligned each chip’s pins by hand, clamped it to the board with a gator clamp (with heatshrinked jaws), soldered the far row of pins, rotated the board, and soldered the now-far row of pins.

Three rows I was able to do by blob-and-drag (heat the pins at the uphill end of the row, make a big solder blob, and drag it down the row at a pace slow enough to heat the pins but fast enough to keep the surface of the blob from oxidizing too badly, trusting surface tension to bring the blob with you and leave only a lovely solder fillet below each pin). Three rows I ended up doing slop-and-wick (get solder all over the place, then use “Size: Good” solder braid to remove solder bridges from between the pins, leaving a lovely solder fillet below each pin and evidence scorched flux everywhere).

I’d take recommendations on a good flux remover — preferably detailed recommendations indicating whether you have to scrub or just spray, how cleanly it washes off, etc. You can see that the rubbing alcohol I used leaves a bit of residue.

If All You Have Is a Logic Analyzer, Everything Looks Like a Timing Problem

June 27th, 2012 by Keith Neufeld

I just rewrote the Arduino Playground Nokia LCD screen code to use hardware SPI instead of ShiftOut(). (More work to do before releasing the code back to the community. And I know, not everyone will want to use the hardware SPI, but it should be an option.)

It looked like a trivial change, but after making it, the display’s screen remained blank.

Logic analyzer capture of bad SPI communication

But … but … but … the slave-select line is supposed to be held low during each byte of transmission. I know the ATmega’s SPI hardware doesn’t manage it for you, but surely the Arduino’s SPI.transfer() function does, right???

Working Arduino SPI Transfer

Logic analyzer capture of working SPI communication

No. You have to manage it manually.

void LcdWrite(byte dc, byte data) {
digitalWrite(PIN_SS, LOW);
digitalWrite(PIN_DC, dc);
SPI.transfer(data);
digitalWrite(PIN_SS, HIGH);
}

SPI support is a perfect candidate to be a real object-oriented class rather than a functional library in OO clothing. Instantiate objects that know which slave-select pin is theirs, which may have different bit orders and clock rates and clock modes, and provide a transfer() method that sets all the registers, twiddles SS for you, and transfers your byte.

Sigh.

Faster Arduino SPI Transfer

BTW, notice on the second capture that manually bouncing SS using two digitalWrite()s takes longer than transferring eight bits of data using the hardware SPI. Start to understand why I want to transfer data using hardware instead of bit-banging?

Logic analyzer capture of working SPI communication with fast SS manipulation

Manipulating the SS bit in the port register directly is much faster … at the cost of being much less clear what’s going on to non-native speakers of C.

void LcdWrite(byte dc, byte data) {
PORTB &= ~ (1 << 2);
digitalWrite(PIN_DC, dc);
SPI.transfer(data);
PORTB |= (1 << 2);
}

ATmega I/O Pin Hardware Toggling for Fastest Arduino SPI Transfer (That Isn't Any Faster)

ATmega I/O pin hardware toggle diagram

Logic analyzer capture of working SPI communication with fast SS manipulation

The C-based bit manipulation code above is already fast enough that the timing constraint has moved back to the programmer-selected SPI clocking speed and the ultimate solution -- using the ATmega's hardware-based pin toggle feature -- doesn't save any noticeable time, but the code sure looks cool but it's the right thing to do and it's a risky game to play to assume you always know correctly the logic level of the pin when you enter the function.

void LcdWrite(byte dc, byte data) {
PINB = _BV(PINB2);
digitalWrite(PIN_DC, dc);
SPI.transfer(data);
PINB = _BV(PINB2);
}

(BTW, I had a dream recently -- which I did not know was not real -- in which the latest Arduino release added digitalWrite(pin, TOGGLE) to do the above. Imagine my disappointment tonight to learn it was only a dream. And no, I'm not the first to suggest that feature, by a long shot. Just, maybe, the first to think it had actually happened.)

Arduino-Compatible “Practice”

June 24th, 2012 by Keith Neufeld

I’m trying to get my LED calculator out the door this summer, and that requires embedding an Arduino-compatible “core” into my own system. Yes, yes, I could use a microcontroller without the Arduino environment; but if I actually get this thing ready to sell, I want my customers to be able to reprogram it (apply firmware upgrades or enhance the feature set) in a comfortable environment. Hence an Arduino-compatible core.

I haven’t made an Arduino-compatible before, and the only two things I found daunting were the crystal, which I understand has to be exactly matched to its supporting capacitors or the circuit won’t resonate, so it was important to find the same one used in the Arduino; and the resettable polyfuse on the USB power lines, which doesn’t (in the Arduino circuit) specify whether 500 mA is the hold current or the trip current.

I found an Arduino playground post by Tom Igoe giving Digi-Key part numbers for a bare-bones breadboard Arduino-compatible and chased the out-of-stock crystal to the equivalent Digi-Key catalog number 887-1019-ND. I searched far and wide for information on the polyfuse and gave up, settling on 500 mA hold current, since that’s permitted (after negotiation) by the USB spec and surely we wouldn’t want to trip at the maximum permitted current.

With that data in hand, I still had a healthy dose of uncertainty about my likelihood of building a working Arduino-compatible. I prefer to develop and test modularly, so I wanted to assemble a working proof-of-concept Arduino-compatible before diving into the LED calculator project. And as it happens, I had a perfect project waiting in the wings — an Arduino-compatible board with ground and power headers surrounding the normal I/O headers (like servo connectors), to make it easy to connect external sensors without going all-out and buying a sensor shield (which actually has the I/O pin at the end of each connector rather than in the middle, whatever). I want to build my own version of my friend Trevor’s household temperature-monitoring system, and such an Arduino-compatible would be a great platform for terminating the three-wire temperature sensors.

To speed the process, I started with the EAGLE schematic of the Freeduino through-hole design, ripping up the board and laying it out mostly from scratch to make room for my extra header rows. I had the board produced by BatchPCB, I received it last week, and I have now assembled it into a working Arduino-compatible.

But not — this is going to sound soooo familiar — without some snags along the way.

Testing the FTDI USB-Serial

The one component not available in a through-hole package was the FTDI USB-serial chip; and I planned on hand-soldering it; and that’s way easier to do without other components looming over it and getting in the way of the iron; so I attached it first. And that led me to test it first as well, since I test as I go.

Arduino-compatible with USB-serial components installed

Read the rest of this entry »

BatchPCB

June 17th, 2012 by Keith Neufeld

My academic background is in mathematics and computer science and I’ve picked up electronics as a hobby along the way, primarily self-taught through excellent books by Forrest Mims, the easy crossovers from math and CS to digital logic and digital design (still my strongest area of electronics), a stubborn willingness to read datasheets, and a constant desire to learn.

For the last two years, I’ve been supplementing that with a formal background from my university’s EE department, taking first one and recently two classes per semester. The education is interesting and enlightening, but it does take its toll — at least forty hours a week of work, six hours of classes, and (say) twenty hours of study and homework, plus some volunteer work unrelated to those, doesn’t leave me with a lot of free time; and you can see it by the decline in my hobby activity.

I don’t want to lose sight of what I love, though; and I hope to make a small business of electronics and make a few products available for sale. So this summer I’m devoting every spare moment to get some projects off the ground. And my ally in that plan is BatchPCB.

Why Have Boards Manufactured?

In the past, I’ve done a lot of circuit prototyping on breadboards. For some types of circuits, though, the needed prototyping has more to do with physical form factor and less to do with circuit validation. (I hope to show some examples in the coming weeks.) I’ve etched my own circuit boards; I’ve imposed on friends to mill prototype boards for me; and I’ve hoped to build my own milling machine to prototype my own boards at home.

The drawback of all of these methods is the lack of plated through-holes. I’ve heard of DIY hole-plating methods, but I found them to require a prohibitive setup for chemical processing. I’ve asked everyone I know whether they can think of any source for 1.5-ish mm (60 mil) OD copper or silver tubing, thinking of making a small riveting press to flare tubing onto the PCB surface both top and bottom — and even found very small silver crimp tubes used in beadwork and jewely-making, but none as small as 1.5 mm OD, nor in a consistently appropriate length.

I’ve worked around the lack of plated through holes by laying out boards that don’t require them, always carrying a signal from top to bottom using a component lead that can be soldered on both sides. But this means no vias (soldering pins top and bottom just to change layers is a pain) and only crossing layers at resistors and diodes. It means always routing connections to electrolytic capacitors on the bottom, ’cause you can’t get to the top side of the board to solder unless you stand the capacitors way up on their leads. It means routing traces to headers only on the bottom, or sliding the plastic guide up on the pins to solder the top side and then sliding it back down. It means a dozen little design compromises for a prototype board that don’t need to be made for a board I’m going to have commercially manufactured later. It means not only extra effort to accommodate my prototyping methods but also extra effort to undo that work before going to manufacturing.

SparkFun Electronics created BatchPCB as an offshoot of their own PCB prototyping contract. They aggregate orders from multiple users, tile them together onto standard-sized panels, upload the panels to Gold Phoenix, get the boards manufactured, receive the shipment from Gold Phoenix, sort out the boards, and send them back. They charge $2.50 per square inch, which is higher than you’d pay if you were ordering 100 square inches — but far less than you can pay anywhere else if you only want a few square inches of prototype. And they charge a flat $10 handling fee per order, regardless of how many designs you include in your order.

They suggest it’ll take about three weeks to get your order. My experience has been two weeks. It sounds like a long wait, but as they say:

As we develop projects, we always get at least one PCB design onto the week’s batch panel. While one design is being fabbed, we have new PCBs for another design already arriving from a previous batch – we always have new PCBs to play with!

My Summer with BatchPCB

I’m trying to place an order every two weeks and to order boards for multiple projects each time. I’ve received two batches so far and I submitted a third this weekend.

Circuit boards from BatchPCB

I’ll say more about these designs as I work on the projects, but starting at the top and progressing in reading order:

  • Logic gate boards to help bridge the huge gap between what happens in the digital design lecture and lab. My classmates with no prior experience did not gain much academic value from poking opaque ICs into breadboards.
  • A Freeduino-derived board for my personal use, manufactured as a proof-of-concept that I have the right components and schematic to embed an Arduino-compatible core into projects of my own. (I will of course publish all source files for designs that I distribute to anyone other than myself.)
  • The first half of a pair of boards to breakout a headphone cable and jack for breadboarding, to plug an iPod’s headphone output into op-amp filter circuits and listen to the results.
  • A board for testing component lead fit against through-hole sizes. To date, I’ve used calipers for measuring lead sizes for PCB design. I’m curious whether testing against a physical board gives me any different expenditure of time or quality of results.

The logic gate boards were my first batch. I ordered four each of two variants of the boards, assembled a few, and discovered that I don’t like soldering 0603 SMT as much as I thought I did; so if I make more, I’ll be changing the boards to use 0805 components.

Lesson learned: Order only one of your first prototype, regardless of how sure you think you are that you’ve finalized the design.

So why so many of the other boards? I did order only one of each … but SparkFun, bless their hearts, appears to fill wasted space in each panel with small customer boards that they give back to their customers as a bonus; and I happened to have small designs in this batch.

Motherboard Electrolytic Capacitor Replacement

April 15th, 2012 by Keith Neufeld

I’ve been quiet lately because I’ve been too busy … hope to break free of that by mid-May and get back to some projects.

I’ve made time to do a little server work; I’m trying to build a more consistent set and get my servers all up to current OS versions. I have three nice rackmount server cases, and while scrounging ATX motherboards to put into them, I ran across this.

Computer motherboard with bulging electrolyic capacitors

The electrolytic capacitor just to the right of the center of the image is seriously bulging, as is the out-of-focus capacitor behind it. They both test good with the Capacitor Wizard, but I wouldn’t trust either of them with power applied, at least not inside anything I care about. Always at least visually check electrolytics before you power up something that’s been off for a while.

Desoldering was easy — heat both leads and gently rock them out.

Cleaning the solder out of the through-holes was trickier. At least one of the holes was attached to one or more large copper planes and kept sucking away the heat — I had to add solder, keep it preheated with the iron so it stayed liquid through the hole’s whole depth, and quickly slip the solder braid into place. Heating solder braid on top of a topped-off through-hole wicked away the top solder before heating it all the way through.

And then I ran out of solder braid. Ended up drilling out the holes, which I’d wanted to avoid in order to avoid any risk of damaging the plating. But I picked a small enough bit that I didn’t even remove all the solder, and it worked out okay.

Computer motherboard with replaced electrolytic capacitors

The replacement capacitors I had on hand were a little wider and crowd adjacent components, but at least are rated for 105°C like the originals. And they seem to work; the board is now cheerfully running my new backup server.

Notching a Circle in Inkscape

March 3rd, 2012 by Keith Neufeld

I needed an SVG and DXF of a circle with notches around the perimeter to laser-cut a diffuser lens and to subtract the lens’s shape from its housing in OpenSCAD. The best tool I had for the job appeared to be Inkscape (in part because I really wanted to do it with an open-source tool so it could be repeated by others), and the method was quite a process of discovery, aided greatly by John Harrison.

Here’s how I did it.

Inkscape circle with position and dimensions

Draw the circle and use the toolbar transforms to set its diameter and position it at the origin. (Since positioning the notching figure correctly on the circle must be done in absolute coordinates, it’s easier to calculate with the circle centered at the origin.)

Inkscape circle and notching square with position and dimensions

Draw a shape you want to use to notch the circle (in my case, a square rotated 45 degrees) and use the toolbar transforms to position it to notch the circle (in my case, overlapping by 0.100″, by setting the X coordinate to half the circle’s diameter minus 0.1″). The next step will be easier if you also size the shape so that its bounding box (enclosing rectangle) is an even number of the units you’re using in your coordinate system (inches).

I had hoped, by the way, to do this by insetting a circle by 0.1″ (but I can’t find how to inset by a distance other than pixels, nor to set my inset distance numerically other than zoom way in and watch the mouse position while I drag the inset control point) and then snapping the square’s position to the inset circle (but Inkscape doesn’t appear to snap to geometry).

What I tried next did not work — moving the square’s pivot point to the origin and creating 16 tiled clones of the square with -100% shift X per column and -22.5° rotation per column. (I’ll show those steps later when I describe what actually did work.) For some reason, Inkscape acts as though my pivot point is 0.1045″ left of where it actually is, and I’m not willing to fuss with manually calculating the (in)correct pivot point every time I want to tile by rotation.

Instead, duplicate (Edit / Duplicate or copy/paste) your notching figure and move the copy to the far side, opposite your original, rotating it 180° if need be. Positioning the second notching shape is where the integer-unit-sized bounding box comes in handy — I placed mine with an X coordinate of negative (half my circle’s diameter minus the inset amount plus the notching obect’s box width), or -(4.350″ / 2 – 0.100″ + 1.000″) = -3.075″.

Select and group (Object / Group) the two notching figures. The next step only works on a single object, not on multiple selected objects.

With the grouped notching objects still selected, enter the tiled clones dialog (Edit / Clone / Create Tiled Clones...). On the Symmetry tab, leave P1: simple translation selected, click the Reset button in the lower left to set everything to defaults, and change the number of columns in the Rows, columns to half the number of notches you want (since you’ve grouped two notching figures together already). On the Shift tab, set Shift X to -100% per column. On the Rotation tab, set the Angle Per column to -360° divided by the number of notches you want (-360° / 16 notches = -22.5° / notch). (Apparently Inkscape rotates clockwise for positive angles, the opposite of the entire field of mathematics.)

Click the Create button, note that the lower left of the dialog box tells you how many tiled clones have just been created, and slide the dialog box out of the way to view your results. If it’s not what you expected, click the tiled clones dialog’s Remove button and review and retry your tiling configuration until you get what you want. Once satisfied, close the tiled clone dialog box.

Immediately delete (Edit / Delete or press Delete) the selected figure. The tiled clone tool leaves your original figure selected and makes a copy of it at the original position; you want to delete the original before continuing.

Select everything (Edit / Select All or Ctrl A or drag a box around everything) and ungroup (Object / Ungroup) to isolate your notching figures, as the next step operates on only two shapes at a time.

Select your circle and one of the boxes and do a path difference operation (Path / Difference or Ctrl -). This should carve your notching shape out of the circle. If instead it carves the circle out of your notching shape, undo, then select the circle and lower it to the bottom (Object / Lower to Bottom) before continuing.

The notched circle should remain selected after each difference operation. Continue selecting additional notching figures and taking the difference until you’ve created all your notches. VoilĂ ! (Or “Viola!,” as we say on the Internet.) A notched circle.

Take care if you intend to move the circle to a specific position on your page: its dimensions may have changed, as the dimensions shown are those of the bounding box and any notches on the right, left, top, or bottom may have allowed the bounding box to creep in a bit. You may need to account for this and add a tiny offset to get the center where you want if you’re positioning the notched circle numerically.

Better Ways?

If you know an easier way to do this, I’d love to hear about it in a comment. Please try your method, right now, before posting a suggestion. It’s too easy to think something will work, or think you remember the exact details, and with the best intentions still mislead people. Always always always test your technical advice before posting it.