Code and Life

Programming, electronics and other cool tech stuff

Supported by

Supported by Picotech

AVR ATtiny USB Tutorial Part 1

I wanted to build an USB device using AVR microcontrollers since I found out that it was possible. However, both the USBtiny project and the more extensive V-USB library lacked an easy-to-approach tutorial. So I decided to make one.

This first part covers the basics for making USB-powered devices, and serves as introduction for second part, which goes through simple example for using V-USB library to implement USB communication to and from ATtiny2313. Additional parts might be published later if I have the time and there’s interest.

But let’s get started. Here is what you need for this first part:

  • USB cable and pin header
  • Small breadboard and a few jump wires
  • LED and 330 ohm resistor
  • Low voltage drop 3.3V regulator, such as LD1086V33 or LE33CZ

The cable

The first thing we need to do is cut the USB cable so the end that goes into computer remains, strip the other end and solder the four wires into a pin header so it’s easy to plug the cable into a breadboard. USB contains four wires which you should solder in the following order (note: not all cables conform to this so check with a multimeter!):

Pin Color Function
1 Red VCC (+5V)
2 White D-
3 Green D+
4 Black Ground (0V)

Here you see the end result. When stripping the wire, be careful not to damage the wires and make sure the wires will not touch each other so your cable won’t short circuit your computer or USB hub!

Cable with soldered pin header

Read post

Apple TV First Impressions

Long time no see. I decided that instead of rambling on and on about my newly acquired Apple TV, I’ll just write about it in my blag. I’ve divided the review into sections so you can dive into the action if you’re only interested in one of the aspects.

Pricing and the Package

For Apple, the 119 € they charge for the second generation Apple TV is not much. I mean, it’s like two iPad HDMI cables, right? With that price, you get a beautiful and very small black box that has a HDMI (limited to 720p) output for video/audio, alternative optical S/PDIF output for audio, ethernet jack if for some reason you don’t want to use integrated wireless chip, and a micro-USB slot for debug purposes (no, I think you cannot connect external drives).

I really don’t have anything but positive things to say about the package and hardware, every detail is beatifully executed. For reference, the hi-fi Cambridge Audio dock that is basically just the S/PDIF part of Apple TV costs a whopping 200 €. So if you can live without 96 kHz / 24 bit audio and satisfy yourself with “just” CD quality sound output, you save 80 € and get a ton of features for free.

Read post

jGoBoard 2.0 and website launched

Although I haven’t been blogging anything recently, just thought to let any readers know, that I’ve created a new library for rendering a photorealistic go board (“goban”) using HTML, CSS and JavaScript. It’s a rather nice piece of software, and published under Creative Commons 3.0 attribution non-commercial license, so it’s free to use in any non-commercial projects.

See the jGoBoard website for more information!

Read post

www.Friendscribe.com launched

I’ve just finished a “public beta” version of Friendscribe.com, which is a web-based chat for keeping in touch with your friends. The idea is that chat messages are stored in a database, so you don’t need to have your browser always open to see what’s going on – just log back in later and see if someone has said anything while you were gone.

Try it yourself at http://www.friendscribe.com.

By the way, the site is powered by CodeIgniter – a PHP development framework you definitely should try out if you’re into PHP web development!

Read post

Linux SATA problem with Abit IP35-E

Just a brief revelation to share with any readers (perhaps they stumble here through Google, or by some horrible accident :).

I’ve had an Abit IP35-E motherboard in my HTPC setup for six months now, and while a great overclocking board, stable and packed with nice features (yeah, right, this is the budget version), I haven’t been able to coerce my Debian Lenny installation copied from previous IDE hard drive, or any Linux Live-CD to properly recognize my 500GB Samsung SATA hard drive.

Because booting to Linux rebooted with USB keyboard on, and IRQ options sometimes seemed to work their magic and temporarily get me to login prompt, I figured there was some IRQ conflict at work. I searched for the fix just half a year ago with no luck, but after 5 months of complete Linux abstince (spelled that wrong, I did), I stumbled upon an article in (now defunct) Fatwallet.

Turns out all I needed was to swap SATA cable from SATA1 port to SATA5 to avoid IRQ conflicts. Voila, now everything works great, no IRQ conflicts there (only SATA1-SATA4 ports conflict with USB controller).

Hope this helps someone!

Read post

Rails template caching intricasies

You just have to love coding. I mean, unless you don’t, you’re not likely to put up with two hours of nearly useless debugging, when you realize your WeBRICK or Mongrel development environment do not work as it should. That’s exactly what I just did, and in order to help others, I’ll give you the details so you can get some decent results when Googling.

The problem: I wanted to do some quick template prototyping. Hitting my WebFaction rails development environment, I started to make changes to a page template, update it, make changes, etc. Only this time no changes were shown after initial load! Only a server restart would make the changes visible. WTF. This isn’t how the development environment should work at all!

Read post