Monday, February 8, 2010
Saturday, January 23, 2010
Wednesday, December 30, 2009
Fail Whale Wallpaper
If you're like me you like to keep the wallpaper on your work computer something inspiring. Personally, like to keep the Fail Whale up on mine (no I don't work for Twitter) just to remind me of my potential :). I run a Dell D630 for my work laptop. It has a 1400x900 LCD and when I'm at work I have a couple Dell 2208WFP monitors with 1680x1050 resolution. Anyway, I figured I'd post the wallpapers for anyone who happens to want some fail sauce for a wallpaper. BTW I threw in a 1280 x 1024 as well.
Monday, May 11, 2009
RGB LED
I was messing around with another project (hence the extra crap on my breadboard in the video) when I figured I'd try something out with an RGB LED I had. I was actually trying to make sure I was using my 74HC254 4-to-16 decoder properly. The easiest way was to hook up LEDs. So why not use 1 and make it pulse a little while I'm at it? Anyway, I had to hold my hand above the LED so you could actually see it since my camera/recording LEDs sucks. Here's the code too.

Update: The 74HC154 actually has two pins which aren't in my schematic. They're just the Vcc and GND pins so let common sense guide you there if you happen to try this for some reason.

Ze code:
int addr_pins[2] = { 2, 3 };
int num_addr_pins= 2;
int pwm_pin = 5;
#define GREEN 0x00
#define BLUE 0x01
#define RED 0x02
void mapToPinArray( int arr[], int arr_size, int val) { // This just takes a number and
int i, j; // converts it to a binary pin map.
for(i=0;i> i) & 1));
Serial.print(((val>>i)&1));
}
}
void setup() {
pinMode(addr_pins[0], OUTPUT);
pinMode(addr_pins[1], OUTPUT);
pinMode(pwm_pin, OUTPUT);
}
void loop() {
int i, col;
for(col=GREEN;col<=RED;col++) {
mapToPinArray(addr_pins, num_addr_pins, col); //Set the color
for(i=0;i<255;i++) { // Now pulse the power.
analogWrite(pwm_pin, i); // First to high.
delay(10);
}
for(i=255;i>=0;i--) { // Then back to low.
analogWrite(pwm_pin, i);
delay(10);
}
}
}
Labels:
arduino,
Electronics,
led
Monday, April 6, 2009
Arduino: Driving a 7-Segment Display
So I've been slowly moving toward the idea of maybe doing a clock project with my new Arduino. I've slowly been looking at how to implement different ideas (this Arduino thing is very new to me.) One of the main things is how to utilize a 7-segment display. This implementation is very preliminary and I'm pretty sure that it's not scalable beyond a couple displays. But, I might be wrong.
Anyway, I basically have a "data bus" that's 8 wires wide. Then (since I only have 2 displays) I have 2 wires "addressing" the displays. The displays I have are common cathode which actually works out pretty well. So (see schematic) I have an NPN transistor on the cathode of each display. To allow it to pass current I just apply current to the base, thus enabling the display.
With this sort of hacked-together addressing scheme it's pretty much up to the software to make sure only one display is active at any given time. Any more than that and things get very dim very quickly. I actually have some 4 to 16 decoders on the way in an attempt to avoid having tons of transistors everywhere.
My main concern with the display at this point is how bright it will be once I add more digits. Essentially the way it works is that it cycles through each display, turning it on then off, hundreds (maybe more) of times per second. Our eyes can't see things that quickly so it works out. But what's going to happen if I add 6 more digits? It cuts down the Amp Hours that each display gets by 75% compared to the current 2-display setup. I'll give it a try with the parts I'll have but like I said, I have a strong hunch that I'll need to get a real 7-segment driver chip.
The only other big concern I have is whether or not I should use an RTC (real time clock) or not. Even though I don't think it's flawed to base my time off of the built-in clock, something just doesn't feel right about a bunch of nested for loops to keep track of the time. We'll save that for another post though.
Oh yeah, I did the hex mappings too so once I actually get this clock project further along I may flesh out a "hex mode".


Anyway, I basically have a "data bus" that's 8 wires wide. Then (since I only have 2 displays) I have 2 wires "addressing" the displays. The displays I have are common cathode which actually works out pretty well. So (see schematic) I have an NPN transistor on the cathode of each display. To allow it to pass current I just apply current to the base, thus enabling the display.
With this sort of hacked-together addressing scheme it's pretty much up to the software to make sure only one display is active at any given time. Any more than that and things get very dim very quickly. I actually have some 4 to 16 decoders on the way in an attempt to avoid having tons of transistors everywhere.
My main concern with the display at this point is how bright it will be once I add more digits. Essentially the way it works is that it cycles through each display, turning it on then off, hundreds (maybe more) of times per second. Our eyes can't see things that quickly so it works out. But what's going to happen if I add 6 more digits? It cuts down the Amp Hours that each display gets by 75% compared to the current 2-display setup. I'll give it a try with the parts I'll have but like I said, I have a strong hunch that I'll need to get a real 7-segment driver chip.
The only other big concern I have is whether or not I should use an RTC (real time clock) or not. Even though I don't think it's flawed to base my time off of the built-in clock, something just doesn't feel right about a bunch of nested for loops to keep track of the time. We'll save that for another post though.
Oh yeah, I did the hex mappings too so once I actually get this clock project further along I may flesh out a "hex mode".



Labels:
7 segment,
arduino,
clock,
Electronics,
led
Monday, March 30, 2009
Brand New Arduino
So I just got my first Arduino the other day and I finally got some time to mess with it. After a little trial and error I started to get the hang of it and I combined the Loop and the AnalogInput examples. I ended up with a sort of adjustable "Knight Rider" effect. Here's some pics and schematics. Oh, don't mind all the extra junk on the bread board. It's not part of this project, I just didn't feel like pulling it all off just for a couple pictures.



Here's the modified code:



Here's the modified code:
/*
* Loop
* by David A. Mellis
*
* Lights multiple LEDs in sequence, then in reverse. Demonstrates
* the use of a for() loop and arrays.
*
* http://www.arduino.cc/en/Tutorial/Loop
*/
int timer = 100; // The higher the number, the slower the timing.
int pins[] = { 2, 3, 4, 5 }; // an array of pin numbers
int num_pins = 4; // the number of pins (i.e. the length of the array)
int val = 0;
int potPin = 2;
void setup()
{
int i;
for (i = 0; i < num_pins; i++) // the array elements are numbered from 0 to num_pins - 1
pinMode(pins[i], OUTPUT); // set each pin as an output
}
void loop()
{
int i;
val = analogRead(potPin);
for (i = 0; i < num_pins; i++) { // loop through each pin...
digitalWrite(pins[i], HIGH); // turning it on,
delay(val); // pausing,
digitalWrite(pins[i], LOW); // and turning it off.
}
for (i = num_pins - 1; i >= 0; i--) {
digitalWrite(pins[i], HIGH);
delay(val);
digitalWrite(pins[i], LOW);
}
}
Labels:
arduino,
Electronics,
led
Tuesday, March 24, 2009
DIY Power Supply
I was sick of eating up %20 of my breadboard with voltage regulation and power conditioning stuff so I decided to whip out the soldering iron and do something about it. Nothing in this post is original but I figured I'd show my implementation. Now everything revolves around the 7805 voltage regulator. It can take anything up to 35VDC and drop it to 5V. I grabbed an old 15V wall wart and it works just fine. You probably don't want to go below 7-8V though. Now the tricky thing about wall warts is that the power they output is far from clean. It's the last thing any of your projects need. So, to clean it up I threw a couple capacitors between the VRU input and ground, and between the VRU output and ground. This will give you a nice steady 5V, free of any ripples.
I also added a 9V battery and a switch to toggle the VRU input between the wall wart and the battery. Here's where having the capacitors comes in extra handy. It turns out that not only do they smooth out ripples, they can also hold the load for a short period of time (.1 - 1 second). It's not much but if you flip the switch quickly you can flip your project over to battery if the need ever arises. Anyway, I made a little video demonstrating this effect and there's also a schematic of the power supply. There are probably about 100 other ways to do this but so far this is working out well for me.



I also added a 9V battery and a switch to toggle the VRU input between the wall wart and the battery. Here's where having the capacitors comes in extra handy. It turns out that not only do they smooth out ripples, they can also hold the load for a short period of time (.1 - 1 second). It's not much but if you flip the switch quickly you can flip your project over to battery if the need ever arises. Anyway, I made a little video demonstrating this effect and there's also a schematic of the power supply. There are probably about 100 other ways to do this but so far this is working out well for me.



Labels:
diy,
Electronics,
power supply
Subscribe to:
Posts (Atom)