Mutiple cams talk to one Arduino MKR ( three masters)

OpenMV related project discussion.
fsikkerm
Posts: 9
Joined: Wed Nov 21, 2018 5:21 pm

Mutiple cams talk to one Arduino MKR ( three masters)

Postby fsikkerm » Tue Apr 02, 2019 1:17 pm

Hi All,

Just wondering if this is sound approach :P

I have three cams performing analyses on moving objects ( around 2 or 3 per second).
(so no time left to do heavy stuff ...)
One Arduino MKR with an ethernetshield is handling the results for each object.
Each cam send ok/notok info..
So all cams are a kind of master, the mkr is slave..

Since i heard I2c is not very suitable i turned to a simplistic approach a bit sonar like.

On the Cams I just use one pin ( grounds are shared ) and then two def's that are called for each outcome

Code: Select all

def ok():
    i=0
    pin1.high()
    pyb.delay(10)
    pin1.low()
    pyb.delay(3)

def notok():
    i=0
    pin1.high()
    pyb.delay(25)
    pin1.low()
    pyb.delay(3)

On the arduino i read three digital ports ( one for each cam )

Code: Select all

Loop {
  int CamOneValue = digitalRead(1);
  //  does the pin on cam 1 goes high
  if (CamOneValue!=0 &&  cam1sig == 0){    
    cam1sig=millis();
   }
  // is it down again ??
   if (CamOneValue ==0 &&  cam1sig > 0  ){ 
    cam1dur = millis()- cam1sig;  // how log was it up ?
    cam1sig = 0
   // so it was ok
   if (cam1dur < 11  ) { 
     // do something with OK
   }
   // it a fail
   if (cam1dur > 11  ) {
     // do something with Fault
   }

  }
  // repeat above for the other two cams, don't use delays

}
Seems to work perfectly with just very little deviations sometimes 9 or 8 instead of ten, but accurate enough for me..

Maybe usefull to some or it this a 'not done' :D

Regards..
User avatar
kwagyeman
Posts: 3209
Joined: Sun May 24, 2015 2:10 pm

Re: Mutiple cams talk to one Arduino MKR ( three masters)

Postby kwagyeman » Tue Apr 02, 2019 10:06 pm

Using the serial port is the best way to transfer data. Anyway, thanks for the post!
Nyamekye,
fsikkerm
Posts: 9
Joined: Wed Nov 21, 2018 5:21 pm

Re: Mutiple cams talk to one Arduino MKR ( three masters)

Postby fsikkerm » Thu May 23, 2019 3:48 am

kwagyeman wrote:
Tue Apr 02, 2019 10:06 pm
Using the serial port is the best way to transfer data. Anyway, thanks for the post!
Hi I understood you can only send from one cam to the MKR, not three at the same time ?
Forgive my noobidity..

Return to “Project Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests