1.Introduction of Traffic flow and Height Detector

This plan use Benewake company’s product TFmini-Plus combined with Arduino-UNO.

The usage:count flowrate and height.

Equipment and wires

2.1    Equipment

  • Benewake TFmini-Plus

3691381435?profile=original

TFmini-Plus detail is on the TFmini-Plus Instructions on benewake website: http://en.benewake.com/download

  • Arduino-UNO

3691381491?profile=original

Detail introductions and study of Arduino is on the website below:

Chinese community:http://www.arduino.cn/

English Website:https://www.arduino.cc/

  • Computer

3691381536?profile=original

The computer is used as the function of program writing, uploading and data displaying. Data display function can be upgraded and optimized later, such as increasing the display screen to display current traffic and height data, and broadcasting greetings such as "Welcome" with speaker.

  • Wires

3691381607?profile=original

Dupont Line——Used for Plus and UNO board connection (Plus terminal removable)

USB Square Port Data Connection Line——Used to connect UNO board to computer

2.2           Wiring3691381590?profile=original

TFmini Plus product line is defined as:red+5Vblack GNDgreen TXwhite RXTFmini-Plus The supply voltage is 5Vso connect directlyFor other radars, please refer to the product specificationsto ensure normal power supply

Serial communication connection needs attention,pin 2 ports of TX terminal plate for arduino UNO plate radar(RX of soft serial 1)pin 3 ports of radar RX terminal board(TX of soft serial 1this is related to the programming in the following article.

  1. Measuring Principle of Human Flow Height
  • After the LiDAR start, set the installing height, height limit, lower limit.
  • When the people enter the detection area, the data will goes up, output number of people, every time this happens, number of people plus one, then output the number.
  • When the people enter the detection area, the data will wave around the height limit, compare it with Height, Height is the peak of the data wave
  • When people go out the detection area, the data goes down, output Height.

  1. program chart

3691381665?profile=original

5.Programming

The implementation of this routine requires at least two serial ports,a data receiving radaranother is used to output data to the computer for display. You can copy and paste the following code into the IDE program edit windowyou can also open the corresponding attachment file directly.

(Get the file? Email us via: bw@benewake.com)

Number_Height

#include<SoftwareSerial.h>// Soft string oral document

SoftwareSerial Serial1(2,3); // Define the name of the soft serial port Serial1,and pin2 is defined as RXpin3 is designated as TX /* For Arduino boards with multiple serial ports, such as DUE boards,comment out the above two pieces of code and use Serial 1 serial port directly. */ int dist;// Distance LiDAR detected

int strength;//LiDAR signal intensity,which is implausible if the data is under 100

int IH=230;//Height of  installing LiDAR(need to be set),need to adjust based on the black object in real

int H;//Height

int h=0;//last detected height

int check;//Check the stored data

int i;

int Number=0;//number of people

int Height=0;//Maxmium of height

int up=50;//height limit(Need to be set),height of the object is credible if is over the limit

int down=40;//lower limit(Need to be set),height lower than lower limit over the height limit will be counted, in case the height is equal to the height limit exactly which will case data waving and conduct errors.

int uart[9];//Store LiDAR detected data

const int HEADER=0x59;// pockets frame header

void setup()

{

Serial.begin(115200);// Set Baud Rate of Connecting Serial Port of Arduino and Computer

Serial1.begin(115200);//Set Baud Rate of Connecting Serial Port of Arduino and LiDAR

}

void loop()

{

if (Serial1.available())//Check SATA have data input or not

{

if(Serial1.read()==HEADER)// Decide pockets frame header 0x59

{

uart[0]=HEADER;

if(Serial1.read()==HEADER)//Decide pockets frame header 0x59

{

uart[1]=HEADER;

for(i=2;i<9;i++)//Store the data into array

{

uart[i]=Serial1.read();

}

check=uart[0]+uart[1]+uart[2]+uart[3]+uart[4]+uart[5]+uart[6]+uart[7];

if(uart[8]==(check&0xff))//Check the received number following the agreement {

dist=uart[2]+uart[3]*256;//calculate the distance

strength=uart[4]+uart[5]*256;//]calculate intensity of the signal

H=IH-dist;//calculate height

/*Detect number of people*/

/*theory: when data break through from lower limit to height limit, then number of people plus one */

if(H>=up&h<down)//when people enter the detecting area, the number of people plus one

{

Number=Number+1;

h=H;

Height=H;

Serial.print("Number = ");

Serial.print(Number);//Output the value

Serial.print('\t');

}

if(H>=up&h>=down)//When people are within the detecting area, compare the values to find the Maximum one.

{

if(Height<H)

{

Height=H;

}

}

if(H<down&h>=up)//When people walked out of the detecting area, the height outputted reach to peak, meanwhile it will be reset to zero.

{

Serial.print("Height = ");

Serial.print(Height);//Output the height

Serial.print('\n');

h=H;

Height=0;

}

//                       Serial.print("H = ");

//                       Serial.print(H);//Output the height

//                       Serial.print('\t');

//                       Serial.print("dist = ");

//                       Serial.print(dist);//Output LiDAR detected distance

//                       Serial.print('\t');

//                       Serial.print("strength = ");

//                       Serial.print(strength);//Intensity of the output signal

//                       Serial.print('\n');

}

}

}

}

}

Upload the program to Arduino, open the serial monitor, then you can see the flowrate and height of the person. As the picture below:
3691381768?profile=original

  1. Notes
  • Installing height should based on the real black object to adjust, because different color have different reflectivity, so LiDAR will detect different signal. Installation height needs to be corrected according to actual black objects,Because different color objects have different reflectivity and different signals received by radar
  • When people are walking in a group, LiDAR can only detect one object, so this plan is suitable for detecting one person’s move. When many people walk together, the radar spot can only hit one object, and can only count plus one, which is suitable for single-person entry and exit scenarios.
  • If the facula didn’t hit on the head completely, then the height detected will be error. Considering the possible of mistake on height data while people walking, try to let the facula hit the feet, using the highest detected value to cut down error.
  • Buffer area is a "height limit - lower limit", which avoids the situation that the number of repetitions increases by 1 when the detection height happens to be a "height limit" object.

If you are interested, welcome to contact us: en.benewake.com

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Activity

DIY Drones via Twitter
Using ArduRover with an RTK GPS https://ift.tt/2N9I3RO
18 hours ago
DIY Drones via Twitter
yesterday
DIY Robocars via Twitter
yesterday
DIY Robocars via Twitter
Friday
DIY Robocars via Twitter
Friday
DIY Drones via Twitter
Thursday
DIY Robocars via Twitter
RT @Heavy02011: @diyrobocars : A Home-brew computer club* for Connected Autonomous Driving on Jan 23rd, 2021 https://www.meetup.com/Connected-Autonomous-Driving/events/275728684/ #Meetu…
Thursday
DIY Robocars via Twitter
Thursday
David Hori liked Isabella Domi's profile
Jan 12
DIY Robocars via Twitter
RT @Heavy02011: ⁦@diyrobocars⁩ Autonomous Driving Assembly at #rC3. join us at https://rc3.world/rc3/assembly/diyrobocars-f1tenth/ ⁦@f1tenth⁩ ⁦@DAVGtech⁩ ⁦@DWalmroth⁩…
Jan 11
DIY Robocars via Twitter
RT @chr1sa: New car designs coming for our next @DIYRobocars @donkey_car virtual race on the 23rd. Choose any one you want at race time Le…
Jan 11
DIY Robocars via Twitter
RT @RoboticMasters: Thanks to @EllerbachMaxime and the Sydney Uni Capstone Students the @donkey_car @diyrobocars simulator is getting a ma…
Jan 11
DIY Robocars via Twitter
Jan 6
DIY Robocars via Twitter
Dec 28, 2020
DIY Robocars via Twitter
An interesting line-following simulator to use with with your robocars: https://github.com/ron-grant/LFS
Dec 23, 2020
DIY Robocars via Twitter
Dec 23, 2020
More…