esp freertos

by Denis Nuțiu

丹尼斯·努尤(Denis Nuțiu)

如何开始使用FreeRTOS和ESP8266 (How to get started with FreeRTOS and ESP8266)

Recently, I purchased a NodeMCU from AliExpress for about $4. The reason I did this was to find out what all the fuss is about with ESP8266.

最近,我以4美元左右的价格从速卖通购买了一个NodeMCU。 我这样做的原因是要弄清楚ESP8266有什么大惊小怪的。

NodeMCU is an open source IoT platform. It includes firmware which runs on the ESP8266 Wi-Fi SoC from Espressif Systems, and hardware which is based on the ESP-12 module.

NodeMCU是一个开源物联网平台。 它包括运行在Espressif Systems的ESP8266 Wi-Fi SoC上的固件以及基于ESP-12模块的硬件。

Compared to the Arduino UNO, my ESP8266 totally knocks it out of the park when it comes to CPU power and price.

与Arduino UNO相比,我的ESP8266在CPU功耗和价格上完全无法使用。

The ESP8266 is 500% faster and 82% cheaper than the Arduino. The ESP8266 also has WiFi connectivity.

ESP8266比Arduino快500%,便宜82%。 ESP8266还具有WiFi连接。

I was very surprised when I visited the Espressif website for the ESP8266. There’s lots of documentation and resources that you can use. For example, there’s an Android application which tells your ESP8266 to connect to your WiFi. The app sends the SSID and password as packets, the ESP8266 sniffs them, and then it connects to your WiFi. This is called SmartConfig, and was invented by Texas Instruments.

当我访问Espressif网站上的ESP8266时,我感到非常惊讶。 您可以使用很多文档和资源。 例如,有一个Android应用程序告诉您ESP8266连接到您的WiFi。 该应用程序将SSID和密码作为数据包发送,ESP8266嗅探它们,然后连接到您的WiFi。 这称为SmartConfig,由Texas Instruments发明。

In this article, I will guide you to setup and run the Smart Config example from the Espressif RTOS SDK.

在本文中,我将指导您从Espressif RTOS SDK设置和运行Smart Config示例。

