IoT using Google Cloud Service IoT solutions (Weave): How to connect Raspberry Pi and lighting the LED? - raspberry-pi

I am trying to connect my raspberri pi with Google IoT Cloud solutions using Weave. I have done it already using AWS and IBM Bluemix, but could not find a way to do the same using Google Cloud. As per their documentation, it seems that some of the fies have been deprecated or not been updated.
Moreover, they have been written in C language and I am not much of a C guy. I used Python for both the IBM Bluemix and AWS to connect my Pi to IoT and then establish the subscriber and exchange messages using MQTT gateway.
Can anyone suggest anything regarding this?
Google Weave getting started
To be more specific, certain packages which I saw in error logs while installing the below step:
make -C examples/host/light
it showed in logs the message like
could not find lldap
could not find llssh2
Even after installing them in my developer machine.
Due to error above, the below command
./out/host/examples/light/light
is not executed as the location
/out/host/examples/light/light
is not created by the above make command. Any suggestions for this?

You might want to try instead to use the new Google Cloud IoT Core product instead of Weave - full disclosure, I worked on it. It's currently in public beta and enables the scenarios you're trying to address. You should be able to use MQTT to communicate to/from your device.
There's a high-level overview of the platform on YouTube as well as an industrial applications focused talk from Google I/O.

Related

Can I use ESP8266 with edgeSDK?

I've started testing edgeSDK in a prototype IOT environment.
The idea is to connect devices with sensors and other nodes (Raspberry Pi, ESP8266, macOS, etc.) and exchange data or messages between them on the edge, trying to avoid communicating through the cloud.
(I will be also "mirroring" this exchanges in an AWS central cloud environment, to establish some comparisons/evaluations).
At this point, I have edgeSDK running on macOS and the Raspberry Pi and would like to add ESP8266 into the mix.
My Question is:
Can I get ESP8266 to work with edgeSDK? I don't see it listed as a supported platform.
If yes, which OS? (I was thinking about Mongoose, keeping the JavaScript coding and follow the standard).
Any other comments/suggestions or similar references would be very welcome!
ESP8266 is a microcontroller, which edgeSDK does not support. However, you can run a RESTFul API client on ESP8266 to call a API served by a microservice hosted by edgeSDK on a Raspberry Pi for example.

How do I deploy .BNA file on IBM cloud blockchain 2.0 resource?

I am trying to set up a rest API that is connected to an IBM blockchain resource. I have developed a model file, logic file, and acl file.
I have it all packed up in a nice tidy .BNA, and now i would like to deploy it to a channel of my IBM cloud blockchain 2.0 resource, running on a free kubernetes cluster.
Everything on the cloud blockchain resource is set up perfectly, and all orgs, peers, orderers, msps, and CAs are set up correctly. The channel is set up properly, and has nodes and an MSP connected. I have all the admin cred .jsons
The channel only accepts smart contract files, so I tried repackaging the files (logic.js, permissions.acl, and model.cto) by putting them in a contract folder, and using the IBM Blockchain vsCode plugin to package them as a smart contract, but trying to install on the IBM cloud crashes the browser.
I am thinking maybe I have to remote connect into the IBM kubernetes cluster that the blockchain resource is sitting on, and use the hyperledger composer CLI to install the .BNA
Seems very unintuitive, but thats the one thing I can think to try while I wait for this question to get answered.
I expected to just be able to install the .BNA as a smart contract, like a .cds.
In August 2018, IBM announced that we are no longer investing in Hyperledger Composer, and instead focusing 100% on Hyperledger Fabric. As a result, IBM Blockchain Platform v2.0 will not provide any support or tooling around Hyperledger Composer.
The good news is that we've significantly invested in the programming model (APIs and SDKs) used to write smart contracts and applications in Fabric v1.4, and we've also released some great developer tooling in the form of an extension for Visual Studio Code: https://marketplace.visualstudio.com/items?itemName=IBMBlockchain.ibm-blockchain-platform
The extension offers an extensive set of capabilities for writing smart contracts - with tooling for creating new projects, packaging them, deploying them, testing them, and debugging them - all from within one of the most popular IDEs around.
To get started - just install Visual Studio Code, and then the IBM Blockchain Platform extension (there are a few prereqs, check the README first). After that, you will be presented with a homepage that links you to tutorials and samples to help you get started.
For the first one, I can't really suggest a solution. At best, try installing and using the composer CLI and the latest version to make the bna file. Composer playground isn't maintained as well imo.
For the second part, in the connection.json file and docker there will be a bunch of IP addresses that look something like localhost:7040 and so on for the CA, orderer, org and peer. You will need to replace these using the IPs given by IBM. The examples on github that demonstrate integration are to do with nodejs SDK and not composer, however you can refer to https://github.com/IBM-Blockchain/vehicle-manufacture to get the idea.
This link is the only I could find for Hyperledger Composer and IBM platform.
(comments were getting too long to fit)

