Raring to go with Raspberry Pi HQ V3 camera module technology? This guide will get you taking pictures and videos ASAP (and even recording slow motion video!) - This video was recorded using the now obsolete 'Buster OS' head to this guide for updated terminal commands https://core-electronics.com.au/tutorials/raspberry-pi-bullseye-camera-commands.html
Hey gang, Tim here at Core Electronics, and today we're getting hands on with the Raspberry Pi high quality camera module. If you're raring to go with this 12.3 megapixel technology, then this guide will get you taking pictures and videos ASAP. It's also going to provide tools to unlock all the photography and video settings that are available within this technology. And I'll even demonstrate how to record video in slow motion.
On the table before me is everything you need to get up and running with your Raspberry Pi high quality camera. Naturally, you're going to want a Raspberry Pi high quality camera, a ribbon cable, a camera lens. For this demonstration, I'm using the 6mm wide angle camera lens, but you can use any lens which has a CS or C mount. And for this, I'm also going to use a camera mount off the top of a tripod. The Raspberry Pi high quality camera has a screw hole that can be used to mount it directly to this. For today, I have a Raspberry Pi 4 model B, 1 gigabyte and also a microSD card with Raspberry Pi OS flash to it. You're also going to need a power supply, HDMI cord and peripheries like a mouse, keyboard and monitor.
Let's assemble it all together, starting with the lens and camera module. We're going to remove the protective caps and screw the lens into the high quality camera. The part you're screwing it into is the back focus ring, and you're going to screw it in until it's finger tight. Now, tighten the locking screw in place. This is going to prevent the back focus ring from rotating around when you're trying to pull focus with the actual focus ring on the lens.
Note here, you can loosen that back focus ring to extendIt out a little bit if a closer minimum focus is desired. To connect the ribbon cables, lift up the edges of the CSI connector gently, slip the ribbon cable in until it bottoms out, then push down the edges of that CSI connector.
From there, you can install the whole camera module on top of a tripod. This will allow you to place it, target it and focus it much more securely. With a microSD card flashed, you can then install it into your Raspberry Pi.
Now, simply connect all the peripheries and plug in the USB-C to turn on the Raspberry Pi. Then open up the Raspberry Pi configuration menu found using the top left menu and scrolling over preferences and enable the camera found under the interfaces tab. After enabling, reset the Raspberry Pi to lock in those changes.
These lenses focus manually, so the easiest way is to set up a preview window which runs continuously on your monitor and find the focus using that preview window as a guide. Now, open up a terminal window using the black console button on the top left screen on the Raspberry Pi OS and type the following and press enter. RaspiStill-T0.
This is going to open up a new window on your monitor showing you exactly what the high quality camera is seeing. We're going to use this window to give me feedback on the manual adjustments that you will need to do on the lens so that you can get good color and sharp focus.
Come in close and let's take a look at the manual controls of this high quality camera and lens. Here in the middle, we have the aperture ring with a locking screw. When we rotate just this part, it's going to determine the amount of light that goes into the camera. If I hold it thisWay, you can see the mechanism that determines this opening and closing. So the extremes of this are going to be either overexposing the image, making everything white as too much light is getting into the sensor or not allowing enough light in, which will make everything completely dark.
Once you find a good level, you can then lock in the camera position using the locking screw here. Next is the focusing by rotating both the front parts like so. You're going to be able to adjust the focus. Once you pull focus on your target, you can then lock the position using the adjustment screw on the back of the lens.
So now we can close that. We focus the camera. Let's start taking some pictures. We're going to type the following into the terminal, opening it the same way as before. Raspi still dash O for output and then image dot JPEG.
Now, once you press enter on your keyboard like so, the camera is going to open up and after a few seconds, it's going to take a few more clicks to open up. Press enter on your keyboard like so the camera is going to open up and after a few seconds, it's going to take a photo. This photo is going to be saved in the home pie directory, providing it with the name image and formatting it as a JPEG file.
There are heaps of additions you can add to this terminal line to alter all kinds of settings like exposure time, ISO settings, image rotation, changing the directory location where it's going to end up, isolating just a section of the image to be captured to name only a few. If you want to see all the available options for these settings, check out the official documentation. I have a link down below.
As an example, I'm goingTo add some custom settings to this right now, for instance, if you typed and entered this into the console, it's going to take a JPEG image named image 2 after a 2-second wait. It's also going to capture it at 640 by 480 resolution. It's also going to flip the image both horizontally and vertically.
Now we've done that, let's take some video with this high-quality camera. We're going to type the following into the terminal, opening it using the same method as before: RaspiBid-T5000. We're going to type video.h264-o for output, then video. So right now, this is capturing a video for 5 seconds.
Once we press that enter key, as you saw, that high-quality camera is taking that 5-second video and saving it in a similar home/slash Pi directory, providing it with the name video and turning it into an h264 format. This video is going to be recorded at the default settings, which for this camera is 1080p 30.
Much like before, there are heaps of additions you can add to this terminal line to get the exact result you desire out of your camera. For instance, if I type the following into the terminal, we could take a video captured at 640 by 480 resolution at 90 frames per second for 10 seconds. We then name the file as 90fps and save it as an h264 format.
As more frames per second are being captured than normal, you can create slow-motion footage using this method. This high-quality camera has a number of supported per second frame rates depending on the resolution you choose. For example, if you're recording at 2028 by 1520, a resolution which is exactly half the maximum resolution of this camera, you can record at a frame rate of 50 per second.Another useful tip is an easy way to turn those h264 files into an mp4 format. And this is a much more commonly used format type.
What we're going to do is enter the following into the terminal to install the GPAC application. What we're going to do is enter the following into the terminal. sudo apt-get install gpac and press enter. If prompted, press Y and enter to confirm the installation. As you can see, I've already installed it here.
Having installed this feature, to convert your video file, type and enter the following into the terminal. Make sure to replace my file name that I write here with your file name that you want converted. This will leave you with an mp4 file and the original h264 file.
You will note that I've added a setting here to lock the FPS to 90. By default, mp4 box exports files at 24 frames per second. By changing the default frames per second like so, it's going to match the original video's FPS. So that's going to prevent you from losing any video data.
It's worth noting that Raspberry Pi by default exports video at 30 frames per second. So if you want your Raspberry Pi camera to take an image of when it sees the movement of a potential thief, or perhaps have your Raspberry Pi 4 be able to identify you based on your face, we have tutorials for you to explore. Just check the description.
So that's all from me for today. Until next time, stay cozy.
Makers love reviews as much as you do, please follow this link to review the products you have purchased.