Showing posts with label smartphones. Show all posts
Showing posts with label smartphones. Show all posts

Sunday, 19 February 2017

Google Will Take Over The World - Terminator - Armageddon - End Of Days


I once said to my students back in 2010 that Google will take over the world, I don't think we're too far from all of that.

What I mean by that is an apocalyptic way, you've probably seen Terminator, where Kyle Reese is sent back in time from the year 2029 by John Connor to 1984 to rescue the teenage Sarah Connor from the claws of the T-800 played by Arnold Schwarzenegger who was sent by Skynet to kill her to prevent John Conner from ever being born, he of course is the leader of the Tech-Com resistance force who are trying to bring down Skynet.

So where does Google fit into all of this? Good question. We all know that google has been around since 1998, we also know that they quickly became the biggest search engine in the world. They're famous for developing the Android operating system, as of 2016 it is now in almost 90% of all smartphones on the market. So we can see how google has grown year after year.

In 2013 Boston Dynamics was bought out to the tune of $500 million. Boston Dynamics is owned by Google X, Google X is a semi secret research and development company owned by Google. Google is now a subsidiary of Alphabet Inc, a company created by the two founding members of Google, Larry Page and Sergey Brin back in 2015.

You only have to take a look at some of the robots that this company is making to see that the days of the T-800 are actually not that far away.

For those of you with smartphones, have you ever noticed how when you're having a conversation with someone that when you pick up your phone and start typing something into Google that it seems to already know what it is you want to search for? Maybe google is secretly listening into our conversations. They might use the excuse that it's all about providing us with a better service, but is this really the case.

How long will it be before we see computers and robots being developed into machines that look just like us. Yes it may just start off where robots are helping us around the house doing odd jobs here and there, there may even be sex dolls that can see to our every need, but where will it stop?

Google have already developed, tested and are now producing driverless cars, how long will it be before those cars turn to robots or can talk to you like another human can? If you're a fan of the 80s then you'll already of heard of Michael Knight and his car KITT.

How long will it be before google becomes the next skynet? And how long will it be before we see the first terminator robot serving on the frontline in Afghanistan replacing soldiers, how long before they're on our streets and our homes?

Node-Red Phone Pinger - Home Automation.

Node-Red Phone Pinger... Home Automation

As part of my home automation project that I have running on the raspberry pi, I wanted to use some sort of system where I could also automate my home security too, which is also built into my raspberry pi. I wanted to find a way to do away with the process of remembering to press buttons before you leave the house to set the alarm system and then the same again when you enter the house. It needed to be as fool proof as possible


I started thinking about using an RFID approach and build this into a key pad, coupled with an Arduino Nano and linked to my raspberry pi via I2c with the an RFID keyring attached to my keys, but again this involved me having to do something in order to arm and disarm my house alarm, it wasn't the approach I was looking for. I needed something that I would always have by my side pretty much 24 hours of the day but wouldn't cost me a huge amount of money. So, after searching the internet I found an easier solution by using my phone.


As I'm already using Node-Red throughout all of this project I found a way for Node-Red to ping my phone every 20, 30 or 60 seconds, it's really up to you. As I'm still in the testing stages I have it pinging my phone every 5 seconds.There are a few things you need to do in order to get all of this working first though.

Firstly, you'll need your WiFi on your phone active all the time, don't worry about running your battery flat, WiFi on smartphones usually only accounts for around 5% of battery usage. It will also need to have a static IP address too since you will need a way for your ping node to always ping the phone you want it to, this isn't as complicated as it first might sound but does involve you logging into your ISP router, for me it's Virgin Media and quite straight forward.

The thing I like using this approach is that you can lock your phones identity to your home network via the IP address you assign it and the MAC address built into your phone. It's a bit like using the RFID approach with a built in digital signature but of course using something that you'll have with you all the time.

Let's make a start. For Virgin Media users who have the black Super Hub 2, once you've logged in to your hub you need to click on the advance settings button (bottom right hand corner), when you get to the next page, scroll down towards the bottom to where it says DHCP, you'll need to click where it says "DHCP Reservation". On the top of the next screen you'll see a tab that says "Attached Devices", somewhere on this list you will see the IP address and the MAC address of your phone.

If you're not sure which one is yours then you can find this one your phone. For Android users, go to Settings > About Phone > Status and on the list you'll see the "IP Address" and "WiFi MAC Address" of your phone. In my case it was 192.168.0.8 and the MAC address ended with b3.

As I've done below, looking on the DHCP page of you router will reveal that your phone and it's MAC and IP address are listed.




Underneath all of this you'll see the section where you can add the IP address reservation for your phone, this means that it's only your phone with it's unique digital marker (MAC address) that can connect to your homes WiFi with the IP address that you specify. Give it a name to easily identify it, in my case I've called it "Reena Phone", after you've filled out the MAC address details you can then click the Add Reservation button.

Underneath all of this you'll see the IP Lease Table. This gives you a list of every device connected to your home network and the IP address that's been assigned to it by the DHCP server built into your router, or in my case, the IP address that you've reserved for specific devices that you have connected. You'll see here that I have five phones connected and all of their IP addresses have been reserved. Don't forget to click "Apply" before you finish.

Now we've got all of that out of the way we move onto the Node-Red part of the process. Below you can see the simple flow that I've got set up along with the two nodes, Ping, and Function.




For the Ping node it's pretty straight forward, all you need to do is enter the IP address of your phone, specify how often you want it to ping and then just name the node








With the function node we just need to add a few lines to make everything work. Because I have five devices that are going to be pinged I need to know which device is either on or off, to do this we have to set a topic message, in this case it's "Reena". I also wanted the output on this to be either a zero or one to represent on or off. The typical debug output for the ping node is either "false" showing the phones WiFi to be off or out of range, or a bunch of numbers which I imagine represents the ping time, but this is no good for what we need, which is a one or zero. So we need a simple if and else command and then output this as a message to the next node. 




In the case of the phone connected to the home WiFi network the output would be topic: Reena and msg.payload = 1 as shown here
So there it is, a simple way to use your phone as part of a home automation project which is secure and safe, but don't just take my word for it, try it for yourself. You could add extra nodes to the flow for more connected mobile phones/devices and then pull all of this into a function node to deal with the logic side of things.

If you fancy giving this a go just copy the code below and import it into Node-Red the usual way.

[{"id":"3e290137.a4488e","type":"debug","z":"c5eb5e6e.d7c1b","name":"","active":true,"complete":"false","x":671,"y":72,"wires":[]},{"id":"a39c7032.c8cc6","type":"function","z":"c5eb5e6e.d7c1b","name":"Analyze Result","func":"msg.topic=\"Reena\";\nif (msg.payload === false){\n        msg.payload = 0;\n} else{\n        msg.payload = 1;\n}\nreturn msg;","outputs":1,"noerr":0,"x":324,"y":72,"wires":[["3e290137.a4488e"]]},{"id":"89cba4fe.3d2058","type":"ping","z":"c5eb5e6e.d7c1b","name":"Reena Phone","host":"192.168.0.8","timer":"5","x":116,"y":72,"wires":[["a39c7032.c8cc6"]]}]

I'll add more for this as I go along, but If you have anything to say or add to this then please feel free to comment below, thank you.