Arduino - WiFi connection through serial

Hello,

I want to connect a Wifi module (Xbee) to the Arduino MEGA through serial. My question is can this work simple by sending data to the serial and be transmitted through Wifi? On the other end I will have another Wifi connected to another Arduino to get the data. So simple as this.. Because as I show on this page,

things are a bit complicated. I just want to open a Serial and send data, without so much configuration...

My question is can this work simple by sending data to the serial and be transmitted through Wifi?

No. WiFi is a network connection and not a serial channel. So you have to open a connection on the network to send a data stream.

I just want to open a Serial and send data, without so much configuration..

In this case WiFi is probably not the best choice. Provide more information about the needs you have on that communication (speed, distance, reliability, obstacles, etc.), maybe we can suggest alternatives.

pylon:
No. WiFi is a network connection and not a serial channel. So you have to open a connection on the network to send a data stream.

In this case WiFi is probably not the best choice. Provide more information about the needs you have on that communication (speed, distance, reliability, obstacles, etc.), maybe we can suggest alternatives.

Open space, around 100-200m, no obstacles (maybe some trees), as reliable as possible. Use of battery. I need an inexpensive solution because in the future I will need more nodes.

Thank you

XBee is not WiFi.

There are many different views as to what 'inexpensive' means, whats yours ?

Have a look at Moteino, Anarduino, and rfm69 .

They Are good alternatives. I’ve just bought 4 Moteino with rfm69 attached and there are good examples for getting them to take to one another - the plan being to eventually just buy the rfm69 which is very cheap, and build my own system up.

Ok, Xbees are expensive if you want to use many, I need a solution with 2-5 euros for each wireless module...

The NodeMCU is at the lower end of that price point and has WiFi built in. Set one to host, the rest as clients. I think they can even do mesh networking between them.

wvmarle:
The NodeMCU is at the lower end of that price point and has WiFi built in. Set one to host, the rest as clients. I think they can even do mesh networking between them.

Will it give reliable 200 m range? I know I got a pair of ESP8266's working at about 120m using ESP-NOW and clear line of sight. ESP-NOW is not WiFi and I have not done any range checks with WiFi. The OP mentioned trees - they are not good for 2.4GHz wireless.

I would expect the high-power nRF24L01+ modules (with the external antenna) to work at 200m, but they are not WiFi. If the OP is interested in those modules this Simple nRF24L01+ Tutorial may be of interest.

I think for reliable long range communication a lower wireless frequency - such as the 433MHz HC12 modules or LoRa would be better. But they, also, are not WiFi and they may be a little more expensive.

The obvious financial advantage of the ESP8266 is that it an work on its own without an Arduino whereas the other modules need to be connected to an Arduino.

The ESP8266-07 has a connector for an external antenna but I have no idea whether or by how much that improves its range.

...R

360modena_cs:
Ok, Xbees are expensive if you want to use many, I need a solution with 2-5 euros for each wireless module...

Are you saying that if the only solution will cost 5.5 euros, your project is not viable ?

Robin2:
Will it give reliable 200 m range

Depends largely on the layout of the project. Line of sight or indoors or city or forest all make a big difference.
Host node in the middle, everything else <100m away - also helps. Maybe mesh networking if there are lots of nodes, all 20-50 meters apart would definitely allow all to connect to one another - again depending on the general environment it has to operate in.
LoRa will indeed get the job done (433 Mhz or ~900 Mhz - depending on what's legal in OP's locality), but those modules by themselves blow just about all of OPs budget - which anyway is very low for a complete node (MCU + comms module + power supply + case + presumable some kind of sensors).

Thank you all for the information!!

Does this (which has also encryption - something that I need):

cooperate with this:

??

It should do.

...R

The problem is that I cannot figure out how to interface it with Arduino...

The problem is that I cannot find out, how to interface it with Arduino.../

That is why people buy Moteinos. A Moteino board has a 328p with a RFM69/RFM95/RFM96 RF module of your choice soldered on the back.

The boards you link to are probably not going work together. The Nano uses 5V logic levels and the RFM69 board probably uses 3.3V logic levels. I say probably because it looks to be a clone of a HopeRF board but one can never be really sure with clone boards.

Almost certainly 3.3V (and 8 MHz clock speed), as all those RF modules can't handle 5V.

Using a 3.3v devices with a 5v Arduino is quite common. You just need suitable components to drop the 5v output signals to 3.3v (such as a voltage divider). The 5v Arduino should have no trouble detecting 3.3v signals from the device.

...R

Ok, thank you I will use level shifter...
In case I want to use encryption and the wireless module does not support it, how feasible it is to make the encryption on the Arduino before sending the data? Do Arduino nano support encryption/decryption, does anyone have experience with this?

Thank you.

Not very feasible on a Nano - not so long ago I looked into this, and it was mentioned that the encryption code takes almost 30 kB of Flash, leaving almost nothing left for your sketch.