Code and Life

Programming, electronics and other cool tech stuff

Supported by

Supported by Picotech

Digi-Key Order and Review

Until now, I’ve been ordering all my electronics supplies through the excellent Finnish firm Partco. However, after running out of ATtiny85 chips I just couldn’t make myself pay 5.90€ ($7.80) when the same part was available for third the price from Digi-Key. I decided to try the fabled distributor myself. In case you haven’t tried them yet, read on for my experiences.

Website and Shopping Process

It is surprising how such a successful electronics component retailer is able to operate with such a poorly laid out and difficult to use website. From a usability standpoint, it’s a prime example of how not do design a web store. There’s so much to critize it’s hard to know where to begin, but here my top annoyances for the front page alone:

Read post

Fast DDS with ATmega88

I’m planning to make some RFID hacking in near future using 150 kHz tags. Since I don’t have a signal generator, I decided to go where quite many people have gone before and build myself one, more specifically a DDS. Instead of just taking a complete project from the net, I thought this would be a good way to learn a bit of AVR assembly programming, and manual D/A (digital to analog) conversion using R-2R ladders. Here’s what I built:

I’m skipping the schematic to save some time – basically it’s a ATmega88 with 6-pin programming header, power, a 16 MHz crystal (other frequencies also work, lfuse for this setup if 0xFF) and a red LED that is not used. The R-2R ladder is wired with white jumper wires to PB0-PB5 (it’s a 6-bit DAC) so that PB0 is the “least significant bit” and PB5 the most significant one. Read on for details.

Read post

Weller Magnastat Autopsy and Repair

Immediately after soldering together my USB password thingy, my solder iron, the family heirloom Weller Magnastat stopped working. Some investigation showed that the base station was providing 24V AC voltage just fine, so I decided to unassemble the handpiece to see if something could be done. Here’s what I found:

It turned out my iron was salvageable; read on to learn a bit about the Magnastat and how I was able to repair mine.

Read post

DIY USB password generator

Having done half a dozen V-USB tutorials I decided it’s time to whip up something cool. As USB keyboards were an area untouched, I decided to make a small USB HID keyboard device that types a password stored in EEPROM every time it’s attached. A new password can be generated just by tabbing CAPS LOCK a few times (4 times to start password regeneration and one tab for each password character generated, 10 is the default password length). Below you can see the device in action:

The place I work at requires me to change my password every few months so this would be one way to skip remembering a new password altogether (as long as I remember to write it down before regenerating a new one so password can be changed :).

What is inside?

The device is powered with a simplified version of the hardware I used in my ATtiny85 USB tutorial – I stripped away the LCD, reset pullup and both capacitors. If you’re better in cramming components inside enclosures I suggest adding at least a 0.1 uF capacitor between VCC and GND, but it seems to work fine even without it:

Read post

DIY resistor folder for 9.90€

If you’ve done even a bit of electronics, the chances are that you’ve already amassed a hefty collection of resistors. Buying them is fun but finding the right values from a stack of resistors is not. I noticed that you can buy actual “resistor folders” with nice labels and the full E24 series of 1500 resistors for $100. I already had resistors so I decided to make my own folder with less expense.

I walked into the nearest book store and quickly found a promising offering: 10 transparent plastic sheets of “collectible card holders” for about 3€. Any store having binders and associated supplies will probably have something similar. I also bought a thin A4 binder and 200+ label stickers for about 9.90€ total (about 1:1 to dollar prices). Here’s what I came home with (already added the stickers):

Each sheet had 9 pockets so for 3€ I get storage for 90 values, and 10-20 resistors fit into a pocket without making the page too heavy. I labeled the first 72 based on my E12 series and that left me with 2 extra pages for “exotic” resistor values. Here’s the first page of E12:

Read post

V-USB: Outputting Data with usbFunctionRead()

I promised to commenter Marek to post an example of using usbFunctionRead() to return larger amounts of data. So building upon the ATtiny85 version we made in last part, let’s add one more command to usbtest.exe:


#define USB_DATA_LONGOUT 5

// [...] Change the buffer size in main():
    char buffer[2048];

// [...] Add the following in the if-else structure in main():

    } else if(strcmp(argv[1], "longout") == 0) {
        nBytes = usb_control_msg(handle, 
            USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, 
            USB_DATA_LONGOUT, 0, 0, (char *)buffer, sizeof(buffer), 5000);
        printf("Received %d bytes: %s\n", nBytes, buffer);
    }

Now let’s tell V-USB that we’re implementing usbFunctionRead() and doing transfers of more than 254 bytes in usbconfig.h:

Read post