Welcome new user! You can search existing questions and answers without registering, but please register to post new questions and receive answers. Note that due to large amounts of spam attempts, your first three posts will be manually moderated, so please be patient.
Because of un-manageable amounts of spam despite our use of CAPTCHAs, email authorization, and other tools, we have discontinued this forum (see the 700k+ registered users with validated email addresses at right?). Please email us any questions or post bug reports and feature requests on GitHub at https://github.com/jevois -- The content below remains available for future reference.
Welcome to JeVois Tech Zone, where you can ask questions and receive answers from other members of the community.

Communication With Multiple JeVois Cameras on a Raspberry Pi

0 votes
I'm working on a project that will involve multiple JeVois cameras.  Each camera will be running object recognition software and sending data about the location of recognized objects on the USB serial port.  There will be at least four and possibly six or eight cameras total.  I'm planning on having a Raspberry Pi receive all that serial data and act on it.

The problem is I don't know what to do on the Raspberry Pi end of things.  I realize this is more of a question for the Raspberry Pi than for the JeVois, but I'm hoping someone who has done something similar with JeVois can point me toward a tutorial or example that covers the important parts of what I want to do.  I'll have to run something that communicates with multiple serial ports, at least some of which are on a USB hub.

Any help would be appreciated.

asked Jul 31, 2019 in Programmer Questions by Meadmaker (170 points)

1 Answer

+1 vote

I would definitely go with serial-over-USB for all cameras for this. You will need a USB hub that can power all the cameras, so that means it needs to have strong external power. For example, we use these with success here:


You want to make sure the hub has enough power for what you need. For example, the one above states it has a 12V/2.5A power supply so that is 30 Watts going in. Each camera could use up to 3.8 Watts, say 4 Watts to allow for some margin. Also we should derate the 30 Watts a bit to account for 12V to 5V conversion, so say 24 Watts available to the USB ports, enough for 6 JeVois cameras (should be ok with 7 as the derating used here is quite severe).

Then use USB cables with 24AWG or lower power lines (see http://jevois.org/doc/UserConnect.html for details).

Finally, each camera will appear on the Pi as a USB-to-Serial adapter. This will create devices /dev/ttyACM0, /dev/ttyACM1, etc on your Pi.You should configure each camera to run in headless mode, see http://jevois.org/tutorials/UserHeadless.html

You can open each device in your application code running on the Pi, and read the data from it. Something similar to this: http://jevois.org/tutorials/UserParseSerial.html but you need to change the code so that it is non-blocking. That is, you just check if some new bytes are available on each port and accumulate the bytes into a buffer until you get a \n that indicates end of line. Once you have a complete line, you can parse that message. If you are programming in C++ see function readSome() here: http://jevois.org/doc/Serial_8C_source.html

Note for completeness that by default each JeVois camera requests the full USB video bandwidth for video streaming. This is to optimize latency of video. Video bandwidth is separate from serial bandwidth, so this does not affect the serial-over-USB ports. But if you wanted to stream video from several cameras simultaneously (as opposed to just serial messages like you want here), see http://jevois.org/doc/Multicam.html

Finally, the USB hub may enumerate the different cameras in random order. So you need a way to figure out which one is which. We have a parameter called "nickname" which you can set to a specific value on each camera, in your initscript.cfg, eg:

setpar nickname front

in the initscript.cfg of the microSD card that goes in your front camera.

Then your pi would first run a "getpar nickname" on each serial port to figure out which port is for the front camera vs rear camera, etc. Or you could also have this in your initscript.cfg:

setmapping2 .........(mode you need)

setpar serout USB

serout HELLO front


and on your Pi just look for messages that start with "HELLO". The serout command just sends its args to the serial output port.

answered Aug 1, 2019 by JeVois (46,580 points)
That's awesome.  Thanks.  Now to go try it out.....