这是您需要的东西: (Here’s the things you’ll need:)

  • A modern computer.一台现代计算机。
  • A NodeMCU board with ESP12-E带有ESP12-E的NodeMCU板
  • VirtualBox (https://www.virtualbox.org/wiki/Downloads)

    VirtualBox( https://www.virtualbox.org/wiki/Downloads )

  • Ubuntu Server LTS (https://www.ubuntu.com/download/server)

    Ubuntu Server LTS( https://www.ubuntu.com/download/server )

配置VirtualBox进行开发 (Configuring VirtualBox for development)

  1. Download VirtualBox and install Ubuntu Server. This should be easy to do, but if you don’t know how, Google it or have a look at this graphic step by step guide. Installing an OS is a nice skill to have. (Tip: When VirtualBox prompts you to select the disk, make it dynamically allocated and at least 50GB in size. This will save you some headaches further down the line.)

    下载VirtualBox并安装Ubuntu Server。 这应该很容易做到,但是如果您不知道如何操作,请通过Google或查看此图形逐步指南 。 安装操作系统是一项不错的技能。 (提示:当VirtualBox提示您选择磁盘时,请对其进行动态分配,并使其至少具有50GB的大小。这将使您省去一些麻烦。)

  2. Make sure that you can access the internet from within the virtual machine and configure the DNS server:确保可以从虚拟机内部访问Internet并配置DNS服务器:

To configure the DNS server, have a look at this example.

要配置DNS服务器,请看以下示例 。

Example: dns-nameservers 8.8.8.8 8.8.4.4 If you can ping Google, then you’re good to go!

示例: dns-nameservers 8.8.8.8 8.8.4.4如果您可以ping通Google,那么您就可以了!

3. (Optional) Install OpenSSH and Samba server. This will make your life much easier.

3.(可选)安装OpenSSH和Samba服务器。 这将使您的生活更加轻松。

4. (Optional) Enable port forwarding. In order to SSH directly into your virtual machine, you need to enable port forwarding. For example, to map the port 2222 on your host machine to the port 22 of your virtual machine.

4. (可选)启用端口转发。 为了直接通过SSH进入您的虚拟机,您需要启用端口转发。 例如,要将主机上的端口2222映射到虚拟机端口22

If you have enabled port forwarding, you can now SSH into your virtual machine from your Host machine as in the figure below.

如果启用了端口转发,则现在可以从主机计算机SSH到虚拟机中,如下图所示。

Note: If you’re on Windows, you need Putty in order to SSH into the virtual machine.

注意:如果您使用的是Windows,则需要Putty才能通过SSH进入虚拟机。

5. Plug in your NodeMCU and execute the following command:

5.插入您的NodeMCU并执行以下命令:

tail -f /var/log/kern.log

tail -f /var/log/kern.log

This should reveal to you that the device has been identified as /dev/ttyUSB0. If nothing happens, then you need to add the USB to the virtual machine. After adding the USB, unplug and plug your device in again.

这应该向您显示该设备已被标识为/ dev / ttyUSB0。 如果没有任何React,则需要将USB添加到虚拟机。 添加USB后,拔出插头并再次插入设备。

If you’ve reached this point and every thing is working, congratulations! You’re now ready to compile the SDK and run the SmartConfig example. You can even shoot me a tweet at https://twitter.com/metonymyqt

如果您到了这一步并且一切正常,那么恭喜 ! 现在,您可以编译SDK并运行SmartConfig示例。 您甚至可以在https://twitter.com/metonymyqt上给我发一条推文

编译SDK并刷新开发板 (Compiling the SDK and flashing the board)

  1. Install the required packages (as below). This info is also available on the SDK’s readme.md.安装所需的软件包(如下所示)。 此信息也可在SDK的readme.md中获得。
sudo apt-get install make unrar-free autoconf automake libtool gcc g++ gperf flex bison texinfo gawk ncurses-dev libexpat-dev python-dev python python-serial sed git unzip bash help2man wget bzip2 libtool-bin

2. Create a new folder and navigate into it: mkdir Development && cd Development

2.创建一个新文件夹并浏览到其中: mkdir Development && cd Development

3. Clone the Open SDK: https://github.com/pfalcon/esp-open-sdk

3.克隆Open SDK: https : //github.com/pfalcon/esp-open-sdk

git clone --recursive https://github.com/pfalcon/esp-open-sdk.git

git clone --recursive https://github.com/pfalcon/esp-open-sdk.git

3. Run make: make

3.运行make: make

Warning: This step will take a while to finish so please be patient. On my virtual machine it completed after 50 minutes. On yours it might take more or less, but before you run, make make sure that you’re connected to the internet and DNS is properly configured. The best way to check this is to execute a ping to Google or some other site if Google is blocked in your region.

警告:此步骤需要一段时间才能完成,因此请耐心等待。 在我的虚拟机上,它在50分钟后完成。 在您的计算机上,可能需要或多或少的时间,但是在运行之前,请确保已连接到Internet正确配置了DNS 。 最好的检查方法是对您所在地区的Google或其他网站执行ping操作。

If your ping is successful, you can minimize the windows and watch an episode of your favorite TV show. Come back after about 40 minutes (but make sure your computer doesn’t go to sleep).

如果ping成功,则可以最小化窗口并观看自己喜欢的电视节目的一集。 大约40分钟后再回来(但请确保您的计算机不会进入睡眠状态)。

After the SDK has been built successfully, you’ll see a message telling you to put something in your path. To do so, execute the following:

成功构建SDK之后,您会看到一条消息,提示您将某些内容放入路径中。 为此,请执行以下操作:

echo 'export PATH=/home/denis/Development/esp-open-sdk/xtensa-lx106-elf/bin:$PATH' >> ~/.profile

The command will append the string to the ~/.profile file. Now please run the following command:

该命令会将字符串追加到〜/ .profile文件。 现在,请运行以下命令:

xtensa-lx106-elf-gcc --version

xtensa-lx106-elf-gcc --version

If the command executes successfully, then you’re good to go!

如果命令成功执行,那么一切就好了!

4. Test your board

4.测试您的板子

Plug your NodeMCU and run lsusb to verify that your device is connected. After that, run esptool.py chip_id. You should now see the board’s chip id.

插入NodeMCU并运行lsusb,以验证您的设备已连接。 之后,运行esptool.py chip_id 。 现在,您应该看到主板的芯片ID。

5. Clone ESP8266_RTOS_SDK

5.克隆ESP8266_RTOS_SDK

git clone https://github.com/espressif/ESP8266_RTOS_SDK.git

6. Export the SDK path and SDK/BIN path using the commands below.

6.使用以下命令导出SDK路径和SDK / BIN路径。

echo 'export SDK_PATH=/home/denis/Development/ESP8266_RTOS_SDK' >> ~/.profile
echo 'export BIN_PATH=/home/denis/Development/ESP8266_RTOS_SDK/bin' >> ~/.profile

7. Compile the SmartConfig example

7.编译SmartConfig示例

cd /home/denis/Development/ESP8266_RTOS_SDK/examples/smart_config/
chmod +x ./gen_misc.sh
./gen_misc.sh

Now accept the default values until you’re asked for SPI_SIZE_MAP. This is where you select 4 because the NodeMCU has a flash size of 32Mbit and this translates to 4MB. You can also select SPI_SPEED 3=80Mhz

现在接受默认值,直到要求您提供SPI_SIZE_MAP。 在此处选择4,因为NodeMCU的闪存大小为32Mbit,并且转换为4MB。 您也可以选择SPI_SPEED 3 = 80Mhz

You’ll see something like this:

您会看到以下内容:

!!!SDK_PATH: /home/denis/Development/ESP8266_RTOS_SDKBIN_PATH: /home/denis/Development/ESP8266_RTOS_SDK/bin
No boot needed.Generate eagle.flash.bin and eagle.irom0text.bin successully in BIN_PATHeagle.flash.bin — — — →0x00000eagle.irom0text.bin — →0x20000!!!

8. Flash the board

8.刷板

cd $BIN_PATH
esptool.py erase_flash
esptool.py write_flash 0x00000 $BIN_PATH/eagle.flash.bin 0x20000 $BIN_PATH/eagle.irom0text.bin 0x3FC000 $BIN_PATH/esp_init_data_default.bin

Now, if you reset the board, you should see no LED blinking.

现在,如果您重置电路板,则应该看不到LED闪烁。

9. Use the Phone Application

9.使用电话应用程序

  • Android Application

    Android应用

  • iPhone Application

    iPhone应用

Open the Application, make sure that you’re connected to a WiFi AP, enter your password, and press confirm. After a few seconds the ESP8266 should connect to your AP. That’s it. Congratulations for reaching the end!

打开应用程序,确保您已连接到WiFi AP,输入密码,然后按确认。 几秒钟后,ESP8266应该连接到您的AP。 而已。 恭喜您成功!

If you want to develop more using the ESP8266-RTOS-SDK, please visit the official websites. You’ll find a lot of resources and documentation there. Also, please take a look at the other examples found in the SDK folder.

如果您想使用ESP8266-RTOS-SDK进行更多开发,请访问官方网站。 您会在那里找到很多资源和文档。 另外,请查看SDK文件夹中的其他示例。

Thank you very much for your time reading this. If you want to reach out to me, you can do so on Twitter: MetonymyQT

非常感谢您阅读本文。 如果您想与我联系,可以在Twitter上进行: MetonymyQT

资源资源 (Resources)

  • ESP8266 Overview

    ESP8266概述

  • ESP8266 Resources

    ESP8266资源

  • FreeRTOS Website

    FreeRTOS网站

翻译自: https://www.freecodecamp.org/news/how-to-get-started-with-freertos-and-esp8266-7a16035ddd71/

esp freertos

esp freertos_如何开始使用FreeRTOS和ESP8266相关推荐

  1. java是否支持freertos_使用GCC配置FreeRTOS(ARM)

    我是RTOS和ARM Cortex MCU的新手 . 我需要使用带有STM32L053核板的FreeRTOS GCC mbed.org库 . 我已经使用GCC mbed qt-creator成功创建了 ...

  2. FreeRTOS+STM32L+ESP8266+MQTT协议传输温湿度数据,控制继电器到阿里云物联网平台

    一.准备材料 二.设备连接 2.1 插入模块.串口线 将ESP8266模块按照图中所示插入指定位置 将串口线一端插入到STM32L的USB口,另一端插入到电脑的USB口 2.2.连接ST-Link仿真 ...

  3. 基于STM32+FreeRtos+ESP8266+MQTT连接阿里云

    基于STM32+FreeRtos+DHT12+ESP8266+MQTT连接阿里云 1.概述 2.实现步骤 2.1.MQTT.fx模拟器与阿里云通信 2.2.STM32与阿里云通信 3. 搭建云平台 3 ...

  4. 非官方esp8266烧写出厂默认AT固件v1.5.4.1

    一.准备工作 1. 硬件部分 1.1  某宝买的一块esp8266模块,跟下面这个一样(非安信可官方硬件,要是想新购买的话推荐到某宝安信可科技买官方的硬件,避免买到劣质的硬件)   1.2 安信可官方 ...

  5. 用Mixly ESP8266 ESP32本地局域网/在线OTA无线wifi上传方法

    Arduino ESP32 ESP8266 远程无线上传 下载 Mixly 齐护机器人 局域网OTA ESP8266 ESP32本地局域网及在线OTA无线wifi上传方法 方法1:在线升级方法 1-1 ...

  6. stm32开发板下esp8266通信

    前言 Esp8266算是一个傻瓜式的wifi通信模块,前前后后也用过好几次,这次隔了好久没用有些东西都忘了,所在这里记录一下,防止以后用的时候又忘了. 硬件电路连接 话不多说,先上电路连接图.本次使用 ...

  7. [08]ESP32+激光传感器VL53L1x移植与调试(附源码)

    文章目录 一.硬件介绍 1. VL53L0X介绍 2. VL53L1X介绍 3. VL53L1X典型电路 4. VL53L0X与VL53L1X区别? 二.移植过程介绍 1. 官方库文件如何使用? 2. ...

  8. STM32项目 -- 选题分享(部分)

    前言 分享部分STM32项目选题以及实现效果(暂时没有分享代码) 列表 编号 项目名称 难度 使用器件 实现效果  1 基于STM32的智能万用表设计 3 STM32F103C8T6.OLED 1.测 ...

  9. stm32-FreeRTOS-ESP8266-OneNET物联网远程开关,心知天气网络时间,开源代码电路原理图altium-pcb

    分享下自己基于OneNet物联网云平台的远程开关,可电脑 / 手机APP远程控制,亦可获取当前时间和近3日天气. 还有好多坑待填,开源仅作学习. 资源下载链接在文章末尾.stm32-FreeRTOS源 ...

最新文章

  1. SLF4J: Failed to load class org.slf4j.impl.StaticLoggerBinder.
  2. NSInputStream和NSMutableURLRequest-实现保存文件到服务器
  3. plantuml 依赖_使用PlantUML绘制类图
  4. varnish 防盗链
  5. 智能车复工日记【7】:关于会车的图像问题
  6. Maven阿里云镜像配置
  7. AJAX和select,绑定值,动态加载select的Item值,设置所选的值 (全都是客户端控件)...
  8. 【pymongodb】去除重复记录
  9. 超级牛散股神叶健颜专找重组题材股,精准买入,不服不行。
  10. html链接到word文档,word做html超链接
  11. 饥荒服务器文档,建立饥荒服务器
  12. 相对于就业来讲,前端工程师和后端开发哪个比较好?
  13. ai自动生成字幕_使用AI对您的会议进行现场字幕
  14. 引流是什么? 怎样学习引流?
  15. iOS数字金额转化为大写汉字(阿拉巴数字转化为汉字)
  16. ArcMap中Shapefile和dBASE文件的创建与管理
  17. 芯片失效分析常见的分析方法有哪些
  18. 从经典到深度学习的数据补全
  19. 索泰显卡超频软件测试要多少时间,【索泰GTX1080评测】显卡超频性能测试-中关村在线...
  20. Android studio中国象棋,下棋思路与代码实现

热门文章

  1. git ignore linux,为什么说.gitignore不能忽视
  2. vs按f5没反应_《死神vs火影》中最受欢迎的游戏角色,仙鸣当之无愧上榜
  3. 微信小程序之apply和call ( 附示例代码和注释讲解) apply call  bind
  4. 微信小程序 封装网络请求并调用
  5. 首例利用智能路由网关犯罪嫌疑人被捕:罪名流量劫持
  6. .net 基于Jenkins的自动构建系统开发
  7. 一星期没完成Ansible任务
  8. [C++] NULL VS nullptr
  9. .NET中多线程的使用
  10. asp.net mvc 3 unobtrusive client side validation not working in IE