I’m trying to connect two PTC06 V3.1 cameras to a Photon using the Adafruit_VC0706 library.
I can get one working great via the serial RX/TX ports. I was hoping to get the second working using the ParticleSoftSerial library but I can’t get it to find the camera.
Here is a simple repro that is just trying to get a single camera working via ParticleSoftSerial with DeviceOS 3.3.0: photon-camera-test.ino · GitHub
Currently wired with Camera RX → WKP, Camera TX → A2 but I’ve swapped those as well.
Same sketch/camera works when connected to the hardware Serial1 pins.
Software Serial Output
0000004441 [app] INFO: ----------------- BEGIN -----------------
0000004656 [app] INFO: No camera found?
Hardware Serial output:
0000003407 [app] INFO: ----------------- BEGIN -----------------
0000003420 [app] INFO: Camera Found:
0000003738 [app] INFO: -----------------
VC0703 1.00
Ctrl infr exist
OV7720
525
0000003739 [app] INFO: -----------------
Image size: Motion detection is 0000004123 [app] INFO: OFF
In a local build I tried cam.begin(9600) with no luck.
When you say “try communicate with the camera directly” do you mean set up the NewSoftSerial connection and use those APIs to try sending commands and seeing what the response is?
Thanks for the coding tips, I don’t spend much time in the C++ world
Edit: I tried 28800, 19200, and 9600 baud and none worked with the camera on the hardware serial port. I remember reading that the camera is only officially supported at 38400
The reason why your code doesn't compile anymore is shown here
lib/TTLCameraLibrary/src/Adafruit_VC0706.cpp:97:13: error: control reaches end of non-void function [-Werror=return-type]
97 | runCommand(VC0706_COMM_MOTION_CTRL, args, sizeof(args), 5);
There obviously is a function in that library that promises to return a value but fails to do so.
If you post a SHARE THIS REVISION link from Web IDE we can pinpoint the exact line of code. There are several VS0706 libraries and we don't know which one you're using.
In order to make the camera accept different baudrates you may have to preset it that way. I don't exactly know for this model but other devices can store the desired baudrate it should default to after cold boot.
Depending on your module you may even have the option to use SPI instead of UART - which would make things a lot simpler
BTW, the datasheet you linked to in your opening post talks about a default baudrate of 115200 which is definitely beyond the reach for ParticleSoftSerial.
Exactly!
The simplest test would be to send the reset command and see whether you get the correct ACK
Which is obviously the info dump from the camera but just not coming through clearly.
I haven’t been able to change baud rates. The PDF documents the command to send but if I open the SoftSerial connection at anything other than 38400 initially I get no data back and the set baud rate command just gets gibberish back if I am connected at 38400.
I even tried a sequence of:
serial.begin at 38400
reset
setBaud 19200
serial.begin at 19200
reset
after switching the serial api to 19200 it goes back to getting no data.
I realized in this project I’m going to end up needing to use a reed relay to only have the cameras powered on when I need to take a picture AND I don’t ever need both cameras at the same time.
I just verified that the cameras work if their RX/TX pins are both wired together to the hardware serial pins on the photon and I just have one powered on at a time. Super hacky but it may actually work
IIRC you can set the baudrate "permanently" so it should be possible to connect the camera to Serial1 to set and store the desired default baudrate.
After that you can detach the camera and reattach to your SoftSerial pins and start off at 19200.