Category Archives: Electronic Projects

IMAG0327

IteadStudio Prototype PCBs

Hack a Day had a post a while back involving a site called Dirt Cheap Dirty Boards offering (10) 5cm x 5cm boards for ~$15 shipped. I immediately wanted to test them out because that sounds like a pretty fair price. I tried to look into them a bit more, and after going through a few forums, it turned out that the site was made intending to be a joke (although they seem to actually be providing services now thanks to demand).

Despite them seeming like a non-option, I did a bit more research. There are a number of other fab shops that offer similar prices. The one that kept turning up in my search was IteadStudio, although others like OSHpark also showed up. IteadStudio had pretty good reviews though, and the prices were decent ($12 for 10 5×5 boards, and ~$3 shipping). I ended up deciding to go with IteadStudio and give them a try.

I don’t have too many Eagle boards designed just yet, because most of my stuff is breadboarded, so I only had a few options as far as what to send them. I ended up using the board layout for the Fireflies I posted earlier as well as a new board for noise makers (a device that can be hidden and beeps randomly). IteadStudio allows panelization of boards, so I managed to fit 3 Fireflies and 1 noise maker in the design, giving me 30 Fireflies and 10 noise makers overall. I submitted the order after adding a few misc electronic parts and got away spending less that $20 including shipping. That feels cheap enough that even if all I bought was crap, it wouldn’t be the end of the world.

Anyhow, about 3 1/2 weeks after I placed the order, I received the PCBs and parts in the mail. They did ship registered airmail so I needed to pick them from the post office after not being home to sign for the package. Once I had the package though, I opened it up and the PCBs looked like I would expect them too.

IMAG0327

They all seemed to have perfectly etched traces, silkscreen, solder mask, even the vias seemed fine. I hadn’t ordered PCBs before, so I wasn’t sure if vias would be included or extra. But, they all seemed pretty good, so I cut them out to their respective boards and soldered on all the necessary components.

IMAG0369

Then I programmed the microcontrollers for each. I found this connector for SOIC-8 packages on eBay for ~$10 and it makes programming this SMD package loads easier.

IMAG0373
IMAG0375

All said and done, I don’t think I found a defect on any of the boards. I’m absolutely impressed with the quality and will source PCBs from IteadStudio in the future for sure.

IMAG0243

TDA 2030 Stereo Amplifier

My latest endeavor has been to create my own stereo amplifier for use with speakers I already own. This has been something I’ve wanted to do since taking the Microelectronics course at school.

Before actually creating one, I considered which topology/class I might have wanted to use for the amplifier: A, AB, D, etc. That ultimately didn’t matter much in the end since there are a number of ICs out there that implement most of the topology for you, only requiring that you supply the right filter caps, input impedance, input bias, etc. With this in mind, and after reading some great online reviews, I ended up purchasing TDA 2030′s as the amplifier IC for the project.

The basis I used for the circuit was the “Single supply amplifier” in the datasheet. This circuit is fairly impressive as is, using reasonably common components and outputting a good amount of power. The only lacking thing I would note of the circuit is an absence of volume control. Volume control would hopefully be easily implemented with a potentiometer, I thought, so I went to work.

All the components for this particular project are through-hole components, so I prototyped the circuit with a breadboard. I tried the prototype out with a couple different power supplies, one 13 volts and one 19 volts. The datasheet only graphs response of this amplifier for 24 volts and up, but I was quite pleased with the volume this put out with even the 13 volt source. The breadboard version of the circuit can be seen below.

IMAG0241

The breadboard version was mostly a success, although the volume control did not work out quite the way I wanted it to. I could use the potentiometer to vary the volume, but it also varied the frequency response of the amplifier. Because of the caps in use, and the input being biased (the bias is required due to this being a single supply amp), the potentiometer would lower the volume by changing the RC time constant of the input effectively lowering the overall gain and increasing the lower frequency cut-off. Only high frequencies could be heard at lower volume (intuitively this would make sense, as the higher frequencies carry higher energy, but it felt very audible that less low frequencies were allowed to pass altogether).

After the breadboard version turned out a success, I set out to create a PCB version with two channels. The datasheet contains a PCB layout for the “Single-supply high-power amplifier” circuit, which is fairly similar to the “Single supply amplifier” I had already prototyped. With this in mind, I placed all my components down in Eagle, connected the appropriate signals, and used the autorouter to produce the traces. (Tip: To do a single sided PCB with the autorouter, set either the top or bottom trace to “N/A”.) After getting traces oriented, I widened them where applicable to ensure adequate power could reach the necessary components. The ending PCB layout is below.

PCB TDA2030

