Code and Life

Programming, electronics and other cool tech stuff

Supported by

Supported by Picotech

Raspberry Pi arrived today!

A rather long wait ended today, when DHL dropped this little package off at work in the morning. I had placed my Raspberry Pi order in the first 24 hours when they started taking orders (or actually, registrations of interest) from RS Components, but it took about two months for me to receive the invitation to order, and three more weeks for the order to arrive.

Opening up the box, I was greeted with a very small computer, and two small leaflets, a quick start guide and a regulatory and safety pamphlet. The board is really quite small, just a few millimeters larger than a credit card. Two USB slots, HDMI, coaxial and stereo audio plugs and micro-USB for power, plus an ethernet jack.

I ran a quick test to see if everything worked. Initially, there was flicker on my projector (the only device with native HDMI input I currently have), but that turned out to be incompatibility with the HDMI switch I had – without it it worked just fine. I used the premade Debian image on a SD card and it worked perfectly.

Read post

USB HID keyboard with V-USB

There still seems to be a lot of traffic to my V-USB tutorials, so I thought I’d write a short follow-up post on USB keyboards. I already did a USB HID mouse post earlier, so you might want to check that out to understand a bit about HID descriptors and associated V-USB settings (in short, human interface devices send a binary descriptor to PC telling what kind of “reports” they send to the host on user activities).

As a basic setup, you’ll need a working V-USB circuit with one switch and one LED attached. Here, I’m using ATtiny2313 with the LED wired to PB0 and switch to PB1. The ATtiny is using 20 MHz crystal, so if you’re following my USB tutorial series and have that circuit at hand, remember to change that frequency in usbconfig.c before trying this out. Note the cool breadboard header I have, there will be more posts about that one to follow soon!

Read post

Repairing a Shuttle motherboard with new capacitors

Just a short post today, in case this will save someone’s day like it did my friend’s. He has a small Shuttle PC setup that suddenly stopped working about three weeks ago – the machine seemed to power up, but no picture came to screen. After some googling, he found out that the motherboard of this specific MB+case combo sometimes dies because of failed capacitors. And indeed, the biggest caps on the MB seemed to have a slight bulge on the top. So he called me if I could help him to replace them, to see if that would help.

The first thing to do was of course procure similar caps. The possibly failed models were three 1500 uF, 10V caps, so I got four new ones to replace them.

Removing the old caps

The first task was to remove the old capacitors from the motherboard. Because we wouldn’t be needing them, we used some force and cutters to first remove the capacitors themselves, and then set out to remove the legs with a solder iron. Unfortunately, the lead-free solder had a melting point beyond the number 7 tips of my Weller Magnastat, and no amount of heating was able to remove the legs!

Read post

PCB design with DipTrace

Continuing from part 1 of this ATtiny2313 breadboard header with DipTrace -tutorial, I’ll now go through the PCB design. In DipTrace Schematic Editor, I used File->Convert to PCB (CTRL-B) to get the components and connections exported to PCB Layout tool. Like it’s schematic counterpart, also this tool is quite easy to use.

First I change the grid to 5 mil so each step is half of the 10 mil breadboard hole spacing. I then proceed arrange the components roughly to final layout, and add two 10-pin headers which will plug into breadboard. I then remove some component names which are not sorely needed, and change the location for the remaining ones to the center of the component.

Read post

ATtiny2313 Breadboard Header with DipTrace

Sooner or later there comes a point in your electronics career where it would be nice to have a schematic for the project you are doing. If you have a steady hand and lots of paper to spare, the first option is to draw the schematics on paper. However, computer aided design (CAD) software does have it’s advantages, allowing easy modifications, sharing and later PCB creation.

In this short tutorial, I’ll show how to create a simple schematic using DipTrace, an excellent electronics CAD package that has a free version as well as inexpensive entry-level commercial and non-profit licenses. The circuit I’m doing is a simple ATtiny2313 breadboard header that integrates an ISP programming header, a few capacitors, a reset pullup resistor and a clock crystal, eliminating the need to wire these things every time I start a new project. Additionally, I’m showing how to use DipTrace’s powerful facilities to create new components in literally few minutes. Let’s get started!

Why DipTrace and not Eagle CAD (or some other brand)?

The electronics CAD software, the most often recommended software for beginners is Eagle CAD. The main reasons are probably the rather reasonable pricing and large existing userbase. Also, a lot of open hardware projects share their schematics in Eagle format, and many PCB fabrication shops accept Eagle files directly without conversion to Gerber format.

Read post

World’s Simplest Logic Analyzer for $5

Today’s post documents my recent hack that may just be the world’s simplest logic analyzer. More accurately, it is a circuit consisting of a 74HC126 quad buffer chip and R-2R resistor network (eleven 330 ohm resistors) that acts as a D/A converter, enabling one to analyze four logic lines with a single channel digital oscilloscope and $5 in parts!

With the circuit described below and an entry level USB scope like the PicoScope 2204, bursts of data can be captured at 10 MSps (million samples per second), and continuous capture rates of 2.5 MSps are possible, the length of the capture only limited by your PC’s memory. This is obviously much better than recently covered Bus Pirate’s 1 MSps for 4 ms!

Even higher throughput can be achieved with better scopes, although the A/D conversion requires several consecutive samples at same logic level, which means that a 100 MHz scope with 200 MSps capture rate should generally be able to analyze logic operating at ~40 MHz speeds. At such speeds, a fast buffer chip and D/A converter is naturally needed as well.

Above you can see an example of SD card traffic analyzed using my circuit – the full capture was 10 million samples which enabled me to capture all the traffic generated by my SD tutorial project without any additional triggering. Read on for details of the hack. A lot of effort has been made to keep the material very accessible and informative to electronics beginners, too. In the end of the article, source code for PicoTech 2000 series is included, and it can easily be adapted for any scope that can transfer captured waveforms to PC (in the simplest form by reading waveforms from a CSV file).

How It Works

Basic idea is to connect 4 logic lines to a D/A converter, that will transform the binary 1/0 values (represented by VCC and GND voltage levels, respectively) into a 16-step analog waveform. Because input lines cannot be directly connected to the R-2R resistor network that is used to do the D/A conversion, a 4-line buffer chip is used in between to provide high impedance inputs that do not interfere with the logic being analyzed.

Read post