CC Blog Projects Research & Design Hub

Just How Fast Was I Driving, Officer?

Figure 1 Through-hole RGB LEDs are available in common anode and cathode packages. A series resistor for each color sets the maximum current flow and brilliance for each internal LED. Applying pulse width modulation (PWM) to each LED allows for dynamic color mixing.
Written by Jeff Bachiochi

Build a Solar-Powered Radar Detector

Radar is commonly used to detect, locate, track, and recognize distant objects as varied as ships, rain, and even insects. This month, I build a solar-powered, Doppler radar speed detector. I use a Grove 24GHz Doppler radar module, combined with my large-format LED display, to inform drivers in my neighborhood how fast they are going.

  • How can I build a redar detector?
  • What solar-powered devices can I build?
  • How does Doppler radar work?
  • Grove 24GHz Doppler redar module
  • DotStart display
  • POWOXI solar array
  • Arduino MEGA

In the late 1960s, my buddy Jimmy Jensen and I often drove to Bradley Field (now Bradly International Airport) and parked at the end of the runway to watch planes take off and land at night. The strobing guidance and taxiing lights, along with the aircrafts’ headlights, were quite the psychedelic playground. We both had an interest in flying, and decided to check out the terminal building. At that time the control tower was in the terminal building, and accessible via a circular metal stairway clearly marked as “control tower,” with an arrow pointing up the stairs.

This was not a secured area at the time, and we would occasionally see personnel use the stairs. As we were hanging around the bottom, one employee asked if we needed help. We asked what the tower’s purpose was, and got invited up to find out. When we stepped through the doorway at the top of the stairs, our jaws dropped to the floor. We had never seen anything like it before—it looked like everyone was playing Asteroids!

Figure 1
Through-hole RGB LEDs are available in common anode and cathode packages.  A series resistor for each color sets the maximum current flow and brilliance for each internal LED. Applying pulse width modulation (PWM) to each LED allows for dynamic color mixing.
Figure 1
Through-hole RGB LEDs are available in common anode and cathode packages. A series resistor for each color sets the maximum current flow and brilliance for each internal LED. Applying pulse width modulation (PWM) to each LED allows for dynamic color mixing.

The supervisor took us to the panoramic windows to explain the field’s runway makeup, and how it related to the information on the monitors. A radar system high above us sent out electromagnetic waves, and these waves were reflected back by any flying object in the sky. Its position relative to the runway was displayed on the monitor, along with an ID broadcast by each bogie. The monitor showed the IDs and positions of all planes within range of the airport. While each flight has its arrival and departure times, the control tower directs traffic, giving planes instructions on when to approach the runway, land, or take off.

RADAR

The foundations for the development of radar were laid by Heinrich Hertz in 1886, when he discovered that radio waves are reflected by metallic objects. Christian Hülsmeyer carried out the first detection experiments using radar waves in the early 1900s, and developed a device that could measure the transit time of reflected waves, the “telemobiloscope.” He took out a patent for the process and is therefore considered the inventor of radar.

Radar differs from other sensing methods, such as optical and infrared devices, in some important ways, including the detection of far distant objects, and the ability to see in darkness and through clouds and vegetation. During WWII, the rapid development of radar gave the British a decided advantage by alerting them to an incoming attack, when Nazi planes were still 100 miles out from reaching the coast of England. This allowed citizens to reach shelters, and the military to scramble fighters to meet the enemy head on. The fact that inclement weather also reflected radar waves caused some difficulties when looking for the enemy, but it also led to the use of radar in weather forecasting (Figure 2). You are probably familiar with the phrase “Doppler radar” in weather reporting.

Figure 2 
Weather reporting has become big business and high tech. We see local weather patterns thanks to Doppler radar and country-wide weather movements from satellite images [2].
Figure 2
Weather reporting has become big business and high tech. We see local weather patterns thanks to Doppler radar and country-wide weather movements from satellite images [2].
PULSED VS. DOPPLER RADAR

Pulsed radar transmits a short radio pulse (multiple cycles in the gigahertz range) using very high pulse power. A directional antenna forces the wave into a narrow cone at the speed of light. An object such as a plane will reflect some of the wave back toward the antenna. The time of flight (TOF) between sending the pulse and seeing a reflection represents twice the distance (d) to the reflected object. So the round trip distance of the wave is 2 x d = c x TOF, where c is the speed of light. This is similar to an ultrasonic sensor that uses the speed of sound. TOF is then an indication of distance between the source and target.

