2

Here's my situation:

I am using a Raspberry Pi to control a system. I want to allow the system to be changed over the internet as well as locally. My current plan for controlling it locally is to connect a laptop to it in some way in order to adjust settings.

I have found that it is possible to create an ad-hoc wireless network with the pi. https://spin.atomicobject.com/2013/04/22/raspberry-pi-wireless-communication/

This sounded like the ideal solution for local control because then one could change the system locally using virtually anything with wifi.

So, I tried hooking up two wifi dongles (both Edimax) and configure them so that one can connect to a wifi network and the other can be responsible for the ad-hoc wireless network. However, there appears to be some issues with this. While I can connect to a wireless network, the ad-hoc network only appears in my laptop's list of wireless connections sporadically. When only hooking up one wifi dongle and configuring it to be an ad-hoc network, the ad-hoc network appears in my laptop's list of wireless connections more consistently.

Has anyone tried something like this before and succeeded? Even if I did manage to do this, I don't know how I would differentiate between them in the program sending/receiving things over those connections. Is using two dongles even possible with the Pi's hardware?

Edit per comments:

I'm currently powering the pi with my laptop USB port. I'll give it a try with my phone charger in a couple hours. Also, this is a Raspberry pi 2 with four USB ports so I am not using a hub....they are plugged directly in.

To clarify, I want the program on the Pi to:

  • Be able to send/receive info from the ad-hoc network using wifi dongle 1(to allow for a computer to connect to it directly and control the device)
  • Be able to send/receive info from the internet using wifi dongle 2 (to allow the device to be controlled remotely over the internet)
  • The most likely candidate for doing all of this at the moment is nod.js

Here is my current /etc/network/interfaces file:

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback
iface eth0 inet dhcp

auto eth0
allow-hotplug eth0
iface eth0 inet manual

auto wlan0
iface wlan0 inet static
  address 192.168.1.1
  netmask 255.255.255.0
  wireless-channel 1
  wireless-essid RPiAdHocNetwork
  wireless-mode ad-hoc

auto wlan1
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
  • Two wifi dongles will eat a lot of power, and I'm wondering if the intermittency is partially caused by that. Are they attached using an external hub? If not, how powerful is your power supply? – Jacobm001 Feb 18 '16 at 23:50
  • The ad-hoc tutorial you quoted is very old, and predates the latest Raspbian. It is certainly possible to use 2 WiFi dongles, but you have not clearly specified exactly what you are trying to achieve, or how the network is configured. – Milliways Feb 18 '16 at 23:59
  • You may have added a bit more, but still haven't explained why you think you need 2 connections. I can't see why you want an ad-hoc connection. If you can connect to the Pi over the internet, why not just connect from your laptop over the network using a single dongle. Normally an ad-hoc connection is used when there is no other network, or to share an internet connection. – Milliways Feb 19 '16 at 1:59
  • I am doing the Ad-hoc network because I am not always guaranteed to have an internet connection. If for instance, the internet is down, I need an alternate way to control the device. – Eric B Feb 19 '16 at 2:28
  • If you are only powering the Pi via the micro-USB port, there is almost no way you will be able to provide enough power for both of the dongles and the Pi. I hate to say it, but you need a powered USB hub. – Patrick Cook Feb 19 '16 at 3:38

Your Answer

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

Browse other questions tagged or ask your own question.