LED Fun

Posted in Projects on September 26th, 2009 by nisburgh – 2 Comments

I decided to swing by RadioShack after work yesterday and see what kinds of fun components I could snag.  I came across this tri-color LED ( datasheet – FYI: the green and blue pins are accidentally swapped in the data sheet ) from RadioShack for $2.99.  I’ve been looking at the same thing over on SparkFun – I just hadn’t gotten around to placing an order yet.  What follows is the simple circuit and software I wrote to give this cool LED a test run.  I used a Basic Stamp 2 module, 3 resistors and the LED.

LED Fun Schematic

LED Fun Schematic

First of all, this is how you hook up the circuit.  Those resistance values are calculated using the typical voltages  on the data sheet.  I limited the amperage to 20 mA to protect the Stamp module and prolong the LED life.  I didn’t have 75Ω on hand, so I substituted 82Ω.

Wired up!

Wired up!

Here’s a picture of the HomeWork Board I used to wire up the circuit.  Ignore those wires at the top of the breadboard – that was for another project.  :)

I’ve uploaded the ( ugly ) source code I threw together to make the LED run through various sequences. Here is a small snippet showing a good way to achieve a smooth, randomly varying color sequence. I think this is a great way to show off an RGB LED:


rand = 188
r = 200
g = 200
b = 200
dr = 2
dg = 2
db = 2
DO
  PWM Red, r, 1
  PWM Green, g, 1
  PWM Blue, b, 1
  IF rand > 10 THEN
    RANDOM rand
    IF rand < 85 THEN
      dr = -dr
    ELSEIF rand < 170 THEN
      dg = -dg
    ELSE
      db = -db
    ENDIF
  ENDIF
  r = r + dr
  g = g + dg
  b = b + db
  IF r = 2 OR r = 254 THEN
    dr = -dr
    r = r + dr
  ENDIF
  IF g = 2 OR g = 254 THEN
    dg = -dg
    g = g + dg
  ENDIF
  IF b = 2 OR b = 254 THEN
    db = -db
    b = b + db
  ENDIF
LOOP

All of the variables are declared as bytes, and the Red, Green and Blue names are PIN aliases. The Stamp is a relatively slow processor, running at about 4000 PBASIC instructions per second. Such a slow execution speed forced me to get a little creative with the code to get a visually smooth shifting of colors. A quick run-down of the code:

  • Use PWM to output a very short ( 1ms ) burst of analog voltage according to the corresponding variable for each color. The astute will note that it's actually more of an "input" of voltage, as the current actually flows from Vcc through the LED and into the Stamp. Remember this when calculating current draw, as the Stamp can only sink 25mA per pin, and 50mA total per IO pin bank.
  • Decide randomly whether you're going to adjust one of the delta factors. This helps minimize the number of times you're doing extra comparisons and math. We have to keep those operations to a minimum because the LED is not lit during that time, and the longer you take to relight the LED, the more flicker you'll see.
  • If you are adjusting a delta, just randomly pick one to flip.
  • Add the deltas to the values
  • If one of the values gets too low or too high, flip the delta and re-add so you don't roll around, because the Bytes will roll over from 0 to 255 and 255 to 0. If you let that happen, the particular color it affects will suddenly turn on or off.

Feel free to tweak some of the numbers. You can achieve some neat effects by stretching out the output times, playing with which colors vary when, or even expanding the code to vary more than one delta at a time.

Here are a couple of action shots for your amusement. Enjoy!

LED in open

LED in open


LED diffused through wax paper

LED diffused through wax paper

Milone Technologies

Posted in Electronics on September 25th, 2009 by nisburgh – Be the first to comment

Lately, I’ve been looking into products to assist in tracking fluid levels within water storage tanks.  After reviewing all of the various products available out there, I had settled into the idea that an ultrasonic rangefinder would be the best option.  Lo and behold, Milone Technologies recently launched and their product, the E-Tape continuous fluid level sensor, measures fluid level by linearly varying resistance on the tape.

E-Tape, by Milone Technologies

E-Tape, by Milone Technologies

I spoke with the founder, Chris, and it seems in about 6 months they will have manufacturing ready to produce E-Tape in the 6′ to 8′ range ( currently the product is offered at about a 14″ length ).  The exciting part about their product is the price.  Unofficially, Chris said he was expecting a 6′-8′ strip to cost under $50.  Compare that with the $105 IP67 rated transducer I was considering from MaxBotix!

Starry night

Posted in Astronomy on September 25th, 2009 by nisburgh – Be the first to comment
Starry night at the house, Dripping Springs, TX -- Nathan Isburgh, 2009

