Monday, September 5, 2011

Meter backpack.

Well dammit.  I spent a few hours testing traces and resoldering points on the not-working board only to finally realize I'd soldered the transistors on backwards.  Fixed that.  It's still not working, but it was more not working before.

Perils of DIY Etching #62:  no silk screen means no markings to align your components correctly.  I might actually print up a silkscreen layer next time and iron it on after I've tinned the traces.

I'm seriously considering just bailing out on this board and etching a new one with vias to make almost all component soldering happen on the back.  This one has been soldered and resoldered so many times I don't know if I trust it to last a month.

Perils of DIY Etching #23:  no through-hole plating means that header pins and other components that can expect some stress are only soldered to a tiny, poorly-adhered wafer of copper.   You are in a maze of twisted copper traces, all alike.  You are likely to rip one up.


Not sure how to best address the strain relief issue, but if I redo the board I'm gonna make sure I solder it nice and clean on both sides.

Here's what the board-with-vias might look like:

Like this, except I really need header pads on the top to help hold the pins in place.

Sunday, August 28, 2011

Meter board with control backpack *updated*

Finished soldering the control backpack last night, but I haven't had a chance to fire it up and test yet.  I am certain there will be problems, but an initial continuity check with a meter shows all traces to be doing what they're supposed to do.

Here's the final front and back layouts for the control board:
Top and bottom layers, as I print them for toner transfer.
It's got two TPIC6B595 shift registers with built-in darlington to sink the 11 rows of LEDs, one 74HC595 shift register that's driving 7 high-side PNP transistors to push the 3.3v up each column, and resistors for the LEDs and the transistor bases.   On one side is 11 pin headers to plug into the columns of the meters board, and on the bottom are 7 header pins for the rows.

Even through there's only 3 control wires and VCC/GND, I used a 5x2 header block to interface with the offboard microprocessor because 5x2 is the easiest ribbon cable connector to find around here, and I figure it's easiest for all of the submodules to use the same connector.  Maybe this is dumb, I'll find out eventually :)

Finally, here's a shot of this board plugged into the meters board.   I haven't cut the boards down to their final size or cleaned them up yet, that would be wasted time if the thing is broke.

I had to stand the 7-pin headerblock off the board by a few mm to get the iron in underneath.  Only afterward did I realize I could solder the headerpins 'upside down' and then just push the plastic retainer down against the board.   Live and learn.
The biggest lesson I've learned in this stage is that etching your own board is easy, but soldering to your home-etched boards can be a major pain in the ass.  Specifically, since there's no through-hole plating, you can't just solder your through-hole components on either side and be done;  you have to solder on the side where the pad connects to the trace.  If this is the same side as the component, you're stuck trying to work the soldering iron in underneath the component.   This can be really difficult, and fixing mistakes becomes even more difficult.

I will need to keep this in mind as I lay out future boards, as I really did not enjoy doing this at all and it made for a sloppy solder job.  If I can't get it right in layout perhaps I will add pads right before the component pads and solder to that, then use a wire to jump to the other side.

*update*
shit's broke,   Feels like a solder bridge somewhere, though it's of course entirely possible the whole layout is wrong.   Losing is Fun!

Friday, August 26, 2011

Progress update

Had some extra time this week to tinker.  Here's what I've got:

1) Finally screened and etched the SSOP24 breakout widget.  This is needed so I can breadboard the chip and find its magic.

SSOP-24 breakout.  Toner transfer method is surprisingly efffective.


2) I worked up a shift-register backpack for the LCD screen.   I figured since 4-bit uperation of the LCD screen requires only 7 pins, why not control them with a shift register and reduce the micro pins count by four?   why not indeed.  We will soon-ish see if this is wise or dumb, but I tossed together a simple interface board to help test.
You can see the evidence of a sloppy laser printer:  the ground pours are splotchy because the printer  is too.

3) I'd always planned on an LED Meter bridge backpack to hold the actual control ICs.  I had assumed something like the TLC5940 sinking the rows and a 595 through high-side transistors on the columns.  Trouble for me is, I don't see a great way to control the TLC5940 without using more pins than I have available...   so I'm falling back to plain shift registers.   I'd already made the LED meter board with plan A in mind, so I'll be driving columns no matter what.  unless I remake the board.
Here's the backpack, it'll hold one 74hc595 to fire seven transistors for the cols, and then two TPIC6B595s to sink the rows.

