How to read from WiThumb on-board sensors

There are two sensors built-in to WiThumb

The following sample code performs basic reading from the sensors and requires MCP9808 library from Adafruit, I2C library and MPU6050 library.

Code explained

The program first initializes the serial port to 115200 baud. It is for printing messages for debug purposes.

Next, it initializes the temperature sensor and takes 10 readings from the sensor. If the average temperature is between 40 and 120 degree Fahrenheit, this part of the test passes.

In the 2nd part of the test, it reads the X, Y, Z orientation from the gyroscope. In order to pass this test, the user needs to rotate WiThumb in all 3 axes within the time limit.

Please refer to the GitHub page here for the full source code.


  • moyboyufl

    When will you be providing sample code for interfacing with the MPU6050? Also, will you provide schematics? Thanks!

    • In fact, the sample code for MPU6050 is mentioned in this page. I am attaching the link again.
      I will post another example in the future.

      • moyboyufl

        Oh great! Sorry, I saw it only required the library for MCP9808, didn’t realize it had code for the MPU6050. You may want to mention on this page that you need to install I2Cdev and MPU6050, and where to find it, as it won’t compile without it. A reference to this is in the code, but it would be nice to warn the user on this page.


  • Petri Savolainen

    I managed to compile the code using Arduino IDE, with required dependencies @moyboyufl:disqus mentioned fetched from GitHub repo of But Arduino IDE produces .hex files as output. How can those be converted to .bin files suitable for flashing to WiThumb? I tried googling but found nothing.