Connected Devices

Using a MKR to talk to the web

In preparation for the big assignment of Connected devices, I decided to follow through Project 6 explained in Chapter 4 of "Making things talk"

Following on the exercise was extremely easy and straightforward,  the only issue is: getting the MKR1000 to work, the challenge being posed when using in Windows, but nothing that a little bit of patience didn´t solve. I discovered that the best answer on how to install the driver is found here: https://www.arduino.cc/en/Guide/MKR1000 , and when I was not able to make it properly connect I went ahead and executed what appears to be a magic trick for the MKR: double-click the reset button. Also, I tried on an iOS while in a network that required for my device to be registered, after registering I was good to go.

sensorsServer.gif

The first part of printing information from the sensors worked perfectly, but as you can see in the next image I am not being able to change the website's color, I am sure it is just of a problem of properly writting the html. Lets hope I can fix that before class

MKRServer_colors.png

UPDATE: CODE WORKS, PAGE LOOKS GREAT!

The code for this is found in this repository

Learning Spanish with the "Jiu"

Now that we've learnt how to create servers and talk to them we are using this basis knowledge to talk to smart home devices such as the Philips Hue, and the WeMo.

Since it looked that it was way more documented I decided to work with the Philips Hue. Which is incredibly easy to use, specially if you have the IP address of your bridge (which I did because I was working with the ER's device).

In order to start smoothly and orderly I went through the Getting Started guide provided by Phillips Hue's Developer site.

It was incredibly easy to get it working and start to grasp how to create an app to control the device.

Again I went in a quest through the open wide web for examples and tutorials, and after trying many I found that the simplest one helped the concepts land in my head. Click here for a link to the Github repo I refered to.

Now that I was able to talk to the lamp I wanted to be able to control it with a p5 sketch, namely the one I made for the homepage of this website. My plan: as you dragg your mouse around the screen the lamp changes color.

Yet my mind was having a really hard time trying to figure out how this may happen. I now I looked into the ITP human web for help, it was Grau Puche with whom I worked in web apps before who came to the rescue. And he showed me how to use socket.io, which he explained is not the optimal tool to do what I wanted to do, but it helped me understand how I would use the way of talking to the bridge/light from Peter Murray's examples to create my own webpage which could control the light.

To finalize the concept. Since Grau and I speak spanish  and we tend to call our variables with spanish name, I decided to make a website in which you could learn the colors in spanish through colors. 

Click here to go to the repo where the bones of this project live.

Understanding servers

Or trying to anyway.

For connected device's first asigment we had to set up a simple server with a restful API and make do a GET and POST function.

This may seem pretty easy to anyone who actually understands servers. But for someone like me who is still trying to wrap her head around the whole network thing, some reiteration was required.

So after looking at a whole lot of examples and tutorials I landed on the following youtube video which is meant to guide you through making a form type of website which will get information input by users and add it to a database

There were several things I couldn't quite understand in the way so the time figuring them out took from my developing time.

Here is a list of my learnings:

  • I understood what dependecies are and how to install them through the json file created by npm
  • Kinda got middleware and how that is where things happen
  • Installed nodemon which is awesome to make testing more efficient
  • Used EJS still don´t know what it will be good for, it is working for the form I guess
  • Was hoping to use the express validator as a way of iterating through possible answers but that is not how it works
  • When I tried to reload my app it was not loading, because it was sending the info forever again (Then I discovered that I was aming at the add user url so of course it did not worked)
  • Yet when I went to the home it worked but then every time I was sending the new parameters it froze
  • Then he did a MongoDB data base but that is not of my interest now

Click here to go to the github repo where the three versions of this homework live