Following on from the previous lab, we took on the task of configuring an analog out applet, where we could send a http request to our microbits from an applet. I partnered up with Dean Sinnott where we configured an applet that once an event would be added to my google calendar, it would display on the microbit.
Week 1
Initial Implementation
For the initial implementation, We decided to try and reverse the configuration I created the week before. We immediately ran into troubles as IFTTT does not provide a webhook for the "then that" part of the applet. With the help of ChatGPT, We found a resource called AdafruitIO, which allowed me to create my own webhook to attach to the applet.
We were running into issues using this implementation on IFTTT's side as it would never trigger the webhook, yet the webhook could be triggered manually using a curl post request.
Serial Implementation
We decided to go down the route of using a serial implementation rather than the cloud board.
We created a flask app and used a tool called ngrok to give it an accessible webhook URL. We attached this URL to the IFTTT applet which was triggered by adding an event to Google Calendar. We also put some basic makecode onto the microbit to read the event title and display it on the LEDs.
Week 2
Class Discussion
Following the first week of the sprint for getting Analog Out working with our Microbit controllers, we had a class discussion about the progress each of us had, along with issues using IFTTT. It was mentioned that a lot of apps on IFTTT did not work, but that the Google suite of apps seemed to work fine. We discussed about alternatives to using IFTTT but this would have required us to have direct access to APIs outside of IFTTT.
Cloud Implementation
Our main goal for the second week of the sprint was to get the same functionality to work but using a DFRobot CloudBoard V2. We decided to go for basically the same approach and set up except changing the makecode to use the DFRobot_IoT_Cloud_Kit extension. We configured the makecode to read in the ngrok endpoint as our webhook. We then had a loop to get the message from the endpoint into a string and return it to the microbit LEDs
We were running into issues where we had timeouts on the microbits side. We wanted to find out where the issue was taking place so we looked at the logs for both the flask and ngrok server.
Since everything seemed to be going through on the ngrok and flask side, we also inspected our IFTTT Applet.
This was also working perfectly as intended. We realised after an hour of testing, that the issue was lying among the makebit code not being able to do a get request for both our ngrok endpoint and our flask endpoint. In order to fix this, we would have to abandon makecode and find an alternative solution to put onto our microbits.
Conclusion
Throughout this sprint, we explored various ways to integrate analog output using IFTTT and our microbits. Our initial approach using AdafruitIO proved to be challenging due to IFTTT’s webhook limitations. After changing to a serial implementation, we successfully set up a Flask app with an ngrok tunnel, which allowed our microbits to receive and display event data from Google Calendar.
In the second week, we attempted a cloud-based approach using the DFRobot CloudBoard V2. While the setup was similar, we encountered timeouts on the microbits side. Despite verifying the functionality of our Flask server, ngrok tunnel and IFTTT applet, the makecodes inability to properly execute GET requests forced us to reconsider our approach.
This project highlighted the complexities of integrating third party tools with microcontrollers for Analog Output. While we faced several challenges, the experience provided valuable insights into debugging network issues, using webhooks for input and output and adapting when initial solutions don’t work as expected.
Lab 2 - Simple Heartrate Sensor Demo For the second lab, our task was to explore the capabilities of the Micro-Bit platform by connecting an external sensor to the microcontroller through its' GPIO pins. Readings were aquired through a simple serial read script created in Microsoft Makecode. In this case, the external sensor measures heart rate / pulse by shining a bright green LED light into skin tissue and measuring the light reflected back. As the heart circulates blood around the body, a small variation in pressure occurs within blood vessels, arteries and capillaries. This pressure variation can absorb more or less light at various stages of the heartbeat and is the primary mechanism of the HRV sensor. By detecting fluctuations in light reflected back from the body, it is possible to get an acurate reading on our heartbeat. A similar mechanism of measuring bloodflow is used in other 'smart' technology such as smart watches, fitness bracelets and even in professional me...
What is it? Heart rate variability (HRV) is the measure of the variation between heartbeats. It is controlled by your autonomic nervous system (ANS). This system operates automatically and regulate process such as the heart rate and other bodily functions that are are not under conscious control. This system is broken into two branches the flight or fight (which preparing the body for action and stress) and the rest + digest (which promotes relaxation + recovery). HRV is influenced by the ability to smoothly shift between these two branches. High HRV: Larger difference between successive heartbeats - Indicates a more flexible and adaptable autonomic nervous system. Low HRV: Smaller differences between successive heartbeats - Indicates a less flexible autonomic nervous system. ...
Lock In day 1 Briefing We started the day with by getting the project briefing on what the end result should be. We decided to make a system where we could read in heart rates using a Microbit and then send that via the cloud to a website that would display real time data from the heart sensor. Kanban planning Once everyone had a clear understanding of the briefing , we began defining a KanBan chart so that we could organise and allocate tasks. This consisted of Backlog, Doing, Done, Testing and Complete columns where we could quickly move tasks into different columns as they are completed. Group allocation We began breaking down the steps required to complete this pipeline. This consisted of many different areas such as creating the cloud infrastructure on AWS, reading data on a micro bit and radio sending it to a raspberry pi so that it could be sent to the cloud infrastructure, creating a u...
Comments
Post a Comment