Setting up PTZ 8MP Camera

<label style=“color:blue”>1.Which seller did you purchase the product(s) from?</label><br>I’ve tried nothing and I’m all out of ideas! https://youtu.be/lOTyUfOHgas<br><label style=“color:blue”>2.The Model number of the product(s) you have purchased?</label><br>B0167B8<br><label style=“color:blue”>3.Which Platform are you using the product(s) on?</label><br>Raspberry Pi 4B<br><label style=“color:blue”>4.Which instruction are you following?</label><br>Video (https://youtu.be/6Ok6WSjYLv0) and 13MP instructions (https://www.arducam.com/docs/cameras-for-raspberry-pi/ptz-camera/13mp-ptz-camera/)<br><label style=“color:blue”>5.Has your product ever worked properly?</label><br>Never worked<br><label style=“color:blue”>6.What problems are you experiencing?</label><br>I was following the instructions and everything was going well, until I got to this line in the “check and test camera” section:

ls /dev/video0

It says:

ls: cannot access ‘/dev/video0’: No such file or directory

Looking in the folder, I can see that video10 through video16 exist, but no video0.

I tried to move on anyway, but when I put in the next command:

v4l2-ctl --list-formats-ext

It says:

Cannot open device /dev/video0, exiting.

Maybe this is because my camera is the 8 MP one, not the 13 MP one? But there were no instructions for 8 MP.<br><label style=“color:blue”>8.How would you like us to help you? </label><br>Anything you could tell me to get me back on the right path would be great.<br>

I’ve tried to do this from the beginning. First I remembered that I hadn’t enabled the camera in “interfaces”, so I did that. Then I ran ./uninstall_driver.sh, then deleted the folder Release. I untarred the folder again and ran ./install_driver.sh. This time I noted what the script said:

pi@raspberrypi:~/Release $ ./install_driver.sh

--------------------------------------

Enable i2c0 adapter…

--------------------------------------

Add dtoverlay=arducam to /boot/config.txt

--------------------------------------

Add gpu=400M to /boot/config.txt

Add cma=128M to /boot/cmdline.txt

--------------------------------------

Installing the arducam.ko driver

--------------------------------------

install: cannot stat ‘./bin/5.4.72-v7l+/arducam.ko’: No such file or directory

install: cannot stat ‘./bin/5.4.72-v7l+/arducam.dtbo’: No such file or directory

reboot now?(y/n):


So it sounds like the arducam.ko and arducam.dtbo files are not present. Did I do something wrong?

Thanks a lot,

Alex

Hello,

The kernel you are using is not the release version and we have not add the 5.4.72 support.

At present, rpi official has release the latest image with 5.4.51 kernel.

Please using the image here

https://downloads.raspberrypi.org/raspios_full_armhf/images/raspios_full_armhf-2020-08-24/2020-08-20-raspios-buster-armhf-full.zip

 

Ok thanks a lot, I do that and I get a little further. I no longer get the “install: cannot stat” errors when running install_driver.sh. Unfortunately I still get the “no video0” error. I still only see video10 through video16 in the /dev folder. I tried this with camera activated and not activated in settings, it doesn’t make any difference.

Could this be because I set the hardware up wrong somehow? Like the ribbon cable not connected properly? Or does this sound like a software problem?

Thanks,

Alex

I believe the camera I’ve got is the IMX219, which the instruction page says is one of the cameras that will not require an extra driver. Could that be the problem?

Thanks,

Alex

Hi,

The link you said is our 13MP PTZ instead of imx219 which is 8MP.

The driver is used for 13mp ar1335 instead of imx219. For imx219, just use the https://github.com/ArduCAM/PTZ-Camera-Controller demo.

Excellent, thanks, when I started from scratch again but this time treated it just like a regular Raspberry Pi camera, Video0 shows up and it is capturing images. I also had the ribbon cable attached to the camera backwards, should have had the blue tape facing up towards the camera.

