sen0192

Hi
Hi
What is the appropriate code for calculating vehicle speed in km
With this eagle sen0192



issamsaid:
vehicle speed in km

For a start, km isn't speed.

But it's not apparent to me from DFR's site that it gives a distance (which of course along with time between two readings could give you speed): it seems to me it detects presence (a bit like a PIR), not distance.

The distance of the presence seems to be adjustable, that is the sensitivity, but can you confirm it can return a variable distance, like an ultrasonic can?

What is the appropriate code to calculate speed

It's a Doppler device, isn't it?
You need to measure the return frequency

Yes and what is the appropriate code

Frequency measurement code.

From the website https://www.dfrobot.com/product-1403.html

Keybord Hung • 7 months ago

Can I use this sensor to measure the speed I want?


Avatar
DFRobot Support Mod Keybord Hung • 7 months ago

No this sensor is a digital sensor. It can detect whether there is moving object in the sensing range, and the range can be adjusted by potentiometer.

So you see this sensor can not measure speed.

look

Read that how to use this forum sticky post for how to work this forum. For an image to work you need to supply the URL of the image NOT the URL of a webpage that contains that image. Links to videos are right out.
If you want to make a point then use words. I just gave you a link to the makers page on the subject, if you want to argue then argue with them.

The link the OP posted was:-

Which appears to be a 4 min movie of something else altogether, not the sensor in question.

I know but the same sensor has my HP 100
And the same loudspeaker

but the same sensor has my HP 100

I have no idea what those words mean.

From what I read on the Wiki page MicroWave_Sensor_SKU__SEN0192-DFRobot This device is a proximity detector for moving objects. It does not give you any indication of the speed of these moving objects on the output pin. The only output you get is a decision signal which shows when movement above a threshold has been detected.

And the same loudspeaker

So what? My radio uses the same loudspeaker and that can't measure speed ether.

This type of sensor is widely used in industrial, transportation and civil applications such as measuring a vehicle's speed, measuring liquid levels,

.........
Why was the speed of the cars mentioned in the description
That's what I want the speed of the car

issamsaid:
Why was the speed of the cars mentioned in the description

While you're asking DFR that question, ask them for instructions and code.

Why was the speed of the cars mentioned in the description

I think your language skills are not good enough to know what these words mean. From the product web site that I posted a link to I. Reply #6

The microwave sensor applies the Doppler effect to detect moving objects using microwaves. This differs from the method used by a regular infrared (IR) sensor as microwave is sensitive to a variety of objects that are microwave-reflective, and its sensor readings are not affected by the ambient temperature.

This type of microwave sensor is widely used in industrial, transportation and civil applications such as measuring vehicle speed, liquid levels, automatic door motion detection, automatic washing, production line material detection and car reversing sensors etc.

this type of microwave sensor
Not this sensor, this type.

If you bought this sensor looking to measure the speed of a car then you bought the wrong thing.

Well what is the right thing that corresponds to Arduino to measure the speed of cars

Google not working for you?
Try using the words

arduino doppler shift speed measuring

issamsaid:
Well what is the right thing that corresponds to Arduino to measure the speed of cars

Real cars? GPS maybe?

(BTW if I were you I'd challenge DFR on what their website says.)

That is a good point. Is the speed measurement required from inside or outside the car?

// 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
//#define PYTHON_OUTPUT
unsigned int doppler_div = 19;
unsigned int samples[AVERAGE];
unsigned int x;

void setup() {
Serial.begin(115200);
pinMode(PIN_NUMBER, INPUT);
}

void loop() {
noInterrupts();
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;
}
interrupts();

// 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.write(Freq/doppler_div);
#else
//Serial.print(Ttime);
Serial.print("\r\n");
Serial.print(Freq);
Serial.print("Hz : ");
Serial.print(Freq/doppler_div);
Serial.print("km/h\r\n");
#endif
}
else
{
#ifndef PYTHON_OUTPUT
Serial.print(".");
#endif
}
}
See I've tested this code that works fairly and gives me semi-accurate results