Doppler radar is a bit different. We are not interested in the distance to the object, but rather the speed at which the object is moving toward or away from the radar. Here the radar frequency is transmitted continuously, and the frequency of the reflected signal is compared to the original. If the object is motionless (not moving toward or away), the frequency is constant. If it’s moving, the frequency changes, based on how fast it is approaching or going away.

— ADVERTISMENT—

Advertise Here

This shift in frequency is known as the “Doppler shift.” It is a change in the reflected frequency due to the target compressing the frequency when moving toward the radar source, or expanding it when moving away. The amount of frequency change, or Doppler shift, when the target is directly approaching the radar is calculated by the following formula:

fD = (2 x v) / λ

Here, fD is the Doppler shift in frequency, vt is the velocity of the target, and λ is the wavelength. Now let’s consider the following example with a transmitted 24GHz signal:

Let vt = 1m/s (2.24mph)

λ = 0.01249135m

fD = (2 x 1m/s) / 0.01249135m

fD = 160/s = 160Hz

When the target is approaching the radar at 2.24mph, the received signal will be 160Hz higher than the transmitted 24GHz signal. Note that the Doppler shift will be negative when the object is moving away from the radar, and positive when moving toward the radar.

— ADVERTISMENT—

Advertise Here

This month’s project is a solar-powered speed detector that uses the Grove 24GHz Doppler radar module and a large-format LED display. The device measures and displays the speed of oncoming moving objects—mainly motor vehicles, but also bicycles and even pedestrians.

INFINEON BGT24LTR11 RADAR CHIP SET

The Grove 24GHz Doppler radar module is based on Infineon’s BGT24LTR11 radar transceiver chip set (Figure 3). Although it has the ability to turn the transmitter ON/OFF, it is used here to reduce power consumption and not to determine distance. It is certainly possible to obtain distance, but it is not being used for this purpose in my project.

The BGT24LTR11 produces two output signals. As their names suggest, the intermediate filter in-phase (IFI) is an in-phase sample of the base-band signal, and the intermediate filter quadrature (IFQ) is a quadrature sample of the received signal. Infineon’s XMC4700, an ARM M4 32-bit microcontroller (MCU), handles the processing of these samples, and also enables the transmitter and analog amplifier chain. The analog amplifier chain provides sample/hold and gain/filter for the IFI and IFQ signals, as shown in Figure 4.

Figure 3 
Block diagram of the Infineon BGT24LTR11, a 24GHz transceiver front end for speed and motion detection. It provides two output signals, IFI and IFQ. The reflected signal IFQ is 90 degrees out of phase with the transmitted signal IFI (24GHz). The phase will change if the reflected signal is altered by a moving target [3].
Figure 3
Block diagram of the Infineon BGT24LTR11, a 24GHz transceiver front end for speed and motion detection. It provides two output signals, IFI and IFQ. The reflected signal IFQ is 90 degrees out of phase with the transmitted signal IFI (24GHz). The phase will change if the reflected signal is altered by a moving target [3].
Figure 4 
To reduce the module's average operating current, the transmitter is turned on and off. A sample and hold circuit holds the signal constant while the transmitter is off, and the low noise amplifier boosts the signal for the analog inputs of the microcontroller [4].
Figure 4
To reduce the module’s average operating current, the transmitter is turned on and off. A sample and hold circuit holds the signal constant while the transmitter is off, and the low noise amplifier boosts the signal for the analog inputs of the microcontroller [4].

The MCU does all the signal processing from sampling these signals. Since the IFI transmitted frequency and the IFQ received frequency signals are 90º out of phase, this measurement represents no target movement. As stated earlier, the relation of the two inputs will change as a target moves closer or farther away as stated earlier. Phase and magnitude are calculated by the internal fast Fourier transform (FFT).

We have access to three variables that will be used by the FFT. The FFT will set its output “bins” between the two extremes of maximum and minimum speed detection values in cm/s (0x0000:0xFFFF). The third variable is the trigger threshold (0x00000000:0xFFFFFFFF). This value must be exceeded before a “good” detection is proclaimed. Let’s take a look at the control we have over the Grove 24GHz Doppler radar module.

