Difficulty level radar traffic monitor

Hi all,

I use arduino a few times a year. I'm not an expert, but with a lot of help of the internet I eventually make stuff work. The majority of the code is copy/paste, and modifying it. Designing code is not my standard yet. I've done a whole range of example projects, and did some simple projects around the house.

There's this road in front of my house, which is 30 km/h, and handles around 60 cars an hour during regular days. But, when the highway 800 metres away gets clogged in the morning and afternoon, the amount of cars passing by on 'my' quite street explodes, which traffic cues, racing (up to 70km/h), dangerous situation and irritation as a result.

I would like to do something about this, but the city council isn't really helpfull so far. I therefore want to aquire data to convince them to take action.

I would like to split the project in two phases:

#1 Measuring / logging traffic speed and intensity, without any display.

#2 Turning the measurements into a indicator sign, which shows the current speed, followed by a happy / sad smiley. These signs can be found across europe, for example see HERE

For phase #1 I dont want to use rubber hose counters, because attaching something to the road might get me in trouble. I therefore would like to look at doppler radars, with a range up to around 30m. I've came across some projects using a HB100. Example videos HERE and Here

Before I start with this, I would like to know what the difficulty level of such a project is, and If I should try to make it work, or don't even start. I would like to avoid investing many hours on a project that won't ever work.

Is my fairly limited knowledge of code designing reason not to start with such a project?
Will copy / pasting and tweaking existing code get me there, or does it requires a huge amount of designing?

If you have any suggestions on the difficulty level or even on the best way to approach this, please share your thoughts.

I have one more questions. What is the differnce in the HB100 module from Tindle and the ones from ebay / AE ? Is the Tindle one more complete or something, or is it just a genuide higher quality piece compared to the cheapers chinese ones?

Thank you in advance!

the $25 module is a HB100 with a signal conditioning circuit piggy-backed. saves a lot of effort putting together a subsystem to offset and amplify the output of the HB100 to a level the arduino can use. after that hurdle, coding to build a radar gun is fairly simple.

I’ve bought the unit, and attached it to my Arduino Uno.

  • VCC to +5v
  • GND to GND
  • Fout to Digital pin 4
  • Vout to Analog pin A0

I’ve uploaded the sample code from Limpkin’s website I didn’t change anything.


// Below: pin number for FOUT
#define PIN_NUMBER 4
// Below: number of samples for averaging
#define AVERAGE 4
// Below: define to use serial output with python script
unsigned int doppler_div = 19;
unsigned int samples[AVERAGE];
unsigned int x;

void setup() {

void loop() {
  pulseIn(PIN_NUMBER, HIGH);
  unsigned int pulse_length = 0;
  for (x = 0; x < AVERAGE; x++)
    pulse_length = pulseIn(PIN_NUMBER, HIGH); 
    pulse_length += pulseIn(PIN_NUMBER, LOW);    
    samples[x] =  pulse_length;

  // Check for consistency
  bool samples_ok = true;
  unsigned int nbPulsesTime = samples[0];
  for (x = 1; x < AVERAGE; x++)
    nbPulsesTime += samples[x];
    if ((samples[x] > samples[0] * 2) || (samples[x] < samples[0] / 2))
      samples_ok = false;

  if (samples_ok)
    unsigned int Ttime = nbPulsesTime / AVERAGE;
    unsigned int Freq = 1000000 / Ttime;

    #ifdef PYTHON_OUTPUT
      Serial.print("Hz : ");
    #ifndef PYTHON_OUTPUT

I’ve changed the serial monitor to 115200 baud, but the behaviour/output differs from what I would expect.

When there is no motion in front of the sensor, every few seconds a dot wil appear in the monitor on the same timestamp line: “21:09:30.334 → …” (this was the result of about 10 seconds without motion)

If motion is detected very shortly, it wil output some data, but VERY slowly. It will first print the number of Hz, followed by “Hz” followed by 6… km… / h.
“1:10:59.579 → 107Hz : 5km/h” Is fully printed in about 15 seconds.

But, when I activily keep moving in front of the sensor, it print’s much much faster.

21:13:09.678 → 79Hz : 4km/h
21:13:11.831 → …
21:13:11.831 → 85Hz : 4km/h
21:13:12.546 → …
21:13:13.981 → 63Hz : 3km/h
21:13:14.255 →
21:13:14.528 → 94Hz : 4km/h

Sometimes when there is no motion, it keeps printing:
21:13:06.211 → 65535Hz : 3449km/h every few seconds.

I am kind of thinking that there is something wrong with the serial monitor, but that cant be the cause of the weird readings.

I admit that I dont fully understand the code (yet), but does anyone know what I can do to get a good reading out of it?

Thank you in advance!

The .... will appear if the consistency check fails (apparently indicating bad/inconsistent data).

The slow printing of the .... probably is due to the fact that pulseIn has a one-second timeout and you're doing nine pulseIns per loop. If they all time out, then there will be about nine seconds delay per dot.

If you study that website and datasheet, you may be able to come up with a more reasonable timeout than the default one-second delay. Or you could ask the developer.

Designing code is not my standard yet.

Might be high time you started to study and practice.
Cut and paste gets you nowhere fast.
Expecting others to study, practice and work out your code will not get you anywhere, and is a bit high on the scale of "lazy".

What is the longest valid pulse you are expecting? Set the pulseIn timeout to just a bit longer than that.