July 6th, 2004


JASCII syndication feed

JASCII ("Jasc's Anime Show Comments and Interesting Images" -- somehow I think the acronym existed before the actual name...) is a site that lists new anime series and gives a short review and some screenshots. It's good to keep track of what is out there and what kind of series it is.
It has a syndication feed over at jascii_syn -- it might interest some of you.
  • Current Mood
    happy happy

Things are looking up again

I went into the city to get some parts for my electronics projects. I got myself some 9-pins serial connectors (male and female) and some ribbon-cable. So now I can make my own serial cables, so I don't have to switch the cable everytime from programmer to target circuit and back again...

The serial EEPROMs I sampled from Microchip have arrived! Now I have another sub-assembly to poke at... It'll have to wait until I got the PWM working, though.

Also, I got a reply from Techcase. The delivery service will come and pick up the PSU, and the case is being shipped immediately. We'll see what will happen...
  • Current Mood
    happy happy
net zombie!

Pulse Width Modulation

A microcontroller is a digital component: there's a voltage on a pin, or not -- 1 or 0, nothing in between. On the PIC, this voltage is the same as the power-supply voltage, in this case, 5V. By connecting a pin to a resistor, you can make a current flow (I = V/R), which you can use to drive a LED. So, if you have an output of 5 volts and a resistor of 270 Ohm, you get roughly 18.5 mili-Ampere of current. Most LEDs can take about 20mA before they break and turn into DEDs (Darkness Emitting Diodes). The more current you feed a LED, the brighter it burns.

I bought some RGB-LEDs. These LEDs are actually three LEDs in one casing: a red one, a green one and a blue one. They all have their own input, but share a common output. By putting current on any of the three LEDs, you can make colors and combinations of colors.
Now, if you use digital logic, you can make 7 different colors (8, if you count 'off' as a color). Because you have 3 inputs that can have 2 values (0 or 1), you have 2^3 = 8 different colors. One of those is 0-0-0, which is 'black' or 'off'.

Now, 7 colors is kind of dull. I'm sure you know the feeling you had when you were a kid and looked in the box with crayons: it didn't contain the exact right color blue, or yellow -- so you had to make do with inferior coloring for your masterpiece of that day.
The graphics card in your computer uses 32-bits of color: each of the RGB-colors has 2^32 different values, so it can produce (2^32)^3 = 79228162514264337593543950336 different colors. That's probably more than is discernable by the human eye (though bakenius probably knows for sure). This means that pretty much any shade of color can be made with a graphics card -- if you know the magic number, you can always get the right crayon from the box!

That's a bit too ambitious for my colored lighting panels, though. But I do want more than 7 colors! So what's an electronics hobbyist to do?
The answer lies in Pulse Width Modulation. It's a fancy name for a relatively simple technique. Instead of 'always on' or 'always off', you switch the line from 'on' to 'off' and back again, so that it is only 1/16th of the time on, or 6/16th, or... you get the idea. If you do this fast enough, there is no discernable flicker, but the amount of current that flows through that line diminishes linearly. A period in which you can switch on or off is a Pulse. The Width of the Pulse varies, and you switch the lines from 0 to 1 (Modulation), hence the name. It's mostly used to slow down motors.

So an 8/16th PWM cycle gives half the current a full cycle gives. In our case, some 9.25 mA instead of the usual 18.5 mA. That's good, because the LED will burn less bright -- more values to make colors with! If we take a pulse width of 16, then each color will have 16 possible values, yielding 16^3 = 4096 possible colors. Certainly good enough for something that just has to cycle through a pre-determined set of colors, right?

But here comes the catch: LEDs don't work linear. A LED that is fed only half the current doesn't burn half as bright. Which means that you will have to experiment which values give off how much light -- which is kind of tedious. But it's even worse: every LED has it's own characteristic, so you will have to change your PWM-numbers for every new LED-type. And now comes the killer: the three LEDs in an RGB-LED all differ too.

I have the PWM-software written, but I will need to build a testing circuit for these particular types of RGB-LEDs. I'm not up to that today, it'll have to wait for some other time...

I hope you enjoyed our little lesson of today...
  • Current Mood
    disappointed disappointed

Blog Haiku-a-day project

The World Blog Haiku Day was pretty fun -- I used to write quite a lot of haiku (with a noted tendency for SciFaiku), so it was fun to get into practice again.
So I'll try to write a blog-haiku every day, from now on, for a week -- to see if it suits me. After the week, I'll evaluate the merits of the concept and decide whether to go on or not. Feel free to join in!

Today's Blog-haiku:
A day for myself
Was not all that productive
Non-linear LEDs
  • Current Mood
    creative creative