UART CONTROL

The module uses the standard Grove 4-pin connector. As is standard with this connection scheme, two connections are Power and Ground, and two connections are I/O. The I/O must be configured correctly, according to each different module—in this case, TX and RX for the Grove radar module. The protocol is one of the simplest I’ve ever used. Each transaction begins with an address sequence: 0x55 0x2A for Commands to the module, and 0x55 0xA2 for Responses from the module. This is followed by a 1-byte Command and a 2-byte count of the remaining bytes, which always includes a 2-byte checksum. So the shortest Command will consist of seven bytes. The checksum is merely the total of all bytes preceding the checksum. All eight Commands/Responses are given in Table 1.

Note here that 0xC2 is only a Response from the module and has no 0xC2 Command. This Response can be one of two types, depending on the 0xC5 and 0xC6 Commands. These Commands allow the user to set and query the working mode (see Table 2).

Table 1
These are the eight commands needed to interact with the BGT24LTR11.
Table 1
These are the eight commands needed to interact with the BGT24LTR11.
Table 2
The response to command C1 will be a simple indication of target activity.
Table 2
The response to command C1 will be a simple indication of target activity.

When the working mode is 0, reports will be of the 0xC1 variety—a word detection distance in cm/s and a 1-byte flag that describes the detection. When the working mode is 1, reports will be of the 0xC2 type—a list of 1,024 sampled IFI Data and IFQ Data word values. This data can be used with your own routines to determine one or multiple targets. It is beyond the scope of this column, but if FFT analysis is your thing, I invite you to go deeper into it with this data. Since we will be depending on the internal FFT algorithms, the working mode will remain 0.

Commands 0xC3 and 0xC4 allow the user to set and query the speed detection range, by defining the minimum and maximum speeds (in cm/s). These values are used by the FFT to define the boundaries of algorithm and the significance of its output bins. These bins contain magnitude and frequency information derived from the I and Q Data.

Commands 0xC7 and 0xC8 allow the user to set and query the trigger threshold, which is the value above which a bin’s magnitude is considered relevant.

You can get the detection information any time, using Command 0xC1; however, the module will report each time it completes an analysis. You’ll probably want to convert cm/s to mph or kph so the output is more relevant. Use the routines in Listing 1 for conversion.

Listing 1
The application gives us a velocity in cm/s , but I'd like to displace this in MPH and KPH.  Here are a few conversion functions.

float Value;
int cms;
int MPH;
int KPH;

Value = cms/44.704;		// converts int cm/s to int MPH
MPH = int(Value);

Value = MPH * 44.704;	// converts int MPH to int cm/s
cms = int(Value);

Value = cms/27.778;		// converts int cm/s to int KPH
KPH = int(Value);

Value = cms * 27.778;	// converts int KPH to int cm/s
cms = int(alue);
EXPLORATION

The first program presented allows the user to explore the Grove 24GHz Doppler radar module by using a menu of Commands and allowing the user to set or query the various possibilities. To do this, I chose to show the information in a formatted screen presentation. Note that Grove supplies a library for this module, but I wrote this application without using it, so you can better understand how communications with the module work. You are invited to explore the library on your own.

Refer to Figure 5 to get the gist of my application. After setup, the main loop handles display of the main menu, choosing an item from the menu, and executing the routine associated with that item. For instance, Command 0xC3, “Set the Speed Detection Range,” builds the Command byte into the commandArray[] and then sends the array’s bytes out the second serial port (hardware, if it is available, or software, if there is only one hardware UART port). The serial event function checks for serial input from that port, and if it finds a response string via captureResponse() it will display the data in one of two formats. If the response is 0xC1, then the response is Speed and Direction, else it must be I and Q data. I and Q data won’t fit on the main screen with the normal Command and Response data, so it gets its own screen and waits for you to hit a key to continue before the data goes away. This way you have a chance to copy it, if you like.

Figure 6 shows what the normal screen looks like. It uses the control characters for Parallax’s serial terminal (0, 1, 11, 13, 14, & 15), to display formatted data without scrolling the screen.

