简体   繁体   English

如何将Arduino与Internet连接?

[英]How to connect Arduino with Internet?

I have gone through several links online but I have not found any appropriate solution to it. 我已经在线浏览了几个链接,但没有找到任何合适的解决方案。 I am wondering if there is a way to connect an Arduino with WiFi without using any shield or any other external hardware. 我想知道是否有一种方法可以在不使用任何屏蔽或任何其他外部硬件的情况下将Arduino与WiFi连接。 My laptop is connected to WiFi and the arduino board is connected to the laptop with an USB cable. 我的笔记本电脑已连接至WiFi,而arduino板已通过USB电缆连接至笔记本电脑。 I want to access/run the data for the Arduino using WiFi. 我想使用WiFi访问/运行Arduino的数据。 Is there a way to do it? 有办法吗? Hope my query makes a sense. 希望我的查询有意义。 Thanks. 谢谢。

Let's restate your question for clarity - you want to share the laptop's Internet connection (eg via WiFi) with the Arduino connected to the laptop with a USB cable, with no additional hardware? 为了清楚起见,让我们重申一下您的问题-您想与使用USB电缆连接到笔记本电脑的Arduino共享笔记本电脑的Internet连接(例如通过WiFi),而无需其他硬件?

Assuming I restated it correctly, the Arduino's USB connection provides a virtual "serial port" for communication. 假设我正确地重新设置了它,Arduino的USB连接提供了一个虚拟的“串行端口”进行通信。 This means you can use an "IP over serial" solution for Internet access. 这意味着您可以使用“串行IP”解决方案来访问Internet。 One such common and widely supported solution is PPP . PPP就是这样一种普遍得到广泛支持的解决方案。

However, programing the Arduino with IP over PPP stack requires significant amount of memory and is probably an overkill for whatever it is you're trying to do. 但是,使用IP over PPP堆栈对Arduino进行编程需要大量内存,对于您要尝试做的事情来说可能是过大的选择。

You're probably better off designing a custom-tailored protocol for the serial communication between the Arduino and a small gateway program you can program and run on the laptop. 您最好为Arduino和可以在笔记本电脑上编程并运行的小型网关程序之间的串行通信设计定制的协议。

If you're bent on a complex solution that provides full Internet access to the Arduino, the steps to achieve what you're after are: 如果您想使用一个复杂的解决方案,该解决方案可以提供对Arduino的完全Internet访问,那么要实现的目标是:

  1. Program the Arduino with a TCP/IP over PPP protocol stack, running on the serial port. 使用TCP / IP over PPP协议栈对Arduino进行编程,并在串行端口上运行。 You'll probably need an Arduino MEGA. 您可能需要一个Arduino MEGA。
  2. Setup the laptop to be a PPP endpoint on the Arduino's serial port. 将笔记本电脑设置为Arduino串行端口上的PPP端点。 For a Windows machine you can refer to this page for information on how to do that. 对于Windows计算机,您可以参考此页面以获取有关如何执行此操作的信息。
  3. Once the PPP link is up, you can setup the laptop's OS to share Internet access to the PPP link. PPP链接建立后,您可以设置笔记本电脑的操作系统以共享对PPP链接的Internet访问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM