This week I began my summer research working on the MuscleMemory Bluetooth Application project. I worked on modifying the PhoneGap App, connecting the PhoneGap App with the Flora, creating and testing the bend sensor and soldering the Floras, and designing the database.
Modifying the PhoneGap App
At the beginning of the week I worked on modifying my PhoneGap app’s instructor and athlete pages as I had noticed a couple of bugs in my code. I fixed the bugs, added in comments to improve the clarity of my code, and then I added in a feature that would change the color of all of the circles on the app’s display to gold when all of the reps that had been assigned have been completed. I then figured that it might be a better idea to add in a feature where all of the circles for a particular set change to gold when that set has been completed. This was more difficult to implement as I had to completely change my updateTable function but in the end I figured it out and got it working.
Here’s an image of the athlete’s display on the app after the changes that I made:
And here’s an image of the instructor’s display on the app:
You can view my code for the athlete and instructor pages at the following links:
Also here’s my CSS for the app.
Connecting the PhoneGap App with the Flora (Trying to)
This week I also attempted to get the PhoneGap app working with the Flora via Bluetooth. It had been awhile since I had worked with the Flora Bluefruit so I reviewed many of the modules and I worked on getting them to run on the MacBook Air. I installed the NeoPixel and Bluefruit libraries on the MacBook so that I could test the modules and I set up the Bluetooth configuration in the example code so that it would work with Hardware Serial (the only configuration that works for the Flora). I then wired the modules exactly how I had on my Windows computer and tested them.
The modules worked consistently when uploaded the code to the Flora board from my Windows computer, but when uploaded from the MacBook with the exact same wiring and code I would receive the error message “Couldn’t find Bluefruit, make sure it’s in CoMmanD mode & check wiring?”. I was really confused by this so I looked around on the internet for a while to figure out what could possibly be going wrong. Eventually I found out that I could get the modules working on the MacBook as long as I didn’t use the Mode pin which was not required, but was recommended.
After feeling that I again understood how to work with Bluetooth I worked on trying to get the Arduino working with my PhoneGap app. I attempted to follow the example for locking and unlocking a lock via Bluetooth on the following website: http://makezine.com/projects/controlling-a-lock-with-an-arudino-and-bluetooth-le/. This example however uses an Arduino UNO which requires a different configuration for working with the Adafruit Bluefruit LE (Software Serial) than the Flora (Hardware Serial). I’ve tried to modify the code to work with Hardware Serial, but so far I have been unsuccessful. I’ve also been looking for examples of how others have connected via Bluetooth with a PhoneGap app using a Flora and Hardware Serial, but I’ve been unable to find any.
Working with John on the Bend Sensor and Soldering
During this week I also met up with John and we tested the latest bend sensor that he had created and we also tested Kim’s old sensors, but unfortunately none of the sensors worked. I then worked with John on creating new bend sensors and we also soldered on the necessary snaps for 2 Flora boards.
Using MySQL to Design the Database
Towards the end of the week I worked on using MySQL and designing the database for the app. I had a hard time accessing the database that we had put in a request for as it kept saying I did not have permission. Eventually I was able to access it though using my dad’s login.
In the database that I designed there are 4 tables:
- “activeConnections” which has columns athleteID, dateStamp, and connected which is a binary value that shows the athlete is either connected (1) or disconnected (0)
- “athlete” which has columns athleteID and athleteName
- “completedReps” which has columns workoutID, athleteID, and repNumber which represents the number of reps the athlete has completed
- “workout” which has columns instructorID, workoutID, dateOfWorkout, setsAssigned, and repsAssigned
By the end of next week I’m hoping that John and I will have created a working bend sensor, the database will be set up and working with PHP, and I will have the PhoneGap app working via Bluetooth with a Flora.