Notifications
Clear all

Need help for the correct choice of distance sensor

10 Posts
4 Users
6 Reactions
120 Views
(@nisheel)
Member
Joined: 1 month ago
Posts: 3
Topic starter  

Hi DroneBot family,

 

I have a project where i need to attach a distance sensor behind a street bicycle. I want the sensor to trigger when any vehicle behind approaches within 6m (20ft or 600cm) of my bike. I have someeone to help we with the code for the trigger but am a bit confused on the most accruate choice of sensor. For example if there is a car 6m behind but not directly behind but lets say only 1/4 the width of his car is directly behind the bike, will a laser sensor trigger given that it has barely any spread ? Likewise i understand a ultrasonic sensor may have some spread but not enough distance (600cm)? and be sensitive to rainy weather. Lidar might be too expensive ?

Looking for the most accruate distance sensor for a reasonable price which will trigger at 6m(20ft or 600cm) and has a field of view of say 30-50 degrees betwee 5m-10m. I don't want too wide a field of view also otherwise a vehicle all the way in the next lane can trigger my sensor which i don't want as well.

thanks in advance for all your help and suggestions folks 🙂

Nish 

 

 


   
Quote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2045
 

@nisheel

I notice that commercial units for bikes that do that use radar.

 


   
Ron reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7334
 

@nisheel As previously mentioned, the Garmins etc use Radar. I have a couple units here but have only used the RCWL0516. That is not good enough for your use, too sensitive (wide) and slow to reset. I have a few more units but have not tested them. I found them via Google or searching Ali. They will not be cheap, the last one I got from Amazon (CDM324) had two prices (ordered by mistake), $56.31 and $11.39. I got a refund on the expensive unit and since it was from China, they told me to keep it. You can have it for the cost of shipping but that might be more than the $11.39 unit. The other unit I have sounds like a better fir for you, here is a short Amazon link LINK. NOTE I am in Canada, so change .ca to .com or whatever.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
Nisheel reacted
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1765
 

Hi @nisheel,

  I think you have posed a good question ... and sorry, but I don't have an answer of the same quality ... perhaps others will be able to oblige, although I have my doubts.

-----

I started with a quick Google, and in addition to the obvious ultrasound and lidar modules, a 60 GHz radar at

https://docs.sparkfun.com/SparkFun_Qwiic_Pulsed_Radar_Sensor_XM125/introduction/

made an appearance. A quick glance at that article suggested it might be of interest as a technology to be aware of, but was unlikely to meet your requirements without some serious research, and probably upgraded hardware.

(NB Note, regulations in your area may limit your legal 'right' to use such kit ... I have no idea ... that is your responsibility.)

 

When I returned to the forum site, after this meander around the web, I saw @robotbuilder had provided a useful hint from the commercial world that collaborated the possibility of using radar. (Whilst writing this message, Ron @zander has also now provided further collaborative info.)

------------

Obviously very low cost ultrasound sensors are widely available, but my impression is their range is fine for 'parking sensor' type applications, but will probably struggle to get to 6m. I guess it would mean increasing the 'sound' power the sensor would need to emit, which might not affect humans, but might be audible to other animals. It might be possible to modify an existing product, say by using a more powerful amplifier, etc., but obviously, this may result in 'magic smoke' if pushed too far.

Similarly, I recall @inq's recent experiments with low-cost lidar, that are well documented in this forum. Here, the maximum range of the chosen sensor was claimed as 4m, but this assumes a large reflective surface and no interfering daylight. This is a technology that is still developing, so it might not be an 'off-the-shelf' and/or economically feasible at this moment, but may become one in the future.

---------

You sensibly question not only the range, but also the field of view. Simplistically, this involves just reading the candidate sensor's data sheet, but if you fail to find an off the shelf product, you might consider the possibility of adding 'lenses' and/or shields, in a manner analogous to often used with a camera. Of course, a 'lens' for a 60 GHz radar is very different to that for an optical camera, so I am only using the term to describe the functionality required.

------------

Perhaps there are convenient products available that will easily fit your requirements, and your project could become almost trivially simple, but I have my doubts.

I would certainly try to find out about any commercial products, including how they work, what specification they achieve, what fundamental components they use and so on.

