IoT (Internet of Things) - What do you think?

Roycefer

Well-Known Member
Licensed User
Longtime User
An idea I've been playing with:
  • A general purpose sketch that would run on Arduino hardware
  • A B4X library that could communicate with above via serial (BT, USB), ServerSockets (Wi-Fi, Ethernet), or a REST API
  • Because the B4X library will abstract away most of the connection details through prodigious use of conditional compilation, it would ideally work across all B4X platforms.
The programming architecture would be sort of a blend of how B4J WebSockets work and how the IOIO works. In analogy to B4J WebSockets, the Arduino sketch would play the role of b4j_ws.js and the Arduino hardware would play the role of client browser. Any B4X device running a program with the aforementioned B4X library would play the role of the B4J server In analogy to IOIO, the B4X library would send commands to the Arduino which would instruct the Arduino how to set pin states and numerous other functions. The Arduino would also send data back to the B4X library which would raise events on the B4X device.

Pipelining synchronized microsecond-accurate pin state changes (like the IOIO) would be an immensely powerful feature; imagine robots programmed in B4X, anything CNC, time-lapse camera rigs, etc...

The advantage to this over IOIO is that Arduino has a MUCH wider variety of hardware with tons of accessories and a huge user community and some small but growing measure of academic acceptance. In addition to the 8-bit and 16-bit AVR Arduinos, there are 32-bit ARM Arduinos and x86 Arduinos. Another advantage is that this setup could make it so an Arduino will have a default program to run when a B4X device isn't connected, something IOIOs can't do (without modifying the firmware).
 

Roycefer

Well-Known Member
Licensed User
Longtime User
Very interesting. Ardulink already does much of what I described. Thanks for the link. I think wrapping Ardulink and maybe adding some additional functionality (like a default loop if Ardulink doesn't have that) could be a good solution.
 

Cableguy

Expert
Licensed User
Longtime User
Most are concentrating on the µprocessor board, being it Arduino, raspberry, banana pi, orange pi or IOIO, but no one seems dedicating time to job-specific libs/classes.
The basis to use these boards are there already, but some shields are simply too hard to implement, like the gerbel, or LCD specific classes.
In my opinion, is just that that's missing... the same easiness Arduino has to connect to it's shields trough the easy to find classes/libs.
 

b4auser1

Well-Known Member
Licensed User
Longtime User
Let's compose into the architecture B4X-IoT ready to use components:

Arduino hardware sketches communicate via
Arduino Client for MQTT / NanodeMQTT + jMQTT - Official MQTT client
with
B4x apps.

To simplify development it is necessary to develop a set of B4x objects implementing request/response objects to be sent/receive via MQTT to/from sketches running on Arduino hardware.
As well it is necessary to build a set of functions for Arduino sketches which are responsible to convert data from/to sensors/devices connected to Arduino into the messages for B4X apps.
It's possible to use a set of json structures for the MQTT messages and B4X library will support conversion json structures from MQTT messages into B4X objects and vice versa.

Build a cloud-ready temperature sensor with the Arduino Uno and the IBM IoT Foundation, Part 2: Write the sketch and connect to the IBM IoT Foundation Quickstart
presents an example how to build the architecture to communicate with Arduino via MQTT.
For JSON objects we can use f.e. structures from IBM IoT Foundation Quickstart
 

Toley

Active Member
Licensed User
Longtime User
Blynk is one of the coolest project actually available for cheap IoT http://www.blynk.cc/

Blynk with an ESP8266 (Arduino core) is by far the cheapest and easier way to go for IoT. Sorry Erel but I can't see how B4X can do more.

Note: I'm not affiliated in any way with Blynk.
 

Roycefer

Well-Known Member
Licensed User
Longtime User
Blynk seems pretty cool but there's a lot B4X can add to this. It's not just about pure IoT functionality, it's about integrating that functionality into other more powerful systems. For one, Blynk seems to do everything over HTTP; a B4X IoT system could, in principle, be connection-agnostic. Integrating IoT into a B4J server would add a ton of value.

And then there's the code reuse argument in favor of creating a B4X IoT framework.
 

b4auser1

Well-Known Member
Licensed User
Longtime User
Blynk seems pretty cool but there's a lot B4X can add to this. It's not just about pure IoT functionality, it's about integrating that functionality into other more powerful systems.
+100.

If we are talking about Arduino, it would be great to have B4s IDE - to create Arduino sketches using B4x language :)

