Intro: A Useful Remembrall
If you've ever watched the Harry Potter series, then you would have seen Neville receive a gift from his Gran which was a Remembrall. For those Muggles who haven't watched it yet or don't remember the scene, a Remembrall is a large marble sized glass ball that contains smoke which turns red when its owner has forgotten something. It turns clear once whatever was forgotten is remembered. Now that's very useful for someone like me who forgets stuff pretty often, but it doesn't let you know what you've forgotten!
I planned to binge watch the entire Harry Potter series again a few days ago and when I was done with the first movie, I thought why not make a real Remembrall. Naturally, I searched the web to see if anyone had made it already and to my surprise two people actually made it! Inspired by this great instructable I decided to build it using a NodeMCU and make it even more useful.
In this Instructable, you will learn how to make your very own Remembrall on which by pressing a button it lets you know what you've forgotten!!!
Step 1: Gather All the Stuff You Need
Here's a list of things you need to make a Remembrall:
- LED of your choice(red is the default color)
- Jumper wires: Male to Male for prototyping and Female to Female if you don't want to solder in the end
- Push Button; preferably this kind because it'll make yours look way better than mine
- Li-Po Battery(make sure it's supply is no more than 5V)
- A plastic ball or a Christmas ornament which is atleast 6-7cm in diameter
- Hot Glue Gun and sticks
- Soldering station
- Drill Press and bits(for the button, it'll vary according to the button of your choice)
Software and online Services:
- Arduino IDE
- Todoist API
- PushBullet API
Don't worry if you've never heard about the online services mentioned above, you'll learn how to use them in the next few steps.
If you want it to look good then do have a look here. She has made it look amazing!
We will be programming the NodeMCU using the Arduino IDE, not MicroPython or Lua.
Step 2: Overview: How Does It Work?
In case you're not interested in knowing how it works or you're in a hurry to just build a Remembrall, then have a look at the flowchart and go on the next step.
In this section, you will get to know how the Remembrall works and the bits and pieces that make up the entire project. While this can be called an IoT project, it doesn't really take sensor data into account if you ignore the push button which is the only thing in the entire project that can be possibly be considered as a sensor.
If you haven't worked with an ESP8266 module or NodeMCU before or haven't yet set it up then click here.
Todoist is a task manager app where you can create and manage tasks productively. Create an account on Todoist, this where you list things that you don't want to forget. It's very easy to use because you can just naturally type the time and date that you need to complete a particular task by and also set priorities and so on. The API provided by Todoist is very simple to use, documented well and the JSON response is very easy to PARSE ;)
It's not always easy to get responses from API's over HTTPS when using modules such as the ESP8266, but I have heard that the ESP32 makes that simple. So, in order to use them we take the help of ThingHTTP which is a product of ThingSpeak that simplifies communication between devices such as the NodeMCU and API's and allows us to perform HTTP requests. In simple words: ThingHTTP provides you with a new URL to use an API that is supported by NodeMCU.
It's an app that allows you to share media across your devices with ease. If you want to open a website that you're currently viewing on your phone but want to view it on your laptop then just share it via PushBullet and it automatically opens the link for you! It can also be used to send tiny notes, which is what we will be using to notify when you've forgotten something. If you're not using it already then click here to create an account. They too have a neat API that lets you send notifications from devices such as the NodeMCU.
The API provided by PushBullet also communicates over HTTPS, but I've not been able to figure out how to send custom messages via ThingHTTP to the PushBullet API which is why I decided to go ahead with PushingBox which is similar to ThingHTTP but allows you to send custom messages in a rather simple fashion. Put simply it does the same thing as ThingHTTP that I mentioned earlier.
Now that you have a brief idea of the services that are used, read the next few lines to know, how all of these are connected. Here's how it works:
You enter your tasks on Todoist, preferably with due dates and times. Connect the Todoist API with ThingHTTP and get a new URL. Periodically send requests to this new URL that you have obtained and check if there are any due tasks by parsing the JSON response. If there is any task that you have forgotten to do even after say 10 mins (later you can redefine this buffer in the code) then the LED is triggered letting you know that you've forgotten something or haven't ticked off your list yet. Now if you want to know what you've forgotten then simply press the button and you'll receive a notification from the PushBullet app that will show you the details. How does it send this notification? Similar to ThingHTTP you get a new URL from PushingBox and then simply send the list of tasks to that URL and they will send it to PushBullet. During the periodic checks the Remembrall performs, the LED turns off if there are no tasks that are due, meaning you're safe!
And that's how it works!
Step 3: Todoist and Their API
If you don't have a Todoist account then make one here. I've briefly described it's awesomeness in the previous step so once you have an account then sign in and go to their API documentation and click the Tab that says Manage App and click on the Create a new app button.
In the new window You will have 2 text fields:
- App display name: Remembrall(your choice)
- App service URL: leave it blank
If you scroll down you will find a section that says Test Token and a Create test token button. Click that button and you will get your access token. Save this somewhere.
Just below you will find a Webhooks section. Here there's a text-box that reads Webhooks callback URL. In that box enter this: https://todoist.com/API/v7/sync/ . Next there's a drop-down list where you can select a version, choose 7. Below that there will be a grid of check-boxes, check the box that says item:uncompleted, and click the Save webhooks configuration button.
Once you've done all that don't forget to save your access token in a notepad file or a sticky note. In the next step, we'll connect ThingHTTP with this API.
Step 4: Connect Todoist With ThingHTTP
ThingSpeak is an IoT platform with many apps and services made by MathWorks that you can program using MATLAB. Once you've signed in, in the top nav-bar under Apps click ThingHTTP. Click the New ThingHTTP button. You'll get a form in which only fill these 2 fields:
- Name: again, your choice
- URL: https://todoist.com/API/v7/sync/?token=your_access_token_here&sync_token=%27*%27&resource_types=[%22items%22]
Replace your_access_token_here with the token you saved in the previous step. Below the Name field there's an API Key field, save the key provided.
Then save and proceed to the next step.
Step 5: PushBullet and Their API
Sign into PushBullet and complete the basic setup steps given. Also install the PushBullet app on your smartphone from your respective stores and sign in to them too. Click the Settings button and then in the Access Tokens section click the Create Access Token Button. Save this access token and go to the next step.
Step 6: Connect PushBullet With PushingBox
Sign into PushingBox and go to the My Services section. Click the Add a Service button and select the PushBullet service. In the dialog that pops up, enter a name and paste the PushBullet Access Token you saved and click on Submit.
Go to the My Scenarios section, enter a name for your scenario and click Add. Click the Add an Action Button and choose the service you just made. In the dialog that pops up enter the fields as shown in the Image. The text between $message_param$ is your list of due tasks that you will send in your request. Save the Action and go back Your virtual scenarios list, here you can find the DeviceID for your action, save it.
Hang on there, you're almost done!
Step 7: Upload the Code! And.... Done!!
Connect the components on your breadboard as shown above. In the code there are certain lines with TODO in the comments change them according to the tokens that you saved earlier. You can find the code on my GitHub repo.
Here's what you need to change in the TODO lines:
- ssid: your WiFi Network Name
- password: your WiFI password
- thinghttp_API_KEY: the API key you saved in Step 4
- deviceId: the DeviceID you saved in Step 6
Pay heed to the LED and button pins used in the code, you can change it by following the schematic shown above. Then Upload the code!
You can change the variable bufferTime to your choice, but it will turn red only if you've forgotten your task after so said minutes, there's also the constant interval in which 30 means it checks for due tasks every 30s, you can change that too!
Once you've done that time to put it all inside your casing and you've just made your very own Remembrall.
You should be proud for a Muggle ;)
Step 8: Improvisation
Here are some tips to make your Remembrall even better, this way you will understand the code and can build your own IoT projects!
- Instead of a normal LED use an RGB LED to vary colors according to priorities, connecting to WiFi, errors...
- If there isn't any task that's due and you still press the button, then you must get a notification saying that you haven't forgotten anything, currently it doesn't send any notification.
And of course, the appearance. I didn't have access to a clear ball and not much time to solder everything so I just stuffed everything inside, so if you're building one do it properly because when it comes to the Remembrall the way it looks matters if you're gonna show it your friends or fellow Harry Potter fans!
If you have any problems with the code or any of the steps then please do comment below. Thank you!