Arduino connects to WiFi of other wifi chip

Hi,

I want to connect my Arduino to the WiFi of lolin nodemcu. Currently the lolin wifi chip (with nodemcu firmware using lua) has been successfully set as a soft AP, and is able to broadcast the SSID in the networks. Now I need to connect the Arduino to the SSID of the lolin chip so that the website on Arduino can have internet access (need it for remote control).

The Arduino has a WiFi library with it, but it works only for its own line of WiFi shield. In my case, the library is not able to use in the Arduino code to connect to the lolin chip. My question is, how am I able to connect the Arduino to the broadcast SSID of the lolin chip so that the website in Arduino has internet connection. Tried to search online to no avail. Need some code samples for it too.

Thank you.

The Arduino has a WiFi library with it, but it works only for its own line of WiFi shield.

So? You either have an Arduino Wifi shield, and can use the Arduino WiFi library, or you don't, and you need to use the WiFi library for the WiFi device that you have.

You failed to say what kind of WiFi shield you have ON THE ARDUINO. What WiFi device it is trying to connect to is COMPLETELY irrelevant.

PaulS:
You failed to say what kind of WiFi shield you have ON THE ARDUINO. What WiFi device it is trying to connect to is COMPLETELY irrelevant.

Maybe I did not make myself clear, I do not have any WiFi shield on the Arduino. Instead, I am currently using a lolin nodemcu v3 WiFi chip (similar to ESP8266), and it is able to provide WiFi on its own. The problem is, how am I able to connect my Arduino to the WiFi SSID broadcast by the WiFi chip in order to have internet access for Arduino?

Since it is not a WiFi shield that is supported by Arduino, there is no library on Arduino that I can use to connect to the WiFi chip. As for the WiFi library of the WiFi chip, it seems to not state how a micro controller can connect to it.

Please pardon my english. I am rather new to programming and and not good at it. Appreciate any help. Thank you.

I am currently using a lolin nodemcu v3 WiFi chip (similar to ESP8266), and it is able to provide WiFi on its own.

So, you have an access point. How that access point is created does not matter.

What does matter is that the Arduino, without additional hardware, can not connect to a WiFi access point.

If the WiFi chip is somehow connected to the Arduino, you have failed to disclose that.

Communication between the WiFi shield (regardless of what kind) and the Arduino is usually serial.

PaulS:
What does matter is that the Arduino, without additional hardware, can not connect to a WiFi access point.

Communication between the WiFi shield (regardless of what kind) and the Arduino is usually serial.

Many thanks for the reply.

Yes I do have an access point. And no, the WiFi chip is not connected to the Arduino at all (whether you mean physical connections or connection of internet).

If the Arduino is not able to connect to a WiFi access point without additional hardware, may I know what hardware should I get in order to connect it to my WiFi chip (the access point)?

And since communication between WiFi shield and Arduino is usually serial, how then can I get the Arduino to communicate with my WiFi chip? Just to add on, it is not a shield so I am not able to plug it directly to the Arduino.

Thank you for the help!

If the Arduino is not able to connect to a WiFi access point without additional hardware, may I know what hardware should I get in order to connect it to my WiFi chip (the access point)?

A WiFi shield.

And since communication between WiFi shield and Arduino is usually serial, how then can I get the Arduino to communicate with my WiFi chip?

You can't. You can get the Arduino to communicate with its WiFi shield using Serial, and get the Arduino's WiFi shield to connect to your access point by calling the right library functions.

Of course, connecting to the access point is only half the battle. The other half is doing whatever it was that caused you to want to use a network connection in the first place.

I think I'm getting what you mean.

Seems like I must purchase a WiFi shield to mount on top of the Arduino in order to use the provided WiFi library to connect to the access point.

But from what I see online, the WiFi shield seems to be able to connect to a router SSID directly, which means I do not need the WiFi chip as access point anymore. Am I right to say that? My application of wanting to have a network connection is to allow remote control of devices using website.

PaulS:
You can't. You can get the Arduino to communicate with its WiFi shield using Serial, and get the Arduino's WiFi shield to connect to your access point by calling the right library functions.

And I think the Arduino Ethernet/WiFi shields communicates with the Arduino using the SPI bus. This means connecting the shield to Arduino Mega pins 50, 51 and 52. I would like to ask if its possible for Arduino SPI pins to be connected to 2 devices (i.e. pins 50,51 and 52 connected to both the Ethernet shield and another device that requires SPI interfacing) and control both?

