0

In an Android app that we created for a project (a step-counter fitness tracker), we require user authentication to access the user's data in Firebase. Same goes for the Python program in the Raspberry Pi.

However, I prefer to capture data from the LSM303 sensor connected to the Pi (which will show it to a tiny display that's also connected to the Pi), and send it to the phone, which will send it to Firebase (instead of having the Pi connect to the Firebase and authenticate), but I never got to figure out how to do it.

Here's the usb0 entry in /etc/network/interfaces:

allow-hotplug usb0
iface usb0 inet dhcp

I tried setting up a USB tethering, but it won't start.

$ sudo ifup usb0
...
Cannot find device "usb0"
Failed to get interface index: No such device
...
ifup: failed to bring up usb0

Raspbian info (if it helps):

$ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 9.8 (stretch)
Release:        9.8
Codename:       stretch
0

Your specific needs are unclear. Do you mean "communicate with each other" or do you mean "connect to each other"? To communicate you can use a WiFi access point in a managed network, the most common setup nowadays. How to do it you can look at Setting up a Raspberry Pi as an access point - the easy way or Access point as WiFi repeater, optional with bridge.

If you want to connect to each other device you have to use a peer-to-peer network. There are mostly two configurations for this: an ad-hoc (IBSS) setup or a WiFi direct setup.

The Independent Basic Service Set (IBSS) as a clean peer-to-peer connection is what it says: a basic service provided by every WiFi device compliant to IEEE 802.11. It is thought to be a base for higher communication protocols so authentication wasn't implemented for it from the beginning. It was expected that this is done by higher level programs like ssh, openvpn, ssl or so. Later WPA authentication was added to IBSS but I wasn't able to get it run on a Raspberry Pi. How to use an ad-hoc setup you can look at How to setup an unprotected Ad Hoc (IBSS) Network and if possible with WPA encryption?.

An often used setup for Android smartphones is WiFi direct. Although it is called p2p (peer-to-peer) it isn't really one. It is mostly used to dynamically connect mobile devices to static available devices (e.g. printer or server). How to setup this you can look at Setting up Wifi direct (wifi p2p) and DHCP server or p2p_group_add setting own password and ssid.

Now you can look what configuration fits the best to your setup.

  • This one worked. However, I cannot enable WPS functionality. I tried this one but my device can't find it – YamiYukiSenpai Mar 20 at 20:50
  • To clarify, this was a complete bust (I must've messed up somewhere), but this worked. Now i"m trying to figure out how to use that config and have them connected via WPS. I have a touch sensor, which I want to use as a WPS button. – YamiYukiSenpai Mar 21 at 15:32
  • BTW, how do I enable DHCP with the 2nd option? – YamiYukiSenpai Apr 11 at 18:58
  • @YamiYukiSenpai What is the second option from IBSS, WiFi Direct, p2p with DHCP and p2p group? Do you mean WiFi Direct? – Ingo Apr 11 at 20:01
  • Never mind. I got it to work (a typo). Now, I'm trying to figure out how to view the webpage from it. It's stuck at loading. – YamiYukiSenpai Apr 15 at 7:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.