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 @chr1sa: Donkeycar 4.4 released with tons of new features, including path learning (useful with GPS outdoors), better Web and Lidar supp…
Nov 27
DIY Robocars via Twitter
RT @NXP: We are already biting our nails in anticipation of the #NXPCupEMEA challenge! 😉 Did you know there are great cash prizes to be won…
Nov 24
DIY Robocars via Twitter
RT @gclue_akira: レースまであと3日。今回のコースは激ムズかも。あと一歩 #jetracer https://t.co/GKcEjImQ3t
Nov 24
DIY Robocars via Twitter
UC Berkeley's DIY robocar program https://roar.berkeley.edu/
Nov 24
DIY Robocars via Twitter
RT @chr1sa: The next @DIYRobocars autonomous car race at @circuitlaunch will be on Sat, Dec 10. Thrills, spills and a Brazilian BBQ. Fun…
Nov 24
DIY Robocars via Twitter
RT @arthiak_tc: Donkey car platform ... Still training uses behavioral cloning #TCXpo #diyrobocar @OttawaAVGroup https://t.co/PHBYwlFlnE
Nov 20
DIY Robocars via Twitter
RT @emurmur77: Points for style. @donkeycar racing in @diyrobocars at @UCSDJacobs thanks @chr1sa for taking the video. https://t.co/Y2hMyj1…
Nov 20
DIY Robocars via Twitter
RT @SmallpixelCar: Going to @diyrobocars race at @UCSDJacobs https://t.co/Rrf9vDJ8TJ
Nov 8
DIY Robocars via Twitter
RT @SmallpixelCar: Race @diyrobocars at @UCSDJacobs thanks @chr1sa for taking the video. https://t.co/kK686Hb9Ej
Nov 8
DIY Robocars via Twitter
RT @PiWarsRobotics: Presenting: the Hacky Racers Robotic Racing Series in collaboration with #PiWars. Find out more and register your inter…
Oct 23
DIY Robocars via Twitter
RT @Hacky_Racers: There will be three classes at this event: A4, A2, and Hacky Racer! A4 and A2 are based around UK paper sizing and existi…
Oct 23
DIY Robocars via Twitter
Oct 23
DIY Robocars via Twitter
Oct 19
DIY Robocars via Twitter
Oct 18
DIY Robocars via Twitter
RT @NeaveEng: Calling all UK based folks interested in @diyrobocars, @f1tenth, @donkey_car, and similar robot racing competitions! @hacky_r…
Oct 13
DIY Robocars via Twitter
RT @araffin2: 🏎️ After hours of video editing, I'm happy to share a best of my Twitch videos on learning to race with RL. 🏎️ Each part is…
Oct 13
More…