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 Robocars via Twitter
RT @Jetsonhacks: And I helped with the course! JetBot, JetBot, happy little JetBot! JetBot ... GO! Meet the Jetson Specialists Inspiring a…
1 hour ago
DIY Robocars via Twitter
RT @a1k0n: Designed RPi + camera mounts + new bumper for the new car. Fits great on the car first try, except my longest camera cable doesn…
1 hour ago
gotham liked gotham's profile
21 hours ago
DIY Robocars via Twitter
RT @RoboticMasters: Monaco GP Circuit in the Donkey Sim (coming soon). Including buildings, tunnel and all! https://github.com/robotics-masters/sim-donkeycar-f1/tree/f1-tracks @diyr…
Wednesday
DIY Robocars via Twitter
RT @breadcentric: Here are the details of #AWSDeepRacer finals: https://blog.deepracing.io/2020/12/01/aws-deepracer-league-finals-2020-round-1-schedule/ #awsreinvent2020 #AWSreInvent https://t.co/ovqsjp8V…
Wednesday
DIY Robocars via Twitter
RT @breadcentric: #AWSDeepRacer League #awsreinvent2020 Open race is on Dec 1st - Dec 31st in three categories, 15 DeepRacer Evo (with LIDA…
Wednesday
DIY Robocars via Twitter
RT @a1k0n: @SmallpixelCar @diyrobocars It's just something that's easy to track with chroma keying. I ended up using different colors on th…
Monday
DIY Robocars via Twitter
Monday
DIY Robocars via Twitter
RT @TinkerGen_: "The Tinkergen MARK ($199) is my new favorite starter robocar. It’s got everything — computer vision, deep learning, sensor…
Nov 23
DIY Robocars via Twitter
Nov 23
DIY Robocars via Twitter
RT @roboton_io: Join our FREE Sumo Competition 🤖🏆 👉 https://roboton.io/ranking/vsc2020 #sumo #robot #edtech #competition #games4ed https://t.co/WOx…
Nov 16
DIY Drones via Twitter
First impressions of Tinkergen MARK robocar https://ift.tt/36IeZHc
Nov 16
DIY Robocars via Twitter
Our review of the @TinkerGen_ MARK robocar, which is the best on the market right now https://diyrobocars.com/2020/11/15/first-impressions-of-tinkergen-mark-robocar/ https://t.co/ENIlU5SfZ2
Nov 15
DIY Robocars via Twitter
RT @Ingmar_Stapel: I have now explained the OpenBot project in great detail on my blog with 12 articles step by step. I hope you enjoy read…
Nov 15
DIY Robocars via Twitter
RT @DAVGtech: This is a must attend. Click the link, follow link to read the story, sign up. #chaos2020 #digitalconnection #digitalworld ht…
Nov 15
DIY Robocars via Twitter
RT @a1k0n: Got a new chassis for outdoor races (hobbyking Quantum Vandal) but I totally didn't expect that it might cause problems for my g…
Nov 11
More…