Hello Walabotters,
This is the Walabot Person Recognizer. Simply ask Alexa who you are; Alexa will scan you and based on your height she can call you by your name. If your height is not recognized, the application can save you as a new person in the database. At least; that is the idea; here is my first implementation of the Walabot Person Recognizer.
The measurement is implemented easy; You just have to stand in front of the Walabot in the room (distance doesn't really matter) and ask Alexa to start the measurement. You see the results and history back on the Display.
This is my second Walabot project. Earlier this year I've made the Walabot Object Detection project here on Hackster, whereby the Walabot could recognize objects. The code of the project is also available in it's source code.
This project can be used without Alexa and Raspberry. Then all the commands goes through the Windows application. If you want to use Alexa, an Amazon Echo speaker and the Raspberry Pi setup is needed.
The following hardware and configuration is needed for this project.
The Walabot API software and the drivers are installed. I'm using the Walabot Pro/Developer edition.
Install the latest Raspbian OS on your Raspberry (a model 3 is preferred since it has build in wifi). Connect the Raspberry Pi to the same network as Alexa.
Serial needs to be enabled. This is done on the Raspberry Pi in Preference - Raspberry Pi Configuration - Interfaces, and enable Serial.
To send the data from the Raspberry Pi, Serial connections has to be configured. I had to install drivers to use it (Prolific download link). I also had to make these steps (Stack Overflow link) to get the UART port configured as serial data (the Bluetooth functionality will be turned of by this action).
Youtuber Netmedias and his github really helped me connecting my Alexa to my Raspberry.
AlexaConnect your Amazon Echo speaker in the same network as the Raspberry.
I'm using now the Smart Home function: Hereby Alexa will scan for smart-connected devices. With the installed software on the Raspberry, Alexa will detect and connect with the Raspberry, therefore no additional skill is needed to install.
Let Alexa search for devices by 'Alexa search for connected devices'. This process will take ~20 seconds.
Alexa will find the raspberry and immediately the Walabot can be accessed.
To let Alexa understand the word 'Walabot' it has to be spelled as 'wallabot'. Otherwise it will see Walabot as 'Wall about'.
Windows ApplicationThe Windows application connects to the Walabot. Just connect your Walabot to the PC, open the application and connect the Walabot through the application. Then the Walabot API's software version is shown and the function buttons will be enabled. Fields with logging and debug information is shown.
- Connect the Walabot
- Set the height of the Walabot in the 'Setup height'
- Stand in front of the Walabot.
- Start the distance measurement (step 1)
- Wait for a few seconds. The Walabot will now measure the distance between you and the Walabot.
- Start step 2: Length measurement. This can take up to one minute. Please stand still on the same location as in Step 1.
- After a minute all the data to process your personal length is collected.
- Start step 3: Calculate your length. This will use the collected data to calculate your length. It will also compare the length with persons in the database. Your length (and a possible match from the database) is returned and visible on the Windows Application.
- Open the Windows application.
- Set manually the right COM port of the Raspberry Pi and click connect.
- Set manually the height of the Walabot in the 'Setup height' field
- Ask Alexa: "Alexa turn on Walabot"
- The Walabot is now connected, a confirmation is shown in the application (Step 1)
- Ask Alexa: "Alexa Start Measurement"
- Your distance between the Walabot is measured (Step 2)
- Step 3 will automatically be started if all the data is processed. Your length is shown on in the Windows application
The first step is to detect what the distance is of the person in front of the Walabot. This is done by a measurement from 0 to 1 degree. An average of 5 measurements is done to precise known the distance.
Step 2:Then in a loop the Walabot will increase the angle by one (or a defined step size) to cover each single angle. If an object is detected within that measurement And this object is within a margin of the previously detected distance, the application saves that angle until the point that the Walabot doesn't detect a target. From that point the measurement will go on one measurement but then it will stop and save the measured data.
while (PersonMeasurementReady == false && ((x + xStepSize) < maxAngleValue))
{
minIndegrees = x; // min angle
maxIndegrees = x + xStepSize; // max angle
// set arena for measurement with new angles
walabot.SetArenaTheta(minIndegrees, maxIndegrees, resIndegrees);
walabot.StartCalibration(); // start calibration
x += xStepSize; // increase the angle
walabot.Trigger(); // Measurement
SensorTarget[] targets = null;
int numTargets = 0;
targets = walabot.GetSensorTargets(); // find targets
numTargets = targets.Length; // find number of targets
if (targets.Length > 0) // At least one target is needed
{
double zPos = 0;
zPos = Math.Round(targets[0].zPosCm); // the distance of the target
// checks if the rarget is within the measured distance // of the person (a margin is included)
if (zPos > heighestZpos && heighestZpos <= maxTargetDepth)
heighestZpos = zPos;
if (zPos >= minTargetDepth && // target is within range
zPos <= maxTargetDepth &&
PersonFirstDetection == false)
{
PersonFirstDetection = true;
PersonEndDetection = false;
PersonLengthStart = x;
}
else if ((zPos < minTargetDepth || // target was within range
zPos > maxTargetDepth) && // but not anymore
PersonFirstDetection == true &&
PersonEndDetection == false)
{
PersonLengthEnd = x;
PersonFirstDetection = true;
PersonEndDetection = true;
PersonMeasurementReady = true; // this will end the loop
}
}
}
This can take some time, since each measurement has to be calibrated, because the angle is changed. This is done with the walabot.SetArenaTheta(x.y.z) command:
Step 3:During testing I found out that when I wanted to decrease the angle downwards (to the floor) the results weren't reliable. Therefore I set the starting angle position at 0 degree and a manual 'Setup Height' has to be entered. For example; if you place the Walabot on a table or tripod with a height of 90 cm, the calculations will include this value to it's final result.
The height of the Walabot (the position of the Walabot regarding the floor) needs to be set manually. This value will be used in the person length calculation.
The distance is measured based on the first target the Walabot finds. It will do 5 measurements and takes an average of all the measurements. The average data is set as the distance between the Walabot and the Person.
Measurement notes: It can only detect persons that are longer than the height of the Walabot. For example; if you place the Walabot at a height of 120cm, it can only detect persons that are longer than 120cm.
Angle calculation:
double PersonHeight = SetupHeight + tan(angle) * distance;
// SetupHeight = The height of the Walabot which can be set in the textbox in the app
// Angle = Angle of measurement, in radian (not degree).
// Note that the angle is measured in degree, to convert this to radian the
// angle has to be multiplied by (pi/180)
// MeasurementHeight = tan(angle) * distance
Function that returns the total length of the person:
private double CalculateTotalLength(double measurementDegree)
{
double measurementRadian = measurementDegree * (Math.PI / 180);
double measurementHeight = distanceToPerson * Math.Tan(measurementRadian);
double setupHeight = double.Parse(WalabotHeightTextbox.Text);
double PersonLengthTotal = setupHeight + measurementHeight;
return PersonLengthTotal;
}
To detect a person to the measured length of the person, a database is linked to the calculated length. Now I have implemented an hardcoded example:
int FinalPersonLength = Convert.ToInt32(CalculateTotalLength(measuredAngle));
if(FinalPersonLength
PersonNameTextBlock.Text = "Marcel"; break;
(Personal) Points of improvement and things to be added in the near future
1. Learn Python. One of my New-year-wishes is to learn python. I will follow a course for this so I can directly control the Walabot with the same Raspberry. Looking forward to start this and show my next project.
2. Use the Lambda Skill functionality: I've created a few smart skills, but I have to invest a bit more to make it ready and use it in my project.
3. Add algorithms to the scanning process. Improve the speed of scanning by smart looking at the angles and skip the unnecessary angles.
Note; I have only tested and used the Walabot Developer/Pro in this project.
If you have any feedback or requests please let me know. Also mention if you see some English/grammar mistakes :)
Thanks for reading.
Kind regards,
Marcel
Comments