Shop OBEX P1 Docs P2 Docs Learn Events
Newbie looking for some advice — Parallax Forums

Newbie looking for some advice

billiambilliam Posts: 12
edited 2008-07-29 21:10 in BASIC Stamp
Hey all, this is my first post here. At least 7 years ago I picked up a Basic Stamp 2 intending to make something with it but never ended up even opening the package. Now I have a project in mind and figured the Stamp would be perfect for the job. I'm somewhat of a beginner to stuff like this though (I'm more of a software guy).

Here's my project. I would like to build a circut to control 10 or so RGB LEDs, to be controlled by software on my computer. My vision is that these LEDs can serve as status indicators for different things on my computer (for instance, say, based on how much email I have in my inbox, the color of one LED will go from green to red, or an LED that changes color based on processor utilization.)

I have a few questions as to how to do this:

First, I'm not sure how old this chip is. It appears to look the same as everything on this site and has a part number of BS2SX-IC, along with a Super Carrier board. The interface to the computer is a Parallel cable. Will this chip be able to be connected to my computer and recieve commands for the lights?

Will the BS2SX-IC be able to drive 10 RGB LEDs?

Finally, how exactly should I go about doing this? What kind of hardware will I need? Are there any similar projects or tutorials that I could be pointed to?


Thanks in advance,
Billiam

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2008-07-16 12:07
    If its a BS2sx (or BS2 of any kind) and Super Carrier, the cable should be a 9-pin serial one. If you're using a newer computer you'll probably need a USB to serial converter (the Parallax one is highly recommeded) with the proper driver (don't let your computer use the generic one).

    As for your project, the easiest way would be to talk back and forth via a serial (or usb) connection. You have to write an application on the computer to gather the data you need then send it to the stamp.

    Limit the LED current to 10 mA or so and the Stamp will be happy.

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • billiambilliam Posts: 12
    edited 2008-07-16 13:51
    Yes. The cable is 9pin serial at the end that connects to the Super Carrier and it terminates in a Parallel connector at the other end.

    As for the software, as long as I know that I can communicate with the Stamp through the serial interface, I should be good to go.

    Again, I am defintiely a bit of a newbie when it comes to building things like this. Are there any tutorials or examples that I could be pointed to?

    Thanks!
  • Mike GreenMike Green Posts: 23,101
    edited 2008-07-16 14:06
    Parallax has immense amounts of educational material on their website. You just have to take the time to work through some of it. Start with the Nuts and Volts Columns and the Stamps in Class tutorials. Go to Parallax's main web page and click on the "Resources" tab. On the left, you'll see "Nuts and Volts Columns". Click on that and you'll get a list of what's available for download (free). Start with #6 which discusses how to control high power stuff using switching transistors. Go back to the main page and click on "Resources" again, then on "Downloads", then on "Stamps in Class Downloads". You'll see a long list of tutorials and matching collections of sample programs. Start with "What's a Microcontroller?". You can buy these in printed form and with parts kits for the parts used in the tutorials, but they're easy to get on your own if you want and people with a "junk box" may have them already.
  • billiambilliam Posts: 12
    edited 2008-07-25 16:54
    Alrighty! I'm back from the books. I've been messing around with some of the RGB leds that I have and so far I have a circut and some code I've written that will accept a 3 byte RGB value and set the led to that color. Now I have some questions.

    First, obviously I won't be able to control 10 or more RGB leds (which is really 30+ individual leds) from the stamp's IO pins without some help from another IC from what I've read. Also, powering more than one of them will draw far too much current for the stamp to source.

    So, I've read about the 4051 multiplexer which controls 8 IO devices 4 stamp pins. Would this be a good choice? I've also read about Darlington transistors. If I used a couple 4051s to control my RGB leds, would I still need the Darlington's to provide the necessary current?

    Secondly, as you might have seen before, the individual leds in an RGB led are rarely all the same brightness. The particular led that I am using is something like 1200mcd red, 3600mcd green, 700mcd blue. What can I do to make sure that I am producing the correct color that I want? Currently I am limiting the brightness of the red and green counterparts by their ratio to blue's brightness, as in:

    PWM RED, INTENSITY/2, CYCLES
    PWM GREEN, INTENSITY/5, CYCLES
    PWM BLUE, INTENSITY, CYCLES

    Any thoughts?
  • Mike GreenMike Green Posts: 23,101
    edited 2008-07-25 17:59
    1) The TI TPIC6595 is a combination (roughly) of a 74HC595 serial shift register and a MOSFET equivalent of a ULN2803 8 bit Darlington driver. There are plenty of examples of the use of the 74HC595 in various Nuts and Volts Columns and Parallax tutorials. This would be a much better choice than a CMOS 4051 multiplexor.

    2) The eye has different sensitivities to different colors, so a red, green, and blue LED with the same mcd rating would look different in brightness. One way to adjust this is to use different amounts of current for each color to balance the apparent brightness.
  • billiambilliam Posts: 12
    edited 2008-07-25 22:08
    Alrighty. Upon thinking about it, let's take a step back here. Why can't I just use the Stamp as a software mux? So Let's say I start with just 5 rgb LEDS. That's 15 individual LEDS. If I wire all the red anodes together to one I/O pin, the greens to another, and the blues to a third, and then wire each led's cathode to a seperate I/O pin, wouldn't I basically have a mux built? And as for the current drawn, I would only have one individual led active at any given time, they would just be going so fast that the eye would percieve all or some of them being on. Are there any problems with this assumption?
  • Mike GreenMike Green Posts: 23,101
    edited 2008-07-25 22:45
    You will probably destroy your Stamp.

    The Stamp I/O pins are rated for about 20mA of current (25mA under some circumstances). The two groups of 8 pins (P0-P7 and P8-P15) can each handle a maximum of 50mA of current. The whole Stamp is rated for 100mA current through the Vdd pin and 150mA through the Vss pin. Allow more than that and something will melt eventually. These are instantaneous values!

    You may multiplex LEDs so that only one is on at a time, but the average current will be quite low (20mA / 15 LEDs = 1.3mA) and the visual intensity is related to the average current.
  • billiambilliam Posts: 12
    edited 2008-07-26 05:22
    I'm still pretty confused with all of this. I just set the stamp up with two rgb leds connected to pins 0-5 (rgbrgb) and wrote code that would turn them on, one at a time, for 1ms each, to the effect that they look like they are all on. At no point did my power supply indicate that the leds were pulling more than 20ma at a time. This makes sense to me, as only one led at a time is powered.
  • irfanirfan Posts: 1
    edited 2008-07-26 08:03
    emmm.. hi
    i'm newbie...
    is there anybody can help me??
    i was in a progress build a robot.. i had a prblem wih ultrasonic sensor parallax ping))) that i used..
    is there any one that had been used it??
    can you tell my the source code for ranging in C language...
    please help me ASAP
  • Mike GreenMike Green Posts: 23,101
    edited 2008-07-26 12:06
    Many people have successfully used the PING))), usually with a Parallax Stamp in Basic. It is pretty straightforward. The documentation for the PING))) gives all the details.

    There is some sample code in C for the Arduino that people have mentioned. It's on one of the Arduino sites.
  • billiambilliam Posts: 12
    edited 2008-07-28 15:37
    Hmm, looks like my post has been hijacked :-P

    So, I'm sold on the fact that I require an LED driver chip for my project. Here's my requirements: I'd like the possibility for my project to scale to more than 16 rgb leds at some point. I want the chip to be able to do PWM as well. So, my stamp would be able to send the driver chip a command, to say, turn on led 0 (say, a red channel) to a specific pwm intensity, and stay on until I send another command. Also, the chip would need to be able to power each led with 20ma (i am using common cathode rgb leds.. would common anode be better?)

    I've seen so many LED driver chips and most of them seem to do what I'm looking for.. is there a specific chip that anyone would reccommend that does what I would like it to do? (and would be moderately simple to operate with the stamp)
  • billiambilliam Posts: 12
    edited 2008-07-29 00:05
    I ended up doing some research and bought a couple of TLC5940s. The specific model number was TLC5940NTG4. Was this a wise move?
  • billiambilliam Posts: 12
    edited 2008-07-29 21:10
    Anyone? I suppose it's too late now to make a change, but I'd still like some reassurance haha.
Sign In or Register to comment.