Shop OBEX P1 Docs P2 Docs Learn Events
LED control wish list — Parallax Forums

LED control wish list

metron9metron9 Posts: 1,100
edited 2005-09-19 21:14 in BASIC Stamp
I have been playing with a coprocessor idea now that controls LED output from a basic stamp using the atmel mega48 chip.
The idea is to send commands to the chip via shiftout command that will set up timers, fades, patterns etc to control 1/2 dozen or so LEDS.
Perhaps daisy chain them for more leds as well as one chip could interface with the BS and control many others as well.

For example to fade up an led from off to full over say 2 second a command string could be sent like this:
First byte=LED number
Second byte= command
Third byte = time to fade up

So in a fraction of a second you can call a function to fade the led up and continue with your stamp code.

An example of Pbasic code to blink an led

for i=1 to 20
High Pin
pause 250
low pin
pause 250
next

instead you would send two commands
shiftout Pin,Pin, first two bytes Led to blink and Ms to stay on
shiftout pin,pin second two bytes Time to stay off and how many seconds to continue blinking.

You would just setup subroutines that have the shiftout commands using a global pointer to select the command strings (dont worry its easy to do)


I am thinking 2 pins for the communication and a third pin could be used as a clock source I could set up a function call so you can set up a clock pulse.

What would you like to see implemented. My list so far is this.

Functions:

1. turn on, [noparse][[/noparse]TIME mS (0=FOREVER)]
2. turn off, [noparse][[/noparse]TIME Ms (0=FOREVER]
3. FADE UP, [noparse][[/noparse]TIME Ms (0=FOREVER]
4. fADE DOWN, [noparse][[/noparse]TIME Ms (0=FOREVER]
5. FADE UPDOWN, [noparse][[/noparse]TIME UP,TIMEDOWN, NUMBER OF SECONDS TO RUN PATTERN]
6. BLINK [noparse][[/noparse]TIMEON,TIMEOFF,NUMBER OF SECONDS TO RUN PATTERN]
7, RANDOM BLINK
8, RANDOM FADE
9, RANDOM BLINK FADE
ETC...

Fades would be implemented using PWM.

it would also have about 2k (depending on how much program space I take up) for you to download specific patterns
a pattern command that sends a pattern number that is previously set up by you, (you would run a program to store the patterns in the mega48s eeprom from your basic stamp initially to set up the hardware.

The chip cost is $1.50 to $2.70 or so, Plus a small cap, you wire 5+ and ground to it with a small cap between two pins very simple

Just a fun project for me and I would be happy to send the programmed chips for cost to anyone who would like one.

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-09-19 16:03
    metron9,

    ·· It seems like you could more easily, and for the same price use the SX as a co-processor for the BASIC Stamp and save 2 pins by using Asynchronous Serial (1 pin) and there are tons of examples of Serial Routines and Interrupt drive LED flashing routines, etc for the SX in SX/B, which is almost as easy as doing it on the BASIC Stamp.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • metron9metron9 Posts: 1,100
    edited 2005-09-19 21:14
    I guess I did not realize that, I was only looking at the modules, I did not even realize you had just the chips.
    I will look at the lineup for future reference.

    But I don't have a sx programmer cry.gif so I thought I would use what I have on hand.

    I guess what I am thinking is a simple programming project that controlls LEDs that takes ideas from many, refines the ideas to psudo code and implements those ideas into programming what can be a usefull all in one LED programable flasher drop in chip for under $2 bucks. It may be along the way the sx chip design would work better but I guess I am looking to find out is if anyone here has any interest in doing an online collaboration to see what might come out of it. Sometimes just throwing the stuff on the wall brings out many ideas that people never knew they had. Lets just brainstorm a full function led flasher chip. Like I say I just happen to have some mega48s and the programming should be portable to the sx line if others have that as well.

    One example that I am thinking about implementing in the led flasher is using a real candle and recording the light level flickering to simulate a candle using an led, yes I know it's been done www.smartcandle.com and the examples here but, those simulations are lacking in realism, I first noticed a smartcandle at a restraunt a few weeks ago but the simple repetative pattern soon regestered in my brain and the obvious conclusion was that it was a fake.

    Anyway I'm just brainstorming again. Now I happen to have been having some problems understanding op amps, so I picked up a 1000 page book on the "op amp" Now I don't feel so bad not understanding these buggers if someone can write a 1000 page book that has nothing but op amps and how to use them. The first page I read said something about current based and voltage based op amps. cant wait to get home and start reading that one.
Sign In or Register to comment.