Face Tracking App Info

Face Tracking App allows you to control any BBC Micro:Bit robot with your face position, rotation or even opening of your moth.

This app is available as a WEB APP that works in the browser and communicates with your BBC MicroBit board via bluetooth.

Supported platforms

  1. Desktop web browser – Chrome, Edge, Opera
  2. Android
  3. ChromeOS
  4. 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)
50500550505005

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

  1. Open template code and adapt it to your robot design. Upload the code to Micro:Bit
  2. In the app click ROBOT HEAD icon in the upper right corner to connect to your Micro:Bit
  3. If your micro:bit is not detected by your computer, check if project settings in MakeCode look like this

App settings

Example code

OPEN IN MAKECODE

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?

  1. Keep your code as simple as possible
  2. Use only one sensor at a time
  3. Avoid using led display when connected to bluetooth
  4. Limit mathematical operations such as dividing, rounding etc.
  5. 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.