After completing the PCB, it was time to print and etch the traces. I used toner transfer here, and decided to try a somewhat new method for transfer. I first heated the copper clad board with a heatgun to ensure the surface was warm and would hold the paper containing the traces. I then placed the paper with the traces on top of the board, and proceeded to heat the paper with the heat gun. Next, I used a makeshift rolling pin to apply pressure and press the toner onto the copper (think laminator, I tried to imitate that same effect). This method actually produced a very good transfer; only one of the outer traces had any issue fully transferring (which I “repaired” using bits of wire soldered between the gaps of the offending traces).

After the board was etched, I realized I did not connect the signal ground input pin to the reference ground of the rest of the circuit. I ultimately remedied this by adding some jumper wires to the overall wires needed to connect power, speaker terminals, and input terminals. The extra wires made it seem a bit more disorganized, but I’m happy with the result. The board and power/input/output panel can be seen below:

IMAG0244

IMAG0245

At this point, I decided to test the board to see if everything was working. It didn’t unfortunately :( I was getting sound output at the time, but it was maybe 10% of the output I’d gotten out of the breadboard prototype. I looked over the breadboard and the PCB multiple times trying to look for issues. I found another broken trace, and also a few resistors that didn’t look quite right. It turns out I had placed some 100 Ohm resistors where I needed 100 kOhm resistors. (I took a quick sanity check at that time and looked through my parts. Whoever sent me these resistors marked 100 kOhm on the package, but the color code clearly indicated 100 Ohm.)

I ended up replacing the resistors with the correct values, and repairing the last broken trace. With everything complete, I tested the setup and it worked perfectly. My final steps were to cut out a hole in one of the speakers and mount the board as well as input/output panel. I measured, then fired up the jigsaw and cut out the hole in the speaker as seen below:

IMAG0246

IMAG0247

With the box prepped for the speaker. I soldered in the channel for the speaker that houses the amp. I also mounted the PCB inside the box, which presented a slight challenge; there was no easy way to maneuver inside the box. To get some sort of mounting in place, and prevent too much unwanted movement of the PCB, I ended up drilling a hole in the bottom of the box and PCB which I used with a bolt and nut to hold the PCB in place while it is in the box. The input/output panel was easy enough to mount, and was put into place with 4 small wood screws. The panel and board mounted are shown in the photos below:

IMAG0248

IMAG0249

Everything was finally put together, so I could finally do a quick demo and record the final product. Have a listen, it’s not bad for a ~$8 amplifier!

You can download the PCB layout here: TDA2030 SSA
Note: The final PCB included above has the ground traces connected for the input signal. This change was too late for etching, but I did make it on the PCB layout.

Parts list:

  • (2) TDA 2030 ICs (my particular part no is now “obsolete”, but a newer TDA 2030 chip should substitute just fine)
  • (2) 2200 uF capacitors
  • (2) 470 uF capacitors
  • (8) 100 kOhm resistors
  • (2) 1 Ohm resistors
  • (2) 4.7 kOhm resistors
  • (2) 2.2 uF capacitors
  • (4) 0.1 uF capacitors
  • (4) 1N4001 diodes

Optional parts (used for input/output panel):

  • (1) Size N coaxial power jack
  • (2) Phono jacks (could substitute for 3.5mm stereo jack)
  • (2) Banana style jacks
  • (1) Power switch
IMAG0186

LED Fireflies

The holiday season has now come and gone, and now that it has I can share some of the details about presents I created for Christmas. This Christmas, my family decided that many of the gifts we give should be created and not bought. I took the opportunity to practice and refine skills among my hobbies.

Specifically, I decided that I would create electronic fireflies as one of my gifts for family. I also decided that I would try to create these on their own dedicated PCBs and housings.

The PCBs were going to be a challenge, as I had not created PCBs before successfully, and I had chosen to use surface mount MCUs.

Before diving into the project, I leveraged an existing project to try to reduce some of the complexity I had chosen to undertake. To do this, I started with an existing asynchronous fireflies project made by Karl Lunt (Very low power LED firefly via HackADay). The overall goal is to simulate intermittent blinking in low light conditions like a firefly.

Using the existing project, I did need to modify a few things. First off, I was using an ATtiny85 instead of the ATtiny13a, as well as an external clock. Luckily, the external clock only required a few fuses to be set as far as programming went, and a couple load capacitors to allow it to be used with the MCU. The ATtiny85 required a few code changes because the output port for the LED and mux for ADC had to be changed among other registers.

Unfortunately, at this point, I did not have any through-hole ATtiny85s, so I could not breadboard the project. What else was I supposed to do at this point, besides making a PCB and hoping for the best? That’s exactly what happened. I did get a new laserjet printer during black friday last year, so I decided to try the toner transfer method. I used photo paper for the print, and Eagle to create the traces needed. I used a couple different designs for the fireflies I handed out on Christmas.

Fireflies v1

To do toner transfer, I print the PCBs mirrored on photo paper, and cut them out for transfer to the copper clad board. I’d seen a few different methods of performing the transfer, such as an iron or laminator,  but I instead chosen to use a torch for heat. I sandwiched the PCB and the photo paper between two sheets of steel and heated the steel from the outside. This worked okay, achieving about a 57% success rate (4 out of 7). Luckily, I was able to get away with only handing out 4 fireflies, but I’ll digress..

After the transfer was completed, I used soapy water to remove the photo paper, and cupric chloride to etch the board. What I had read about cupric chloride suggested this would be a quick process, but it was not, perhaps because I was doing this in 30 degree weather. The process eventually produced good traces on the boards however.

IMAG0182

After the etching was complete, my next task was to solder on the SMD ATtiny85s. I had never done any soldering of SMD before, nor would I consider my through-hole soldering skills refined, so this was a somewhat daunting task. Anyhow, I went about this task by dabbing solder paste on the pads of the PCB and then placing the ATtiny85 on the pads. I successfully reflowed each board by using a heatgun ($9.95 harbor freight special). The heat gun works relatively well at least for this size of board, larger boards might prove troublesome. Well my reflow was mostly successful, I did get some pin bridging though, to resolve this I touched bare copper wire to the bridge while the solder was still melted; the bare copper soaked excess solder rather well (alternatively, using a soldering iron with solder wick and flux may be more reliable).

After the SMD chip soldering, the drilling and through-hole soldering needed to be done. I used a rotary tool and mini-drill bits from harbor freight to drill the board. A quick tip here: design your pads for through hole components with a hole in the center, I thought the solid pad would be just fine, but drill bits easily slide along copper when they otherwise catch the epoxy board just fine. After drilling, all the through-hole parts were soldered.

Next up was to see if I could interface with the chip and get the external clock to work. To interface with the chip, I used some tiny IC clip leads; this works well, but looks horrible. Once I had the ISP interface connected, I was able to read the device ID from the chip, and look at the current fuse settings. I made it this far, so I was pretty happy.

I, next, proceeded to change the fuse settings to use the external clock/oscillator (32kHz). Programming the fuses seemed to work well, until verification came along. The device programmer reported that the device could not enter programming mode. Noooo!!! I made it this far and now the I’ve bricked the chip (I’m aware of HVSP, but haven’t tried it yet). I tried reconnecting the chip multiple times, still couldn’t program it. I checked the interface settings, and realized I hadn’t selected an appropriate clock speed. I reduced the interface clock to 2 kHz, it’s less than one quarter of 32 kHz, so I thought I finally figured it out. Nope! Still couldn’t program the chip. I also tried swapping the crystal to see if the oscillator was the issue, no luck…

After the failed attempts to get the chip back into being able to program, I tried a last ditch effort and figured I could just use an extremely slow clock rate to program it. The GUI for Atmel Studio unfortunately only goes down to 2 kHz it seemed, so I tried this on the command line. I tried using atprogram to read the fuses with an interface clock of 1 kHz. It worked, and then I read the fuses… CKDIV8 is still set. Well, I feel silly… 2 kHz would work to program if using a 32 kHz clock, but it won’t work for a 4 kHz clock. (At this point I was confused that the Atmel GUI wouldn’t go lower than 2 kHz. That’s not the case, the slider only goes down to 2 kHz, but a lower clock can be entered in the text box, go figure…)

I could finally program the chip. I uploaded the modified source code to the ATtiny85, and success! A firefly was born (no crew to go with it, but eh, I’ll take what I can get…).

IMAG0146IMAG0144
The last step was packaging and presentation. The board doesn’t look so much like a firefly, and people capture fireflies in jars right? So I ended up burying the board in sand in a mason jar and got the below product.

IMAG0155IMAG0152
I was then able to hand these out at Christmas. I included extra batteries for each as I didn’t know how long they would last. They all seem to be going on the same battery today, so they’ve lasted a little over 30 days so far.

After the success of these for Christmas, I expanded my parts collection a bit, and created a full SMD version (minus battery holder and LED as it an SMD LED wouldn’t make sense). The board design and resulting firefly are below.

Fireflies v2 IMAG0186
The source and board for this project can be download here: Firefly ATtiny85

Part list:

  • (1) ATtiny85 (ATTINY85-20SH at Digi-Key)
  • (2) 12 pf 0805 capacitors
  • (1) 100 kOhm 1206 resistor (for reset line)
  • (1) 1 MOhm 1206 resistor (for LED discharge)
  • (1) CR2032 battery holder (BC2032-E2 at Digi-Key)
  • (1) CR2032 battery
  • (1) Clear Orange 5mm LED (754-1271 at Digi-Key)
  • (1) 32 kHz crystal (535-9166-1 at Digi-Key)
  • (1) 8 to 12 oz Mason Jar
  • 2-3 oz Sand