Warning: Cameras are sensitive to static. Earth yourself prior to handling the PCB. A sink tap or similar should suffice if you don’t have an earthing strap.
The camera board attaches to the Tinker Board via a 15-way ribbon cable. There are only two connections to make: the ribbon cable needs to be attached to the camera PCB, and to the Tinker Board itself. You need to get the cable the right way round, or the camera will not work. On the camera PCB, the blue backing on the cable should face away from the PCB, and on the Tinker Board it should face towards the Ethernet connection (or where the Ethernet connector would be if you're using a model A).
Although the connectors on the PCB and the Tinker Board are different, they work in a similar way. On the Tinker Board itself, pull up the tabs on each end of the connector. It should slide up easily, and be able to pivot around slightly. Fully insert the ribbon cable into the slot, ensuring it is set straight, then gently press down the tabs to clip it into place. The camera PCB connector also requires you to pull the tabs away from the board, gently insert the cable, then push the tabs back. The PCB connector can be a little more awkward than the one on the Tinker Board itself.
Camera software is default built inside the release image. You don’t need to do extra setup.
To test whether the Camera is working, try the following Gstreamer command:
$ gst-launch-1.0 v4l2src ! video/x-raw,format=NV12,width=640,height=480 ! videoconvert ! autovideosink
The display should show a preview from the Camera, whilst displaying various informational messages.
If the Camera Module isn't working correctly, please use below command to check whether the Camera Module be detected by Tinker Board.
$ ls /dev/video*
You will see /dev/video0
/dev/video1
/dev/video2
. If not, there are number of things to try:
- Is the ribbon cable attached to the Camera Serial Interface (CSI), not the Display Serial Interface (DSI)? The ribbon connector will fit into either port. The Camera port is located near the HDMI connector.
- Are the ribbon connectors all firmly seated, and are they the right way round? They must be straight in their sockets.
- Is the Camera Module connector, between the smaller black Camera Module itself and the PCB, firmly attached? Sometimes this connection can come loose during transit or when putting the Camera Module in a case. Using a fingernail, flip up the connector on the PCB, then reconnect it with gentle pressure. It engages with a very slight click. Don't force it; if it doesn't engage, it's probably slightly misaligned.
- Is your power supply sufficient? The Camera Module adds about 200-250mA to the power requirements of your Tinker Board.
The CSI Camera of Tinker Board support IMX219 and OV5647. Here describes the basic usage of Gstreamer and MJPEG-streamer.
$ gst-launch-1.0 v4l2src ! videoconvert ! autovideosink
$ gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=NV12,width=640,height=480 ! videoconvert ! autovideosink
$ gst-launch-1.0 v4l2src num-buffers=10 ! video/x-raw,format=NV12,width=640,height=480 ! jpegenc ! multifilesink location=image_%02d.jpg
$ gst-launch-1.0 v4l2src num-buffers=10 ! video/x-raw,format=NV12,width=640,height=480 ! jpegenc ! multifilesink location=image.jpg
$ gst-launch-1.0 v4l2src num-buffers=512 ! video/x-raw,format=NV12,width=640,height=480,framerate=30/1 ! queue ! mpph264enc ! queue ! h264parse ! mpegtsmux ! filesink location=/home/linaro/vga.ts
$ gst-launch-1.0 playbin uri=file:///home//linaro//image.jpg
$ gst-launch-1.0 filesrc location=image.jpg ! decodebin ! imagefreeze ! autovideosink
$ gst-launch-1.0 playbin video-sink=rkximagesink uri=file:///home/linaro/vga.ts
$ gst-launch-1.0 uridecodebin uri=file:///home/linaro/vga.ts ! rkximagesink
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install subversion libjpeg62-turbo-dev imagemagick
$ svn co https://svn.code.sf.net/p/mjpg-streamer/code/
$ cd code/mjpg-streamer
$ make
$ sudo make install
$ cd ~/code/mjpg-streamer
$ ./mjpg_streamer -i "./input_uvc.so -y" -o "./output_http.so -w ./www"
You will see camera preview on your browser http://IP_ADDRESS:8080/?action=stream
.
Note: IP_ADDRESS
is 127.0.0.1
on Tinker Board browser or use wlan0
address (sudo ifconfig
to check) on remote PC browser