Pages: [1]   Go Down
Author Topic: 2D grid of ir sensors  (Read 814 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


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);     }


Manchester (England England)
Offline Offline
Brattain Member
Karma: 639
Posts: 34724
Solder is electric glue
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: