Photo Speed Radar – Description of Hardware
This is the second of four parts describing this project. Why this project was developed and what it does is found in part one, Overview. This part will describe the hardware in reasonable detail. Particular attention to detail is given to the “hack” of the Bushnell Speedster Radar Gun and how it works. This information will permit whoever wishes to do the same thing.
Pi 3 Model B and Camera Complete Assembly
Pi Camera with Telephoto Lens
This project called for a telephoto lens, so what was available was a pi camera with a CS mounted adjustable lens, the specifications of which are below.
The existing lens was swapped out with a telephoto zoom lens that was considerably low in cost but high in quality. This particular lens has the CS mount need to mount on the pi cam sensor board above.
Pi 3 Model B and Camera Complete Assembly
The next piece is the core of this project. What is shown next is the Pi 3 and camera assembly mounted to a sturdy base. It is not apparent in the picture but the Pi 3 plastic case is also held to the base with screws. The camera mounting structure is particularly rigid and sturdy to support the somewhat heavy lens.
Note that the camera board is actually mounted upside down so that it is not needed to twist the CSI flat ribbon cable. Image inversion is handled in the software.
The Radar Gun in Detail
First let us look at the disassembly. The unit shown here was an old unit that was used for a number of years. In particular take note of all of the screws that need to be removed.
The entire assembly is composed of a split case. The side with the screws is removed exposing everything. (First remove the battery retain cover at the bottom of the handle.) The heart of this unit is the Gunn diode assembly and the metal horn antenna. To the rear of the unit is all of the circuitry.
Next is shown the LCD display, which is mounted to the main circuit board.
The main board is easily removed, exposing the Gunn diode assembly attached to the horn antenna. The circuit board integrated with the Gunn diode contains some pre-amplification of the output signal as well as a boost power supply to convert the battery voltage to the 5 volts DC that the diode requires.
A close up of the pre-amp board shows the three terminals of the Gunn diode: 5 volts, ground, and output U1. U1 is the output of the mixer diode. The Gunn diode component is actually a somewhat simple device. The Gunn diode oscillates in the cavity the size of which determines the resonant frequency (24 GHz), and the mixer diode generates a signal that is the difference between the resonant frequency and frequency of the wave reflected back to horn antenna.
Now the main board is examined. The amplified diode mixer signal, which is the doppler frequency, connects to AUD (audio) on the main board. This signal is connected to a comparator that in turn converts the signal to a rectangular wave and is available at COMP. The rectangular wave signal then routes to an input on the TI processor which then computes everything and displays the results.
The comparator detail is shown here.
Signals
This next image shows both the AUD and COMP outputs when no doppler signal is present. The AUD signal has a few tenths of a volt ripple riding on 1.7 DC volts. The ripple produces a somewhat random COMP output of rectangular pulses pk-pk=3.38 V. There is a 1.7 VDC bias on the POS input of the comparator and the positive peaks of the ripple are sometimes large enough to drive the COMP output low, thus creating a pulse. These pulses are not welcome in that they must be ignored and distinguished from doppler pulses or their presence eliminated.
In this next image a not-too-strong doppler signal is present, typical of a vehicle in the beam but at a far distance. Note that the COMP output becomes quite distinct and uniform and its frequency, which appears constant, can be measured easily.
Here is what a strong doppler signal looks like. The AUD output saturates and the COMP output presents a signal the period of which can be easily measured.
Now looking at the big picture the next image shows the AUD output with a time base of 200 milliseconds per division of a car coming down the street and passing. The signal rises and saturates and finally decays. The duration of the signal, the time the car remains in the beam, is typically between 300 and 600 milliseconds.
Dealing With the Ripple
As described earlier the ripple is problematic since it produces COMP output pulses with no doppler signal present. Although this output is fed directly to the TI processor the processor somehow distinguishes these ripple pulses from the doppler pulses. Attempts to do this algorithmically in the executable running on the RPi 3 did not succeed. So a different path was taken. A straight-forward solution was implemented with an auxiliary circuit consisting of an op amp comparator with an adjustable reference level so that the DC level with ripple was cut off after properly adjusting the reference. Its output then consisted only of pulses generated by doppler signals.
The circuit schematic above shows the use of a Micrel 7101, but any low voltage op amp comparator can be used. The AUD signal with the ripple riding on 1.7 VDC is connected to Vin+ while the adjustable reference derived from a 5K pot is connected to Vin-. The reference is then adjusted enough greater than the 1.7 VDC plus ripple so that Vout has no output pulses. On the unit that was built once this adjustment was made it has remained effective now for over a year of use. Note that the three inputs, Ground, AUD, and +3.3 V all are taken from the radar gun. Ground_out and counts_out go to the RPi 3 breakout board.
Power Supply for Radar Gun
Two C cell batteries nominally provide about 3.2 volts DC. This power source was replaced with a 5 volt wall charger that has its output routed through a 5 volt to 3.3 volt converter. The converter is incredibly simple, consisting of two components on a circuit board.
The comparator and the converter are shown in this photo.
Theory and Measurements
So the questions remain: how do the doppler frequencies relate to vehicle speed and does this really work? With the aid of a digital oscilloscope (DSO), the radar gun pointed at passing cars, and a pair of tuning forks, measurements were made and compared to theory.
First, a little bit of theory. One can start with the relativistic equations for frequency shift but will quickly find that they simplify to:
∆f = 2 * f * v/c
where f is the radar frequency of 24 GHz, v is the velocity of the vehicle, and c is the velocity of light (=186,282 MPH per second). The factor of two arises because the car first sees a doppler frequency shift incoming, and once the wave bounces off the car which is moving, the radar gun sees the same amount of doppler shift added to the first shift.
The DSO does a nice job of accurately measuring the average period of a train of rectangular waveforms and it was used to plot the period of passing cars versus the reading on the radar gun. Additionally, for calibration two different tuning forks were used that represented 15 MPH and 35 MPH. The results are shown is the graph below where the smooth line is the theoretically predicted period versus speed.
One can see that the two calibration points lie almost exactly on the theoretical line and all but one of the passing car points lie on or very close to the line. The one discrepant point remains unexplained but is clearly a disagreement between the DSO and the TI processor in the radar gun. These results show that the RPi 3 must now measure the period of the incoming pulses as well as the DSO does and apply a multiplication factor to come up with speed.
Conclusions
The Raspberry Pi 3 with camera assembly and the Bushnell radar gun has been described in enough detail that one can use this information to fashion a similar system. The radar gun description is particularly detailed showing how it works and where one obtains the signal(s) needed to feed to the RPi 3. Furthermore, it has been shown how to deliver purely doppler pulses devoid of any artifact such as ripple at the inputs. Finally, the theory of the doppler shift has been shown to align very well with actual measurements. The third part of this four-part series deals with a description of the code executing on the RPi 3.