Advanced Iris Tracking Software

Yes, you’d have to write code…

So, when you talk about having two OpenMV Cam’s you’re looking at having to communicate between them. We provide code to send and receive bytes via the UART. But, you need some protocol on top of the data stream to send commands, staemachines on the camera to process data, etc.

If you don’t need to send much data between cams then you can use GPIOs instead if your just trying to synchronize them. However, you have to write sometypr of statemachine.

Alternatively, you can also just send all data from the cameras to the PC and do all the processing on the PC. Then you can keep the program on the OpenMV Cam simple.

So I could send UART data between the two and essentially have the one with the live feed running while the other marks on its feed?

Not exactly sure what you want to do…

One camera is looking at the person… And one at the screen the person is looking at? I thought you planned to write a PC app… So, what is the second camera for? The PC app should be able to track what the user is looking at given the coordinate stream from the first camera.

I was just thinking if I wanted to have the person look at something other than the screen, then I would need the other cam.

Now for reference, is there a library I need to access to send data via UART from one board to another? Also, you mentioned something about examples of sending data online, what are those examples called?
Once again, thanks a million

Forget that last post, I got it working. My other question is if I use UART to communicate between the two cameras, do I use the pins or no? Also, do I write the UART read function in a different program or in the same as the one I’m using to send the data? If different how do I separate the programs from each other?

Thanks

Essentially, if you remember the code you sent me last time, how would I read that data via UART.

Yeah, so, you just use this method here: class UART – duplex serial communication bus — MicroPython 1.9.3 documentation

And then do: class UART – duplex serial communication bus — MicroPython 1.9.3 documentation

When there’s a byte.

For a statemachine example, checkout the Pixy emulation examples.

Thank you so much. Now just for my own ideas, you said that the two cameras can be run at the same time right? However, since there’s only one IDE running at a time, how to I run the UART packaging code and the UART shipping code at the same time. Sorry about my newbie questions!

Also, is there a way of using the COMS to communicate data at the same time or quickly switching between them? Basically, can a just have the cameras read the COMS for data or do I need to have some sort of bussing method?

OpenMV IDE supports connecting to one camera on purpose with the main feature set. You can use the Open terminal feature to connect to multiple cameras for debugging though on a second/third/etc. serial port.

Realistically, once you have two cameras in the system your skill level is going to need to be rather good to deal with communications issues. I really can’t teach you this over the forums.

As for sending image data back and forth. Um, I thought you’d just route everything to the PC. If so, then the cameras are just generators.

WOW that really helped thank you se much! For the open terminal though, how to I run code on it?

Please see our YouTube channel. I posted a video about the feature.

Thank you those videos really help. Now just to recap, there’s no easier way to send eye coordinate data from one camera to the other and mark it on the other’s display without using the coms correct? Once again thank you for your help.

Serial is the easiest. Please see the Picture Emulation UART example. It shows how to do serial.

You’d have to do something like serial for any Microcontroller. It’s a fundamental communication step.

The code for reading serial is on there right?

By the way, there is nothing blocking your cam’s serial port right? I keep getting an issue on Visual Studios saying that the port to the cameras is blocked.

I have the following as C# code in VS for receiving the Cams data:


mySerialPort.BaudRate = 9600;
mySerialPort.Parity = Parity.None;
mySerialPort.StopBits = StopBits.One;
mySerialPort.DataBits = 8;
mySerialPort.Handshake = Handshake.None;
mySerialPort.RtsEnable = true;

Does another program have the serial port open?

Note that there are two serial ports on the camera. A hardware UART and a USB VCP port. OpenMV IDE uses the USB VCP port to talk to the camera. If you are trying to use OpenMV IDE and your program at the same time then you have to talk to the camera via the hardware UART in I/O pins 4 and 5 which you can connect to the PC via an FTDI chip.

Alternatively, you can develop your code using OpenMV IDE and the hardware UART and then switch to the software USB VCP uart after you’ve gotten things working to reduce complexity.

Thank you for that, just so you know my MVcam is connected to the computer using a microUSB cable and it is being run on the penMV IDE. Meanwhile, I’m trying to get the code to Visual studios but it keeps saying that access is denied to the camera. Note visual studios detects that there’s an object in my port, it just can’t access it. The code on the camera is the one you sent me awhile ago, but the VS code is as follows. I don’t know serial very well so please tell me if something isn’t matching up! Thank again

using System;
using System.IO.Ports;

class PortDataReceived
{
public event SerialDataReceivedEventHandler DataReceived;
public static void Main()
{
SerialPort mySerialPort = new SerialPort(“COM4”);

mySerialPort.BaudRate = 115200;
mySerialPort.Parity = Parity.None;
mySerialPort.StopBits = StopBits.One;
mySerialPort.DataBits = 8;
mySerialPort.Handshake = Handshake.None;
mySerialPort.RtsEnable = true;

mySerialPort.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler);

mySerialPort.Open();

Console.WriteLine(“Press any key to continue…”);
Console.WriteLine();
Console.ReadKey();
mySerialPort.Close();
}

private static void DataReceivedHandler(
object sender,
SerialDataReceivedEventArgs e)
{
SerialPort sp = (SerialPort)sender;
string indata = sp.ReadExisting();
Console.WriteLine(“Data Received:”);
Console.Write(indata);
}
}