kofiaddaquay (22) [Avatar] Offline
#1
Sorry i cannot help but ask. I am getting very excited but a question keeps creeping up i need to ask. Perhaps the books talks about this in the future... but Why do iot sensors and actuators come with such short wiring. I mean... if i bought a camera or and lcd and attached it to the pi 3 b... i cant use that in the real world. I understand these are for simple testing projects... but when i am finally ready and i wanted to connect to an iot camera in my garage...how does it hook to my pi 3? or how does the temperature sensor in my refrigerator connect to my pi? are we running cables eventually (one option) are we communicating wirelessly (another option)

can you please shed some light here smilie))))
domguinard (69) [Avatar] Offline
#2
Hi there,

Very interesting question, don't be sorry for asking smilie

kofiaddaquay wrote:but Why do iot sensors and actuators come with such short wiring. I mean... if i bought a camera or and lcd and attached it to the pi 3 b... i cant use that in the real world. I understand these are for simple testing projects... but when i am finally ready and i wanted to connect to an iot camera in my garage...how does it hook to my pi 3? or how does the temperature sensor in my refrigerator connect to my pi? are we running cables eventually (one option) are we communicating wirelessly (another option)

can you please shed some light here smilie))))


I think the answer is: it depends smilie You can see the Pi (thanks to it's GPIOs) as a way to create a super real-world aware device: adding sensors and actuators directly to it (wired) to make it a more powerful and smarter device.

However, you should also see the IoT and in particular the WoT as a network of devices where the Pi can become a Web gateway. This is the gateway pattern explained in Chapter 7 (Section 7.3): your Pi provides a Web API in the name of other devices that do not provide a Web API themselves. In this case it provides a Web (HTTP/WebSocket) API for a CoAP devices but you can apply this to any other device.

The communication between the Pi and other devices can use any networking protocol supported by the Pi 3, that is natively WiFi, Ethernet or Bluetooth. Support for other protocols (e.g., Zigbee or Thread) can be added using USB dongles.

This is the pattern we used to provide access to the Webcam we use on http://devices.webofthings.io (Chapter 2). The communication between the Pi and the Webcam is implemented over WiFi but this is transparent to app developers who use the API of the Webcam abstracted and provided by the Pi (e.g., http://devices.webofthings.io/camera/).

All in all I'd say that attaching sensors and actuators directly to the Pi is great to make the Pi itself smarter but it isn't a way of creating an Internet or Web of Things. For that, IoT systems largely use Wireless protocols to combine different devices together however, not all devices have to offer a Web API as long as one device acts as a Web Gateway.

Back to your use-case: you can place a Pi somewhere in your home, buy a cheap Webcam and build a plugin for communicating over WiFi between your Webcam and the Pi, implementing a Webcam Web API on the Pi. Rewiring the sensor in your fridge might be challenging and your fridge probably does not have wireless capabilities (unless it's a smart fridge). You could create a system with a Pi zero and the temperature sensor we use in the book (I actually did that in my fridge to ensure the temperature is stable smilie), then you could build your physical mashups to talk to both the Pi 3 (serving both its own sensors and the Webcam) and Pi Zero in your fridge.

In the future it is very likely for home appliances to come with some sort of WiFi connectivity (e.g., Thread) so their integration to the Web will be either out of the box or via Gateways.
kofiaddaquay (22) [Avatar] Offline
#3
Thank you so much for such detailed explanations. This is even more exciting that i thought. The Pi Zero has definitely got my attention now since the reason i bought the book in the first place was find out how i could use the Pi in my fridge for monitoring. So that would mean i would put the Pi Zero device in my fridge... I guess i can assume that they come built to survive in zero temperature environments. Might have to get the appropriate casing for it etc? Are there are free source codes online that might help me do this project... OR is going through the book enough the give me the info i need? I am still in Part 1 (chapter 3) (only because of the holidays)... Happy new year by the way! I am keen on getting the fridge project done this year... thats my new years resolution smilie

Re: "build a plugin for communicating over WiFi between your Webcam and the Pi".. do you teach how to do that in the book? If not, can you provide some resources on plugin development? Can the Pi work with any Webcam or videocam as long as u have written this plugin? I noticed that the shopping list didnt have a camera as well... but was hoping to have a camera and videocam as part of my project as well. I am sure the more i read the book the clearer things will become. I have so many questions though smilie smilie I will keep it short for now and go back to the book to get a little more knowledge. Thanks so much for your time and patience.

Kofi
domguinard (69) [Avatar] Offline
#4
Hi Kofi,

The book should be enough to build your fridge monitor indeed, check this: https://twitter.com/domguinard/status/757847165658013697/photo/1

I used the device of the book to monitor my own fridge and it worked great smilie

Good look and let us know how it worked!