将数据传感器从 arduino 发送到 esp8266,后者使用 SSL 将其发送到云端 [英] Send data sensor from arduino to esp8266 who send it to the cloud using SSL

查看:51
本文介绍了将数据传感器从 arduino 发送到 esp8266,后者使用 SSL 将其发送到云端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个从传感器收集数据的 arduino Uno,我想使用支持 SSL 的 wifi esp8266 将这些数据发送到云端,使用库 WifiClientSecure,是否有替代方法可以将数据从 arduino 发送到 esp 卡和 esp8266 读取此数据并将其发送到云端,我可以使用 mqtt 但我想知道是否有办法在没有第三方的情况下直接连接 arduino uno 和 esp8266,任何帮助都会感激不尽.

I have an arduino Uno which collect data from sensor, i want to send this data to the cloud using wifi esp8266 who support SSL using the library WifiClientSecure, is there an alternative to send data from arduino to the esp card and esp8266 read this data and send it after that to the cloud, i'm able to work with mqtt but i want to know if there is a way to have a directly connection between the arduino uno and esp8266 without having a third part, any help will be gratefull.

推荐答案

根据我的研究,ESP8266 AT Command API 不支持 SSL.这意味着您需要使用 Arduino(作为 FTDI 转换器)来使用自定义固件对 ESP8266 进行编程.这将使您能够使用 WiFiClientSecurepubsubclient.

According to my research, the ESP8266 AT Command API does not support SSL. This means you will need to use the Arduino (as an FTDI converter) to program the ESP8266 with custom firmware. This will enable you to use WiFiClientSecure and pubsubclient.

要将 Arduino 用作 FTDI:

To use the Arduino as an FTDI:

  1. 加载不使用Serial的草图,例如Blink"示例
  2. 将 Arduino 的 TX 引脚连接到 ESP8266 RX 引脚
  3. 将 Arduino 的 RX 引脚连接到 ESP8266 TX 引脚
  1. load a sketch that does not use Serial, such as the "Blink" example
  2. connect the Arduino's TX pin to the ESP8266 RX pin
  3. connect the Arduino's RX pin to the ESP8266 TX pin

现在您需要设置 Arduino IDE,以便它可以对 ESP8266 进行编程

Now you need to setup Arduino IDE so it can program an ESP8266

  1. 在 Arduino IDE -> 文件 -> 首选项中,将其粘贴到附加板管理器 URL 中:http://arduino.esp8266.com/stable/package_esp8266com_index.json(只需复制链接而不是点击)
  2. 转到工具 -> 板 -> 板管理器.在板卡列表中找到esp8266",点击安装"
  3. 在工具 -> 开发板中将您的开发板设置为通用 ESP8266 模块"
  1. In Arduino IDE -> File -> Preferences, paste this into the Additional Boards Manager URLs: http://arduino.esp8266.com/stable/package_esp8266com_index.json (just copy the link as it is instead of clicking)
  2. go to Tools -> Boards -> Boards Manager. Find "esp8266" in the list of boards and click "Install"
  3. Set your board to "Generic ESP8266 Module" in Tools -> Boards

Arduino IDE 已准备就绪!但是在使用它对 ESP8266 进行编程之前,您需要将复位按钮和编程按钮连接到 ESP8266.

Arduino IDE is ready! But before you caan program an ESP8266 with it you need to connect a reset button and a program button to the ESP8266.

  1. 在 GND 和 ESP8266 GPIO_0 引脚之间连接一个按钮
  2. 在 GND 和 ESP8266 RESET 引脚之间连接一个按钮
  3. 在 3.3V 和 ESP8266 引脚之间添加一个 10K 欧姆的上拉电阻(默认复位引脚为高电平)

当您准备好将草图上传到 ESP8266 时,请使用这些按钮,如下所示:

When you are ready to upload a sketch to the ESP8266, use those buttons like this:

  1. 同时按下两个按钮
  2. 松开 RESET 按钮
  3. 松开 GPIO_0 按钮

这会将 ESP8266 置于编程模式!您现在应该可以单击 Arduino IDE 中的上传"按钮.我建议使用提供的 ESP826a6 示例草图之一(例如 这个) 来测试一切.

This puts the ESP8266 in program mode! You should now be able to click the "Upload" button in Arduino IDE. I would suggest using one of the provided ESP826a6 example sketches (like this one) to test everything out.

这是该项目的概述:

.Arduino Uno 草图:读取传感器数据,通过 Serial 发送到 ESP8266.ESP8266 草图:连接到 WiFi 网络,从 Serial 接收传感器数据,通过 WiFiClientSecure 发送到云端.

. Arduino Uno sketch: read sensor data, send via Serial to ESP8266 . ESP8266 sketch: connect to WiFi network, receive sensor data from Serial, send via WiFiClientSecure to the cloud.

我会将这两个程序的实际代码留给您,但如果您遇到困难,请发表评论.希望这会有所帮助!

I will leave the actual code of these two programs up to you, but if you get stuck just leave a comment. Hope this helps!

这篇关于将数据传感器从 arduino 发送到 esp8266,后者使用 SSL 将其发送到云端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