Micro:bit Distance Reader with Haptic Feedback

2 CommentsFriday, 17 March 2017  |  Admin

One cold and blustery morning, Ewan had an idea! "How about using a micro:bit with a distance sensor and a haptic feedback driver to create an Electronic "white stick".

This task was handed to myself, and after reading a few data sheets, I designed a circuit and then a PCB that can mount to a micro:bit.

The PCB has a ST VL53L0X 'Time of Flight' sensor to measure the distance (this works up to around 1.2 Meters and down as low as 30mm) and a TI DRV2605 haptic feedback driver, with a vibration motor.

After laying out the PCB and getting it manufactured, it was time to solder the components. As the passive components were 0603 size, these were easy to solder by hand, the TI DRV2605 has a 0.5mm pitch, so not too difficult. The VL53L0X was an LGA12 package, with tiny, 0.5mm pads on the bottom. This required mounting with hot-air, but managed it on my second attempt (Not bad as this was only the 2nd BGA style chip I have mounted).

          Next came the firmware, I chose to program this in PYTHON, while I've not had much experience with this programming language, There are thousands of resources online. I started by searching the web for Arduino Libraries, this way I could connect an Arduino with jumper wires, and test that the assembly of the PCB was working. This also gave me a reference for the calls required to make the devices work. The haptic chip had a few Arduino libraries on the web, and they all used the same calls to set up the chip, so understanding the code was straight forward.


I stripped the code down as far as I could to get it to be functional, and fit into the micro:bit's memory. The Time of Flight sensor only had a few libraries, and these were based on the API provided by ST. Most of the libraries were written to be as comprehensive as possible and give access to the full features of the sensor, I found that the calls to read the distance in the default mode did not require any set up. This made the job of writing the firmware a lot easier.

            Testing the device was down to Ewan and myself walking around our warehouse with our eyes closed, trying to not bump into things. The code makes the haptic feedback unit 'Buzz' with a strength that is proportional to the closeness of an object, so you can feel when you are getting closer to it.

The Prototype connected to CR2032 bat:bit SLIM:


David Briscoe
Wednesday, 12 April 2017  |  22:38

Are you able to share the code for the VL53L0X sensor? I'm trying to prototype something with this sensor on the micro:bit. The micropython forum can't help me and I can't find any other code. I am an existing customer of yours so I'm hoping you can help. Thanks.

Tuesday, 9 May 2017  |  12:01

Hi David, Sure, Here is a link to the code : Haptic Test code