Array of Sensors
Cactii
Posts: 14
I'm new to the Parallax community.
I picked up a Basic Stamp Homework Board because it was something that I had been wanting for a long time for a project that I would like to do.
One thing that I noticed right away though is how limited the projects are with regards to sensors and I/O channels.
I'm probably not very original in my idea but it is a challenge to myself to complete it.
I would like to build a sun tracking device using an array of 9 photo-resistors to control two servos which would give me a 2 axis tracker. The Basic Stamp Homework Board has enough I/O ports to easily accomplish this but I want to be able to use a small I/O footprint so that I may add on to the project at a later date.
I guess my question is this:
Is it best to deal with a large sensor array by developing a Basic Stamp daughter board around the Basic Stamp 1 or 2 Module and having it send feedback to the Main Projects' Basic Stamp board?
So I would have a Basic Stamp Homework Board that sends a signal to a Basic Stamp Module Board that is connected to my sensor array telling it to poll the sensors the program on that board would do all the calculations for the sensors and then send a signal back to the Basic Stamp Homework Board so that the it would utilize only one I/O channel for that whole array of sensors.
I picked up a Basic Stamp Homework Board because it was something that I had been wanting for a long time for a project that I would like to do.
One thing that I noticed right away though is how limited the projects are with regards to sensors and I/O channels.
I'm probably not very original in my idea but it is a challenge to myself to complete it.
I would like to build a sun tracking device using an array of 9 photo-resistors to control two servos which would give me a 2 axis tracker. The Basic Stamp Homework Board has enough I/O ports to easily accomplish this but I want to be able to use a small I/O footprint so that I may add on to the project at a later date.
I guess my question is this:
Is it best to deal with a large sensor array by developing a Basic Stamp daughter board around the Basic Stamp 1 or 2 Module and having it send feedback to the Main Projects' Basic Stamp board?
So I would have a Basic Stamp Homework Board that sends a signal to a Basic Stamp Module Board that is connected to my sensor array telling it to poll the sensors the program on that board would do all the calculations for the sensors and then send a signal back to the Basic Stamp Homework Board so that the it would utilize only one I/O channel for that whole array of sensors.
Comments
If you can show me a real world example of how I would set up a 9 sensor array with any one of those that you mentioned I would love to see it.
Thanks for your reply.
You essentially want 9 identical circuits for using the RCTIME statement for measuring the resistance of a photoresistor. Each one would use a different I/O pin. You have a program that measures the resistance of each in turn, then does any calculations for the sensors. You then use two I/O pins to connect this Stamp to the main one with 1K resistors in the leads to the other Stamp (for protection in case of programming errors). The main Stamp signals the coprocessor to send a set of data by changing one I/O pin from LOW to HIGH, then it waits at a SERIN statement for a response. After the SERIN finishes, it sets its signalling pin back to LOW. The coprocessor checks the corresponding I/O pin on every measurement cycle. If it's HIGH, it uses a SEROUT statement to send the data on the 9 sensors to the main Stamp, then waits for the main Stamp to change the pin back to a LOW before going to get the next set of measurements.
' {$STAMP BS2}
' {$PBASIC 2.5}
'Variables
pr1 VAR WORD
pr2 VAR WORD
pr3 VAR WORD
pr4 VAR WORD
pr5 VAR WORD
pr6 VAR WORD
pr7 VAR WORD
pr8 VAR WORD
pr9 VAR WORD
DO
GOSUB P_PRs
PAUSE 2000
LOOP
P_PRs:
HIGH 1
PAUSE 100
RCTIME 1, 1, pr1
DEBUG DEC5 pr1, " ", CR
WRITE 1, WORD pr1
HIGH 2
PAUSE 100
RCTIME 2, 1, pr2
DEBUG DEC5 pr2, " ", CR
WRITE 3, WORD pr2
HIGH 3
PAUSE 100
RCTIME 3, 1, pr3
DEBUG DEC5 pr3, " ", CR
WRITE 5, WORD pr3
HIGH 4
PAUSE 100
RCTIME 4, 1, pr4
DEBUG DEC5 pr4, " ", CR
WRITE 7, WORD pr4
HIGH 5
PAUSE 100
RCTIME 5, 1, pr5
DEBUG DEC5 pr5, " ", CR
WRITE 9, WORD pr5
HIGH 6
PAUSE 100
RCTIME 6, 1, pr6
DEBUG DEC5 pr6, " ", CR
WRITE 11, WORD pr6
HIGH 7
PAUSE 100
RCTIME 7, 1, pr7
DEBUG DEC5 pr7, " ", CR
WRITE 13, WORD pr7
HIGH 8
PAUSE 100
RCTIME 8, 1, pr8
DEBUG DEC5 pr8, " ", CR
WRITE 15, WORD pr8
HIGH 9
PAUSE 100
RCTIME 9, 1, pr9
DEBUG DEC5 pr9, " ", CR
WRITE 17, WORD pr9
RETURN
C_Nums:
X = pr1
move = 1
IF X < pr2 THEN X = X
IF X > pr2 THEN
X = pr2
move = 2
ENDIF
IF X < pr3 THEN X = X
IF X > pr3 THEN
X = pr3
move = 3
ENDIF
IF X < pr4 THEN X = X
IF X > pr4 THEN
X = pr4
move = 4
ENDIF
IF X < pr5 THEN X = X
IF X > pr5 THEN
X = pr5
move = 5
ENDIF
IF X < pr6 THEN X = X
IF X > pr6 THEN
X = pr6
move = 6
ENDIF
IF X < pr7 THEN X = X
IF X > pr7 THEN
X = pr7
move = 7
ENDIF
IF X < pr8 THEN X = X
IF X > pr8 THEN
X = pr8
move = 8
ENDIF
IF X < pr9 THEN X = X
IF X > pr9 THEN
X = pr9
move = 9
ENDIF
RETURN
Post Edited (Cactii) : 3/30/2008 12:08:19 AM GMT