Published: 2024-02-22 | Categories: [»] Tutorialsand[»] Optics.

It is relatively natural for an optical system to rely on one or more cameras for either the acquisition of data or, more simply, as a tool during the alignment process. The various systems that I presented on this website are no exception to that and do heavily use one or more cameras.

For newcomers to optics, cameras can be tricky to setup properly – especially those Ethernet (GigE) cameras that I tend to recommend in my post. I therefore wanted to make a comprehensive article that would cover how to design and operate GigE cameras in scenarios of various complexity. I will start with a basic system of one computer with one camera and we will gradually move on to systems with multiple cameras and multiple computers located far away from the system.

In my previous posts, I have used both FLIR BFLY-PGE-31S4M-C and Daheng MER2-160-75GM-P monochrome cameras and I will soon post about the MER2-1220-9GC-P color camera as well. There are many other camera brands, but the procedure is (almost) always the same thanks to the standardization of Ethernet cameras.

When operating an Ethernet camera, you will need a Network Interface Controller (NIC) in your computer with a “RJ45” Ethernet cable output (8 pins telephone-like connector) to be able to connect to the camera. You will spot it thanks to an RJ45 connector somewhere on your PC case. Almost all desktop computers come with one pre-installed on the motherboard but it’s not always the case for laptop computers so be sure to check out what are the Ethernet capabilities of your computer before you buy anything. With the prevalence of WiFi these days, the need of a cabled connection is not a strict requirement anymore for computers.

If you are already using your NIC for your Internet connection because you don’t have or don’t want to use WiFi, you will need an extra NIC to add to your computer to be able to connect to your camera. Also, some very old computers don’t support the necessary transfer speed required by GigE cameras. You can check your NIC speed by going to Windows configuration > System > Network & Internet. Select your NIC (usually called “Ethernet” if you have only one) and check in the properties that it supports at least 1,000 Mbps:

Alternatively, you will find the same Information in System > Network & Internet > Advanced network settings by clicking on your NIC again.

If you plan on purchasing a new NIC, it is recommended to ask your camera manufacturer which brand he recommends for maximum compatibility. Usually, you will be well deserved with cards that use an Intel chip. Don’t pick a card with fancy WiFi as you won’t be using it. Double-check that your card has a RJ45 output as some higher-end cards will have fiber-optics-compatible connectors which will be more difficult for you to use and will be more expensive anyway. I don’t recommend spending more than $100 on a network card unless you have very specific needs (see below). Don’t buy a card with multiple RJ45 connectors either as we will see later how to handle setup with multiple cameras in a more elegant way.

A typical NIC for desktop computers is shown in Figure 1. It needs to be connected to an empty PCIe slot on your computer motherboard. If you don’t have an empty PCIe slot or if you’re using a laptop, there are USB-based solutions available as well but I don’t have experience with them so I cannot necessarily recommend one in particular.

Figure 1 – a typical NIC card for desktop computers (picture from QNap)

Now that you have a computer that can accept a GigE camera and you have a GigE camera, you will still need two things in order to establish a connection: (1) an ethernet cable, (2) a power supply.

Ethernet cables are probably one of the most overlooked things in an optical setup, but you should be aware that choosing an improper cable can lead to unsatisfactory results such as no connection to the camera or very poor overall performances (dropped frames etc.). Not all cables are equal regarding transfer speed and resilience to noise. I recommend that you use exclusively “Cat6 S/FTP” cables and avoid excessive cables length (above 30 meters). Technically, a Cat5e cable is ok up to 1,000 Mbps (1 Gbps) transfer speed and Cat6 are made to handle up to 10 Gbps. That being said, the price difference between a Cat6 and Cat5e is not that large and you will have more room with the Cat6. Similarly, S/FTP cables are shielded cables with twisted pairs which dramatically improves the reliability in noisy electromagnetic environments. Again, the price difference compared to a non-shielded, non-twisted cable is not that large so sticking to a S/FTP cable will make you safer for a small additional cost. Consider about $20 for a 5 meters Cat6 S/FTP cable and $10 for a 2 meters cable. I don’t recommend cables shorter than 2 meters for cameras because you will be limited very quickly. It is also a good idea to sort your cables by color to quickly find the one you need (e.g. yellow for 2 meters, green for 5 meters etc.).

To power-up your camera you will finally need a source of energy. Here you have the choice between an external power supply or running the camera through Power over Ethernet (PoE) mode if your camera supports it. Although I initially worked a lot with external power supplies, I’m now a big fan of PoE and strongly recommend that you purchase cameras that support this mode of operation. In PoE, the camera is powered up directly through the network cable. Unfortunately, most desktop NIC don’t support PoE (or at very high prices) so you will need either what is called a PoE injector or a PoE-enabled switch. I will come back to PoE-enabled switches later.

A PoE injector, in addition to a classical 110-230V plug, will require two ethernet cables: one input cable to handle the network traffic (typically connected to your computer), and one output cable that connects to the camera and provide both the traffic and the power. You can see PoE injectors as some sort of generic power supplies for PoE-enabled devices like cameras.

Using either a PoE injector or a power supply is up to you and may depend on the circumstances. If you already own a PoE injector for other devices like your Raspberry Pi, it would be a waste of money to buy an extra power supply specific to your camera brand. On the other hand, if you want to setup a closed-box instruments with minimalistic connectivity, it makes sense to have an embedded power supply to power up your complete instrument from only one source – especially if you also need to power up lasers, LEDs etc.

The two modes of operations are shown in Figure 2.

Figure 2 – connecting your first camera to your computer

We’re almost done and only need to configure the camera and computer such that they can talk to each others. A lot of new users struggle here but it’s not very complicated once you know basic IP networking.

All Ethernet devices need an address in order to communicate with others. This includes your computer, your camera, but also your Internet router, your newly connected-fridge, liter-robot, cell phone etc. Most of the time, you don’t have to deal with these addresses manually because your home router assigns them on its own through a protocol known as DHCP (Dynamic Host Configuration Protocol). When connecting a camera to your computer NIC, things are a bit different because none of them have DHCP by default (in some circumstances it’s possible to enable one either on the computer or the camera but this goes beyond the scope of this post and depends on your operating system and camera you are using). As a consequence, we will have to set their addresses manually so that they can talk to each other.

The type of addresses we are talking here are IPv4 addresses. There are other kinds of addresses (IPv6, MAC …), but we will stick our approach to configuring manually the IPv4 addresses of both the computer and the camera. We will also pay attention to assign valid IPv4 addresses to them within authorized IPv4 ranges.

We will start with the computer first.

Go to Settings > Network & Internet and select your NIC. Then go to “IP Assignment” and click on Edit. Choose “Manual”, toggle IPv4 and fill in as indicated below:

Alternatively, if you are running an older version of Windows, you will have to edit your adapter settings using the configuration panel (Configuration > Network and Internet > Network Connections then select your adapter and right-click > Properties):

The IP Address is the address of the host and needs to be unique. In IPv4 norm, it consists of 4 numbers between 0 and 255. The two first numbers describe the class of the network and the last two numbers the specific address of the host on the (local) network. A typical home network will be in the range of 192.168.0.[1-254] and should be avoided if you don’t want to screw up your Internet router configuration. Working in the range 192.168.10.[1-254] is therefore a relatively safe choice to start with. Note that you can’t use the addresses “0” and “255” as these are special addresses required by the IPv4 protocol. A good address for your computer is therefore

The network mask is used by the computer (and the camera – when configured on the camera) to know what belongs to the current network and what doesn’t. Since we would like to isolate everything in our new camera local network from the rest, we set it to This is a bitmask that specifies that everything that belongs to the range 192.168.10.[0-255] belongs to our camera network and everything outside that range doesn’t.

