prepping for Model A: Two WiFi dongles possible?


16 posts
by poing » Sun Dec 16, 2012 11:51 am
The setup: Embedded project used for data collection in the field with a WiFi dongle configured as access point and a WiFi capable E-reader as human interface. When back home the data must be offloaded immediately to the main server.

Model B: this works great, for when I get home I plug the Ethernet cable into the Pi and have instant connection to my network.

The problem: I want to use this system with a Model A when they become available, as it seems that its power consumption is only 1/3 of that of the model B so battery time will be three times as long. As it has no Ethernet interface and a WiFi dongle setup as access point can't act as a normal WiFi client at the same time I need two WiFi dongles; one as client and the other as access point.

But I can't get it to work (on the model B); The Pi won't even start up when two dongles are inserted in the hub; it hangs either on starting ntpd or sshd. I have two Ralink RT5370 (work as both access point and client: http://www.ebay.com/itm/150-MBPS-Ralink-RT5370-Chipset-MINI-USB-2-0-WIFI-Adapter-NEW-Network-Adapter-/180880367847?pt=US_USB_Wi_Fi_Adapters_Dongles&hash=item2a1d4f60e7) and one Edimax EW-7811UN (works only as client: http://www.ebay.com/itm/Edimax-Network-EW-7811UN-Wireless-N-150M-Nano-USB-Adapter-Retail-/320873113652?pt=US_Internal_Network_Cards&hash=item4ab5872834.

My initial idea was to use the two Ralink dongles and configure wlan0 as client and wlan1 as access point. As they're both the same it would not matter which one is found as wlan0 or wlan1 at startup. But the Pi won't even complete the startup sequence when both are plugged in until I pull one of the dongles out of the hub (haning on starting sshd).

I hope someone can help with this, as I think the setup described above will be fairly common once the model A starts shipping. I'm just learning Linux, so if you have some hints please give clear instructions. Thanks.
Posts: 1099
Joined: Thu Mar 08, 2012 3:32 pm
by jamesh » Sun Dec 16, 2012 12:23 pm
Remember the Model A only has one USB port...so you would need a hub, and therefore lots more power.

Can you not have a switch (on GPIO) that turns the adapter from access point to client and back?
Soon to be unemployed software engineer currently specialising in camera drivers and frameworks, but can put mind to most embedded tasks. Got a job in N.Cambridge or surroundings? I'm interested!
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11563
Joined: Sat Jul 30, 2011 7:41 pm
by poing » Sun Dec 16, 2012 1:11 pm
Good thinking, I guess that would be possible with some nifty scripting that's way over my head just yet :D

Anyway I need a hub regardless as I need to connect more stuff, like a card reader, USB data stick and possibly a barcode scanner. With all this and a small travel hub I found I get 10 hours of battery life using a 10,000mAh battery and a model B; when I omit the hub and use only a WiFi dongle and a card reader I get 12+ hours out of a charge.

Both above when running idle. Using the CPU intensively for periods of time I hope to still get 8 hours of battery life, which would be just enough. Reducing the power with a model A I'd get more leeway. Or I can take a spare battery of course, not a real problem, but the best would be to have the system on when leaving home and be sure it still runs 16 hours later.

Why wouldn't it be possible to just get two WiFi dongles working? They're recognized as I see something like: "skipping eth0...wlan0...wlan1" from the boot process.
Posts: 1099
Joined: Thu Mar 08, 2012 3:32 pm
by jamesh » Sun Dec 16, 2012 1:14 pm
Where does it stop in the boot process - any messages? Any available logs?
Soon to be unemployed software engineer currently specialising in camera drivers and frameworks, but can put mind to most embedded tasks. Got a job in N.Cambridge or surroundings? I'm interested!
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11563
Joined: Sat Jul 30, 2011 7:41 pm
by poing » Sun Dec 16, 2012 1:19 pm
With the first boot of a 2012-10-28 distro it hangs at "ntpd".
After config, update and upgrade it hangs after "sshd".
After executing the access point tutorial (http://elinux.org/RPI-Wireless-Hotspot) (changing wlan0 to wlan1) and disabling ssh it hangs while starting busybox dhcp server.

So every time it hangs just before showing the login prompt.

Ehrr, what was the command to show the logs again, seen it a couple of times but it didn't stick ;)
Posts: 1099
Joined: Thu Mar 08, 2012 3:32 pm
by poing » Sun Dec 16, 2012 2:31 pm
Getting a little further now...

Curiously the hanging on startup disappears when I put the two WiFi dongles in two different slots of my 7-port USB hub. I guess the hub has a problem, although other stuff like keyboards and mice work as normal in those slots :?

Trying with a different 4 slot hub I get the following results:
- using a single dongle it starts up as client using wlan0
- using two dongles one of them starts as access point using wlan1
- starting with a single dongle, then adding the second one makes dongle #1 inactive; when I restart hosapd and udhcpd the access point works.

So at this time I think I have just a configuration problem, will try to sort that out with a fresh distro install and move step by step.
Posts: 1099
Joined: Thu Mar 08, 2012 3:32 pm
by Twinkletoes » Sun Dec 16, 2012 3:14 pm
Some wifi chipsets allow multiple SSIDs on the same dongle. You'd need to see what your chipset can do.
Posts: 204
Joined: Fri May 25, 2012 9:44 pm
by jamesh » Sun Dec 16, 2012 4:57 pm
is dmesg the log command you were looking for.
Soon to be unemployed software engineer currently specialising in camera drivers and frameworks, but can put mind to most embedded tasks. Got a job in N.Cambridge or surroundings? I'm interested!
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11563
Joined: Sat Jul 30, 2011 7:41 pm
by poing » Sun Dec 16, 2012 7:09 pm
Yeah, that was it!

iw list says:
Supported interface modes:
* IBSS
* managed
* AP
* AP/VLAN
* WDS
* monitor
* mesh point

AP/VLAN seems promising, although to use that you need a Radius server running, which seems a little over my head while I'm not sure I can run that on a Synology NAS box (which is my main server).

At this point, if I use one dongle (wlan0) I have normal client access to my router. If I use two dongles wlan0 will come up briefly until hostapd is started immediately thereafter at which point wlan0 becomes inactive and I'll have an access point at wlan1. Tried several things but so far no show.
Posts: 1099
Joined: Thu Mar 08, 2012 3:32 pm
by jamesh » Sun Dec 16, 2012 7:55 pm
Have you tried it on a desktop Linux box?
Soon to be unemployed software engineer currently specialising in camera drivers and frameworks, but can put mind to most embedded tasks. Got a job in N.Cambridge or surroundings? I'm interested!
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11563
Joined: Sat Jul 30, 2011 7:41 pm
by poing » Sun Dec 16, 2012 8:00 pm
jamesh wrote:Have you tried it on a desktop Linux box?


You mean because of the USB-stuff? Had not thought about that. But yes, I must have a HD around somewhere with a Debian installation, can pop that into a machine tomorrow.
Posts: 1099
Joined: Thu Mar 08, 2012 3:32 pm
by poing » Tue Dec 18, 2012 2:06 pm
Well, I could not locate the HD with Debian just yet, but I now have a workaround.

When I boot client wlan0 comes up for a second until hostapd is started creating an access point on wlan1; this somehow disables client wlan0. But if I then issue the command 'sudo service hostapd stop' the acces point disappears (naturally) but client wlan0 appears again. After 'sudo service hostapd start' the situation is reversed once more etc.etc.

So I could make a button that switches between these two modes. Not ideal, but workable I guess.

Some USB ideas:
I do find a difference between the behaviour of 4- and 7-port hubs. The 4-port gives no trouble while with the 7-port I see strange things happening, like a USB stick unmounting and mounting again immediately or WiFI dongles not working in a specific port where a keyboard has no problems but working just fine in another port of the same hub.

This specific 7-port hub (Sitecom) is several years old and has been used in many configurations including to couple three WD hard drives to a single USB port of a Synology (Linux-based) Nas box. I've always regarded it as ultra-reliable.

As you see always 4- or 7-port hubs on the market it's not rocket science to guess that one USB input can be forked to 4 USB ports with some specific standard hardware. A 7-port hub then obviously has two of such pieces of hardware where one fork of the first 4 is used as input of the second four for a total of 2*4-1=7.

In this line of thinking something goes wrong with the Pi and the second piece of hardware in a 7-port hub giving three dependable USB ports and four funky ones.

(I'll put this in the USB redux thread as well)
Posts: 1099
Joined: Thu Mar 08, 2012 3:32 pm
by Mobius » Thu Dec 20, 2012 11:15 pm
poing wrote:Some USB ideas:
I do find a difference between the behaviour of 4- and 7-port hubs. The 4-port gives no trouble while with the 7-port I see strange things happening, like a USB stick unmounting and mounting again immediately or WiFI dongles not working in a specific port where a keyboard has no problems but working just fine in another port of the same hub.

This specific 7-port hub (Sitecom) is several years old and has been used in many configurations including to couple three WD hard drives to a single USB port of a Synology (Linux-based) Nas box. I've always regarded it as ultra-reliable.

As you see always 4- or 7-port hubs on the market it's not rocket science to guess that one USB input can be forked to 4 USB ports with some specific standard hardware. A 7-port hub then obviously has two of such pieces of hardware where one fork of the first 4 is used as input of the second four for a total of 2*4-1=7.

In this line of thinking something goes wrong with the Pi and the second piece of hardware in a 7-port hub giving three dependable USB ports and four funky ones.

(I'll put this in the USB redux thread as well)


You are correct about the 7-port hub sometimes having two 4-port chips. Apparently that is an issue with some 7-port vs 4-port hubs from the same supplier (see the list of known working peripherals for details).
Posts: 238
Joined: Thu Aug 30, 2012 1:07 am
Location: San Angelo, Texas USA
by wallarug » Fri Jan 25, 2013 10:50 am
poing wrote:Yeah, that was it!

iw list says:
Supported interface modes:
* IBSS
* managed
* AP
* AP/VLAN
* WDS
* monitor
* mesh point


What exactly do I type to get iw list output like that? I am having problems checking my card's supported interface modes.
Youtube Channel: http://www.youtube.com/user/CMDenterprises
Project page: http://code.google.com/p/cmd-robot/
~~ Now selling Apps on the Google Play, WP and Apple App Stores. ~~
Posts: 432
Joined: Mon May 14, 2012 8:21 am
by poing » Fri Jan 25, 2013 4:19 pm
Code: Select all
iwlist

If it's not installed try:
Code: Select all
sudo apt-get install iwlist

more information: http://linux.die.net/man/8/iwlist
Posts: 1099
Joined: Thu Mar 08, 2012 3:32 pm
by wallarug » Sat Jan 26, 2013 12:17 am
poing wrote:
Code: Select all
iwlist

If it's not installed try:
Code: Select all
sudo apt-get install iwlist

more information: http://linux.die.net/man/8/iwlist


iwlist very different to 'iw list' ?
Youtube Channel: http://www.youtube.com/user/CMDenterprises
Project page: http://code.google.com/p/cmd-robot/
~~ Now selling Apps on the Google Play, WP and Apple App Stores. ~~
Posts: 432
Joined: Mon May 14, 2012 8:21 am