Step 3: The algorithm works

The algorithm itself is quite simple.

The task was as follows.
When crossing the infrared beam at the bottom of the stairs - the LEDs smoothly light on upwards.
When crossing the infrared beam at the top of the stairs - the LEDs light on down smoothly.
In case when both beams are crossed at the same time- all the LEDs light on smoothly

After a certain time, preset using the display and the keyboard the LEDs light down smoothly in the same direction, in which it has been turned on.

All the delays are set and controlled by the display.
Several iluminating effects can be find in the menu. 
And the choice of outputs (1 to 16)

The program was written in CodeVisionAVR.
I will not post the whole code , but here are some main points:

unsigned char mask;

void processUp(){
if(datUp==0) {
    for (mask = 0x01; mask; mask <<= 1)
        PORTC |= mask;
        wait1();   /

    // delay
    wait1();   // delay before lighting down

    //now lights off (in the same direction)
    for (mask = 0x01; mask; mask <<= 1)
//   for opposite direction:
    //for (mask = 0x80; mask; mask >>= 1)
        PORTC &= ~mask;

<p>whats the point of buying your boards if you dont post the code?</p>
Hi. i have wewbsite http://ipfgroup.co.uk/ there you can buy it <br>Best regars<br>
<p>For any one interested in one of these controllers I currently have mine for sale. I purchased it but does not work for my project ... </p><p>Ryan </p>
hello, i really loved this project, could it be possible for you to send me the schematics for a diy project?? <br> <br>thank you very much
Good day to you, <br> <br>im extremely interested in this for my home's stairs would you please please be able to share the schematic and sketch with me ? <br> <br>I'd be making the PCB homebrew style so it wont be a nice as yours, lol, just be great if you could email me the details ! <br> <br>A Great many thanks in advance for your help !
helo......friend, my name is eddy, i am form indonesia <br>how can get the BCP schematic and code source from the project I like this because I need do this in home can u buy and post me to indonesia <br>
how could i do this without the keypad or lcd, just a simple switch using the IR LED and a sensor but still keeping the effect you did with the LED's turning on?
For slow on/off leds i used portc-portd atmega legs with powerfull transistors and code for PWM. <br>For easy way you need take controller with xx legs (dont know howmany steps you have) <br>+ 3-4 aditional legs for sensor and ir led. Then make program for slow on\off
For ir led and sensor (if use tsop sensor) you need modulated ir led 36 or 38khz. <br>For modulation i use PortB2 at atmega 16 with code <br>interrupt [TIM0_OVF] void timer0_ovf_isr(void) <br>{ <br>static char v=0x19; <br>TCCR0=v; <br>v^=0x19; <br>} <br>TCCR0 = 0x00; //stop <br>TCNT0 = 0x97; //set count <br>OCR0 = 0x69; //set compare <br> <br>
Is there any chance for us to see the electric diagram of this project for a DIY? Thank you!
Private message please )
now avaiable on ebay.......&Acirc;&pound;179.99
It's so BIG price. At my ebay 99usd + free worldwide shipping )
How can place an order?
See private or see link at the end of instruction.
Good idea, good quality and low price
The idea is not mine, but thanks

About This Instructable


150 favorites

More by ipf_group: Automatic Led Stairs Controller
Add instructable to: