About IoT using Dfinity

I am thinking about utilizing Dfinity for IoT.
Through my study Wasm, I know it is expected for IoT other than web apps and blockchains too. So first my question is will be able to write a program in Rust or Motoko for IoT’s software and deploy it on an Internet Computer? it’s difficult to understand so I can’t imagine well.

I consider the below too. It’s like general architecture IoT and cloud for now. As you know, the Internet Computer plays the role of decentralized cloud and IC will integrate HTTP communication. In IoT devices, Should we better run the IoT devices such as C, C++, and Python and they communicate with the cloud using HTTP communication?
Please tell me which architecture is better?

2 Likes

This is an interesting question, however I don’t fully understand you. Could you please elaborate? Could you give me a concrete use case scenario?

write a program in Rust or Motoko for IoT’s software

What do you you mean by “IoT’s software”, any examples?

I consider the below too. It’s like general architecture IoT and cloud for now. As you know, the Internet Computer plays the role of decentralized cloud and IC will integrate HTTP communication. In IoT devices, Should we better run the IoT devices such as C, C++, and Python and they communicate with the cloud using HTTP communication?

The way I understand this is the following: you’d want to have some IoT device (for example: a microcontroller running ARM-based low-power chip made by Nordic Semiconductor on a custom PCB). Just to be clear, your IoT device is not as sophisticated as (let’s say) a Raspberry Pi - what I mean by that is your IoT device can’t run full linux, because if it can, then you are free to do whatever you wish. You would then want to connect that IoT device to the internet, and then you’d want your IoT device to interact with Internet Computer. If my understanding is correct, then there are few options you could try exploring:

  1. Use Rust and agent-rs. There are ways to compile Rust code for embedded devices. I’m not sure if agent-rs currently supports no_std flag which is required to compile Rust code for use in embedded devices - I opened a issue in our repository for the discussion to take place
  2. Use Micropython and ic-py - I’m not an expert on Micropython, but chances are this could work.
  3. This is probably the most amount of work, but everything still happens directly on IoT device: fork and play with agent-rs code, so that you will be able to compile it as a C/C++ compatible dynamic or static lib. Then, use that lib in your C/C++ code and compile everything into single binary and flash your microcontroller.
  4. The option you’ve already suggested - setup a server via centralized cloud provider, and use that server as a proxy/communication bridge between your IoT device and IC. This is option will surely work and is the least amount of work, however you would need to rely on the cloud service provider.

Sadly, I don’t know of any implementation of agent- libraries in C or C++, but I think the topic is worth further exploration.

1 Like

Thank you for replying. I’m happy to discuss.

It means the program that control actuators or sensors.
My question is whether such programs can be deployed in the IC.
I saw that Wasm was used for IoT. But I think there is some kind of misunderstanding the role of Wasm.
fig3

I had thought about using a Python agent, but Rust was the first time I had noticed it. I will study it. thank you.
However, what the Agent can do is post data from the IoT device to the IC. Isn’t it also important to send commands(e.g. remote control) from the IC to the IoT devices. The IC will integrates a GET request of HTTP communication, but a GET request would not be sufficient? Would you still need a POST request to send commands from the IC to the IoT devices?
Please tell me if I’m wrong as I’m still learning about telecommunications.

I don’t want to rely on a centralized cloud as much as possible. However, you mean this one?

Thanks for telling me all about it.

That’s very interesting, I haven’t thought before about using wasm on microcontroller, I guess writing a bootloader too accept the wasm is the biggest challenge, but the use case seems to be a good fit for the tech. Thanks!

Right, thanks for bringing this up - in my previous post I focused only on

IoT -request-> IC
  ^--response--| 

and have completely forgotten about the other use case, where the cloud sends a request to the IoT to control it. I’m happy to tell you that soon the feature will land, which will enable you to send GET/POST HTTP(s) requests from the canister to the internet. You’ll find all the details here. Please be advised the solution will not work for controlling nuclear fusion reactor :slight_smile: - the delays in communication will be too long for any use case where subsecond time resolution is required.

1 Like

Generally right now, you will be best off using a polling strategy from the IoT device. Every 1, 5, 10 or however many seconds, you can query the state of a canister for instructions

1 Like