Interfacing with a usb wifi dongle from microcontroller

Did you see a new gadget or toy and start brimming with ideas? See something that has tons of potential? Discuss these thoughts here.

Interfacing with a usb wifi dongle from microcontroller

Postby roel » June 26th, 2012, 7:39 am

Hello hackers,

What do you think: would it be infeasible or near-infeasible to interface with a usb wifi dongle from an atmega or whatever your favourite uC might be?

I think that it would be awesome to just add a usb port to your pcb / breadboard, plug in a cheap dongle (< 5 eur / usd), and have a connection. I know, there are things like xbee. Way too expensive I think. And there are those 433.92MHz (I don't know the name of the US equivalent) radios. Cheap, at least the ones from China, but not reliable (again, the ones from China). And such things require additional hardware to connect to your pc/mobile devices as well. Not very elegant. But on the other hand, everyone has a wifi infrastructure at home, right? Access points (which cost next to nothing), tablets, mobile phones, etc.

So, I believe that if it is feasible to create something like this, it is a lot of work. Being an USB host, talking to wifi dongle, speaking 802.11, tcp/ip, etc. But most (if not all) of those things are already open source, for different platforms though.

So, what do you think?

Regards.

PS. And yes, I know that there are wifi modules ready for uC usage. They cost 10x the time of a single wifi dongle.
roel
 
Posts: 2
Joined: June 26th, 2012, 7:25 am

Re: Interfacing with a usb wifi dongle from microcontroller

Postby Colecago » June 26th, 2012, 8:49 am

You either pay for time or ready made components. Whatever you end up doing, you probably want to go with a 32bit micro and a real time OS as those tend to have robust TCP/IP and USB protocols built in or available. Still you have to know a lot about USB and the dongle to be able to do this, you are basically rewriting the drivers on an embedded platform.

I'd say not worth it, you save a few bucks, but you spend it in time and it's not like writing embedded drivers for one dongle will work on every cheap ass dongle people find out there.

If your end goal is to connect to tablets, phones, computers, why not bluetooth? The modules are half the price of the wify modules and you don't have to screw around with USB.
User avatar
Colecago
 
Posts: 245
Joined: January 27th, 2011, 9:34 am

Re: Interfacing with a usb wifi dongle from microcontroller

Postby Quin » June 26th, 2012, 5:27 pm

https://courses.cit.cornell.edu/ee476/F ... index.html

Yes, you can use a Mega32 as a USB host. But you'll want to know whether that cheap USB wifi dongle has a whole TCP/IP stack in it, of if it is just a USB chip and an antenna; which would leave you to write the stack in your code.
Quin
 
Posts: 103
Joined: February 24th, 2012, 9:17 am

Re: Interfacing with a usb wifi dongle from microcontroller

Postby roel » June 27th, 2012, 4:03 am

Thanks for the comments.

Sure, for my own purposes it wouldn't justify the amount of work. But I'm sure the community would like it a lot, wouldn't you?

I forgot to mention Bluetooth indeed, a good one. But still it is not as convenient as wifi. For example, to control devices from the web with Bluetooth one would need some intermediate step (like a server) to translate things to Bluetooth. It's less plug and play.

Anyway, I took a look at the linux driver for my wifi dongle. Its totally intimidating. I guess I'll have to wait until the moment that raspberrypi's (clones, derivatives) cost next to nothing, and use less energy, and plug my dongle simply into such a platform.
roel
 
Posts: 2
Joined: June 26th, 2012, 7:25 am

Re: Interfacing with a usb wifi dongle from microcontroller

Postby jnsnsa » January 2nd, 2014, 8:36 am

It would be interesting to start with the simpler project of interfacing to a usb dongle which does have the full tcp/ip stack in its firmware. The part that is unknown to me (and that I have not been able to find on the internet) is the protocol for requesting the connection to a router (for example) and the protocol for sending and receiving data. (I hope this is rather standard.)
If anyone knows how to do this or knows where to find the protocol, it would be very interesting and helpful.
Thanks
jnsnsa
 
Posts: 3
Joined: January 2nd, 2014, 5:30 am

Re: Interfacing with a usb wifi dongle from microcontroller

Postby st2000 » January 2nd, 2014, 1:01 pm

The problem of how much time this would take hasn't change over the past year. If people are still interested, I would suggest finding a embedded processor OEM who has already written the code for USB HOST and the TCP/IP stack (assuming that is not already abstracted from you by the dongle). I know Microchip.com has USB HOST as well as TCP/IP stack software in their "tool box" of code. All of which, I believe, is free for the asking as long as it is being run on a PIC processor.

The part that is unknown to me (and that I have not been able to find on the internet) is the protocol for requesting the connection to a router

You have the right idea but are (possibly) going about it the wrong way. There are a boat load of protocols in Ethernet land. Many are nested inside of others. Some are incompatible with one another. You question is skirting these issues. It's as if you want to learn French by first asking how to fly a plane in a French airport. Eventually you will get it. But it might be quicker to learn the constituents of the language before doing anything as complex as learning to fly.

What you probably want to search for (ask about) is how a DHCP server and client interact (i.e. figure things out for them selves).
st2000
 
Posts: 1137
Joined: February 3rd, 2011, 6:10 pm

Re: Interfacing with a usb wifi dongle from microcontroller

Postby jnsnsa » January 4th, 2014, 10:29 am

Thanks for your answer.

I do understand your point and I do agree that learning all about DHCP server-client interaction is the best way to go.
However I still suspect that may be a shortcut if the usb-wifi "dongle" has the full tcp/ip stack built in. If I understand correctly, this means that it handles the DHCP interaction between the server and the client.

Let's take, as an example, the VIA vnt6656 module. If I understood the product information correctly, the vt6656 chip handles the tcp/ip stack. Now suppose I want to connect either a PIC or and Arduino etc. via usb to the VIA module with the purpose of connecting to a local router, for example.
So then I do know how to send serial information through the usb. The VIA processor expects to receive certain requests in a certain format in order to search for and setup the TCP/IP connection.

I was wondering whether the serial communication between my microprocessor and the VIA is proprietary or standard and if standard is it available somewhere.

Thanks for your patience.
jnsnsa
 
Posts: 3
Joined: January 2nd, 2014, 5:30 am

Re: Interfacing with a usb wifi dongle from microcontroller

Postby st2000 » January 4th, 2014, 10:49 am

Well, I think the best thing to do is find out what people have done WRT a Linux driver for the WIFI dongle you are interested in. In the case of the VIA vnt6656 I found this:
http://cateee.net/lkddb/web-lkddb/VT6656.html
Unfortunately, I see this:
This is a vendor-written driver for VIA VT6656.

...on that page. Without getting deep into this, I'm guessing, if the vendor wrote the Linux driver, then some or all of the software is proprietary. Which may make it difficult to port to a non-Linux OS.

I am not sure how most (or all) WIFI dongles work. Many cell phone dongles are easy to use as they (most?) use the same (similar?) AT command set.

I am fairly sure that the Microchip WIFI solution / development-kit (which physically looks very similar) puts the TCP/IP stack in the PIC processor. So the behavior you are suggesting is different from that of the hardware I have worked with.

Maybe someone else knows more and can help out.
st2000
 
Posts: 1137
Joined: February 3rd, 2011, 6:10 pm

Re: Interfacing with a usb wifi dongle from microcontroller

Postby jnsnsa » January 5th, 2014, 1:32 pm

Thanks again!

I suspect you are right that the equivalent of the "at commands" are proprietary or at least differ from manufacturer to manufacturer. I had a quick look at the linux source code for the vt6566 as well as the source code for the arduino wifi shield (both of which, I think, have the TCP/IP stack on the interfacing processor) and it seems to me that the protocol is different.
I'm thinking of writing to VIA to see if they would be willing to provide the interface protocol.
jnsnsa
 
Posts: 3
Joined: January 2nd, 2014, 5:30 am


Return to The new gadget brainstorm pit

Who is online

Users browsing this forum: No registered users and 1 guest