The final project for Connected Devices was to create an IOT thermostat that would record the temperature in whatever room it was placed in and then send that temperature to a remote server. The thermostat was required to have a working UI and post the temperature to the server once every hour for a week straight.
After a lot of trial and error I was able to achieve this using the MKR 1010 microcontroller, much assistance from Tom Igoe, and Koji, and a few repos listed below.
The initial setup of the MKR1010 took quite a while. Having to make sure that the most up to date firmware was present on the device, adding the mac address to itpsandbox, and then receiving a static ip address for the device. Once all of this was done and I was assigned a specific session key I could begin really working.
I made the decision to use dweet to test that I was sending data correctly. First I wanted to test the server with a static value and once that sent properly I set up the temperature reading circuit and sent the temperature data to dweet. Both of those worked correctly so I moved onto the real thing.
This is the part of the assignment where I wish I could say everything worked perfectly the first try but I ended up spending more time than I care to admit trying to fix an error that made little sense to me. Multiple people attempted to help and it wasn’t until Tom took a look at my code and realized that in my call to the server address I had added “https://” this created a -2 HTTP Status in my code even when everything looked like it was sending to the server properly.
Once this issue was fixed I got my first 400 Status, this wasn’t ideal but I was still elated because at least I knew that it was because of a JSON formatting error rather than some unknown.
After a lot of tweaking to the JSON I was sending I finally got a 201 status.
Curling to the server proved that I was successful and could focus on doing a bit of fine tuning and working on the UI. I decided not to invest as much time in that aspect so I stuck to a simple LCD screen and potentiometer combination. The LCD displays the current room temperature in Celsius and the potentiometer simply turns the temperature display on or off depending on the state of rotation.
Here is a video of the working device:
A link to the code repo can be found here: Link