First up please note I am on the arduino forums but despite a few weeks of researching and experimentation I've not had much luck. I've greatly benefited from this forum in C# so thought I'd try my luck with an arduino question.
I'm very interested to know the maximum transfer speeds that have been achieved by an Arduino acting as a file server using the various network protocols such as RS232 vs Bluetooth vs TCP vs FTP vs Wifi. If someone has done a proper comparison I'd love to see it.
I've been scouring the net over the last few weeks and have found various webserver examples, and implemented a few myself, but I still can't seem to get the transfer speeds I need. The BEST rate I've got so far is 80kB/s via ethernet webserver, and about 20kB/s via WiFi. I've read of people getting 240kB/s via ethernet on custom light FTP servers so I know it's got to be possible to improve my speeds. I'm guessing it's my newb SPI and buffering code that might be inefficient. I've outlined some summary info below. I'd really appreciate any input on this from the pros!
And just to clarify - the arduino is the file server not the client for this scenario, and is serving files from the SD card to a client computer. Both are sharing the SPI bus.
My Setup
Ethermega (ATMega256)
SD Card (via SPI)
ATWINC1500 WiFi (IEEE 802.11 b/g/n running on SPI).
File Serve Method: HTTP Webserver accessed by a client browser
(Console access for RS232).
MAXIMUM SPEEDS ACHIEVED
RS232: 14kB/s
Via console I can serve large files direct from the SD card at around 14KB/s at 115200 baud (which is essentially the bit rate in short distance digital serial comms). As expected.
Bluetooth: ?
Not tested yet. I understand the bluetooth protocol supports up to 50Mbit/s in theory, however in reality Bluetooth 4.1 you can get about 1Mb/s (125kB/s) and the upcoming Bluetooth 5 is touted for 2Mb/s (333kB/s) max throughput (wikipedia). I suspect performance may also be severely constrained on a microcontroller like arduino. I'm guessing you might double 114200baud speeds to say 30kB/s?
HTTP webserver - Ethernet (TCP/IP): 80kB/s
I implemented [Sean Ashton's WebDAVNav][2] web based file server and modified it to server HTML not XML. Got it serving files from the SD card at 80kB/s. Tried to get [sirleech's Webduino][3] server going to no avail.
HTTP webserver - WiFi (TCP/IP): 20kB/s
I modified standard WiFi Webserver and coded SPI handling to share the SPI Wifi and SD card to serve files via HTTP GET method. It worked but is horrendously slow. After optimising my loops as best as possible, using a 1024 byte buffer, low level C calls to bypass the DigitalWrite/Read methods, I managed to get 20kB/s. I also looked at the [Jaycar example][4] of a WiFi webserver, however it uses the older style WiFi shield that uses serial, not SPI. So it's limited to serving at 500bytes/second.
Ethernet FTP fileserver (TCP/IP): ?
Not tested. I haven't implemented a light FTP server. I've read of people claiming 255kB/s transfer speeds using a Due. This is impressive.
Basically I'm trying to get the best possible wireless transfer speeds from an 8bit embedded microcontroller (ATMEGA256), such as an Arduino Ethermega, preferably by hosting a simple WiFi HTTP file server so the client browser can connect to it as a hotspot and rapidly download files from the SD card.
Any help would be appreciated and I hope this question is of relevance to the community.
Dan
Related
I am involved in a project where we have some kind of IoT device. An nxp processor with an LTE modem on a PCB. The software running on it connects to the modem over a single uart interface. It will initialize the modem through AT commands, and finally made a data call to the provider (PPP).
Then, it uses lwIP (light weight IP) to open some mqtt subscriptions, and allow user code to make http get/post requests to our servers.
Every 15 minutes we want to retrieve signal strength from the modem and report this back to the server. What I do now, is put the modem back in command mode, retrieve the signal strength info, go back to data mode, and resume normal operation.
The round trip from data mode, to commando mode, and back to data mode takes several seconds (4-5 ish). This is annoying, because during that time we are not receptive for commands.
I've read about gsm mux 07.10. By following some defined protocol it allows to create virtual serial ports, over one physical uart. That sounds nice, although I realize this will go at the cost of performance (bytes will be added to each frame we send to either command mode / data mode).
The gsm mux 07.10 spec dates from 1999. I am far from an expert in mobile solutions. I was wondering: is muxing still the way to go? How does a typical smart phone deals with this for example? Do they include modems with more than one uart to have parallel access to AT commands and a live internet connection? Or do they in fact still rely on gsm mux?
If somebody would be so kind to give some insights. Also on potential C libraries that are available that implement gsm mux 07.10? It seems that TinyGSM implements it (although I can't seem to find where), and I also can find the linux kernel driver that implements gsm mux 07.10. But that driver is written on top the tty interfaces in linux, so that would mean I would have to reverse engineer the kernel driver and strip out the tty stuff and replace it with my own uart implementation.
First of all, the spec numbering is the old GSM specification numbering, so those old specs will never be updated, the new specifications with new numbering scheme will. I do not remember when the switch was made, but I do remember someone at work giving a presentation on 07.10 probably around 1998/1999, so probably a few years after that or around that time (and definitely before 2009).
The newer spec numbering scheme uses three digits for the first part.
So for instance the old AT command spec 07.07 is now 27.007, and the current 07.10 multiplex specification is 27.010.
The following is what I remember of 07.10.
The motivations for developing 07.10 was to exactly support the kind of scenario that you describe. Remember back in the mid 90's, if mobile phones had a serial interface then that was RS-232 though each manufacturer's proprietary connector at the bottom of the phone. One single serial interface.
However, in order to use 07.10 mux in serial communication you needed to install some specific serial drivers in Windows with support for 07.10 (and I think maybe there was some reliability issue with them?), and for that reason 07.10 never took of and became anything more than an rarely used solution.
Also by the end of the 90's additional serial interfaces like Bluetooth and IrDA became available on many phones, and later USB as well, which both added additional physical interfaces as well as natively multiplexing within each protocol.
So the need for multiplexing over physical RS-232 became less of an issue, and whatever little popularity 07.10 ever had dwindled down to virtual nothing.
Fast forward a couple of decades and suddenly someone asks about it on stackoverflow. Good on you :) As far as I can tell I cannot see any fundamental problems with using it for the purpose you present.
Modern smart phones that support AT commands will most likely have a code base for the AT command parsing with roots in the 90's, which most likely include the AT+CMUX command. Of course manufacturers today have zero explicit wish for supporting it, but when it is already present it will just come along with the collection of all other legacy AT commands that they support.
So if the modem supports AT+CMUX you should be good to go. I have no experience or recommendation with regards to client protocol libraries.
I am using an ESP8266 for a project which requires the ESP to establish a connection to the Access Point , with as less delay as possible, but as of now it takes a minimum of 4-5 mins for establishing the connection which is too much delay. I have tried to set a static ip, gateway, subnet and DNS by passing them as parameter to WiFi.config() function, still no success. Would someone help me regarding this issue ?
I have seen lengthy delays on ESP8266 WiFi connection if the WiFi is persisting its configuration to the flash memory. Anywhere from a few seconds to a minute or so.
Try to call WiFi.persistent( false ) before you call WiFi.mode() and WiFi.begin().
At the very least, that will help you narrow down the cause of the problem.
Ensure access point frequency is 2.4Ghz (not 5Ghz). This will cause prolonged connection time (never connecting).
"The ESP8266 is not designed for 5 GHz." Source
NodeMCU V1.0 (as pictured) uses an ESP8266's (ESP-12E) chip, Antenna is configured for 2.4 Ghz only.
I think the library <ESP8266WiFi.h> you are using have problems, you can use older versions of it.
I'm working on an Arduino Uno + ESP8266 project.
I try to use them as a web server on Wi-Fi network to control a motor that connects to Arduino - basically a trigger system that receives signals via Wi-Fi. Currently, I've successfully connected ESP8266 to my access point by sending AT commands from Arduino. Another client on the same network can statically access ESP8266's assigned IP address.
However, when I try to catch some HTTP queries (I want to use them as conditions to control the motor) I occasionally encountered the non-ASCII characters in HTTP request. I use serial comm to debug, please look at the screenshot in the link below:
Arduino - Computer serial communication for debugging
The line ",519:POST ..." should contain a complete number following "/?", but there's some strange characters instead. So I cannot determine the input data to control motor. Once in a blue moon, the expected format of request shows up as follows:
The correct data received
There's no issue with the HTTP response part, even though I got the uninterpretable request, I can still send the JSON error message back to client.
Attempt Note:
The Arduino uses different serial ports to talk to computer and ESP8266. Since the connection can be established, and the data being sent, I believe that the baud rate is simply correct on both side. (115200 for ESP8266, 9600 for computer - also tried 115200 for both and got the same result)
I use V3.3 from Arduino as power source for ESP8266. But I also use voltage regulator to smooth out the current as many people suggest that. The problem still remains.
I'm struggled with this issue for a few days, just want to know if anybody had the similar experience, or could give some clue for the next step.
After a considerable effort to stabilize the circuit, I switched to NodeMCU and got the system working perfectly. I assume that ESP8266 alone is somehow not robust enough without other components, which I unfortunately have no knowledge on.
So I'd like to close this thread with a short recommendation for anybody struggling with the same issue to switch to NodeMCU (which would replace both Arduino and ESP8266); if that could support the requirement.
Firstly, I'll just give you a brief introduction about our project... its "Speech controlled Home Automation System" where we are controlling the Home appliances by the voice or speech commands. We're successfully done with the voice recognition module. But our problem is with achieving the communication between the transmitter {where the user gives the voice command} and receiver {where the home appliances are present} through WiFi i.e. we have got 2 ESP8266 12E modules interfaced with Arduino both at the transmitter and receiver side and these two WiFi modules need to be communicated(To interchange some data sent by Arduinos).So please let us know which Arduino code need to be used at transmitter side wifi module and at Receiver side wifi module and also about the header files or additional softwares(if any)to be used.
you can achieve this by starting one of wifi modules in Access Point Mode and the other one has to be set to Station Mode in order to connect to the first one.
In case you want to add a router, just set both ESP8266 modules to Station Mode and connect them to the router.
And then transfer any data you want through AT commands of ESP8266.
Here is the refrence to them.
https://room-15.github.io/blog/2015/03/26/esp8266-at-command-reference/
If you are newbie to Esp8266 and Arduino , this will help you.
http://www.teomaragakis.com/hardware/electronics/how-to-connect-an-esp8266-to-an-arduino-uno/
Good Luck !
I worked on a similar system a year ago. I was developing a remote controlled toy. My main difference was I used the ESP8266 without an Arduino attached.
One ESP worked as a a WiFi hotspot and the other connected to it, sending messages through UDP.
For some reason, I could not get the two ESP modules to connect (I think it was a problem with the board I had), but I sent messages from my computer, and it worked out fine. I will not burden you with all of the code, but here is the GitHub link.
All that needs to happen is they will be on the same WiFi network, and then you can use the ESP8266 WiFi library to send messages between the two. Like I said above, I used UDP, which is good for high speed, with no error checking. But there is also TCP (higher up, has error checking code), or you can use the server/client part of the library to set up a full web server and read/write data to it. Without knowing what type of data, I cannot comment on what would be the best method.
As for headers, you will need WiFi.h, and if you are using UDP you will need WiFiUdp.h
You should not need any external software besides the Arduino IDE.
I taught myself from scratch for this product, using two main resources: the Arduino library reference, and the docs on the ESP8266 Arduino GitHub page
Please pardon me if this question comes as a little too basic but I have tried searching almost everywhere but haven't found a clue.
I am using the esp8266 module and have uploaded the firmware in it. I have also set it as "Access point" so that other modules are able to connect with it. My problem is that I want to control it pro-grammatically through an 8051 micro-controller. I have searched online and there is a lot of documentation on how it program it through arduino, but that doesn't solve it for me. I want to use assembly language to build a serial protocol that communicates the data from 8051 to esp8266 and then to the connected modules (such as Android device).
My question really is, "would it be possible to just connect TX/RX of 8051 to RX/TX of esp8266 and write a code in assembly that transfers data as I desire to esp8266? Or, do I have to do something else?".
At the moment the only documented way for a host controller (the 8051 in your case) to talk to the ESP8266 is to use the serial port (there is a slave SPI port but the mechanism for driving it isn't known yet). So you will have to make up a little protocol to send and receive commands and data (assuming that the standard support for an enhanced AT command set isn't sufficient for you).
The baud rate can go a lot higher than the default 115200bps, if you need it to (although I'm not sure if the 8051 could keep up).