Today I should be laying my newest path and cementing in the edging brick pavers, but it's cold and raining so I'm staying inside. I could watch the telly, I could drink a cup of tea, I could even tidy my desk (no, anything but that), but I thought why not see about something for the latest Project14 competition on Photography (Photography | element14). I'm not particularly a camera person and I don't know much about optics but I did purchase a digital camera module with serial TTL communications (Miniature TTL Serial JPEG Camera with NTSC Video : ID 1386 : $35.95 : Adafruit Industries, Unique & fun DIY electronics and kits) when I retired (some years ago now) with the intention of finding out more about this stuff - but then never did. So now this competition seems like a good time to dig out the camera.
It is quite an interesting camera module as it is designed for surveillance so pretty much everything is automatic (light level, colour level and so on - which is good for me), it provides a direct video output (NTSC) along with a serial communication link for modifying the video and for taking snapshots which can be downloaded via the serial link as JPEG files. The serial is a bit slow for this kind of activity at 38400 Baud but I'm retired so I'm not in a hurry. It also has motion detection built-in. I was outside when it came rushing into my brain at the same time as I was disposing of yet another cat pooh that maybe I could use this to detect the cats using my garden, and hey presto, Cat Detector Mk IV was born.
Unfortunately I do not have any screens capable of displaying NTSC directly as we are PAL based in the UK so I have purchased a low cost NTSC to HDMI convertor as I have at least one HDMI display I could use. While I am waiting for that to arrive I have sorted out the serial communication link. The user manual provided with the camera is nearly 10 years old and for a slightly different camera but it was suitable, mostly, for connecting the camera to my laptop. I needed a TTL serial to USB convertor to connect the camera to my laptop and I do have some of these, but as I want to do things with data at some point I decided to use a Nano instead and piggy-back the serial, again as this is not something I have done before.
Piggy-backing serial turns out to be a bit more confusing than I had anticipated as I think the laptop is now the master so that the serial data transmitted (from the laptop) comes out of the Rx pin on the Nano PCB and goes into the Rx pin on the camera. Similarly Tx on the Nano is connected to Tx on the camera. Fortunately the camera is more resilient than the data sheets indicate especially as first I connected the power the wrong way around and then the serial communication pins incorrectly. Also, the camera is 3.3V serial and the Nano is 5V so I used a simple resistive voltage divider on the Nano Rx (transmitting!) pin. The Tx pin doesn't need anything as it is the camera doing the transmitting at 3.3V and the Nano will work correctly with this voltage level. The circuit diagram is shown below. followed by a photograph of the working system.
To get the serial link on the Nano to work it needs to be programmed with an empty shell, listed below.
* Empty sketch for testing the TTL Serial Camera
* Dubbie Dubbie
* 4th June'21
* Uses a Nano, Cooms Tool software package and the serial
* camera. Serial needs voltage divider for correct 3.3V
A software communication tool is provided for the chip in this camera called VC0706CommTool which I downloaded and setup with the COM6 serial port being used by the Nano.
There is a button near the bottom which puts the software into a mode that enables the camera data stream to be accessed Fbuf Ctl which brings up the menu below enabling snapshots of the video stream to be taken and displayed. First you have to use Set File to create a JPEG file in Windows that will be used to save the JPEG image, which gets overwritten every time you take another picture, unless you change the file name. Then you click the Stop CFBuf button followed by the Read button and after a short delay while the JPEG file is loaded a still image appears, as illustrated below.
If you want to take another snapshot you click the Resume button, then the Stop CFBuf button and finally the Read button. The latest image will then be displayed.
The image is upside down so I'm assuming the camera is also upside down as well which I can fix by rotating it through 180 degrees. There might even be a software button to do it - or there might not. It is a relatively low quality image but good enough and if you look carefully you can see the brick pavers waiting to be cemented in. I think the rain may have stopped but it is too late in the day now and tomorrow looks to be warm and sunny.
The next step will be to work out how to get the motion detection working and then see if I can detect cats! It does seem to use quite a lot of current, somewhere is the region of 70-80 mA, somewhat high for a battery powered system. Still, I used a BIG battery for Cat Detector Mk III and I might have to use the same one for this.
All I need now is a programme to make use of the motion detector feature of the camera, something to store the JPEG images and some sort of time stamp, maybe a PIR detector and I will have a fully functional Cat Detector. It will also detect dogs, foxes, horses, rabbits, squirrels (probably), people and maybe even birds!