4) I drilled and tinned all of these, and began populating the meter backpack. The tinning ain't pretty, but it seems to work well.

Wednesday, August 17, 2011

Duh moment

I just realized I've been routing audio directly into the digital pots.  And that is dumb.  All this mess about biasing the signal to center around 2.5v and whatnot, so dumb. I have no idea why I went down this path, and I feel pretty foolish.

HEY ANDREW:  USE THE POT TO CONTROL THE OPAMPS.  OR NOT.  MAYBE I WAS RIGHT TO BEGIN WITH.

SO CONFLICTED RIGHT NOW

Tuesday, August 16, 2011

Meter board, double-sided PCB etching

With the success of the SSOP breakout experiment, I was eager to try it on a larger scale.   If everything goes well, I may end up making all of the boards in-house!  This would be awesome, because I make a lot of mistakes and wasn't looking forward to the one-month turnaround times just to learn my board was crap.

The next most-simple board I have planned is the meter bridge.  It's a simple matrix of 77 LEDs, to be controlled by a TLC5940 PWM LED driver chip and a 74HC595 shift register.  In order to fit everything within the front panel of a 1U rack unit, I've opted to move the chips onto a daughter board that will backpack onto the front-facing meter board.  

The meter board is a simple affair, but absolutely requires a two-sided PCB due to the nature of a matrix.  Step one:  design the board.
Front and back of a board for 7 10-LED bargraphs and a single 5mm LED at the top of each column.
Some close-ish traces, but after doing the SSOP I felt confident.

Several people suggested printing both sides and aligning them  face-to-face, taping the paper together on one side, and ironing them both at once.  This sounded a lot better than the one-side-at-a-time technique I had imagined, and in practice it worked perfectly.

Hey, cool.
 I'll solder it up tomorrow night, but dang I am excited about this.   I chose the right drill size this time (1/32") and everything just came together.  Assuming everything is good, this is a major win for my productivity - all of those LEDs and their associated 150+ wires were a total mess on two breadboards.  Consolidating all of that down to just 18 pins is wonderful.  If the soldering goes well, I'll prototype my control chips and then make the daughter board for this, further reducing the pin count to 5.  Yes!


Saturday, August 13, 2011

si4735: AM/FM LW/SW radio on a chip, DIY circuit etching

I noticed this chip on sparkfun the other day, and immediately knew I had to have it in the project.   Since this mixer is meant to sit next to the media PC and handle all audio, it's just too cool to have a radio in the box as well.

The chip looks awesome, but there's a small problem - the largest package available is SSOP in a narrower-than-normal size.  This means that any commonly available SSOP-24 breakout board is worthless.   However, I've gotta break it out to bread-boardable pins because I have no hope of getting it set up correctly without testing first.

That left me with only one real option - I've gotta make the breakout myself.   Instead of using one of the many PCB fab companies, I thought I'd try my hand at etching a circuit myself.

First, a design.  Seems simple enough for a first attempt:
Narrow SSOP-24 breakout.  Click for full size
So there are several methods for DIY etching.   After some research, I decided to try the toner transfer technique, where you print your design on glossy paper and then iron the plastic toner right onto the copper.   The toner resists the etchant, and boom hot dog.

My first attempts were failures of course - it took me a while to find the right combination of paper and heat and time, but in the end I got a good transfer. Etched it, and all traces were good!

Soldering to a board without plated pin holes is trickier than I'm used to.   Also, I drilled the holes a little big, so I had to bridge the gap between the pad and the pin.   It took some re-working and the result is ugly as hell, but all pins are clean and working.

SSOP breakout board.  This is an earlier design than the one above, and the solders are /ugly/
I'm extremely encouraged to know I can cheaply and quickly make PCBs with tiny SMDs.


Sunday, August 7, 2011

Maple Mini

I ordered a Maple Mini last week and it showed up on Saturday.  It's a fantastic piece of work, it's extremely fast, lots of hardware interrupts, lots of memory, and I'm having a blast playing with it.  I was running up against many limits with the ATMega328, and I was adding lots of components to work around them.  With the Maple, I can get a little lazier!