How to connect the back end and the front end and use the Discovery API in IBM cloud app services?

I am very new to using APIs so please excuse me. I am currently using a Python-Django App service from IBM cloud app services and the IBM Watson Discovery resouce. I have followed all the steps given here:
https://console.bluemix.net/docs/apps/tutorials/tutorial_web.html#before-you-begin
I have a machine that has docker and so the app got built successfully. However I am lost as to how I am supposed to get the front end ( which I am writing in bootstrap, javascript ) to connect to the backend and link the API.
EDIT
For example : I want my app to accept documents, feed them in Discovery, extract the keywords and sentiments and display them in the UI. How do I know what to access from the server side code and what to link where in the UI.
It is a very broad question but its a compulsory project I need to do and I am clueless. Pleaassee Help !
Before you try to integrate an API, you will need to be familiar with Python and Django. If that is not the case, then you really need to go through a series of tutorials.
Then before deploying to the cloud, you will be better off running your Django app locally on your laptop. Use pip to install the watson-developer-cloud pypi module and use the API documentation to build the python code in your Django application - https://www.ibm.com/watson/developercloud/discovery/api/v1/python.html?python#query
If none of this makes sense, then you need to brush up on your knowledge of Python, Pip, and Django.
When you have the app running on your machine, then you will be ready to package it up into either a docker image or cloud foundry container and deploy to the cloud.

How to integrate Watson IOT service to Hyperledger Fabric?

Due to IBM doesn't provide free plan for IBM Blockchain anymore, I come up with with solution to integrate Watson IOT to Hyperledger Fabric instead of IBM Blockchain.
I found this document, it say that Watson IoT Platform blockchain integration supports connecting to both IBM Blockchain fabrics and Hyperledger fabrics
(in section Config Blockchain IBM environment)
But I can not find any guideline.
Anyone can help?
I have several related comments:
1) The page you linked to shows an early version of the IoT Contract Platform that I authored. I have not been funded to port it to Hyperledger v1 so it must be considered deprecated at this time. Instead, I suggest that you get comfortable with the Hyperledger Composer, which provides a huge development environment and a powerful data modelling language.
https://hyperledger.github.io/composer/introduction/introduction.html
2) Which leads me to IBM's free container service. If you want to get started with IBM Blockchain on Bluemix, you can create a free kubernetes cluster using the instructions found here.
https://ibm-blockchain.github.io/
The "create_all" script gives you a working fabric on a lite cluster (as in free) with hyperledger composer running (with playground) and with a copy of the example02 ubiquitous sample Go chaincode running on the same channel.
https://github.com/IBM-Blockchain/ibm-container-service
EDIT: As for the iot connection, you can use node-red to create iot apps that will catch your events on a topic and then forward them to the blockchain. This is for experimentation of course, but you will get the idea how an application must be written.
If you want to follow my "partial state as event" pattern in composer contracts, you can look at the deep-merge npm project and mimick that code while we wait for the node based chaincode that is coming in Fabric 1.1, at which time I hope that we can import it as normal in our business network js files.
Using deep-merge requires that you create your own transactions for create, replace, update and delete in your smart contracts, but these are straightforward. The bonus is that it is also easy then to emit custom events defining what happened to listening applications.
I think you will like these two technologies together.
Instead of using the IBM Blockchain, you should create your own Blockchain. You should use the Hyperledger Fabric for that. You have the documentacion about it here. I suggest you to start reading from the Building Your First Network chapter.
Then, you should integrate your Blockchain with the Watson IoT.

How do I deploy server-side Swift on google cloud platform?

Im interested in implementing server-side swift on Google Cloud using "Perfect". Though Im quite new to server side, some guidance in implementing this would be helpful !
Knowing nothing about Perfect, I read Perfect's github page and see that in runs on Linux. Therefore, I see three ways to run Perfect on Google Cloud Platform, in order from easiest to most complicated:
On a Linux Virtual Machine in Google Compute Engine.
Building a custom docker image and running it in the App Engine Flexible Environment.
Building a custom docker image and running it in Container Engine.
If you're already familiar with Docker or Kubernetes, then options 2 or 3 may be easier for you.