HuskyLens

11th February 2020 0 By alister

I ordered a Huskylens on kick-starter way back in 2019, it has finally arrived & although it is no unlikely to be used on dangle it seemed appropriate to write a few words on this product for anyone considering using it in the future.

First of all the item arrived well packaged & included a nice fitting silicone rubber sleeve/case & a mounting bracket.

The inboard display is nice & bright & the menus are easy to navigate. Initially I had issues upgrading the firmware for 2 reasons:-

  1. The official upgrade process is currently only available on windows & I don’t use windows.
  2. Once I installed the upgrade firmware on my work laptop it refused to communicate. after much trial & error I finally traced the problem to a poor quality USB cable (despite it functioning without issue with my phone).

The current documentation (https://wiki.dfrobot.com/HUSKYLENS_V1.0_SKU_SEN0305_SEN0336) only provides example code for Arduino so I had to work out how best to use it with a RaspberryPie.

Connection is via a 4 pin JST connector using either I2C or serial protocols. The Huskylens can be set to auto detect but it is better to configure it with a fixed protocol. This is because once the unit has decided on its protocol it will not change until it is reset & it can easily become confused when the Raspberry is booting.

The communication protocol is quite well defined, serial is straight forward as you would expect but I2C is a little different to most devices

Rather than the more usual ‘register bank’ configuration of most I2C devices it simply has an input buffer & an output buffer. This means that the normal python SMBus library is not suitable & you need to be able to write & read the I2C bus directly. One advantage of this is that once you have configured your RX/TX routines to use either serial or I2C the rest of your code can remain the same.

I have now crated a very simple python library which makes setting the made of the device & reading the data quite simple currently it only returns the raw data packets as provided by the Huskylens but Intend to expand it to give pre-formatted data for easier use.

This library is released under GPL3 & can be found on GitHub (https://github.com/erawretsila/HuskyPi). this should e considered very much a work in-progress although I will try not to make any backwards incompatible changes.