Thank you once again.

But from what I see online, the WiFi shield seems to be able to connect to a router SSID directly

That is correct. Doesn't your access point have an SSID?

And I think the Arduino Ethernet/WiFi shields communicates with the Arduino using the SPI bus.

The Arduino communicates with the Ethernet shield using SPI. It communicates with the WiFi shield using Serial (or a SoftwareSerial instance).

I would like to ask if its possible for Arduino SPI pins to be connected to 2 devices (i.e. pins 50,51 and 52 connected to both the Ethernet shield and another device that requires SPI interfacing) and control both?

Sure. SPI is a bus, with lots of seats. Each device needs a dedicated chip select pin, and only one device is communicated with at a time. The Ethernet shield has an SD card on it. That is a separate SPI device, with a separate chip select pin.

PaulS:
The Arduino communicates with the Ethernet shield using SPI. It communicates with the WiFi shield using Serial (or a SoftwareSerial instance).

Sorry, I'm a little confused with this part. Do you mean that the Ethernet shield and WiFi shield are 2 different things? It seems that you are referring the Ethernet shield as the Arduino Ethernet shield while the WiFi shield is some other shield not from Arduino. Could you please explain the difference?

PaulS:
Sure. SPI is a bus, with lots of seats. Each device needs a dedicated chip select pin, and only one device is communicated with at a time. The Ethernet shield has an SD card on it. That is a separate SPI device, with a separate chip select pin.

If only one device can be communicated at a time, and I have the Ethernet shield mount on the Arduino, does that mean I cannot have a website running at the same time as a camera module? (My application hopes to provide real time monitoring, and would require the camera module to take picture and send to the website for user to see remotely. In addition, the SD card is also required for storage of pictures from the camera, and that is another device that also needs SPI)

PaulS:
The Ethernet shield has an SD card on it. That is a separate SPI device, with a separate chip select pin.

Please correct me if I'm wrong. It means each device that requires SPI connection to pins 50, 51 and 52 can ALL be connected to those pins at the same time. But each device will need another digital pin of the Arduino mega to be use as a chip select pin for the respective devices, and it needs to be set high on that chip select pin if you want the Arduino to communicate with a particular device(With the other devices not selected). Am i right to say that?

Another question is, how do I let the Arduino know a particular digital pin is change to be a chip select pin for the device?

Thank you for your patience. Pardon me please.

Do you mean that the Ethernet shield and WiFi shield are 2 different things?

Of course they are.

The Arduino store sells Ethernet shields that are pretty good. They sell WiFi shields that are not.

If only one device can be communicated at a time, and I have the Ethernet shield mount on the Arduino, does that mean I cannot have a website running at the same time as a camera module?

Suppose that you have two phones. Can you talk to someone on each phone AT THE SAME TIME? Not well. You can talk to someone on one phone, then ask them to hang on for a second, and talk to someone else on the other phone.

If the Arduino is acting as a server, when a client connects, the client gets (or should get) priority and the complete client request should be handled before resuming whatever (usually nothing) the Arduino was doing before it discovered that there was a client request to deal with.

I have no idea what you are planning to do with the camera module, so I can't comment on whether you can successfully use it while acting as a server (wearing an ethernet shield).

My application hopes to provide real time monitoring, and would require the camera module to take picture and send to the website for user to see remotely.

Should have read ahead, I guess. While it IS possible to send picture data to a client, it will be VERY slow.

Remember internet connections in the days of 1200 baud dial up modems? The Arduino isn't that fast.

It means each device that requires SPI connection to pins 50, 51 and 52 can ALL be connected to those pins at the same time.

Correct.

But each device will need another digital pin of the Arduino mega to be use as a chip select pin for the respective devices, and it needs to be set high on that chip select pin if you want the Arduino to communicate with a particular device(With the other devices not selected). Am i right to say that?

I don't remember whether HIGH or LOW selects the device being communicated with, and most libraries take care of enabling the device they need to talk to (assuming that you have disabled all the others) and then disabling it when done. But, that is substantially correct.

how do I let the Arduino know a particular digital pin is change to be a chip select pin for the device?

The Arduino doesn't need to know that a pin is being used as a chip select pin. There is nothing magic about a chip select pin. Its nothing more, or less, than an output pin,