Tuesday, April 21, 2015

AD9833 Signal Generator

In an earlier series of posts, I described building a prototype signal generator using a DAC driven by an Arduino. The Arduino sent sample values to it, allowing arbitrary wave forms to be generated. It was limited to a fairly low frequency by the rate at which the samples could be sent.

An alternative is to use a component that generates signals directly. Analog Devices have several such. They are known as DDS devices, for direct digital synthesis. The idea is that the DDS generates a digital value internally which it then converts to an analog output. The disadvantage of such devices is that they can't generate arbitrary waveforms. For example, the AD9833 generates sine, triangle and square waves, and the AD9850 generates only sine and square waves. They are not really intended for arbitrary signal generation, and instead are aimed more at things such as modulating and demodulating signals.

I put together a signal generator using an Arduino, a prebuilt AD9833 module and some components to provide a user interface: a LCD display, and a rotary encoder. You can pick up AD9833 modules quite cheaply on ebay. AD9850 modules are more widely available and a bit cheaper. Here is the wiring diagram for how I connected it up:
The rotary encoder incorporates a switch, which I have shown separately, and the trimmer is for adjusting the contrast on the LCD.

There is code for it here. Roughly, the idea is to show three fields in the display: the frequency (1Hz to 1MHz), the waveform and whether automatic or manual mode is in use. Automatic mode means changes take effect immediately. Pressing the switch (actually the shaft of the rotary encoder) has various effects. A long press moves between the three fields, indicated by an arrow next to the active field. While in the frequency field, turning the encoder increases or decreases the frequency, and a short press of the button select which digit you are altering. For example, if the current frequency is 10000Hz and the current digit, indicated by a cursor, is the middle one, the frequency changes in steps of 100Hz. On the waveform field, the encoder steps between sine, square and triangle. On the automatic/manual field, the encoder steps between these options, and a short press on the button while in manual mode applies the current settings.

Originally I had thought of making this a full project, packaging it up and adding more options to the software. For now, I am leaving it like this, as I have some ideas for a different signal generator project that I would like to explore.

Sunday, April 19, 2015

Finishing off the PSU

In a couple of previous posts, I wrote about building a PSU based on an instructable. I finished this off by packaging it in a plastic box. The original used an aluminium one, so the whole box can act as a heatsink. The converter board came with a heatsink with some self-adhesive tape. I replaced this with a thermal adhesive pad made by Startech, and then cut a hole on the side of the box for it to protrude from. I'm not sure how hot the heatsink will get and whether this poses any risk to the plastic box; time will tell.

Here's a few pictures. Note that I set this up so that anything that is in the lid of the box connects to things in the base through something that can be unplugged or removed mechanically in some other way. This makes putting it together a lot easier.


Friday, April 17, 2015

Desoldering parts from a buck converter module

A few weeks ago, I wrote about building a power supply based on a LM2596 buck converter module. The design came from a posting on instructables. Destructables might be a better name, as you have to remove two present pots from the board and it's very easy to damage it in doing so. After my first messy attempt I decided to try to do it better. I've desoldered things with a solder sucker and with solder wick, and by just heating and wiggling the part, but all of these have the risk of damaging small tracks or pulling out the through hole plating. A bit of searching pointed me at using ChipQuik. See this video for a good description of it, and also part of this one. It's expensive to buy, but it turned out I had some lying around from a SMD soldering skills kit I got at Jameco. You slather some flux paste on the joints, then melt something which looks like solder over the joints. It's actually not solder, but an alloy which merges with the solder and gives you a mixture that has a lower melting point. You can can then keep all the pins molten which you gently pull on the part. To clean up, I used solder wick, taking a tip from the second video. Melt some solder onto the tip of the soldering iron, place the solder wick over the area to clean up, and then press the soldering iron onto the solder wick. The solder on the tip of the iron helps the wick heat up quickly and transfers heat the the areas of the board you are working on. Together these resulting in a board with clean holes and no damage to the tracks. Nice.

Sunday, April 12, 2015

Dremel tools

I bought a couple of additional tools for my Dremel (actually a Wen). One is the Dremel 561 Multipurpose Cutting Bit. I was hoping this would help when I need to cut a hole in a project box. It's a bit too aggressive for that, and you can't cut accurately to a line, at least on ABS, so I'm not sure I'll be making much use of it. The other is the Dremel 631 Brad Point Bits set. This is really nice - four very sharp drills, with brads (pointy bits) which helps center them when you are starting to drill.

Tuesday, April 07, 2015

Boxing up the Capacitance Meter/Transistor Tester

A short while ago, I wrote about a kit for a tester for capacitors, transistors and other components. I got the kit from banggood and they also sell a plastic case for it. You have to do a bit of adaptation to make the case fit. As they put it: "You need to trepanning for the switch, because this shell is Molding products, you need to DIY yourself". As the saying goes, Trepanning Takes your Breath Away.