The gateway is an address that is used to redirect traffic when the host tries to reach another device whose IP address is outside of the network range. Typically, when you are browsing on the Internet, you want your router (which in most case have the IP address to handle the traffic leaving your computer and therefore set the gateway address to the router IP address (here, Since we don’t need to have the traffic leaving the local network, you can leave it empty. If your operating system doesn’t allow for an empty gateway field, set it to your computer own address (e.g.

The DNS field plays a role similar to the gateway and is used to convert text addresses (like to an IP address. Since we don’t care about traffic leaving our network, we just don’t set the DNS. Again, if your operating system doesn’t like empty fields, try using which is Google DNS IP address.

The procedure is the same for the camera except we will set the IP address using a camera proprietary tool since cameras are not running under Windows. The procedure will differ from camera brand to camera brand but will usually involve assigning an IP address and a subnet mask at the very least. Some tools can even configure this automatically for you based on the current settings of your NIC. I recommend doing it manually a couple of times to understand how to do it yourself before using the automated tools. You can set the camera IP address to Don’t forget to “upload” these values to the camera by clicking on the proper button in the camera tool window. You may have to dig a little bit in the installation folder of your camera software to find the IP configuration tool as they rarely have a shortcut on the desktop.

For Daheng cameras, the tool GxGigeIPConfig.exe can be found in C:/Program Files/Daheng Imaging/Galaxy SDK/Demo/Win64 after installing the Galaxy SDK. For FLIR camera, configuration is done directly through the SpinView program that you use to view the camera images. Figure 3 shows how to configure an IP address on a Daheng camera using the manufacturer provided tool.

Figure 3 – Configuring the IP address on a Daheng camera

Since both the camera and the computer are on the same network (192.168.10.x with a mask of in the example), they can talk to each other. By launching your camera software you should now see your camera listed and be able to connect to it and livestream images.

The here-above procedure is already enough for most work with GigE cameras. However, in some optical systems, you may need to access several cameras at the same time. And while it’s possible to have multiple NIC or NIC with multiple outputs and many power supplies, there is sometimes a better way to solve this problem.

I previously said that to power up PoE cameras you would need either a PoE injector or a PoE-enabled switch. As we already covered-up PoE injectors, let’s discuss about PoE-enabled switches.

Switches are ethernet devices that allow multiple hosts (cameras, computers, printers etc.) to be connected together without having to multiply the number of NIC in each devices. Each host is connected to the switch via one cable and the purpose of the switch is then to dispatch traffic to the proper host. Here, I will assume that we have one computer and multiple cameras connected to a switch such as shown in Figure 4.

Figure 4 – multiple cameras using a switch

Note that you may be familiar with switches through your Internet router which plays the role of a router, a switch and a modem at the same time. I don’t recommend using your Internet router to connect your cameras to your network but rather have a dedicated switch made to handle the traffic you’re going to generate and keep it isolated from the rest of the network.

PoE-enabled switches are regular switches but whose outputs support powering up PoE devices. There are multiple classes of PoE switches capabilities such as PoE/PoE+/PoE++ depending on how much power they can deliver per port. For cameras, the regular PoE version is enough as cameras don’t use a lot of power.

When choosing your PoE switch, you should be careful about two things: (1) number of PoE ports, and, (2) the total PoE power. Not all switches will deliver power to all of their outputs and the total amount of power that can be delivered by the switch is generally limited.

You will find many brands of switches in different price ranges. I personally work a lot with UniFi products and have multiple PoE switches from them. I’m currently using a US-8-60W  switch (shown in Figure 5) to drive my cameras which supports 8 total RJ45 connection with 4 PoE ports at 48W maximum total power which is plenty enough to drive 4 cameras simultaneously. It is possible to find switches cheaper than this one (the US-8-60W is $100) but they lack some features that I will address later in this post.

Figure 5 – UniFi US-8-60W (picture from UniFi)

If you connect everything such as shown in Figure 4 and try running all the four cameras at the same time, it is likely that you will run into some trouble. Setting even as little as two cameras can be tricky and is more difficult than using only one camera. I’ve seen people extremely frustrated and complaining that camera brand XYZ was shi** because they couldn’t use two cameras at the same time. Truth is, it’s usually a matter of proper configuration and dimensioning of your system.

I will assume that you have setup up all of your cameras through static IPv4 addresses and that each camera has its own unique IP address (e.g.,, and

When accessing all the cameras at the same time, this generates a lot of traffic. Let’s assume that we have 4 Mpx cameras running in 8 bit mode; this means that each camera will generate 4 Mbytes of data at every frame (4 Mpx * 1 byte/px). If the cameras have acquisition frame rates of 10 Hz, it means that each camera generates 4 Mb of data 10 times per second so 40 Mb/sec. Converted in bits, this means that each camera occupies at least 8×40 Mbit/s which is 320 Mbps (mega-bit per seconds). I say at least because the TCP/IP protocol used to convey the information will add some information too (see below).

There are multiple things we need to check here.

First, we need to check if each RJ45 input of the switch can handle the traffic generated by the camera. Here, each camera produces 320 Mbps and each input of the switch is rated for 1,000 Mbps so we don’t have any problem. This is rarely an issue because if the traffic can be handled by the camera output, it’s very likely that the switch will be able to accept it as input. The rare condition where this doesn’t apply is when you’re using a very old switch which doesn’t support GigE speed or when you use a camera that is exceptionally fast, like a 10 GigE camera, with a switch that can’t cope with that speed.

Second, we need to check if the switch logic itself can handle the 4 cameras running at 320 Mbps each for a total of 4×320 Mbps (1,280 Mbps). For that, we need to check the switch datasheet and look for its switching capacity. The US-8-60W has a switching capacity of 16 Gbps so we’re on the safe side here as well. This is also usually not an issue for small, high-quality, switches but can be an issue with cheaper switches or switches with many inputs running at full speed each.

Third, we need to check if the switch output port can handle the traffic generated by all four cameras. Here, the switch ports are limited to 1 Gbps so we’re well above that limit with 1,280 Mbps of data! It is therefore not possible to redirect all the traffic generated by the cameras and things will block with dropped frames, cameras hanging over etc. Assuming that the switch could handle the load (e.g. we have a 2.5 Gbps switch), the computer NIC is itself limited to 1 Gbps so it would then start blocking there.

The only solution here is to dimension your system to handle the output load. That means going for a 2.5 Gbps switch at least with a 2.5 Gbps NIC on the computer. Such switches are, as of 2024, still expensive to buy. Whereas the US-8-60W is $100, an eight-port 2.5 Gbps switch is listed around $500 in the UniFi catalog. And I would not necessarily recommend going for a 2.5 Gbps switch either as you may quickly become limited as well. On the other hand, 10 Gbps switches are even more expensive. For instance, UniFi US-XG-6POE is listed at $600 for 4 PoE++ RJ45 ports and 2 SFP+ ports meaning that the total price tag will go above $700 once you add the SFP+ to RJ45 adapters.

Fortunately, there is an alternative to this problem which consists of decreasing the traffic generated by the cameras. We could either reduce the frame size by doing pixel binning or by using a region of interest (ROI), or we could lower the frame rate of the camera. Dropping the frame rate from 10 Hz to 2.5 Hz or applying a 2×2 binning will reduce the total load by a factor 4 and be well within the range allowed by our switch output port and our NIC. You can also use different settings on each camera depending on which information is more critical for the application. Maybe it’s important to have a high frame-rate on camera 1 and you can live with a small ROI on camera 2 at lower frame rate? This decision depends on what your instrument is doing, and you need to tackle it early into the project to know which switch and what NIC you will need.

That being said, you should also be very careful as you approach the maximum load of your NIC or switch. As I mentioned, the TCP/IP protocol itself generates some traffic and you need to be sure that the total traffic can be handled by both the switch and the computer. At this stage, it is also important to double check the packet size sent by cameras and that your computer supports “jumbo frames”. This ensures optimal usage of the total available bandwidth.

Adding a second computer to your network presents no inherent difficulty – you just need to plug a new cable into the switch and assign an IP address for the new host on the network (e.g.

This works for a few computers/devices as long as you can run cables long enough on your bench. It becomes very quickly unpractical however as you increase the number of co-workers and a more suitable configuration is to have multiple PoE-enabled switches at each bench connected to a master, beefy, switch (known as an aggregation switch) in a star-pattern network. An illustration is given in Figure 5.

Figure 6 – Star network with multiple switches

At this point, you no longer need to have the computer directly next to the optical setup and the processing computer can even be located in another building. The only important thing is to make sure that the network (physical network) can sustain the amount of traffic generated by all the instruments. In such configuration, it is common to have switches that have 1 Gbps ports but support 10 Gbps (or higher) uplink to the aggregation switch. 10 Gbps aggregation switches can be found at affordable prices, around $250 with SFP+ ports. The US-8-60W on the other hand does not support 10 Gbps uplink and you will have to upgrade to something like a USW-Pro-8-PoE if you plan to have important traffic.

As your network starts growing, you may want to have a DHCP server to automatically configure your cameras and computers IPv4 addresses. Just plug-in a DHCP server to the aggregation switch and set all your hosts to DHCP mode, including the cameras. If you enjoy the UniFi brand like me, you can invest in a Dream Machine which combines everything you’ll ever need for your local network (firewall, DHCP and router functionalities) for home and small businesses.

Last but not least, one very handy feature with the switches that I previously presented is that they are managed switches. This means they have an internal server and can be programmed to do more complex things that cheaper switches can’t do. I will focus on one important aspect which is network segregation.

As you plug everything into your switch, you may not necessarily want each device to be able to communicate with the rest of the network. There is no need, for instance, that my cameras have access to the Internet through my router. Similarly, you don’t necessarily want your colleagues to start messing up with the super-ultra-confidential instrument you are working on, not because you don’t trust your colleagues but maybe because it’s a requirement set by the client. Working with different networks and subnet masks can already help in that regard but if your DHCP blindly assign the same IP addresses range to every host it’s not going to work and you will have to do it manually. Subnet is also not inherently safe because it’s very easy to spoof them. That’s where managed switch can help.

It is possible to tell the switch that, for instance, its ports 1, 2, 7 and 8 belongs to one specific network and that ports 3, 4, 5 and 6 belongs to a second specific network. We say that we tagged ports 1, 2, 7 and 8 with a Virtual Local Area Network (VLAN) and ports 3, 4, 5 and 6 with a second VLAN. Only ports within the same VLAN can communicate with each other and it’s not possible to spoof that because its directly handled by the switch itself. Also, you can tell your DreamMachine to assign different DHCP addresses range for each VLAN.

The concept of VLANs however goes beyond the scope of this post but I strongly encourage you to have a look at it as soon as you feel confident in growing your network. I can also recommend you to have a look at what UniFi offers in their online catalog to avoid investing in hardware that will quickly become deprecated (like I did…). Finally, if you would like to have more information on networking, I can recommend the excellent series of videos of NetworkChuck on YouTube in the playlist “Free CCNA 200-301” – it’s through his videos that I started gaining interest in networking in 2021 and transformed my house into a hobbyist’s datacenter dreamland.

I hope this post has been useful for you :) don’t hesitate to share your comments on the [∞] community board to let me know!

I would also like to give a big thanks to Young, Naif, Samuel, Sebastian, James, Lilith, Alex, Stephen, Jesse, Jon, Sivaraman, Cory, Karel, Themulticaster, Tayyab, Marcel, Samy, Kirk, David, Dennis and M who have supported this post through [∞] Patreon. I also take the occasion to invite you to donate through Patreon, even as little as $1. I cannot stress it more, you can really help me to post more content and make more experiments!

[⇈] Top of Page

You may also like:

[»] Choosing the Best Camera Sensor for Spectroscopy

[»] DIY Camera Test Bench Setup

[»] Data Communication With a PIC Using RS232

[»] Building a 5 kHz PIC-based Oscilloscope

[»] The Home-Scientist FAQ