Best way to get sensor data from NR on Android to NR on RPi

I am currently building an astrophotography barn door tracker (haig mount) using NR as the control system. In order increase accuracy, I want to use an instance of NR installed on my android phone to provide sensor data (such as GPS co-ords, compass bearing and accelerometer) to NR running on an RPI.

My first thought was to try using BLE, however I quickly discovered that RPi doesn't make this easy.

What would be the easiest way for a beginner to set up this transfer of information from NR on Android to NR on RPi?

If both are on the same LAN, then MQTT is the easiest & best method IMO.

1 Like

As Steve implies, it depends upon the connectivity between your phone and the pi -- if they are both connected to the same network, it's simple to use [tcp, udp, http, mqtt] to send the data. It would be trickier, but you could set up telegram, sms, even email listeners on the pi.

But it sounds like you are asking about near-field communications like BLE. I'm guessing you want this to work outside, or somewhere that does not allow internet or private lan networking? In that case, I think your only options are wired (serial line connected to gpio, usb cable) or wireless (bluetooth, infrared, zigbee). Of course you could also display the location/orientation data using your phone, and enter it manually into the pi (assuming some input device with display).

But this does bring up an interesting question -- has anybody used a phone or tablet, connected by usb to a raspberry pi, as an input device? If so, I have some old devices that I could repurpose... :thinking:

If you can give us a better picture of what you want to set up, there will likely be someone who has better answers for you. Good luck!

Could you provide info or a reference for how you accessed the phone sensor data (android?) using NR? I wish to report weather data, specifically wind data, from a boat on a mooring. I can get the weather data from the anemometer using NR running on Android. But, as the vessel rotates on the mooring, the wind weather data needs to be adjusted to reflect the boat's orientation. Thanks in advance.

Welcome to the forum @MBK

Have you read through the thread and considered the suggestions there? MQTT is often the easiest way for problems like this.

Thanks @Colin. I'm afraid I'm very new to this sort of thing. Since posting I found, and installed, redMobile for Android. I'm now using that to interrogate the required phone sensors.

You can install termux on your android phone, and termux api, then enable the api in termux. Then you can install the full node-red as instructed here, as redMobile pallette is limited and has in app purchases. You should then be able to access all sensor data. If stuck ask for help at termux forums

Thanks @E1cid. I had been down the termux route and had NR working OK but ran into problems. My requirements are very simple. The pallette available with RedMobile is quite adequate. I'll stick with that, at least in the short term.