But also, if you are still keen, consider and imagine how you can achieve your aims. Try to envisage the likely investment in time, cost, materials, test gear and so on involved. This may be daunting, but if you are still up for the challenge, then go for it. I may not have the answers you need, but at least I wish you success.

Best wishes, Dave


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1765
 

Hi @nisheel,

Google just came up with this ultrasound sensor, from the 'more professional' market

https://www.baumer.com/medias/__secure__/UNAM_70I6131_S14_web_EN.pdf

which includes a polar diagram of:

image

And the text includes:

general data
scanning range Sd 600 ... 6000 mm
scanning range close limit Sdc 600 ... 6000 mm
scanning range far limit Sde 600 ... 6000 mm

... which suggests that it may not sense objects less than 600 mm away, although that might be a misinterpretation on my part.

I have no idea of availability and cost, as the website just says 'on request'.

Please note, this is not a recommendation of a specific product. It is only provided as an indication of what can be physically manufactured.

Best wishes, Dave


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7334
 

@davee @nisheel At one point a couple years back I was planning on outfitting an electric bike with the latest offering from Garmin which was automatic brake lights. They used a radar of some sort and were quite sophisticated taking into account closing rate and light intensity/pulsing. They were also expensive. A quick check shows them still in the $300 to $500 range. I think the radar unit I found and posted earlier at (HERE) is the better choice of the 3 I am immediately aware of. What that means, is that there may be better units I am not aware of.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
DaveE reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7334
 

@davee @nisheel Here is a link to the unit I used in my RV. It was installed in the kitchen island and had no trouble penetrating the wooden sides. It 'saw' about 4 to 6 meters but could be much further but my sensor was unable to see down the narrow hall as it was off to one side. It worked fine for this application as it still turned on many feet before entering the previously unlit room. It is cheap and simple to use. My concern with this sensor is it may be too sensitive. some sort of beam shaping technology may be needed.

Here is the code for it, very simple to use.

const int SensorPin = 2;    // RCWL-0516 Input Pin
const int LedsPin   = 13;   // LedsPin Output Pin

bool swLedsON = false;   // follows Leds pin value

const unsigned long millisWatchDogTimeout = 900000;   // 15 min * 60 secs/min * 1000 millis/sec
// TEST const unsigned long millisWatchDogTimeout = 10000;   //  10 secs/min * 1000 millis/sec
unsigned long millisWatchDogPrev;

void setup() {
  pinMode(SensorPin, INPUT) ;        // RCWL-0516 as input
  pinMode(LedsPin, OUTPUT) ;          // LedsPin as OUTPUT
  digitalWrite(LedsPin, LOW) ;        // Turn LedsPin Off
  millisWatchDogPrev = millis();
}

void loop() {
  static int SensorStatus = 0;    // RCWL-0516 SensorPin Value

  SensorStatus = digitalRead(SensorPin);

  if (SensorStatus == HIGH) {
    millisWatchDogPrev = millis();
    if (swLedsON == false) turnLedsON();
  } 
  else if ((millis() - millisWatchDogPrev) > millisWatchDogTimeout) turnLedsOFF(); 
}

void turnLedsON() {
  digitalWrite(LedsPin, HIGH) ;
  swLedsON = true;
}

void turnLedsOFF() {
  digitalWrite(LedsPin, LOW) ;
  swLedsON = false;
}

 

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
Nisheel and DaveE reacted
ReplyQuote
(@nisheel)
Member
Joined: 1 month ago
Posts: 3
Topic starter  

@zander @davee @robotbuilder

Guys thanks so so much for your suggestions! I am looking into the various links and ideas you all have so graciously suggested. Had also earlier seen the Garmin products, but they are all pricey. am aming for a more cost effective solution.

@davee to your specific question on the project, yes I need to invest time, effort and resources to make the project work. Don't have a choice with it 😀 .

 

Guys, im a bit new here so if there any more ideas or links or members within the community who you think might be able to help, please feel free to share on this thread.

 

thanks once again and have a great day ahead guys!

Nisheel


   
ReplyQuote
(@nisheel)
Member
Joined: 1 month ago
Posts: 3
Topic starter  

@zander Hi Ron,

what was the sensor you used in the RV with the code that you posted?


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7334
 

@nisheel It's mentioned in 3 lines of the code. RCWL-0516

Screenshot 2024 05 23 at 07.29.50

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote