Post about your Basic project here

Moderator: Mmiscool

User avatar
By Electroguard
#68805 This experiment was for testing the viability of using multiple radar sensors for increased detection coverage.

A 12 LED neopixel ring was used to provide long-distance visual feedback of sensor status (red=alert, green=clear) to eliminate potential for wifi signal problems.
Reading of the multiple digital sensors outputs was unconventionally done using diodes and analog input - this was because:
1. It is not viable to use seperate digital interrupts per sensor due to sensors interrupting each other.
2. It is not viable to OR all sensors to a single digital interrupt using diodes because the active-high sensor outputs are internally driven via 1K resistors, therefore opposing sensor states interfere with the logic threshhold levels at the common cathodes.

But although the collective sensor output threshhold levels are not suitable to drive a digital logic input, they are ok for reading as high or low using analog in. The A2D signal is read into the 'radar' variable, which is displayed in a browser textbox for confidence.
A 100K pulldown resistor ensures the commoned analog input is pulled low when all the active-high sensor output diodes are in their untriggered non-conducting low state.

The radar value was typically less than 50 for a logic low, and solid 1024 for a logic high of 1v or greater. A value of 900 was chosen as an unambiguous high/low threshhold giving sufficient noise tolerance.
Sampling rate was 500ms.

The analog in method allows for many additional sensors to be added if wished.
All sensors and the neopixel ring were powered from the ESP modules onboard 5v USB pin. The ESP was configured to autonomously autorun without any wifi connection.

The experiment was organised to test many different variables...
A removable curved metal reflector was fashioned which could be placed varying distances from the sensor array. Use of the reflector increased forward sensitivity, which increased as it was brought closer to the sensors, until at less than 10cm the sensors had a tendency to cause continuous triggering.

An optional jumper lead allowed for connection to the electronics 0v 'ground', but this had no noticable effect.

The 5 sensors were arranged in an adjustable flexible horizontal arc, suitable for testing with different amounts of curvature.

Initially the sensors were arranged to alternately face directly out and face in to act as reflector 'collectors'.
Subsequently all sensors were re-arranged to just face directly out.

Considering the amount of planned adjustments and control of variables and conditions, results were dissappointingly inconsistent.
Use of the metal reflector - grounded or not - extended the central range from 10m to 15m or greater, dropping away at the sides to about 8m.
This gave a useful overall detection hemisphere of about 15m wide by 15m forward.
However, reception appeared to sporadically de-sensitize significantly, sometimes requiring a return to almost within a few meters of the array before re-triggering resumed. Conversley at other times spurious triggers occured even when 'in hiding' behind the metal shielding of vehicles.

I tried increasing the analog sampling duration to 900ms, and also commented out all web-browser output, but it made no significant difference. I also disabled 2 of the 5 sensors to leave only 3 operational, which reduced coverage area as expected, but did not improve trigger consistency.

The only definitive way I can think of to pin-point whether the lack of consistency is a sensor issue or an esp-basic limitation is to try similar testing using an alternative system such as arduino, but that's not likely to be any time soon.

Here's the analog sensor script with neopixel indicator in case anyone is interested...
Code: Select allmemclear
radar = 0  ' sensor analog output value
alert = 0  ' triggered flag
alertpin = 12 '(RED on my RGB led)
okpin = 15 ' (GREEN on my RGB led)
pixels = 12 ' number of neopixel LEDs available
neopin = 4 ' neopixel data pin
warning = 10 ' turns meter to full green
warningcss = "background: red;"
'warningcss = warningcss & "width:100%;height:85%"  'commented out to reduce browser load
meter warning, 0,10
cssid htmlid(), warningcss
html "<BR><BR>"
textbox radar
cssid htmlid(), "margin:auto;width:100:text-align:center;font-size:30px;color:blue;"
timer 500, [RADAR]

radar = io(ai)
if radar > 500 then
 if alert = 0 then
  alert = 1
  warning = 0
 alert = 0
 warning = 10