Build A Camera: Difference between revisions

From Global Meteor Network
Jump to navigation Jump to search
Line 173: Line 173:
* Using three 12 mm M2 screws, connect the camera board to the metal holder, passing the lens through the square hole from the back.  
* Using three 12 mm M2 screws, connect the camera board to the metal holder, passing the lens through the square hole from the back.  


* Note that on some camera models, the writing on the camera board must be UPSIDE DOWN to get the correct orientation of the camera. In this orientation, the sockets for power and networking will be at the bottom of the rear of the camera board. To be sure you have it the right way up, see advice in the section on Testing and Focusing.  
* Note that on some camera models, the writing on the camera board or image of a stick man must be UPSIDE DOWN to get the correct orientation of the camera. In this orientation, the sockets for power and networking will be at the bottom of the rear of the camera board. To be sure you have it the right way up, see advice in the section on Testing and Focusing.  


* Finally, remove the plastic cap on the lens.  
* Finally, remove the plastic cap on the lens.  

Revision as of 07:51, 28 March 2022

Parts and Tools needed

Annotated Parts List

Click on the image to the right to see a larger version with the parts labelled

  1. IMX291 sensor board
  2. Lens with the lens holder - 4mm, 6mm are M16 mount as pictured, while other lenses might be CS which have a different holder
  3. 2x M2 screws, 6mm long - for mounting lens holder
  4. Camera housing
  5. Small cable gland (supplied with the housing)
  6. Large cable gland (supplied with the housing)
  7. Camera Power over Ethernet (PoE) cable (sometimes called a network cable by the sellers)
  8. Camera board holder (supplied with the housing)
  9. Holder metal plate (supplied with the housing)
  10. 4x M2 screws, 12 mm long - for mounting camera module to bracket
  11. 1x M3-.50 screw, 6mm long - for mounting camera module L-bracket to base plate
  12. Metal plate screws (supplied with the housing)
  13. Transparent weatherproof silicone
  14. Housing mounting bracket (supplied with the housing)
  15. Waterproof ethernet cable protector
  16. PoE injector to supply 48v to the camera (not shown)
  17. Raspberry Pi 4 Model B 2GB (or at least a 3B+ with 2GB) with official power supply (not shown)
  18. Raspberry Pi housing (not shown)
  19. 128 GB or greater microSD card (not shown)
  20. Self-amalgamating tape (not shown)

Purchasing Parts

For consistency across the network and to make collaborative support possible, it is recommended that the camera and lenses listed below are used in preference to random handy bits that are cobbled together. The selected components are proven and known to work well. Other components can be sourced from any convenient seller.

Many components such as the Pi and microSD cards are are readily available in most locations. For other items such as lens, camera and housing, AliExpress - the Chinese equivalent of eBay - is the preferred online source as it serves most of the globe and has been reliably suppling parts to date.

NB: Links are given to current sellers, but stock levels vary and if the link is dead or the seller is out of stock, you should be able to find an equivalent from another seller on AliExpress.

Sensor

The bare IP security camera featuring a Sony IMX291 has been selected for the RMS system. This is available from many sellers on AliExpress. Out of the options offered, choose "With 48V POE cable" and "No lens":

Always buy a lens separately from the list in the following section.

Lens

Most cameras available on Aliexpress come with a choice of lenses. The preferred lens is a 4mm f/0.95 M16 lens providing ~88x45° field of view, which can also be bought separately for example via this link.

If you live in an area with heavy light pollution, other options are available. We wholeheartedly recommend only using lenses from the following list, as others might not be as sensitive or might have large distortion. See this page for more lens options.

Housing

A security camera housing is used, providing weather-tight protection without distortion introduced by plastic domes. From the options offered, select "Plate and Bracket" to get a plate for mounting a 38x38mm bare IP camera module, and an L-shaped mounting bracket.

Power Over Ethernet Injector

This connects by network cables to both the Raspberry Pi and the camera sensor, and injects 48V DC onto the network cable to the camera to supply it with power. Pick a suitable plug style for your location from the options offered. An example unit is:

Note that over short lengths of up to about 5m you can also use plain PoE connectors. These simply feed 12V from a power supply into the ethernet and extract it at the other end. Over short distances this will supply the camera with adequate power without the need for 48V injectors.

Finally, if you are operating several cameras, you can use a PoE switch instead of a PoE injector.

Cooled Housing for Raspberry Pi

This is one of the rare cases that fulfills our needs. It has a fan which is relatively quiet, it’s sturdy, and it can fit the RTC with the addition of riser pins. Please buy this case, we have tried many others, but they are not as good. From the options offered, make sure you select one that says "for Pi 4" if you are using a Raspberry Pi 4, or "for Pi 3B Plus" if you are using a Raspbery Pi 3B+. Additionally there is a case variation that is fully enclosed and has no fans; do not select this option.

Real Time Clock for Raspberry Pi

RTC installation

Very precise timing is essential to processing the meteor data, so unless you are confident in your internet connection an RTC module ensures the Raspberry Pi always has the precise time, even when power or internet is unreliable. AliExpress sells a pack of 10 but they are inexpensive - maybe share the extras among other camera constructors in your area.

Once you plug it into the Pi (see image on the right) and make sure the current time is correct on the Pi, open the terminal and run:

sudo hwclock -w

This will set the current computer time to the RTC. Every time the Pi boots up, it will read the correct time from the RTC.

Pin Headers

Required to raise the height of the Raspberry GPIO bins to allow the RTC to sit proud of the Raspberry Pi case. You only need 1 but the pack of 20 is available for only a dollar or so.

Network cabling

You will need two lengths of network cabling, one (probably quite short) between the Raspberry Pi and the PoE injector and the other between the PoE injector and the camera. You can purchase suitable lengths locally or on AliExpress. Some people have found the following thin flat network cable to be useful for sneaking the wire through a window or door to avoid drilling holes in walls or eaves, although it will require some extra attention to seal the cable at the camera's PoE connector:

Waterproof Cable Connector

One end of the network cable will be outside, connected into the PoE cable from the camera. This is not only carrying data but 48V DC power and needs to be kept sealed. This waterproof connector is fitted over the end of the network cable connector then after the network cable is plugged into the camera's PoE cable, the connector is locked into the end of the PoE cable. For extra weatherproofing, wrap in self-amalgamating tape.

128GB Micro SD Card

You need at least a 64GB card but a 128GB is recommended as 20+ GB of data is collected every night. Make sure it is a fast card eg Class 10 UHS-1 or better. A card can either be purchased locally or from AliExpress. Be warned that there is an ongoing problem with the production and sale of fraudulent memory cards misreporting the available storage and even supplies from a reputable outlet can be affected - test the card you purchase. The AliExpress link has been used successfully to obtain suitable micro SD cards. If you live in North America, buy your SD cards at Costco.

Raspberry Pi 4

These are likely to be available to be purchased locally or from a domestic online source. You need at least a 2GB RAM model. The Raspberry Pi Model 4B is now the minimum spec. Previously, a Raspberry Pi Model 3B+ was considered the minimum but these do not have the performance or memory to handle busy meteor showers. Purchase the official 5.1V 3A 15.3W power supply to go with it - most problems with Raspberry Pi units are due to inadequate power supplies being used instead of purchasing the official power pack. Note: to connect a RPi 4B to a monitor you will also need a micro-HDMI cable, so that might be necessary to add to the shopping cart also.

Additional items and tools

  • Source suitable M2 and M3 screws. It might be possible to find these locally but in some places they are just odd enough to be quite hard to find. You could order some hardware from the ScrewHome Store on AliExpress. Each packet of 50 M2x6mm, M2x12mm, and M3x6mm machine screws will cost only a few dollars.
  • A tube of silicone sealant is used to seal the glass window for the housing and the front screws in the housing.
  • Self-amalgamating tape can be used to wrap and seal the cable connector(s) to ensure they remain weathertight in all conditions.
  • Tools such as small wire cutters or a sharp knife, various sized screwdrivers, a drill and screws to mount the camera bracket will be required.

Deprecated shopping list: LINK

Some cameras come with a slightly different cable with a separate 12V socket for power input as shown here. If the power input port has a small cap, then you can just cover it and use the PoE on the ethernet port. If it's open, then you will need a pair of PoE adapters (seen in that picture in the background).

To test and focus the camera you will need VLC. This software is preinstalled on the Pi but is also available for Mac, Windows or Linux from here.

Assembly

[Note: there's a longer version of the camera assembly section of this page available on Google Docs. Please refer to this if you need more information.]

Preparing the Lens

single filter: punch out the filter
  • Start by removing protective covers from the sensor and lens. Take care not to touch the sensor after this is removed.
  • The cameras come with an IR Block filter in the lens holder. We don't want this.

Lens holder with single filter

  • If you have a lens like the one shown in the first image, unscrew the lens from the holder.
  • Then using a screwdriver, carefully push the filter out of the lens holder as shown in the image on the right. If you push from the front, the filter may come out intact.
  • If it shatters, make sure there are no shards left.

Lens holder with electronic filter drawer

  • Some lenses come an electronic day/night filter drawer. These have a small cable to plug into the camera board. Two different types of these filter holders are shown here.
Two sorts of lens holder with day/night filters
  • DO NOT try to punch out the filter directly as this may jam the mechanism or leave shards of glass inside.
  • If your holder is the type with a rectangular sliding drawer, remove the drawer by undoing the screw on the end. Then remove the while filter glass entirely.
Sliding type: Remove the filter entirely
  • If your holder is the other type, undo the three small screws on the top and take off the cover. Then remove the clear filter. You can leave the reddish daylight filter.
Rotating type: Remove just the clear filter
  • Now reassemble the filter holder. Do not connect the power cable to the camera.
  • Next look on the underside of the lens holder where you will see two plastic nubbins. These get in the way, so using the wire cutters snip them off. Make sure you get the base completely flat.
  • Then screw the lens back into the lens holder.

Attaching the Lens to the Camera

Attaching the Lens
  • Carefully unclip the circuit board from the plastic holder but do not detach the ribbon cable.
  • Using the supplied screws, attach the lens to the sensor.
  • Replace the circuit board in the plastic holder.

Preparing the Camera Housing

Glands in Place
  • Fit the small cable gland to the housing and pass the loose ends of the Camera PoE cable up through, but don't tighten it up yet. Remember to slip the cap over the cable first!
  • Fit the large cable gland in the other opening, and push a piece of plastic packing foam into it. Don't seal it up completely though this is to keep insects from getting in, but allow moisture out.
  • We do not recommend that you put the whole cable inside the housing, as the LEDs on it will create light pollution inside the housing.

Attaching the Camera

Camera In Mount

Note: I recommend installing the camera in the housing at this point so that you do not have to detach the cables or risk knocking focus later on. However, you can proceed to test focus etc before installing the camera in the housing if you wish. If you prefer to do that, skip this section for now and come back later. Otherwise:

  • Connect the metal camera holder to the metal plate using one 6mm M3 screw. Note the orientation of the plate as shown in the photo.
  • Using three 12 mm M2 screws, connect the camera board to the metal holder, passing the lens through the square hole from the back.
  • Note that on some camera models, the writing on the camera board or image of a stick man must be UPSIDE DOWN to get the correct orientation of the camera. In this orientation, the sockets for power and networking will be at the bottom of the rear of the camera board. To be sure you have it the right way up, see advice in the section on Testing and Focusing.
  • Finally, remove the plastic cap on the lens.

See image for the proper camera board orientation, so the video is not sideways or upside down.

Installing the Camera in the Housing

Camera In Housing
  • Remove the plastic plate from inside the housing and discard it.
  • Fit the camera on its metal plate into the housing, as close to the front glass as you can get it without actually touching. A few millimetres away should be good.
  • Looking at the camera from the rear, attach the largest connector (often with blue/green wires) to the right hand socket.
  • Attach the power connector to the left hand socket. This connector has several pins but only two are connected (red/black).
  • The third connector (two pins, red/black) is for a powered lens and is not used so tape it back out of the way.
  • Once you've secured the camera in position, you can tighten up the cable glands.

Testing and Focusing

At this point, your camera must be tested and focused. There's no point sealing up the housing and screwing it to the wall if its not working or isn't focused !

Testing the Camera

  • If your camera came with a single PoE cable, connect this to a netork cable and plug the other end of the network cable into your PoE injector.
  • if your camera came with a cable with separate network and power sockets, plug the "output" PoE adapter into the camera cable and plug a network cable into the PoE adapter, then connect the other end of the network cable into the other PoE adapter.
  • . Connect the PoE adapter or injector into a spare socket on your home router and connect the camera power supply to it.

The Camera PoE cable lights should come on, indicating traffic is flowing. After a few seconds, it should steady down to irregular flashing. If you don't see flashing lights then check the cable connections to make sure everything is plugged in properly.

Find its IP Address

Finding the Camera Address

The camera should now appear as a device on your network and to test it properly you will need to find its IP Address. The easiest way to do this is using a free piece of software called [IP Scanner]. Download and run it (no need to install). Click "Scan" and wait till it finishes. The camera can usually be identified by Manufacturer 'ICP Internet Communications' or 'Motion Control Systems', though other vendor names are possible such as 'Koenig & Bauer AG' and 'Metrohm AG'. If none of the names look right you may need to experiment by trying to connect to each candidate in turn.

Checking the Connection

VLC Network Stream
  • Once you have the IP Address, open VLC on your Pi, Mac or Windows machine, and from the "Media" menu, select "Open Network Stream".
  • Enter the following into the address box, replacing 1.2.3.4 with the address you got in the previous step

rtsp://1.2.3.4:554/user=admin&password=&channel=1&stream=0.sdp

  • After a second or two, you should get a view through the camera. If nothing comes up, check you have got the right IP address, and that the cables are secure.
  • You can now double-check that you installed the camera the right way up. If the image is upside down in VLC, turn it through 180 degrees in the housing.
  • If the image is upside down, do not be tempted to use firmware settings to flip or mirror the image. These cameras have a 'rolling' shutter and to work out precise timings of meteors, the RMS software compensates for the shutter. If the camera is upside down and the image then flipped, the shutter is working in the opposite direction to that expected by RMS and timings will be wrong. You must physically rotate the camera.
  • Note that its entirely normal for the image to be very red and overexposed in daylight. We've removed the IR Block filter, so the camera picks up a lot of red light. This is exactly what we want.

Checking for Obstructions

Obstructions
  • Temporarily close the housing case up and check if it can be seen obstructing the view anywhere.
  • Move the camera around on the mount to minimise the obstructions, and if necessary bend or tilt the bracket to angle the camera down a bit.
  • However, don't worry if you can't eliminate all obstructions. Later on you will create a software mask to prevent these areas causing false detections.

Focusing the Camera

There's a whole separate section of the Wiki on focusing, but here's the short version !!

  • connect the camera to your network as above.
  • Open VLC.
  • Aim the camera at something at around 30-50 metres away.
  • Screw the lens in and out slowly to get best focus.

Note that there's a short lag due to the network, so you should wait a second or two after each adjustment to allow the change to be reflected in VLC.

Important note: if your camera came with an electronic filter, and you have left the 'daytime' filter in place, you MUST finalise focus at night. The filters slightly alter focus, so the daytime view is not focused when the nighttime view is!.

Setting Camera Parameters

To operate at night, the camera must be reset to the correct gain, colour mode and video mode. There are two ways you can do this:

Using the CMS Software

  • If you have a Pi3, you will currently have to use CMS.
  • CMS is a security camera software package you can download from the internet. You can use the software as explained in this video by Denis Vida.
  • Note however that you should reset the network as the LAST thing you do. The video does it a bit soon.

Using the RMS software

Making sure the Pi can see the Camera
  • If you have a Pi4, you can use a utility that's part of RMS, as follows:
  • If you're not using the pre-built image, first install RMS on the Pi as explained here.
  • Now plug the camera into your router, open a Terminal window on the Pi and, using the address of your camera, make sure the Pi can ping the camera:
ping a.b.c.d

If you get any errors or timeouts, check the camera IP address, and check that the Pi is connected to your home network.

  • Next run this script to reset the camera IP address.
 python -m Utils.SetCameraAddress a.b.c.d 192.168.42.10
  • You will lose connection to the camera and see a bunch of error messages. Thats normal. Once you see a timeout message, unplug the power and network from the camera.
  • Now plug the camera directly into the Pi's ethernet port and run the following script to update the camera gain, video mode, and other settings.
Setting Camera Params
Scripts/RMS_SetCameraParams.sh
  • Note: If you have RMS installed on your PC then you can change the camera address from your PC instead, then connect it to the Pi and run the 2nd script.

Final Steps

Sealing the Housing

Sealing the Housing

Depending on your climate, its usually advisable to seal up the camera housing against rain and snow.

From the outside, carefully go round the edge of the glass with silicone sealant. Also squirt sealant into any screw holes visible on the front of the camera housing, where it will be most exposed to rain.

But DONT seal up the hinged door because you will occasionally need to maintain the camera, and you don't want to have to prise it open with a chisel!

If there are any cable connections outside the casing, you should also seal these up thoroughhly. This writer can attest to the damage caused by water ingress into a PoE connector! Tape up or seal the connections tightly with some sort of waterproof product (I used electrical tape), but remember you may need to change the cable, so don't seal it irreversibly.

Mounting Outside

Mount the camera somewhere with a good view of the sky and without too many 'terrestrial' obstructions such as trees, hills and buildings. Take special care to angle well away from security lights. These lights emit infrared and without the IR Block filter, the IMX cameras are extremely sensitive to this.

When locating the camera, bear in mind that you will need to be able to get to the camera to maintain it. The cameras do not need to be high up as long as they have a good view of the sky. Mine are at eye-level on my observatory shed.

As before, don't worry if its not practical to eliminate all obstructions as you can mask off any that can't be avoided.

Aiming the Camera

Aiming the Camera

The cameras have a field of about 40-45 degrees vertically and 90 degrees horizontally so angle the camera upwards at between 35-45 degrees, higher if you have lots of nearby hills or trees. This should maximise meteor detection.

If you can arrange so that the camera view overlaps with other RMS users, thats even better. Check with the network to get an idea of a good direction.

In this photo, the camera is aimed up at about 40 degrees, just above the top of the hill behind the camera location. The parts of the hill that are visible will be masked off in the software to avoid 'meteor-wrongs' due to dog-walkers with head torches!

Thats it!

Once the camera is installed, connect up the PoE adapter, attach a long network cable and run it to wherever you are going to keep the Raspberry Pi. Remember to ask permission before drilling holes in the walls... :)


Now install the Software

Now you can finish configuring the Raspberry Pi by installing a prebuilt image. This is covered in a separate guide here.