Integrating IoT into a B4J server would add a ton of value.
I agree, but have an option to build IoT system without B4J server good as well.
Using MQTT broker allow to build applications in B4a, B4i, B4j even without B4J server.
 

woniol

Active Member
Licensed User
Longtime User
Hi,
Im my opinion B4X is a good solution for IoT development,
but there are some things that can be improved about secure connection between devices.

I work on a SmartHome solution using B4X:
- Android Client is written using B4A
- Server written using B4J it runs on Raspberry Pi
- Node software written using B4J (nodes are Raspis too)

I wrote the communication (client->server, node->server) using B4X Websocket server.
It is ok for testing purpose and for my private use, but when I show to my potential customers they alwas ask me if it's SECURE?
I can't say that since b4X doesn't support wws connections.
Other questions are related to the IOS support, which i plan do work on, but still not sure if the wws connetion will work.....

The new Mqtt coud be the solution for my problems, but i will too spend too much time on it to change to mqtt, and Im not 100% sure
is it's ok for client -> Server communication.

So secure web socket connection (wws) is the thing to work on.
 

KMatle

Expert
Licensed User
Longtime User
I did not use B4J (VS 201x is my favourite), but ... Since I know that I can use it to make programs for the RaspBerry, I'm in...

Benefits:

- I needed 30 Minutes from unpacking the brand-new RaspBerry to "my B4J-program runs!!!!!!" (Installation and updating the RB not included)
- Programs can be debugged with B4J-Bridge
- you can code & test offline without the device (except you need the hw to test)
- code can be re-used from B4A (as long as you build a non-ui app)
- it's easy
- there are examples/tutorials
- there are libs which can be used

What we could do is:

- have an extra Sub-Forum for the RB/Arduino
- build examples/libs for all standard extension boards to cover it "all" (PiFace digital is available, PiFace control would be nice)
- publish, that B4J is excellent to develop RB programs
 

woniol

Active Member
Licensed User
Longtime User
Hi,
one more feature i think of is a possibility do make some kind of plugin system in b4J.
The main program should communicate with plugins (also writen in b4X) using some kind of api(interface).
The user can choose which plugins to use.
Plugins (connectors) for different controls (like tv, audio eqipment, other HA systems) could be written by other developers.
It's similar to libs, classes but with option which one shoul be initialized with the main program start.
 

coslad

Well-Known Member
Licensed User
Longtime User
I would like to see a broker written in b4j. In that way I can manage each message and topic, for example, to save any of they to a database, to send an email etc.
 

freedom2000

Well-Known Member
Licensed User
Longtime User
I have an old Android phone stil working.
Convertir it info mqtt broker would be nice + opene API to do things with it.
 

Michael1968

Active Member
Licensed User
Longtime User
Relays.jpg


raspberrypi
+Raspberry 7" touch
+relayboard
+ B4J

I like it:)
 

Toley

Active Member
Licensed User
Longtime User
Hi all, after some reflexions/experiments, here are my thoughts about B4X and IoT.

Everything depends on what you mean by IoT. For me IoT is used to get data from different devices, send them over the Internet and then show that in a graphical way. It can be used to see how cold your wine is in your cellar or monitor the voltage of your car’s battery on winter and so on.

The combination B4J/RPi/Webapp can do a lot more than that. It can makes many IoT devices connected and interract together on a complete system. This is more a kind of home (or system) automation IMO.

That said, IoT requires additionnal hardware and RPi is much too expensive and overkill for simple IoT. Arduino, ESP8266 and the like are much more adapted for that purpose. B4X should focus on much more complex system than simple IoT.

From my experiements the most complicated part in a B4J/RPi/Webapp project is the web side of the thing. I’m not a web designer (and don’t want to be) I have limited knowledge of HTML and I have found that almost all of the Webdesign tools are made for Text/Graphical contents. If we can have a tool like the B4X designer to design webapps with controls and buttons and makes it easier to integrate with the B4J code, it would be fantastic.

B4X are great softwares but if you want to have a place in the IoT world you must choose your battles wisely. The goal being here not to convince the existing fans (which I am believe me) but to seduce new ones.
 

Cableguy

Expert
Licensed User
Longtime User
From my experiements the most complicated part in a B4J/RPi/Webapp project is the web side of the thing. I’m not a web designer (and don’t want to be) I have limited knowledge of HTML and I have found that almost all of the Webdesign tools are made for Text/Graphical contents. If we can have a tool like the B4X designer to design webapps with controls and buttons and makes it easier to integrate with the B4J code, it would be fantastic.

That's exactly what ABMaterial is promising us!!
 
Top