Entire Forum This board This topic Members Entire Site
 Welcome, Guest. Please login or register.Did you miss your activation email? October 27, 2016, 08:38:22 20:38 1 Hour 1 Day 1 Week 1 Month Forever Login with username, password and session length
 Pages: [1]
 Author Topic: Automated Staircase led lights with 16f 628a  (Read 2215 times) 0 Members and 1 Guest are viewing this topic.
setiorion007
Newbie

Offline

Posts: 19

Thank You
-Given: 8
-Receive: 2

 « on: February 24, 2012, 09:55:13 09:55 »

Hello guys

I am learning Proton pic-basic & have found it very difficult on how to  make a automated staircase led lights with 16f628a

I have found a video on youtube but i don`t know how to implement the functions on the 16f628a

here is the link for the video

http://youtu.be/uGqE6fnI8I0

I would appreciate if any one could help me with an idea on how to implement ( code sample would help)

 Logged
jeanninemtv
Senior Member

Offline

Posts: 315

Thank You
-Given: 57
-Receive: 25

 « Reply #1 on: February 24, 2012, 10:50:14 10:50 »

what about create a finite state machine?  a loop with all the states and each condition that trigger that state ...

something like this (i'm little busy but i think that can give you a little idea)
( but do your fsm scheme first to get all the possible cases and transitions ... )

Device 16F648A
Xtal 20
TRISA = \$03
TRISB = \$00

Symbol sensor1 TRISA.0
Symbol sensor2 TRISA.1

Dim ep As Byte ; etat present
Dim ea As Byte ; etat anterieur

state_on_reset:

ep=0
ea=0

PORTB=0
PORTA=3

state0:

PORTB=0

ep=0
ea=0
loop:

If sensor1=0 Then
ep=1
ea=0
Else
GoTo cycle
EndIf

If ep=1 Then
ep=2
ea=1
PORTB=1
GoTo cycle
EndIf

If ep=2 Then
ep=3
ea=2
PORTB=3
GoTo cycle
EndIf

cycle:

DelayMS 100

GoTo loop
 « Last Edit: February 24, 2012, 11:08:03 11:08 by jeanninemtv » Logged
setiorion007
Newbie

Offline

Posts: 19

Thank You
-Given: 8
-Receive: 2

 « Reply #2 on: February 25, 2012, 04:41:35 04:41 »

Thank you for the code

I will have to learn how to do finite state machine

i will make use of your code & try  building it next week

If u have some more ideas i would appreciate that
 Logged
jeanninemtv
Senior Member

Offline

Posts: 315

Thank You
-Given: 57
-Receive: 25

 « Reply #3 on: February 25, 2012, 04:45:08 16:45 »

mmm as i can see, your system dont need so much nanoseconds precision, so you can use the internal 628/648 crystal.

btw are you simulating this on isis???
 Logged
thetrueman
Junior Member

Offline

Posts: 69

Thank You
-Given: 24
-Receive: 2

 « Reply #4 on: March 03, 2012, 05:49:26 17:49 »

Hi, I saw youtube video, but there is one flaw as, if we see video, there is one man comes from right and one from left. Now the sensors has counted two persons.

But if both got out parallel in front of any sensor then sensor will assume only one person has been out and still one person is on the stairs and controller will wait to switch off lights untill person counting is zero but there is no person available. Is it right flaw? Thanks.
 Logged
jeanninemtv
Senior Member

Offline

Posts: 315

Thank You
-Given: 57
-Receive: 25

 « Reply #5 on: March 17, 2012, 05:24:47 17:24 »

if both got parallel ... then both inputs activatet and the system will illuminate all the lights ^^ :p   kinda silly solution ..
 Logged
Elmer
Junior Member

Offline

Posts: 43

Thank You
-Given: 14
-Receive: 8

 « Reply #6 on: March 17, 2012, 07:04:33 19:04 »

I'd consider using PIR sensors covering the stairway (you get modules at many online electronics stores). Counting people in/out just doesn't seem like a very good idea, as previously pointed out by others.
 Logged

peace in the valley
thetrueman
Junior Member

Offline

Posts: 69

Thank You
-Given: 24
-Receive: 2

 « Reply #7 on: March 17, 2012, 07:54:11 19:54 »

if both got parallel ... then both inputs activatet and the system will illuminate all the lights ^^ :p   kinda silly solution ..

I mean not sensors in parallel. I was meant that if both persons got out side by side at once from any one side then sensor will count one person but actually two person has been out. So there is flaw in system...
 Logged
Elmer
Junior Member

Offline

Posts: 43

Thank You
-Given: 14
-Receive: 8

 « Reply #8 on: March 18, 2012, 10:11:25 10:11 »

So there is flaw in system
Flaw is trying to count that way in the first place. Use PIR sensor(s) for detecting those people, same as your burglary-alarm does. It's mass produced so it's cheap too
 Logged

peace in the valley
CocaCola
V.I.P
Senior Member

Offline

Posts: 389

Thank You
-Given: 107
-Receive: 173

 « Reply #9 on: April 05, 2012, 01:36:15 13:36 »

The counting sensors are nice as they allow the fade up or down of the lights and work well...  As stated they do have a flaw that could be exploited but that is easily taken care of with the addition of a single PIR aimed at the stair case...   The single PIR can be polled after a period of inactivity when the lights are on, to verify if anyone is still on the stair case or if it should shut off the lights...  That way if two people sneak out as one and the lights are still on, if you had a 15 second time out then the CPU would poll the PIR, if no one is around it shuts off the lights, if someone is around it goes back into the main loop...
 Logged
 Pages: [1]
Jump to:

 DISCLAIMERWE DONT HOST ANY ILLEGAL FILES ON THE SERVERUSE CONTACT US TO REPORT ILLEGAL FILESADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS... Copyright © 2003-2999 Sonsivri.to ... | HarzeM Dilber MC