Starry night at the house, Dripping Springs, TX -- © Nathan Isburgh, 2009

Shopping!

Posted in Power Supply on September 24th, 2009 by nisburgh – Be the first to comment
This is part 2 of 4 in the series Variable Power Supply

Now that I had a basic design to prototype, I needed to collect all of the parts to test out the basic power supply circuit.

First iteration - variable power supply

First iteration - variable power supply

Austin does not have many options when it comes to electronics parts stores.  Up north you have Frys Electronics.  They have a pretty decent selection of components ( mostly NTE ), project boxes, wire, switches, supplies, tools and what not.  I’m not sure how long they will continue stocking this gear, though, as their real bread and butter seems to be consumer electronics – computers, stereos, tv’s, etc.  None the less, I found most of what I needed to complete a simple breadboard test of the supply.  Here’s a short list of what I used to put everything together.  The prices are from memory, so the accuracy is sure to be lacking.  :)

  • NTE 956 – $2 – adjustable positive voltage regulator, 1.5A, 1.2-37 VDC
  • NTE 5312 – $4 – 8A single phase bridge rectifier, up to 70VAC input
  • 1000 μF electrolytic capacitor, 50VDC – $4.  ( Always remember to derate your caps.  50% is the rule of thumb, so technically I shouldn’t run this power supply over 25V.  If you want to run all the way up to 37V, get 75V or better caps. )
  • 0.1 μF electrolytic capacitor, 50VDC – $0.50
  • 1 μF electrolytic capacitor, 50VDC- $0.50
  • 10 turn, 5k Ω potentiometer – $12 ( This was a high quality, audio grade pot ).  I went with the 10 turn for precision voltage selection.  Any 5k pot will work, just remember that the shorter the wiper travel, the harder it will be to set your voltage to exactly what you need.
  • A knob to fit the pot – $2

I had a breadboard and all the resistors I could ever want in the lab at home, so I didn’t need to buy them.  I probably also could have avoided buying the smaller caps, but I wanted to make sure I had the exact sizes.

With loot on hand, I carefully put the circuit down and double-checked every connection.  You might be wondering about some of the other parts listed in the schematic that I didn’t buy.  Since I was just testing at this point, I didn’t invest in a switch or a fuse, figuring that I would simply connect or disconnect a fused power source to verify the design.

Speaking of power sources, I looked for a decent transformer but couldn’t find one that would give me the voltage/amperage combination I sought.  Optimally, a transformer wound for a 120 VAC primary with a 36 VAC secondary rated for at least 60 VA ( or watts ) would allow me to run the circuit at full capacity – up to the maximum voltage and amperage the regulator can handle.  Check out an online giant like Mouser to find the perfect transformer for the job.

Since I couldn’t find one that matched those specs, I dug through my wall wart collection and found an old printer supply that output 28 VDC and could push 1A.  VDC?!  The schematic calls for a VAC input!  No big deal.  You can connect VDC or VAC to a bridge rectifier and it will correctly provide the positive and negative potentials at it’s outputs regardless of how you hook up the input.  Just check the schematic if you don’t believe me.  :)   Having the rectifier in place gives my power supply the ability to handle direct or alternating current input.

With everything checked on the breadboard, I hooked up the wall wart and did the first smoke test.  Nothing smoked, popped or fried!  Good sign!  Hooking my Fluke to the output, I verified a roughly 1.2VDC signal on the output.  Dialing up the pot, I watched the voltage climb up and up, eventually topping out at about 30 VDC.  Success!

Next up, conversion to dual variable output, dissipation consideration and the beginning plans for a permanent power supply system.

The Pennybacker ( 360 Bridge )

Posted in Bridges on September 24th, 2009 by nisburgh – Be the first to comment
The Pennybacker Bridge, Austin, TX -- © Nathan Isburgh, 2009

The Pennybacker Bridge, Austin, TX -- © Nathan Isburgh, 2009

Three Little Pigs

Posted in Funny on September 23rd, 2009 by nisburgh – Be the first to comment

  Hilarious song by Green Jellö!

Initial design

Posted in Power Supply, Schematics on September 22nd, 2009 by nisburgh – 2 Comments
This is part 1 of 4 in the series Variable Power Supply

I started tinkering with electronics again recently and quickly realized the need for a good power supply.  Shopping around, it became apparent that a decent dual-output unit was going to set me back quite a bit.  So I started doing some research on what would be involved in a simple little power supply I could build on my own.  Enter the LM317 variable positive voltage regulator.  Fantastic little IC capable of providing up to 1.5A and 1.2-36 volts.

First iteration - variable power supply

First iteration - variable power supply

Here was the first schematic I put together from various circuit designs available around the internet.

Working from left to right, we have our 120VAC input, which goes through a switch and a fuse to energize a basic 120/28 or 120/36 step down transformer.  ( BTW, it’s very difficult to find a transformer of that size with the VA rating to handle a couple of these power supply circuits at full output! ).

Now that we’ve stepped down our common household voltage, we rectify it using a standard bridge rectifier B1 ( 2A for safety ), followed by a large capacitor and a small one.  The 1000μF cap is there to provide substantial current in the event of transient demand spikes.  This large capacitor, though, does not respond very quickly, so we paired him up with a 0.1μF cap for higher frequency pulse suppression.  These caps help cut down on voltage ripple in the eventual output.

Next we have the workhorse of the circuit, the LM317.  Note that most manufacturers that produce regulators will have something comparable to the 317.  You don’t have to have the actual National Semiconductor part for this project ( I don’t!  I use an NTE956 because it was readily available at Fry’s Electronics ).  Any 1.2V-36V variable positive voltage regulator with a 1.5A output will do fine.  Double check that pinout!

Anyhow, the 220Ω resistor ties back in to the adjust pin as feedback gain, which you then pull down with the 5kΩ potentiometer.  The more current fed into adjust, the higher the output voltage.  Hence, as you increase resistance on the pot, you increase the output voltage!  All the way up to about 36VDC!  BTW, another fantastic feature about these regulators is that they’re extremely hardy, with built-in overload and thermal protection features.

Finishing up the circuit walkthrough, we have one more cap, C4, rated at 0.1μF, for further noise suppression and to hopefully limit our voltage ripple to an acceptable level.  Once I get a good oscilloscope, I’ll let you know what the actual ripple is.

In later posts, I’ll cover the ongoing construction of this project, along with adding a second output and voltmeter displays.

Zilker bridge

Posted in Bridges on September 22nd, 2009 by nisburgh – Be the first to comment
Bridge over Barton Creek in Zilker Park, Austin, TX

Bridge over Barton Creek in Zilker Park, Austin, TX -- © Nathan Isburgh, 2009

Schematics and PCBs with Eagle

Posted in Boards, Recommendations, Schematics on September 22nd, 2009 by nisburgh – Be the first to comment

So I’ve spent a couple of weeks looking for a good tool to handle schematic capture and PCB layout.  At first I tried various free tools from the cheaper PCB fab houses like ExpressPCB and Pad2Pad.  They were ok, but I ran in to limitations pretty quickly.  And the bigger problem was the lack of adequate parts libraries.  I didn’t want to spend hours and hours laboring over footprints that should already be available.

So, after some more research, and high marks from hobbyists and professionals, I started working with Eagle 5.6.0.  I am extremely pleased with this tool.  I’m currently using it as freeware, which is great because for most hobby type electronics, it’s more than adequate.  Plus, if I need more power, I can upgrade the license at a fairly low cost.

After reading thoroughly helpful tutorials from Sparkfun, I got the hang of the software.  I will admit it’s a bit, umm, gangly in some of it’s user interface.  But once you get used to it, it’s fantastic!  Check out this power supply I designed after only a few hours of work:

Simple variable power supply schematic

Simple power supply

I even created a custom library to handle off-board components like pots, LEDs, etc.  Overall, I’m impressed with the drafting abilities of Eagle, and will continue using it for future projects.

Now the next question was the PCB layout software.  How good was it?  Did it have the all-important auto-routing functionality?  For most prototypes and simple one-offs, I like auto-routing.   It provides a good starting point, and can help you solve routing issues in ways you hadn’t considered.

Well, here’s the PCB from the above schematic.

Corresponding PCB

Corresponding PCB

Note that I only spent a few minutes laying out the components.  The silkscreen needs a lot of tuning.  ;)   There are certainly better ways to lay things out to economize on board space and simplify routes.  Also note that I currently don’t have dimensions on heatsinks, which are an absolute necessity in power circuits like this.  Still, this simple project should give you an idea of the power available in Eagle.

I’ll start providing libraries, schematics and boards on projects like this and others as soon as I think they’re worth posting.  :)   Anyhow, enjoy Eagle and share your thoughts/comments on it and other EDA tools!

Sparkfun!

Posted in Recommendations on September 22nd, 2009 by nisburgh – Be the first to comment

Be sure to check out Sparkfun! I love those guys! Their tutorials rock, and they have tons of really neat products.