Home \ Help \ Search \ Login RSS

Welcome, Guest. Please Login

This forum is now READ-ONLY! Please visit http://forum.wiring.co/ for the new forum.

Wiring ForumWiring HardwareTangible computing › schematic for multiple sensors?

Page Index Toggle Pages: 1
schematic for multiple sensors? (Read 14250 times)
03/26/07 at 02:37:28

mistergreen   Offline
YaBB Newbies
I Love YaBB 2!

Posts: 15
*
 
Is there one you can point me too?
(preferably using the analog pins like multiple photo resistors)

thanks.

 
IP Logged
 
Reply #1 - 03/26/07 at 03:55:27

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
This example shows how to connect a photo resistor to an analog input pin, and the corresponding code. Connecting 8 of them is just matter of wiring each in the same way to a different Wiring analog input pin. Also check this diagram: http://wiring.org.co/learning/tutorials/diagrams.html#040 remeber it's just matter of repeating the connection for each photoresistor going to each analog input (0 to 7).
 
IP Logged
 
Reply #2 - 03/26/07 at 04:39:23

mistergreen   Offline
YaBB Newbies
I Love YaBB 2!

Posts: 15
*
 
yeah, that's exactly what I did.. I made 2 photo sensors to start out with.
But both sensors are outputting to the same pin it seems..

Here's my board.
http://i169.photobucket.com/albums/u217/mistergreenphoto/photosensor.jpg

and here's my wiring code.

[code]

int valA;
int valB;

void setup()
{
  Serial.begin(9600);           // sets the serial port to 9600
}

void loop()
{
  valA = analogRead(0);   // read analog input pin 0
  valB = analogRead(5);   
  Serial.print(valA, BYTE);
  Serial.print(valB, BYTE);
  Serial.print(10, BYTE);    
  delay(100);                   // wait 100ms for next reading
}
[/code]

Any insights would be great. thanks!

 
IP Logged
 
Reply #3 - 03/26/07 at 04:52:24

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
can you take a picture from the top?

also, data read from the analog inputs is in the range 0...1023, and BYTE is 0..255
so you could do this in order to reduce your analog values in the range 0..255:

int valA;
int valB;

void setup()
{
  Serial.begin(9600);           // sets the serial port to 9600
}

void loop()
{
  valA = analogRead(0)/4;   // read analog input pin 0
  valB = analogRead(5)/4;   
  Serial.print(valA, BYTE);
  Serial.print(valB, BYTE);
  Serial.print(10, BYTE);      
  delay(100);                   // wait 100ms for next reading
}
 
IP Logged
 
Reply #4 - 03/26/07 at 05:28:33

mistergreen   Offline
YaBB Newbies
I Love YaBB 2!

Posts: 15
*
 
hopefully this is clearer.

http://i169.photobucket.com/albums/u217/mistergreenphoto/board2.jpg

 
IP Logged
 
Reply #5 - 03/26/07 at 05:35:13

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
After the code modification are you still getting the same values? even if you block one of them with your finger?
Check if both photoresistors are getting power, I am not sure about your breadboard but if you look at this one http://wiring.org.co/learning/tutorials/breadboard.html
the lines you are using for power are linked only half way.
 
IP Logged
 
Reply #6 - 03/26/07 at 17:29:23

mistergreen   Offline
YaBB Newbies
I Love YaBB 2!

Posts: 15
*
 
It turned out to be a dead photo resistor.. Everything is working .
Thanks.

 
IP Logged
 
Reply #7 - 03/26/07 at 22:02:21

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
cool, I'm glad things worked out for you.
 
IP Logged
 
Reply #8 - 03/27/07 at 03:00:08

mistergreen   Offline
YaBB Newbies
I Love YaBB 2!

Posts: 15
*
 
I was thinking.. What if I wanted 64 photo cells hooked up?
There's only 8 analog pins. Do I have to get another board?
Just point me the way.
thanks.
 
IP Logged
 
Reply #9 - 03/27/07 at 05:11:13

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
It is possible to connect Analog to Digital converters (ADC) to Wiring, there are many kinds, depending on the resolution (10 bits or 8 bits) and the number fo channels (Analog Inputs). It might worth to check at www.analog.com AD7812 10-Bit, 8-Channel, 350 kSPS, Serial A/D Converter, I think this one is very good. http://www.analog.com/UploadedFiles/Data_Sheets/AD7811_7812.pdf 
In this way you can extend the Analog Input on your Wiring board.
 
IP Logged
 
Reply #10 - 03/28/07 at 17:33:06

mistergreen   Offline
YaBB Newbies
I Love YaBB 2!

Posts: 15
*
 
My dad who is into electronics suggested a simpler solution than using a A/D converter (I'm not really sure how that works) . It revolves around using the Digital IO ports & analog ports on the Wiring board, bi-lateral switches and creative software....
I'll keep you guys updated.
 
IP Logged
 
Reply #11 - 03/28/07 at 22:09:19

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
This sounds very exciting, please keep us posted.
 
IP Logged
 
Page Index Toggle Pages: 1