About two years ago I was working on a project for a weight training device that used an NXP ( formerly Freescale ) freedom board the FRDM-KL25Z. This was a rapid development using the MBED cloud based compiler. A provisional patent application has been made for this concept.
The basic idea of the project is to use a high brightness LED to communicate to the user whether they are doing an exercise properly. The high brightness LED makes the translucent material of a ball shaped enclosure glow RED if the exercise is being performed too rapidly, or the enclosure glows GREEN if the exercise is being performed too slowly. When the enclosure glows YELLOW then the user knows the exercise is being performed at just the right speed.
Since the hardware of Hexiwear and the FRDM-KL25Z have similar accelerometers and three color LEDs, I wondered if the firmware could be ported from the FRDM-KL25Z hardware platform to the Hexiwear hardware platform. It was close to this time that MBED.org announced support for the Hexiwear platform.
Porting the MBED FRDM-KL25Z software to the MBED HexiwearI opened the Hexiwear accelerometer example project ( Hexi_Accelero_Magneto_Example) as a starting point. I also opened the FRDM-KL25Z project I had made two years ago in my MBED Program Workspace. Since nothing has changed in the method that PWM signals are made for lighting the RGB LED and nothing has changed in the method timers are provided, code was simply copied and pasted into the MBED Hexiwear accelerometer example project. Transferring the program over to the Hexiwear platform was quick and fun, but I became eager to use Hexiwear to its advantage with its OLED display.
The OLED display adds a game-like feel to the use of the device , attractive to a wide range of demographic groups. Extensive research has shown that proper exercise form, particularly the rate of exercise is important for achieving the desired benefits from exercise programs. Additional refinement will use the accelerometer and add to it the rate gyro MEMS devices for assessing exercise quality.
In addition to this, planned future refinements will use the IoT aspects of the device to enable reporting on the performance of exercises to a wide number internet services from social media to medical care computer systems. A great benefit to the physical trainer / therapist is that paperwork regarding exercise is eliminated so that a better quality of service may be given in a more personal manner.
Adding OLED functionalityAfter looking at the Hexi_OLED_Image_Example it seemed a shame not to use the OLED display to make the REP Hexiware device a little more exciting. So I worked on creating 96 pixel by 96 pixel bitmap files to produce a picture that transitions from red to orange to yellow and then green. I also gave the picture some added significance by adding a logo from Indiana University.
For those people wanting to download the OLED version of REP Hexiwear into the MBED development IDE , click on the link below
https://developer.mbed.org/users/tom_minnich/code/REP_Hexiwear_OLED/
Microsoft Paint was used to create 96 pixel by 96 pixel .PNG files with the desired color transitions. GIMP was used to convert the .PNG files into the .BMP files with 16bits per pixel RGB 5:6:5 format.
How to export the file in GIMPFrom the File menu select Export as...
Name the file with a .bmp file extension and click the Export button
Check these options in the dialog box below and click the Export button.
Then the ResourceCollectionTool.exe program from the Hexiwear GitHub repository was used to create a images.c and images.h file to contain the bitmaps. Place the .bmp files you want converted into a .c and . h file into the same directory with ResourceCollectionTool.exe. Then run ResourceCollectionTool.exe . Click on the Add Images button, and then select the .bmp file you would like to add and click on the Open button. Add other .bmp files if you want and when you are done adding images then click the GenerateResources button.
The generated files noname.c and noname.h were renamed images.c and images.h
Minor edits were needed to the images.c file to make the bitmap data type uint8_t. Minor edits were needed to images.h to include a file with the uint8_t typedef.
I imported the library for the OLED display controller called Hexi_OLED_SSD1351. The code changes from my LED only version are directly inspired by the example project Hexi_OLED_Image_Example.
AutoDesk Fusion 360I designed a Hexiwear Holder for weight training barbells.
https://gallery.autodesk.com/fusion360/projects/rep-hexiwear?popupSNS=true
ConclusionsJust as in my original MBED project 2 years ago, the Hexiwear MBED environment shows its power to help us rapidly produce cool functionality without having work terribly hard to produce the cool functionality.
Comments