Face Tracking App allows you to control any BBC Micro:Bit robot with your face position, rotation or even opening of your moth.
Supported platforms
- Desktop web browser – Chrome, Edge, Opera
- Android
- ChromeOS
- iPhone or iPad – via Bluefy web browser
How it works?
The app tracks face with such parameters:
- X – horizontal position
- Y – vertical posiition
- Z – distance
- Yaw – rotating head left/right
- Pitch – rotating head up/down
- Roll – tilting head
- Mouth – mouth openness
The parameters are scaled to fit the range between 0-100 or 0-10 (Z and Mouth). To adapt the code range to your needs you have to recalculate it on the Micro:Bit.
Bluetooth communication
The app communicates with the Micro:Bit via web-bluetooth over UART service (bluetooth serial port). This method tends to be quite slow so the transmision rate is reduced to 12 updates per second.
Data is being sent as a string (text) containing 14 digits. Each two digits transfer one parameter.
X (00-99) | Y (00-99) | Z (00-25) | Yaw (00-99) | Pitch (00-99) | Roll (00-99) | Mouth (00-10) |
50 | 50 | 05 | 50 | 50 | 50 | 05 |
Check out Makecode template code to see how to decode it on the Micro:Bit it might look intimidating at first but in fact is quite simple. Remember that the values are transfered as text so it has to be converted into numbers.
Setup
- Open template code and adapt it to your robot design. Upload the code to Micro:Bit
- In the app click ROBOT HEAD icon in the upper right corner to connect to your Micro:Bit
- If your micro:bit is not detected by your computer, check if project settings in MakeCode look like this
App settings
Example code
Troubleshooting
Micro:Bit v1 has limited memory. It becomes a problem when you use bluetooth as it takes most of RAM. The board will crash when you will try to make it use bluetooth and anything more than one sensor and basic operations.
When you are low on memory you will see a sad face and error code 20 on Micro:Bit display after connecting via bluetooth.
How to avoid this error?
- Keep your code as simple as possible
- Use only one sensor at a time
- Avoid using led display when connected to bluetooth
- Limit mathematical operations such as dividing, rounding etc.
- Use Micro:Bit v2 – the easiest way (SORRY) it has much motre memory
In the end with Micro:Bit v2 it is still possible to do most of interactions but it is frustrating for students (and the teacher) to encouter low memory error time after time and trying to avoid it.
Micro:Bit v2 has enough RAM memory (128kB vs 16kb in the old one) that you will not face this problem.
2 Comments
[…] https://cardboard.lofirobot.com/face-app-info/ […]
[…] Face Tracking App […]