Flyport ftp webcam
Flyport FTP Wecam
My camera was built with a Sparkfun camera module, but Adafruit or the Grove camera should work as well. This means that a flyport with a Grove Nest or a Starter-Kit will work.
This new webcam is a simplified version of the original webcam (OP-PRJ-006 ) that was copying the pictures to the web-page calling. This version currently does not need any web-menu as the pictures shooting is triggered by picture movements detected by the camera. In order to configure the webcam you will need to setup an FTP Server on a local NAS or on a remote site, i.e. your Internet provider site. The big advantage of storing the pictures on a remote site is that you secure the pictures as they are taken. Storing the pictures on an SD card like I did in my previous project would not secure the pictures if for example the camera would be stolen.
The new camera setup is not yet done using a web-page, so you will need to use the IDE Wizzard to setup your local network connection. The following détails need to be defined to setup your own camera: Connection to your local router that gives access to the local or internet: SSID, Network Type, Security type and PSK Password.
The ftp setup is currently hard coded inside the taskflyport.c line 257 and below. You have to define the YOURIPADDRESS,YOURACCOUNT, YOURPASSWD. On line 270 you can define the path of the directory on the remote FTP server.
The flyport code will first setup the camera UART speed and picture resolution. Camera code explanations are shown in (OP-PRJ-006 ). In this example, we switch from the default speed of 38400baud to 115200 baud, some cameras default speed is 115200 which makes this part redundant. Next is to wait until the camera is connected to the WIFI network, this allows the camera to grab SNTP time that will ne used to define the FTP file names. I included the date and time inside the file name to self document pictures review.
Once initialized, the camera will run the following process:
- Wait until a motion is detected
- Take picture (freeze camera)
- Connect to remote FTP site (my attempt to have the connection open all the time failed probably due to timeouts.
- Set remote directory and file type (Binary)
- Open remote file, update time, generate file name, FTPStreamOpen()
- Copy Picture to remote side, we read blocks from the camera and FTPStreamWrite.
- Close the remote FTP File with FTPStreamClose().
- Free up the camera that was frozen during picture transfer
- Jump to task 1 and wait for the next motion.
The flyport COM1 is used to send debug information and camera détails to the flyport console. You can enable or disable some features in the code to play with it.
In my case, the camera was connected to the 5V power of the Starter-Kit, the camera I used had his own voltage regulator. The TX and RX line was directly connected from the camera module to the Flyport COM Port 2, Camera RX1 to Flyport OUT1 and Camera TX to Flyport IN1. The attached code configures the 2nd COM Port of the flyport, so nothing to do on that side if you use my code.
In addition and as I had problems when resetting the flyport, I solderd a wire on the camera reset line (Reset is by chance connected to an SMD diode). I used IN2 of the flyport to send the reset (reprogrammed that pin as output), an other ouput pin would work as well. Yellow wire on the picture showing the reset line.
You can download the code that was compiled with Openpicus version 2.3. Still having in minde to add the TCP and FTP configuration to the WEB page of the WEBCAM, that would simplify building commercial cameras. Source Code
sing the camera motion detection maybe to sensible, it generated 100th of pictures during 12hours operation, an IR motion detector maybe more appropriate to detect people presence. Above example showing the camera detecting our cat on our balcony. Same happens for every car crossing.