Android Question How to connect B4A and B4R

Mark Read

Well-Known Member
Licensed User
Longtime User
I have a project at work where I need to build something similar to a 3D printer but instead of printing, I have a series of sensors on a sledge. This means I have movement in x, y and z axes. Each movement will be controlled with one or more motors via an Arduino Uno (my choice). The whole thing should be controlled with a tablet runnning B4A.

As I cannot use cable connections, I need another system linking the Arduinos to the tablet. My question is: Can I do this with Wifi, which would be my preference and if so how?

I cannot see how to make an app which talks to three different IP addresses at the same time (apart from a chat!).

I don't think bluetooth would work as in the environment where I am working, something disturbs bluetooth connections.

Any help would be appreciated.
 

Mark Read

Well-Known Member
Licensed User
Longtime User
I have seen an Uno board with built in Wifi (here)but it might be a clone. Can you recommend a ESP8266 board, as I am not familiar with them.

I have never used MQTT or sockets but am willing to learn. Time to search the forums I think.
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
I personally use these in most of my WiFi projects, including my house alarm project and my irrigation system project, but it depends on what you need it for https://www.aliexpress.com/item/D1-...32630518881.html?spm=a2g0s.9042311.0.0.4Qh1Nn, they are great especially if you are using a battery to power them, they can easily lasts for months with the correct power management implemented.

If I fancy a mix of everything or need more I/O then I use these https://www.aliexpress.com/item/Meg...32801281945.html?spm=a2g0s.9042311.0.0.qXDe9P

I also have the D1 that Erel posted above, but I don't really like them.

If I were you, I would start off with the D1 Mini and work your way up from there for connecting to an Android device.
 
Last edited:
Upvote 0

Mark Read

Well-Known Member
Licensed User
Longtime User
I was thinking of using the NodeMCU ver.3 (with a motor shield) as I have just got one to play with.

My planned setup would be something like (Imagine a crane moving along rails!):

1. ESP + Motor shield + Stepper [X-axis left]
2. ESP + Motor shield + Stepper [x-axis right] (X-axis is 28 meters long. Y-axis weighs approx. 25 kg)
3. ESP + Motor shield + 2x Stepper + Sensor via Serial Port and voltage reduction 5V to 3.3V [Y and Z axis]
4. Android Tablet to control 1 to 3

Power in each case is from a power pack (till now 5V) but I may need to go higher for motors.

1 and 2 need to be controlled simultaneously. Each item would have an IP (192.168.1.x). They are only connected to the tablet. I have no possibility to connect to an external server.

Regarding MQTT: If I am understand correctly, the tablet would be the MQTT Broker and the ESP's the clients (still reading up on this). What is not clear, is how do I send a command to a particular ESP. If I send "start moving" to 1 and 2, how does 3 know to ignore the command?

This is all research at present, as I have to make a presentation to my Boss soon.

Many thanks for the help.
 
Upvote 0

Mark Read

Well-Known Member
Licensed User
Longtime User
So as in post 7, 1 and 2 would be a topic and 3 a new topic? Is a topic bi-directional (still reading)?

Forget that last comment. I have a weather station at home with ESP8266, publishing to ThingSpeak. Just found an app for Android which uses MQTT to display my data - cool!

It looks very easy to implement.
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…