KY-037 KY-038 sound sensor for traffic counting

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Gebruikersnaam
New user
Posts: 4
Joined: 25 Mar 2024, 22:25

KY-037 KY-038 sound sensor for traffic counting

#1 Post by Gebruikersnaam » 25 Mar 2024, 22:48

Hi,
I'm new here but using ESPEasy a long time.

I want to count traffic trough our street using KY-037.
It has analog and digital output.
I want to use a digital pullup for counting, in a later stage analog values to discriminate between normal cars and heavy traffic.

First things first: the digital way.
I have setup ESPEasy as follows.
Capture.PNG
Capture.PNG (37.39 KiB) Viewed 405 times
As you can see below it catches sound
Devices.PNG
Devices.PNG (20.17 KiB) Viewed 405 times
but in a rather unpredictable way.
Happily some of the results even land in domoticz
domoticz.PNG
domoticz.PNG (8.92 KiB) Viewed 405 times
I'd like to have some advice about what type of sensor to choose and what settings
sensors.jpg
sensors.jpg (54.28 KiB) Viewed 405 times
Maybe someone has set it up properly.

User avatar
Ath
Normal user
Posts: 3520
Joined: 10 Jun 2018, 12:06
Location: NL

Re: KY-037 KY-038 sound sensor for traffic counting

#2 Post by Ath » 26 Mar 2024, 22:13

I'm not sure if sound is the best way of counting traffic, as modern electric cars hardly make any sound, other than some continuous 'whine', that can easily be mistaken for background noise.

For the digital counting, I assume you already set some threshold using the potentiometer on the sensor, so not every change in sound is actually counted.
When using the Analog input, you could work with a dynamic threshold, making the measurement somewhat more accurate, but it will take quite some effort to get that right.
/Ton (PayPal.me)

Gebruikersnaam
New user
Posts: 4
Joined: 25 Mar 2024, 22:25

Re: KY-037 KY-038 sound sensor for traffic counting

#3 Post by Gebruikersnaam » 26 Mar 2024, 23:58

The street is a brick road, so every car that passes is noisy.
I cannot hear myself speak when a car passes.

Meanwhile I discovered that measuring sound is unreliable.
Not because of the sound but because of the device, the KY-037.
It's easy to set a threshold but how long should the input interval, the dealy before the next input be.

I'd be happy to get more advice and I'm open to using other devices to do the counting.

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: KY-037 KY-038 sound sensor for traffic counting

#4 Post by TD-er » 27 Mar 2024, 09:16

Maybe you can use one of those 'radar' sensors like the LD2401.
Those do also react to humans, but maybe you can set some thresholds based on measured distance?
Not sure how fast the cars drive by, so it might not respond fast enough as those are typically designed for detecting humans/animals.

bidrohini
Normal user
Posts: 105
Joined: 03 Nov 2022, 16:24

Re: KY-037 KY-038 sound sensor for traffic counting

#5 Post by bidrohini » 27 Mar 2024, 15:33

Here are some more approaches for traffic counting and traffic control. You can implement these and see if you get better results than the sound sensor. If you compare the performances, it may help you select the proper components for your final design.
https://www.hackster.io/lintangwisesa/i ... ter-3657c5
https://www.pcbway.com/project/sharepro ... 84430.html
https://github.com/ahmetozlu/vehicle_co ... tensorflow

Gebruikersnaam
New user
Posts: 4
Joined: 25 Mar 2024, 22:25

Re: KY-037 KY-038 sound sensor for traffic counting

#6 Post by Gebruikersnaam » 27 Mar 2024, 19:05

Hey thank you @bidrohini
I'll have a look at it.
Maybe different counting methods alltogether may result in more or less exact counting.
Whatever method I'm using, it cannot be a method with a camera. It's forbidden to take pictures in the public area.

Meanwhile I have been trying and testing.
- setting the sound threshold does a lot of good and I'll finetune it while watching the traffic and compare it to the actual count from the KY-037.
- setting the non responsive interval to (at this moment) 8 seconds enhances the counting accuracy a lot.

I'm realistic. I don't need to achieve a 100% exact count, but knowing about how much traffic passes is interesting to be able to compare my numbers with the numbers the local authoroties are publishing.
I just want my estimation being supported with figures.

Post Reply

Who is online

Users browsing this forum: No registered users and 40 guests