Blog 4 - Analog Out / IFTTT

 Blog 4 - Analog Out / IFTTT

Introduction

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.







Comments

Popular posts from this blog

Blog 2 - HRV Demo

Week 1: HRV Review

Lock In Day 1 (20/05/25)