Building a low cost multispectral camera

Multispectral imaging is a sensing technique where a spectrum is obtained for all of the points in an image, allowing the user to detect signatures across different parts of the spectrum. In agriculture, this information gives a good insight to the level of crop stress. Multispectral cameras mounted on drones or aircraft allows for quick assessments to be performed for yields across large areas of farmland, making it possible for targeted use of fertilisers, pesticides and irrigation.

Professional multispectral cameras will typically cost £5000, however excellent imaging for plants can be achieved using Pi cameras co-ordinated with a Raspberry Pi computer. The basis for this is that the R channel for a NoIR camera with a blue filter will be in the NIR range, while a standard RGB camera (with an internal RGB cut off filter) will be able to capture red band information.

Camera/filter holder

The holder for the NoIR/RGB cameras, the Raspberry Pi and the camera multiplexer are mounted in the laser cut enclosure shown above. The design starts from one design by Koen Hufkens, with modifications to hold the Pi Cams flush against the surface, and allow them to be mounted using M2 screws. There are ports for USB power and ethernet to control the Pi.

Camera multiplexer

To allow the Pi to switch between capturing images from two different cameras, a IVMech IVPort V2 camera multiplexer is mounted on the Pi, this is the highest cost component in the system.

Processing software

Calculating the NDVI from the RGB and NIR images was done in a Python script, which used OpenCV to load the images, isolate the R channel, account for parallax errors due to the shift in camera positions, and take a normalized difference value.


NDVI results in Cambridge

The results are in broad agreement with that found in literature, with high value of 0.7-0.8 for green foliage, and low magnitude values for other areas of the scene. Objects closer to the camera (such as the bin in the bottom left corner above) show an edge effect due to the imperfect correction for parallax error.

Further improvement

To make this into a commercial system, there are the following considerations:

  • Calibration: the response of each camera to the relevant bands: NIR and visible red, need to be measured and accounted for in the calculations for NDVI
  • The system costs £120 to build, far less than that needed for a commercial model, however this is offset by the need to mount it on a drone.
  • For low cost applications, it could be possible to mount the system from a pole of a fixed height: this will allow a large area to be photographed, and also means the parallax error will be known in advance.

Building this multispectral camera was the focus at a workshop I ran at the Cambridge Makespace, one team cleverly used two Raspberry Pi’s to co-ordinate the two cameras; and synchronize between them using I/O interrupts. This reduces the cost by £30.

Hard at work

Sun controlled valve for Majico

Majico are a startup in Cambridge who are using a photocatalyst to purify water in developing countries. Their system aims to remove bacteria and heavy metals, and functions without electricity.

Serpentine track for water flow, with photocatalyst beneath it.

The task before the team went out to Tanzania in November, was to bring up a system which shuts off the flow of water should be shut off when there isn’t much radiation. This consists of a light sensor which sends data to an Arduino micro via I2C, the Arduino then sends the control signals to a solenoid valve. The valve is either on or off, so it is modulated using the width of the ‘On’ signal.

A gate driver was originally used to convert the control signals into driving signals for the valve. However the module showed a lot of ringing, was expensive and required several interface signals to control. The design was simplified by replacing this with a N-MOSFET with a flyback diode across the inductive valve.

In Tanzania, the design was able to successively modulate the flow of water. A more fundamental problem is the power requirement: maintaining the solenoid valve in its on position requires 5W of power. To generate this reliably in the evenings and cloudy conditions calls for a 25W solar panel. Besides the expense, it also seems a much more power-efficient solution can be found – which only requires power to switch, rather to maintain its position. One possibility is a servo motor which rotates a blocking element.

Wireless charging for E-Bikes

Electric bikes are growing in popularity around the world – especially in China, and given their high price there’s the potential for public rental schemes to be set up. For a public docking station having wireless charging could be beneficial: charging ports are no longer exposed to the outside, and there could be benefits for safety for 72V stations.

As with all forms of wireless charging, the main issue was in making the efficiency comparable to using plain simple wires. The focus for this project was on improving the efficiency of power transfer at a distance of 5-10cm, an area which may be useful in other appliances – e.g. laptops.


The general approach was using resonance by incorporating capacitance into the circuit. With a transmitter and receiver side, as well as the possibilities of both series and parallel compensation, there two main topologies to consider: series – series (SS), series – parallel (SP).

Test setup: L-R: mBed micro for generating PWM, transmitter H bridge, coupled induction cooker coils, receiver bridge rectifier

In all of the circuits, a square wave or PWM generator is required. In order to test and compare the efficiency of different topologies without duplicating the circuit, it was decided to design and build a custom high frequency inverter with the following specification:

  • Voltage rating: 50V
  • Current rating: 10A
  • Upper frequency limit: 1MHz square wave
  • Capable of generating sinusoidal PWM
  • Adjustable output frequency
  • Feedback system for automated frequency control.


Power efficiency vs frequency for S-P topology
High power testing results for the S-P layout, a maximum efficiency of 78.7% is achieved with 4cm separation between the coils.

The efficiency vs frequency curves were in good agreement with those predicted in AC analysis in LTSPICE. The efficiency is close to zero far away from resonance – the impedance is large and mostly imaginary at these frequencies. This explains the agreement in results even though the SPICE simulations assumed a sinusoidal input, when a square wave was used.

The two main differences between the S-S and S-P layouts are the larger ‘bandwidth’ for the S-P circuit, and its higher efficiency at lower coupling constants. These factors mean the S-P circuit would be the better choice for a real charging system: it is less susceptible to errors from component tolerances and shifts in the bicycle position.

The improvement in the coupling factor is the main mechanism for the improvement of power transfer efficiency – as the graphs in the next section show.


The V-I waveforms (driving voltage in yellow, input current in blue) are for the resonant, sub-resonant and over-resonant switching cases. It is only in the resonant case that there is power being delivered to the receiver circuit. In the sub-resonant case the switching triggers oscillations at the natural frequency, while the over-resonant case is in effect driving an inductive load.

Imaginary component of S-P circuit as a function of frequency

By definition the power factor is one when the imaginary component is zero; the above shows this component as a function of frequency for the S-P circuit. The frequency at which they cross the x axis corresponds well with the frequency at which maximum efficiency is observed, while the flattened shape of the curves for the 680nF and 340nF explains the large bandwidth seen in the efficiency vs frequency curves.


The MOSFETS were chosen to be the FDMS86101A because of their high current limit, low drain-source resistance and fast switching speed, and were driven from a HIP4081 IC along with bootstrap circuitry. The control signals were sent using an mBed platform, as this was connected via USB to a laptop, it was optically isolated from the higher power side using an optocoupler.

Post 0

Thanks for joining me!

I’m an electronics engineer graduate from the University of Cambridge, with two years of professional experience in embedded systems and FPGA/ASIC design. This is going to be a blog of some of the projects I’ve done, and thoughts on tech and sustainable development.

My main interest is in how the rapid advances we’ve had in electronics and software can be applied to challenges in resource scarcity. As the population continues to grow and people aspire to the living standards of the developed world, the fundamental challenge is providing energy, food and water affordably and sustainably.

Both of these requirements must be met. It’s a tall order and new technology won’t be the full picture by any means, but it’ll give policy makers and markets far more room to manoeuvre.

Plus, engineering’s at its most fun when the requirements are tough.