Figure 5 
The flow chart shows how the application handles communications between the Arduino and the radar module. There are only eight Commands. All communication uses a single UART port.
Figure 5
The flow chart shows how the application handles communications between the Arduino and the radar module. There are only eight Commands. All communication uses a single UART port.
Figure 6
This is the formatted screen, with all communication displayed on the top left. The menu is shown at the bottom. The module will automatically report its status, which is shown in the center.
Figure 6
This is the formatted screen, with all communication displayed on the top left. The menu is shown at the bottom. The module will automatically report its status, which is shown in the center.

I often use debug flags with my print statements to allow the user to turn off and on different kinds of debugging info. Although this variable could be dynamic, changed through user input, most of the time I just set it before compiling. You’ll note that the 0xC1 response presented on the left in Figure 5 is via Command 0xC1. Also, the module makes periodic 0xC1 responses when the working mode = 0, and sampled data has been analyzed. In this case, I present this in the center. Both include speed information, which I display in both kph and mph.

— ADVERTISMENT—

Advertise Here

COMBINING

Now that the application can make use of the Grove 24GHz Doppler radar module, let’s remove the fluff from this application—all the user choices, and display data routines. I’ll add in some code from last month’s “From the Bench” column, to make use of the large-format, seven-segment display I built, using DotStar addressable RGB LEDs (“Rainbow LEDs,” Circuit Cellar #388, November, 2022) [1]. Then, after adding the code, this radar module will be packaged with the large-digit display, to inform drivers in my neighborhood how fast they are driving.

Very little code is needed to use this module. The user parameters are fixed to the best fit for this application, and the module is initialized with those parameters. There is no need to communicate any longer with the radar module, since it will continue reporting what it finds.

You can expect the radar module, the (idle) DotStar display, and the Arduino MEGA (which I’m using for this project) to average about 150mA. When all the DotStar LEDs are lit up (white), the current goes up to 500mA. To run this for a day, the minimum requirement is 150mA x 24 = 3.6A-h with the LEDs OFF and 12A-h with them ON. I have a rechargeable 6V gel cell battery capable of 7.2A-h. It can run a couple of days with the LEDs OFF, but what fun is that? Let’s say that 100 cars a day pass by. Each time a car (or a pedestrian) is in the field of view, the display alternates between the “posted limit” in WHITE LEDs, and the “actual speed” in GREEN LEDs if it’s equal to or lower than the posted limit, or RED LEDs if it’s greater than the posted limit. These are ON for about five seconds. Five seconds x 100 is 500 seconds (8.33 minutes) or about 0.006 days. With a maximum requirement of 12A/day, that’s 12 x .006 or about 70mA/day. So you can see that the project should still run for almost two days (2 x 3.4A), periodically lighting up the display for each of the 100 cars. I’ll need to collect about 4A-h a day from a small solar array, to keep the battery from fully discharging.

PACKAGING

I wanted to put all of this in a nice package. Some really nice windowed enclosures are available for $200-$300. Since that’s more than my whole budget for this project, I opted for something a bit less expensive. What I needed was something like a shadow box. I found one at Michaels, a craft supply store. It was a Black Extra Deep Shadow Box, 10” x 10” on sale for $26.24 [5]. It’s one of the few boxes that has more than 3” of room behind the glass, and I needed some room for circuitry and a large battery.

I thought I might have to purchase some opaque material to replace the glass, so the LEDs would be visible only when lit, but I found that a single sheet of paper hid everything well, acted as a diffuser, and let the LEDs shine through nicely. I mounted the digits on a piece of foam core, and slid it all the way up against the glass (Figure 7). I used a few strips of wood to hold the foam core firmly inside the box.

The circuitry is mounted on a piece of 1/4” masonite, with the Arduino stack on one side and the radar module on the other side. The radar module is mounted up against the front glass. Radar will penetrate most non-metallic surfaces. To mount the enclosure to a sign post, I used two black L brackets secured to the center of the top and bottom with a single 1/4-20 thumbscrew. Four-pronged T-nuts inserted from the inside of the enclosure (Figure 8) secure the thumbscrews and allow the enclosure to pivot left and right approximately ±30º. The brackets hold the enclosure firmly to a standard U-channel sign post.

FigurE 7 
The digits I put together last month are mounted on a piece of foam core that is placed up against the glass front of the shadow box. A single sheet of copier paper will provide a translucent cover over the digits. The sign displays the speed limit until it registers a moving target. The target's speed is displayed in green if it's at or below the speed limit, and red if it's above the speed limit.
Figure 7 The digits I put together last month are mounted on a piece of foam core that is placed up against the glass front of the shadow box. A single sheet of copier paper will provide a translucent cover over the digits. The sign displays the speed limit until it registers a moving target. The target’s speed is displayed in green if it’s at or below the speed limit, and red if it’s above the speed limit.
FigurE 8 
T-nuts are great for creating a threaded capture in wood. They remain embedded, so you don't have to fumble with a loose nut.
Figure 8 T-nuts are great for creating a threaded capture in wood. They remain embedded, so you don’t have to fumble with a loose nut.

The solar panel (POWOXI) is an adjustable, waterproof, 6W panel, with a built-in intelligent charging controller [6]. This is a nice 9” x 6” array in a water-tight plastic frame, complete with mounting bracket. The mounting bracket is adjustable in elevation only, but since it came with a plastic stake for mounting in the ground, I was able to cut the stake and mount it to the top of the enclosure, such that the panel’s bracket fits over the stub. This allows the whole panel to rotate on the stub and pivot up and down. I wanted to be able to zero this in on the sun’s arc across the sky. Trees will hinder it in the early morning and late afternoon, but I expected to get several sun-filled hours every cloudless day.

CONCLUSION

The device is now mounted along the road in front of my house. I’m close to the public boat launch here at Crystal Lake, so while it’s rather quiet during the week, it gets pretty crazy on the weekends. The posted speed limit is 20mph. The first capture of 3mph was of me walking up to the radar to adjust it on the post (Figure 9). Just as I finished the adjustments, a cyclist flew by at 13mph. From this encounter, I don’t think anyone will be driving 20mph past my house. I guess we’ll see, and so will some pretty surprised drivers.

FigurE 9 
I happen to have a "no parking" sign along the road that borders my yard. It is a perfect place to mount this project. The solar panel has a clear view of the sun for most of the day.
Figure 9 I happen to have a “no parking” sign along the road that borders my yard. It is a perfect place to mount this project. The solar panel has a clear view of the sun for most of the day.

I’ve already started thinking about improvements. The MEGA isn’t exactly the lowest-power device. It would be nice to log power and speed info to my MQTT server. Oh, and capturing a photo of flagrant violators would be…eh, wait, let’s not get into that trap! 

REFERENCES
[1] Jeff Bachiochi, “Rainbow LEDs.” Circuit Cellar 388, November, 2022.
[2] Application of C-band Doppler Weather Radar (CDR) for Detecting Volcanic Ash Dispersion of Sinabung Eruption – Scientific Figure on ResearchGate. Available from: https://www.researchgate.net/figure/Cartoons-from-the-Doppler-weather-radar-the-distance-to-the-location-of-the-rain-is_fig1_333611911
[3] https://www.infineon.com/cms/en/search.html#!term=AN472&view=downloads
[4] https://www.infineon.com/cms/en/search.html#!term=AN597&view=downloads
[5] Shadow box: –
https://www.michaels.com/black-extra-deep-shadowbox-10×10-studio-decor/10229048.html
[6] Solar panel: –
www.powoxi.com
https://www.powoxi.com/products/6w-solar-charger-6v#

RESOURCES
arduino | www.arduino.com
infenion | www.infenion.com

Code and Supporting Files

PUBLISHED IN CIRCUIT CELLAR MAGAZINE • DECEMBER 2022 #389 – Get a PDF of the issue

Keep up-to-date with our FREE Weekly Newsletter!

Don't miss out on upcoming issues of Circuit Cellar.


Note: We’ve made the Dec 2022 issue of Circuit Cellar available as a free sample issue. In it, you’ll find a rich variety of the kinds of articles and information that exemplify a typical issue of the current magazine.

Would you like to write for Circuit Cellar? We are always accepting articles/posts from the technical community. Get in touch with us and let's discuss your ideas.

Sponsor this Article
Website | + posts

Jeff Bachiochi (pronounced BAH-key-AH-key) has been writing for Circuit Cellar since 1988. His background includes product design and manufacturing. You can reach him at: jeff.bachiochi@imaginethatnow.com or at: www.imaginethatnow.com.

Supporting Companies

Upcoming Events


Copyright © KCK Media Corp.
All Rights Reserved

Copyright © 2024 KCK Media Corp.

Just How Fast Was I Driving, Officer?

by Jeff Bachiochi time to read: 15 min