Go Down

Topic: 2D grid of ir sensors (Read 1 time) previous topic - next topic


I need help figuring this out guys. 

I have created a grid of IR sensors which i would like to determine the proximity of an object within it. for example say a ball rolled into the ir grid, it would register as being in (row 3, column5). this would tell me the location of the ball in relation to the grid.

I have a row of 6 ir sensors and a column of 6 ir sensors.  I need to be able to read one sensor at a time to avoid interference. So the program will turn on sensor 1 and see if it detects something, if not sensor 1 will go off and 2 will come on, then 3 and so on until an object is detected on the grid.

Cant find any material addressing  sequencing analog sensors to avoid interference and determining location on a 2d grid.

Below is the code i have so far but isn't doing the job.


Code: [Select]
int IRpin = 1;                                   
int IRpin1 = 0;
void setup() {

void loop() {
  float volts = analogRead(IRpin)*0.0048828125;   
  float distance = 27*pow(volts, -1.15);
  float Inches = (distance / 2.54);

  float volts1 = analogRead(IRpin1)*0.0048828125;   
  float distance1 = 27*pow(volts1, -1.15);
  float Inches1 = (distance1 / 2.54);
if (Inches >= 2 && Inches <= 20){
  Serial.print("MISS...The ball stopped in ROW1");                               
  delay(2000);     }
  else if (Inches1 >= 2 && Inches1 <= 20){
  Serial.print("MISS...The ball stopped in ROW2");                               
  delay(2000);     }



What circuit are you using? P,ease post your schematic.
You should be using data selectors are you?

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131