Micro:bit Distance Reader with Haptic Feedback
2 CommentsFriday, 17 March 2017
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 (on our upcoming CR2032 bat:bit)