However, the servos are not working :(. I have activated the I2C interface and downloaded the PTZ-Camera-Controller from the link above. However when I run it I get this:

pi@raspberrypi:~/PTZ-Camera-Controller/pyCode $ python FocuserExample.py

Traceback (most recent call last):

File “FocuserExample.py”, line 227, in <module>

main()

File “FocuserExample.py”, line 219, in main

curses.wrapper(draw_menu,camera)

File “/usr/lib/python2.7/curses/wrapper.py”, line 43, in wrapper

return func(stdscr, *args, **kwds)

File “FocuserExample.py”, line 204, in draw_menu

RenderMiddleText(stdscr,k,focuser)

File “FocuserExample.py”, line 82, in RenderMiddleText

focus_value = “Focus : {}”.format(focuser.get(Focuser.OPT_FOCUS))[:width-1]

File “/home/pi/PTZ-Camera-Controller/pyCode/Focuser.py”, line 120, in get

self.waitingForFree()

File “/home/pi/PTZ-Camera-Controller/pyCode/Focuser.py”, line 69, in waitingForFree

while self.isBusy() and count < (5 / 0.01):

File “/home/pi/PTZ-Camera-Controller/pyCode/Focuser.py”, line 65, in isBusy

return self.read(self.CHIP_I2C_ADDR,self.BUSY_REG_ADDR) != 0

File “/home/pi/PTZ-Camera-Controller/pyCode/Focuser.py”, line 56, in read

value = self.bus.read_word_data(chip_addr,reg_addr)

IOError: [Errno 121] Remote I/O error

Other python scripts in the pyCode folder give similar errors. So I think the I2C is not connected correctly. I read here that you can check the interface using sudo i2cdetect -y 1, on my Pi this results in:

pi@raspberrypi:~/PTZ-Camera-Controller/pyCode $ sudo i2cdetect -y 1

0 1 2 3 4 5 6 7 8 9 a b c d e f

00: – – – – – – – – – – – – –

10: – – – – – – – – – – – – – – – –

20: – – – – – – – – – – – – – – – –

30: – – – – – – – – – – – – – – – –

40: – – – – – – – – – – – – – – – –

50: – – – – – – – – – – – – – – – –

60: – – – – – – – – – – – – – – – –

70: – – – – – – – –

So I think no I2C connection set up. I double checked that the connections are all the same as in the diagram and I believe they are. I believe the servos are 5V (they appear to be the same as in the 12MP video) so I attached the two left most lines (red [servo VCC] and black [ground] in the diagram) to Pin 2 (5V) and Pin 9 (Ground).

Sorry for what I’m sure are very basic problems. As I’m sure is very obvious by now, I don’t have a lot of experience with this stuff.

Thanks a lot,

Alex

Hello,

It seems the i2c bus is abnormal. Have you enable the i2c 1 bus ? Just open the /boot/config.txt file and add “dtparam=i2c_arm=on” then reboot.

 

Well I started from the beginning and made sure to follow all the steps in order, and double checked all the pins. The I2C is definitely activated, “ls /dev/i2c” shows “/dev/i2c-1”. However “sudo i2cdetect -y 1” still shows a bunch of blanks:

0 1 2 3 4 5 6 7 8 9 a b c d e f

00: – – – – – – – – – – – – –

10: – – – – – – – – – – – – – – – –

20: – – – – – – – – – – – – – – – –

30: – – – – – – – – – – – – – – – –

40: – – – – – – – – – – – – – – – –

50: – – – – – – – – – – – – – – – –

60: – – – – – – – – – – – – – – – –

70: – – – – – – – –

And I still get the same error when running FocuserExample.py:

pi@raspberrypi:~ $ python PTZ-Camera-Controller/pyCode/FocuserExample.py

Traceback (most recent call last):

File “PTZ-Camera-Controller/pyCode/FocuserExample.py”, line 227, in <module>

main()

File “PTZ-Camera-Controller/pyCode/FocuserExample.py”, line 219, in main

curses.wrapper(draw_menu,camera)

File “/usr/lib/python2.7/curses/wrapper.py”, line 43, in wrapper

return func(stdscr, *args, **kwds)

File “PTZ-Camera-Controller/pyCode/FocuserExample.py”, line 204, in draw_menu

RenderMiddleText(stdscr,k,focuser)

File “PTZ-Camera-Controller/pyCode/FocuserExample.py”, line 82, in RenderMiddleText

focus_value = “Focus : {}”.format(focuser.get(Focuser.OPT_FOCUS))[:width-1]

File “/home/pi/PTZ-Camera-Controller/pyCode/Focuser.py”, line 121, in get

self.waitingForFree()

File “/home/pi/PTZ-Camera-Controller/pyCode/Focuser.py”, line 70, in waitingForFree

while self.isBusy() and count < (5 / 0.01):

File “/home/pi/PTZ-Camera-Controller/pyCode/Focuser.py”, line 66, in isBusy

return self.read(self.CHIP_I2C_ADDR,self.BUSY_REG_ADDR) != 0

File “/home/pi/PTZ-Camera-Controller/pyCode/Focuser.py”, line 57, in read

value = self.bus.read_word_data(chip_addr,reg_addr)

IOError: [Errno 121] Remote I/O error

I’m kind of running out of ideas of things to try. I guess I could replace the wires and try again. I would test if other I2C devices work on this Pi, but I don’t have any. Do you have any ideas? Is it possible that there’s a problem with the camera control board?

Thanks a lot,

Alex

Here are pictures of the wiring:

Into controller board

Right side

Left side

As you can see I plugged in the servo vcc and ground into the remaining 5V pin and another ground, respectively.

I think it all matches the instructions, so I’m kind of stumped.

Thanks a lot,

Alex

 

Can you detected the slave address using i2cdetect -y 1?

If normal you can see 0x0c which is the PTZ system’s slave address.

 

No, it just gives me blanks for all the addresses. Like this:

0 1 2 3 4 5 6 7 8 9 a b c d e f

00: — — — — — — — — — — — — —

10: — — — — — — — — — — — — — — — —

20: — — — — — — — — — — — — — — — —

30: — — — — — — — — — — — — — — — —

40: — — — — — — — — — — — — — — — —

50: — — — — — — — — — — — — — — — —

60: — — — — — — — — — — — — — — — —

70: — — — — — — — —

Hello,

Sorry for my late reply, please contact our sales for replacement.

 

Thank you, the new board arrived and fixed the problem!

I am now having issues getting a focused picture, but I will make a new question for that.

Thanks for making this work for me.

Hello,

Great to hear you have solve your issue. About can’t get a focused picture, What the range of your focus?

Do you mean the range printed on the camera? It says 2.7-13.5 mm, 1:1.3, 1/2.7" on the lens:

When I reset the zoom (R) and run autofocus (ENTER) in the focuserExample script, it says the focus setting is 16211:

The image it captures is very out of focus:

I haven’t adjusted anything physically, do I need to? I see there are some set screws.

Thanks,

Alex

Hello,

Before you run auto focus, Please press R to reset then run the auto focus.

Fee free to let me know if you need more help.

I did that, it still does not focus correctly.

I can hear the motors going after I press R, so it is resetting everything. But then after pressing ENTER it remains fuzzy.

Hello,

Can you find the correct focus by manual adjustment?

I haven’t tried because I was afraid of breaking it, can you tell me how to adjust the camera manually?