There are several things that need doing. There is a switch for operating the tester, but no hole in the case for it, so you need to measure up and drill one. The kit includes a plastic top to put on the switch, but it still didn't make it easy to use, so I replaced the switch with a simple normally open push button mounted on the case. You can drill a hole in the side to get at the 2.1mm power socket. Some of the pictures on the banggood web sites show bringing the 9V battery clip outside the case by making a small notch for the wires, and I did the same, to avoid opening the case every time I needed change the battery. Finally, I used binding posts for the test points. The holes on the case aren't quite far enough apart for the ones I used, so I filed them out slightly. I also rotated the screw terminal block that the wires from these go into so that the opening face inward on the circuit board. This makes the wires from the terminal block to the binding post less crowded.

One other thing I needed to do was to remove a couple of lugs from the bottom half of the case. Without doing this, the case is not deep enough. This might explain one of the comments about the fit on the banggood site.

Here's some pictures:

Sunday, April 05, 2015

ATX power supply

There are many people out there on the web who have taken old ATX computer power supplies and adapted them for use a bench power supplies. Instructables has a page with many such designs, differing mostly in the style of case, and the connectors they use. You can also buy a hugely overpriced kit from Sparkfun. I had an old power supply from a disassembled PC and decided to do the same. I decided that I would use 4mm binding posts so I can plug banana plugs into them, and to include an on-off switch and a couple of LEDs, one for when the power is connected the ATX (standby) and one for when it is actually on. For the project box, I chose a CES box, size 3.97" x 2.12" x 1.72". That's 100mm x 54mm x 44mm in measurements used by grownups.

To get the layout of where I needed to drill holes and cut a hole for the on-off switch, I drew up a diagram in Open Office Draw, then printed it out with lines marking the centers of the holes. One of the holes, for the switch, was rectangular, so I marked the boundaries of where I'd need to cut. It looked like this:

I then took the lid of the CES box and placed it face down on the printed reversed diagram, taped it in place, and used a rules and something pointy to lightly score the positions I needed to drill and cut. Note that my power supply does not have a -5V output, as some older ATX supplies do, and having two posts for ground was just for convenience.

My ATX supply had many wires and connectors coming out of it:

The printed page in the background is an older version, before I realized that there was no -5V. The important connector is the rectangular 24 pin connector at the top right. I hesitated between putting a 24 pin female connector in the box as in this design, or snipping the 24 pin male connector off and bringing the wires in directly. Using a connector has the advantage that if the power supply dies or if I wanted it for something else, I could disconnect it easily, but I wasn't sure that I could cut a clean hole the right size and make it mechanically stable. The design I just mentioned attaches the connector to the box with epoxy, but as these connectors are quite stiff to attach and remove, I'm not sure how well that would survive. Another option might have been to attach the female connector to a piece of stripboard and then attach that the the case with a couple of screws. That plan was thwarted by the size and pitch of the pins on a Molex Mini Jr connector. It's 0.165", so it won't go on standard 0.1" stripboard. One more option is to keep the connector, but make the connection inside the case, with just a hole in the side of the case to bring the wires in. This is promising, but with the size of case I had chosen it was hard to make it work. So in the end I decided to connect a 24 pin female connector outside the box and just bring through the wires I needed. I brought in one wire for each voltage and signal, and two for ground.

With this, we're ready to get out the drill and the dremel. I'm not good at doing the physical construction part of projects, due to a lack of both skill, and good tools. Or perhaps experience rather than skill. I can usually get something that's OK, though it might not look pretty, and in this case I ended up with the LEDs a bit skewiff. I see an analogy with what my coding was like back when I started: I could hack my way to something that would work, but in an unclear way and lacking finesse. 35-plus years of programming and working in a professional environment changed that, and maybe if I spend more time on projects like this one, I'll improve.

With all the parts in place on the front panel, it's a matter of connecting everything up:

I attached the ATX connector to the outside of the case with hot glue, and also daubed a bit around inside to anchor the LEDs and the bundle of wires. To prove it works:

I still have to make some labels for the binding posts, and then it'll be done.

Things that worked and didn't about this. Worked: it's compact, gives useful voltages. Drilling and cutting the case was imperfect but not too bad. Less good: the weight of the bundle of wires from the ATX makes it hard to keep this stable. Some of the instructables projects are physically attached to the ATX case, and this is probably a better idea. Other less good things: I'm not sure how well the glue holding the connector will last. And finally, I scratched the case in a couple of places while putting the whole thing together, which is just annoying. Overall, I'd rate this as 2/5: it works, but is a little disappointing.