Week 7: 💪💬⬆️⬇️➡️

Getting a glimpse of the light at the end of the tunnel!

14th July – 20th July

14th July:
We had a little depressing start to the week because our precious Communicating Manatee has gone to serve the country (the Manatee family misses him very much ;-;)! Today, we were focused on revising the homing sequence for the I2C protocol. Unfortunately, we were hit by yet another road block. The first problem we faced was the bars homing one after another (not simultaneously as we had intended). The programme is coded in such a way that for every one step moved by the Master actuator, it sends a corresponding letter signal to the Slave which interprets it and moves in the same way as the Master. This occurs for all 3 actuators before the loop repeats itself. However, by default, the Master sends one bit signal to the slave at a time. As a result, the last actuator that sends its signal in the loop overwrites the first 2, causing the asynchronous homing of the 3 bars. 

After some reconfiguration, we managed to increase the number of bits of information sent within the same signal, which fixed the first problem. Then, the second problem hit. We realised through analysing the serial monitor that there was some data loss during transmission to the slave board, causing the Slave actuators to move slower than the Master actuators. After some research, we hypothesised that this could be due to the I2C protocol. The need for both boards to acknowledge the address through which communication happens may make way for errors in transmission which led to the loss of data. 


15th July:
After realising that the I2C communication method might not be the most optimal for our system, we decided to use another serial communication method, UART (universal asynchronous receiver-transmitter) which is more straightforward for point-to-point communication compared to I2C (suitable for communication between multiple devices). With the updated code and communication method, the system worked better and we managed to reduce the difference in speed between both sides of the actuators until it was almost unnoticeable! 

Furthermore, we worked on the air pump code on the Slave which responded well to the instructions by the Master board. We ended work in half a day as we attended a volunteering session after lunch! We will be back tomorrow for more coding adventures!


16th July:
Today was a day filled with productivity as we managed to write and successfully run a code for manual calibration! This function allows users to manually calibrate their preferred height settings for side and back sleeping respectively. This will be achieved through the use of a set of 5 buttons explained below:

        1. Up: to lift a bar/ inflate the pillow
        2. Down: to lower a bar/ deflate the pillow
        3. Next
          • Short press: to toggle between the bars and pillow for adjustment
          • Long press: to toggle between calibration and sleeping mode
        4. Back
          • Short press: to move to back setting
          • Long press: to save current height as back setting
        5. Side
          • Short press: to move to side setting
          • Long press: to save current height as side setting

Additionally, we designed a 2-part tray that will contain our pumps and electronics to ensure the tidiness of our final prototype. We have sent the model for printing and we are excited to put everything together soon!


Model of the 2-part tray!


17th/ 18th July:
The last two days of the week were dedicated to putting our code together and seeing our hard work come to life! After successfully setting up the manual calibration function, the final piece to the puzzle was the automatic height adjustment mechanism. We decided to use a large sustained change in pressure readings on the first bar as an indicator for a change in sleeping position as the pressure difference was sufficiently large to account for minor fluctuations. Thankfully, after spending many hours coding, we are happy to report that the programme has worked well for two test subjects, a very rewarding end to a week filled with challenges. 

Next week, the Manatees will be going on a short break from MNT to fulfill our FOP duties and we’ll be back to give our prototype its finishing touches!