Friday, August 5, 2011

Back at it

Well, that was a long break from the project.  But now I have a 7-month-old daughter!

Saturday, January 29, 2011

Audio setbacks

Well, I knew I didn't have all of the audio issues worked out, but I didn't know it was this bad.

I finally broke out one of the DS1807 digital pots and got it working.   Some notes:
* I think I have the audio biased around +2.5v correctly.  Even without this the pot works and I don't hear clipping, but it's noticeably better with.  I'm probably still screwing something up here.   No mater what, the audio board layout I've got is definitely wrong and needs a pretty big re-work.
* The zero-point crossing feature of this chip is not working.  I've tried tying AREF to +2.5 as well as to the other end of the wheatstone bridge, but there is still a *click* when level changes.
* My row/column scanning pauses *very* noticeably when writing over the I2C bus.  this means the write is taking a really long time, like 0.5sec.  I should dig into the Arduino Wire library and see what I find;  perhaps I'll need to resort to port manipulation.   I'd rather not :(
* Lighting any LEDs in the matrix causes noise.  Lighting many LEDs causes a LARGE amount of noise.  It seems to go away when I turn the pots all the way down, meaning it's not noise related to the ATMega328 crunching or the shift registers doing their thing...   This is probably good news, as I'll have the LEDs pretty well isolated in the final product.
* Writing over I2C is LOUD.  A half-second of BZZZZT happens on every write.  I am sure there are ways to avoid this, as the DS1807 is primarily intended for audio applications.  I've just gotta get better at isolation and grounding.
* USB noise is still present, especially when I do something graphically heavy on the computer.  I'm encouraged because it was much, much worse before.  I'm assuming this is because components are in different locations on the breadboard now, and that means it's probably fixable with intelligent layout.

In my last post I defined my main issues to be:  snappy display and responsive controls.  I'm adding noise-free operation to this list.

Friday, January 28, 2011

Display test

In the midst of some breadboard work I began to get worried about cycles.   Specifically, I wasn't sure the ATMega328 + arduino bootloader would have enough processing power to do everything I have in mind.    As I see it, the two critical factors are a snappy display and responsive controls.   The LEDs have to be updated at least every 4ms to avoid a strobe effect, and preferably more like 3 or 2ms.  I thought this would be easy with a 16mhz CPU, but some quick tests I ran (with my terrible, terrible code) had me worried;  I was running into strobe territory with a very small number of additional instructions.

So I wired up the whole display section on a breadboard to see if I'm on the right track.   Here's video of an early test.   4 10-segment LED arrays.   Each time through the main loop:
* An analog pin is read 5 times
* The values are mapped from 0-8
* The mapped values are shifted out to the Row and Column registers.
I put a pot on the analog pin so I could wiggle it around and see the results.   I'm relieved to see that there seems to be quite a bit of headroom.   (The flickering LEDs in the upper right are due to me selecting poor cutoff values)



Heartened, I next wired up all 5 LED arrays, and added the extra shift register needed for LEDs 9 and 10.  Additionally, I added the multiplexer I plan to use to switch between each audio input and wired 4 pots to the MUX (didn't have 5 on hand).   In this video, each loop has the following steps:
* The three MUX control pins are set 5 times to select input channel
* The analog pin is read 5 times
* The values are mapped from 0-8
* The mapped values are used to lookup the appropriate LEDs to light
* The looked-up values are shifted out to the two Row and one Column registers 



It appears my concerns were unwarranted.  I know that many of the Arduino functions (like shiftOut) translate to quite a few steps in actual AVR code, so I'm glad to see that I've still got a good amount of headroom after doing so many shifts and reads.  I was able to add up to a 4ms delay on the whole program and it was still quite acceptable.   Hooray.

There's some issues with using the MUX.  When the signal approaches +5v, things get flickery and glitchy. I should probably read the datasheet.  Also, since the MUX needs 3 control pins plus the one output pin AND I'm only reading 5 inputs, I'm only saving 1 pin...   I need to revisit my audio board design once I have a better grasp of the amping and biasing process.  If the signal is already in a happily-readable state before it hits the mux, I'll just remove the mux and run them all right back to analog pins on the arduino.   I just happen to have a single pin free, and this would remove a good number of steps from the main loop. 

I'm still struggling with audio signal manipulation and interpretation.  A couple of halfassed attempts at biasing and amping a linelevel signal produced bupkis.   Perhaps I should read up on what I'm doing instead of taking more shots in the dark.

Sunday, January 16, 2011

Audio Board Again

Spent a few hours today reworking the audio board.   I've learned that digital devices want an audio signal that's not referenced to 0V.   Makes sense if you think about it, they only work in the positive domain, so an audio signal that spends half of it's time below 0 isn't going to be happy.   My current solution is to simply add 2.5V DC to the signal, the 2.5 I was already generating for the inverting input on the single-supply op amp. In theory this will center the signal between ground and VCC.

The latest audio board.
edit: added output caps, fixed input caps.

I also applied my newfound groundpour abilities to the board.
I've got a few little issues on this, but I'm pretty certain I'll be adding a component or two before it's done.

Friday, January 14, 2011

Main Board layout

Now that I have a decent idea of what each subboard will require, I've begun laying out the main board.  It's really just a breakout board for the processor, but I've included the MSGEQ7 chip here too because the audio board is already pretty busy and this will cut down the number of header pins needed.

Front and back of the mainboard

I've learned about ground pours and how to draw them in Eagle.  It's a little counterintuitive at first, but it makes sense once you see it.   This is a good but outdated tutorial. I'm pretty sure I'll have some noise issues once I assemble everything,  but hopefully this will have a positive effect.

In other news, I managed to score $60 credit in Sparkfun's Free Day.  The servers were slammed but mysteriously opened up right at the end, so I only had the chance to answer 6 questions before the money ran out.   $60 in free stuff is awesome, I am definitely not complaining!

Sunday, January 9, 2011

Display layout

While I wait for my USB<->Serial chip to come in I've been working on the display board layout.  Initially I just wired it up and tossed the components on there as I went, and it came out kinda OK I guess
Five 10-LED arrays with resistors and three shift registers to drive them.
The horizontal resistors would have been soldered on the back of the PCB.
But then I remembered that I want the display on the front panel of a 1/3rack 1U enclosure and that (optimistically) gives me 1.35" of vertical space to work with.  Couple this limitation with the 4" width limitation on the free version of Eagle and I simply ran out of room.

My solution (for now at least) is to stack two boards, giving me a poor-man's 4-layer board.  This is very similar to the 'shields' you see available for various pre-made arduino boards.   I separated the bits into display and logic and connected them via headers;  they'll just press together.

In this iteration, all resistors live on the back of the display board, right next to their LED.


The display board has some very, very close traces.  I don't know if this is printable.  I think I'll be using sparkfun's batchpcb.com for this, and possibly for the whole project.   Since they have a (very reasonable) $10 setup fee per board, I may try and have these made as a single board, and just dremmel them apart myself.

In other news, it's finally raining.

Friday, January 7, 2011

The perfect chip.

In the process of researching my audio circuit I came across the perfect chip.  The SSM2163 mixes 4 stereo  signals down to two via VCAs, is controlled via I2C, and even includes it's own Vref generator.   Basically it's my whole audio board in one chip.   It's absolutely perfect, and of course it hasn't been manufactured in a decade.  Apparently it was made by SSM for analog synths, but they were absorbed by Analog Devices in the 90s and AD has no use for the device anymore.

While trying to track down one of these chips I came across a sort of chinese grey market for used and discontinued electronics.   The process was interesting:  I put my email and the part number into a couple of websites and within an hour I had 40+ bids!  The prices did not inspire confidence;   they ranged from $2.50 to $175...  just what am I dealing with?     I eventually threw caution to the wind and made a $20 payment to a company who promised two parts, shipped.  

And then they reply, telling me they're now out of stock.   I kissed my $20 goodbye and considered it a lesson learned, but to my total surprise I was refunded in full.    Hooray for the free market?   For the record, the company was HY (HK) IC LIMITED and 'Julie' handled the transaction extremely well.


After poking around some more I've given up on this chip.  I've already got the DS1807 digital pots, and the hassle of fielding so many offers was quite a bit more trouble than just laying this out in discrete parts.

Wednesday, January 5, 2011

Whoops, that wasn't right AGAIN.

You'd think I'd have learned my lesson by now.  Once again I was fiddling around with power supply (this time I was trying to reduce noise from the USB or computer) and managed to kill my fancy-ass FTDI USB<->Serial chip.  The whole part was $15 (making it the most expensive component in the device, ouch!)  but I can get the chip itself for $4+shipping.   Looks like it's time for another sparkfun order, and then I get to learn how to solder SMDs...

Tuesday, January 4, 2011

LED Matrixes with shift registers

I've learned a bit about LED matrixes in the last few weeks.  Here's a few key points:

* The basic concept couldn't be simpler.   A shift register flips on one column, and another register lights whichever LEDs need to be on for that column.  Then you do the same for the next column.  Do it fast enough and boom hotdog.
* Yes, each LED needs to have it's own resistor.  Otherwise the column will get dimmer as more LEDs are lit. EDIT:  Whoops, I'm dumb.   Since only one column will be lit at any one time,  you only need one resistor per row.
* Many shift registers don't deliver enough current to drive more than a few LEDs.   Ditto for the registers on the cathodes;  they must be able to sink the current for every LED they control without asploding.
There are a few ways around this, but most of them involve transistors.  The low-current register signal flips the switch and the transistor does the higher power work.

I'm planning 5 columns of 10 LEDs.   I don't intend to ever drive the LEDs to full power, as this device is intended to sit next to a television and I don't want  it to be distracting.  With some experimentation I've found that a basic 8-bit shift register will happily drive 5 LEDs per channel at my desired brightness without heating up, so that eliminates the need for a transistor array on the rows.  However, the same registers were not happy sinking the current for 10 LEDs so my columns must be handled differently. Fortunately I'd anticipated trouble here, and put this high-power shift register in my last sparkfun order and it happily handles all 10 LEDs.   Important to note:  this chip will not source current, only sink it.

I'm very happy that I won't need to mess with darlington arrays or anything.   A few hours of digging for a simple cheap PNP array were fruitless.

I'll wrap this up with a video.
Here is the familiar 'count to 255 in binary' program, but the high-power shift register is switching the output between three LED arrays, once per step.   I've slowed the steps down a lot so that they would each be visible - normal column-scanning should happen so fast you aren't aware of it.

Monday, January 3, 2011

Noise noise noise

After sorting out the distortion issues with my single-supply opamp, I thought I was essentially finished with audio quality issues, at least until I started to pack these components closely in an enclosure.   Boy was I wrong.

I've left the core of the mixer circuit breaded and active as I play with the display circuit, and I began to notice some noise.   Then when I plugged the USB interface in, the noise got distractingly bad.  It's definitely some sort of interference that's getting passed down the power or ground lines, and it absolutely has to go.

This has been a more difficult subject to research, mostly because the material I find is largely dedicated to high-frequency and RF circuits, not audio.  One of the first successes was putting buffering capacitors (1uf and 0.1uf) on the voltage-dividing-buffering opamp, between the supply and ground.   This immediately cleaned up all but the tiniest bit of already-tiny noise I was hearing without the USB attached.  (That is mostly the noise from the microprocessor,)   The USB noise is proving much harder to tackle.   A trip to Fry's got me an assortment of chokes and ferrite rings, and I've been swapping them in and out on supply and ground from the USB bridge, with varying success.   The biggest problem is that this sort of interference seems to be very hard to chase down;  just waving my hand over the board makes a difference, and the inherent component-jostling that comes with swapping parts makes for fairly unrepeatable results.   I can't tell if my efforts are making a difference, or if I'm just having a lucky low-interference moment...

I noticed that the USB cable I'm using doesn't have a choke on it.    Since the noise I'm hearing seems to track the computer's activity at least as much as the arduino's, I'll see what a better cable can do.

Saturday, January 1, 2011

More audio board simplification

Right, that was dim.   Instead of sending each L/R signal all the way back to the multiplexer before summing them, why don't I sum them at the source?  boom, 50% fewer long traces.

I really like the clean and repetitive upper portion.   The bottom half is a bit awkward, but by this point it's clear that I'll be making more changes anyhow.