5543|13

113

帖子

0

TA的资源

一粒金砂(中级)

楼主
 

【ESP32】ADC 更新 [复制链接]

 
  本帖最后由 47857872 于 2018-6-1 00:10 编辑 在1.9.4版本的ESP32 mpy固件中 ADC部分可能较之前有一定的变化,正好调到这里就贴出来 首先,使用的基本代码如下:

```pythonfrom machine import Pin, ADC adc = ADC(Pin(36)) adc.atten(adc.ATT_0DB) adc.read()

但是较之8266的固件,可以在tab按键后看到 ADC的方法只有 ADC.atten() ADC.read() ADC.width() 另外,ATTN的参数使用可以扩展采样电压范围,但是据说线性度没想象那么好,这点我还没有测试。。。

ADC pin input range is 0-1.1V. This maximum value can be increased up to 3.3V using the highest attenuation of 11dB. Do not exceed >the maximum of 3.3V, to avoid damaging the device.

最新回复

这个硬件和我们常见的低成本ESP32开发板不一样,支持4M及以上psRAM。我们下半年来做一个吧。  详情 回复 发表于 2018-6-3 15:39
点赞 关注
 
 

回复
举报

113

帖子

0

TA的资源

一粒金砂(中级)

沙发
 
同时,发现8266 在1.9.4固件下 adc.read()的测量范围对应的是0-3.1V(1024),不是官方宣称的0-1v。。。

点评

物理层上最高输入是1V,是bug吗?  详情 回复 发表于 2018-6-1 19:54
 
 
 

回复

1万

帖子

24

TA的资源

版主

板凳
 
47857872 发表于 2018-6-1 09:08
同时,发现8266 在1.9.4固件下 adc.read()的测量范围对应的是0-3.1V(1024),不是官方宣称的0-1v。。。

物理层上最高输入是1V,是bug吗?

点评

shao大有没有用过loboris/MicroPython_ESP32_psRAM_LoBo 这个版本?发现这个版本里有很多官方没有的功能,而且好几个功能很好使  详情 回复 发表于 2018-6-2 09:33
我的测试方法是直接读这个读数,一直读到1024看看电压是多少,结果是3.1v 物理层上。。。应该不会只输入到1V吧。。。不然这个3.1V咋出来的 今天我做了ESP32的AD的校正 用的是ATTN_0DB,12bit,可以比较准确的测0  详情 回复 发表于 2018-6-1 22:32
 
 
 

回复

113

帖子

0

TA的资源

一粒金砂(中级)

4
 
本帖最后由 47857872 于 2018-6-2 00:09 编辑
dcexpert 发表于 2018-6-1 19:54
物理层上最高输入是1V,是bug吗?

我的测试方法是直接读这个读数,一直读到1024看看电压是多少,结果是3.1v
物理层上。。。应该不会只输入到1V吧。。。不然这个3.1V咋出来的

今天我做了ESP32的AD的校正 用的是ATTN_0DB,12bit,可以比较准确的测75mv-1V内的电压了
ad_tmp = ad_tmp/sample_num*976.7/4096+75

点评

你用的是ESP8266开发板吧,有些开发板内部带有分压电阻了,所以可以输入更高电压。你直接量ADC引脚试试  详情 回复 发表于 2018-6-2 10:13
 
 
 

回复

113

帖子

0

TA的资源

一粒金砂(中级)

5
 
本帖最后由 47857872 于 2018-6-2 09:55 编辑
dcexpert 发表于 2018-6-1 19:54
物理层上最高输入是1V,是bug吗?

shao大有没有用过loboris/MicroPython_ESP32_psRAM_LoBo 这个版本?发现这个版本里有很多官方没有的功能,而且好几个功能很好使
加个连接
链接已隐藏,如需查看请登录或者注册

 
 
 

回复

1万

帖子

24

TA的资源

版主

6
 
47857872 发表于 2018-6-1 22:32
我的测试方法是直接读这个读数,一直读到1024看看电压是多少,结果是3.1v
物理层上。。。应该不会只输入 ...

你用的是ESP8266开发板吧,有些开发板内部带有分压电阻了,所以可以输入更高电压。你直接量ADC引脚试试

点评

嗯 我想起来了 nodemcu上是有分压电阻。。。给忘记了 MicroPython_ESP32_psRAM这个版本里 有很多功能是主线版本不具备的 甚至我看issue里有很多修正蓝牙的帖子在 昨天很晚才找到这个 后面有时间我试试这个  详情 回复 发表于 2018-6-2 18:22
 
 
 

回复

1万

帖子

24

TA的资源

版主

7
 
MicroPython_ESP32_psRAM的版本没有试过,听说是不错。
 
 
 

回复

113

帖子

0

TA的资源

一粒金砂(中级)

8
 
dcexpert 发表于 2018-6-2 10:13
你用的是ESP8266开发板吧,有些开发板内部带有分压电阻了,所以可以输入更高电压。你直接量ADC引脚试试

嗯 我想起来了 nodemcu上是有分压电阻。。。给忘记了
MicroPython_ESP32_psRAM这个版本里 有很多功能是主线版本不具备的
甚至我看issue里有很多修正蓝牙的帖子在 昨天很晚才找到这个 后面有时间我试试这个

点评

micropython官方团队在ESP32上进展很慢,可能原因一是硬件本身bug,在就是为了先发展商业版本。所以国外有网友着急开了一个ESP32的新论坛。 https://bbs.eeworld.com.cn/thread-617804-1-1.html  详情 回复 发表于 2018-6-2 21:14
 
 
 

回复

1万

帖子

24

TA的资源

版主

9
 
47857872 发表于 2018-6-2 18:22
嗯 我想起来了 nodemcu上是有分压电阻。。。给忘记了
MicroPython_ESP32_psRAM这个版本里 有很多功能是 ...

micropython官方团队在ESP32上进展很慢,可能原因一是硬件本身bug,在就是为了先发展商业版本。所以国外有网友着急开了一个ESP32的新论坛。

https://bbs.eeworld.com.cn/thread-617804-1-1.html

点评

哦哦 原来Boris是他啊 嗯,是啊 他这个确实会有一些新的东西进来,现在用的ESP-IDF是3.1 怪不得有蓝牙 I (30) boot: ESP-IDF v3.1-dev-961-ga2556229 2nd stage bootloader  详情 回复 发表于 2018-6-3 09:21
 
 
 

回复

113

帖子

0

TA的资源

一粒金砂(中级)

10
 
dcexpert 发表于 2018-6-2 21:14
micropython官方团队在ESP32上进展很慢,可能原因一是硬件本身bug,在就是为了先发展商业版本。所以国外 ...

哦哦 原来Boris是他啊
嗯,是啊 他这个确实会有一些新的东西进来,现在用的ESP-IDF是3.1 怪不得有蓝牙
I (30) boot: ESP-IDF v3.1-dev-961-ga2556229 2nd stage bootloader
 
 
 

回复

113

帖子

0

TA的资源

一粒金砂(中级)

11
 
dcexpert 发表于 2018-6-2 21:14
micropython官方团队在ESP32上进展很慢,可能原因一是硬件本身bug,在就是为了先发展商业版本。所以国外 ...

这个是LoBo版本的启动输出


  1. rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
  2. configsip: 0, SPIWP:0xee
  3. clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
  4. mode:DIO, clock div:2
  5. load:0x3fff0018,len:4
  6. load:0x3fff001c,len:5904
  7. ho 0 tail 12 room 4
  8. load:0x40078000,len:0
  9. load:0x40078000,len:14948
  10. entry 0x4007862c
  11. I (30) boot: ESP-IDF v3.1-dev-961-ga2556229 2nd stage bootloader
  12. I (30) boot: compile time 17:37:01
  13. I (30) boot: Enabling RNG early entropy source...
  14. I (36) boot: SPI Speed      : 40MHz
  15. I (40) boot: SPI Mode       : DIO
  16. I (44) boot: SPI Flash Size : 4MB
  17. I (48) boot: Partition Table:
  18. I (52) boot: ## Label            Usage          Type ST Offset   Length
  19. I (59) boot:  0 nvs              WiFi data        01 02 00009000 00006000
  20. I (66) boot:  1 phy_init         RF data          01 01 0000f000 00001000
  21. I (74) boot:  2 MicroPython      factory app      00 00 00010000 001d0000
  22. I (81) boot:  3 internalfs       Unknown data     01 82 001e0000 00100000
  23. I (89) boot: End of partition table
  24. I (93) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x6d79c (448412) map
  25. I (191) esp_image: segment 1: paddr=0x0007d7c4 vaddr=0x3ffb0000 size=0x0284c ( 10316) load
  26. I (193) esp_image: segment 2: paddr=0x00080018 vaddr=0x400d0018 size=0x13d6a0 (1300128) map
  27. I (455) esp_image: segment 3: paddr=0x001bd6c0 vaddr=0x3ffb284c size=0x02a50 ( 10832) load
  28. I (457) esp_image: segment 4: paddr=0x001c0118 vaddr=0x40080000 size=0x00400 (  1024) load
  29. I (461) esp_image: segment 5: paddr=0x001c0520 vaddr=0x40080400 size=0x15d60 ( 89440) load
  30. I (490) esp_image: segment 6: paddr=0x001d6288 vaddr=0x400c0000 size=0x00648 (  1608) load
  31. I (490) esp_image: segment 7: paddr=0x001d68d8 vaddr=0x50000000 size=0x0098c (  2444) load
  32. I (502) boot: Loaded app from partition at offset 0x10000
  33. I (503) boot: Disabling RNG early entropy source...
  34. I (508) cpu_start: Pro cpu up.
  35. I (512) cpu_start: Starting app cpu, entry point is 0x40081434
  36. I (0) cpu_start: App cpu up.
  37. I (522) heap_init: Initializing. RAM available for dynamic allocation:
  38. D (529) heap_init: New heap initialised at 0x3ffae6e0
  39. I (534) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
  40. D (540) heap_init: New heap initialised at 0x3ffbcfd8
  41. I (545) heap_init: At 3FFBCFD8 len 00023028 (140 KiB): DRAM
  42. I (552) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
  43. I (558) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
  44. D (564) heap_init: New heap initialised at 0x40096160
  45. I (570) heap_init: At 40096160 len 00009EA0 (39 KiB): IRAM
  46. I (576) cpu_start: Pro cpu start user code
  47. D (588) clk: RTC_SLOW_CLK calibration value: 3286438
  48. I (2) cpu_start: Starting scheduler on PRO CPU.
  49. I (0) cpu_start: Starting scheduler on APP CPU.
  50. D (3) heap_init: New heap initialised at 0x3ffe0440
  51. D (7) heap_init: New heap initialised at 0x3ffe4350
  52. D (12) MicroPython: Entry
  53. D (1014) MicroPython: SPIRAM: Disabled
  54. D (1015) nvs: nvs_flash_init_custom partition=nvs start=9 count=6
  55. D (1066) MicroPython: Configure stack
  56. D (1066) nvs: nvs_open_from_partition MPY_NVM 1
  57. D (1066) nvs: nvs_get MPY_StackSize 4
  58. D (1067) nvs: nvs_get_str_or_blob MpyTimeZone
  59. D (1071) MicroPython: MPy stack: 0x3ffc06d8 - 0x3ffc56e0 (20488)
  60. D (1077) MicroPython: Configure heap
  61. D (1081) nvs: nvs_get MPY_HeapSize 4
  62. D (1084) MicroPython: MPy heap: 0x3ffc56e4 - 0x3ffd7724
  63. D (1090) MicroPython: Main task min stack: 2200
  64. I (1092) MicroPython: [=== MicroPython FreeRTOS task started (sp=3ffc5610) ===]


  65. Internal FS (SPIFFS): Mounted on partition 'internalfs' [size: 1048576; Flash address: 0x1E0000]
  66. ----------------
  67. Filesystem size: 956416 B
  68.            Used: 1280 B
  69.            Free: 955136 B
  70. ----------------

  71. FreeRTOS running on BOTH CORES, MicroPython task started on App Core (1).

  72. Reset reason: Power on reset
  73.     uPY stack: 19456 bytes
  74.      uPY heap: 72000/6320/65680 bytes

  75. MicroPython ESP32_LoBo_v3.2.17 - 2018-05-16 on ESP32 board with ESP32
  76. Type "help()" for more information.
  77. >>>
复制代码
 
 
 

回复

113

帖子

0

TA的资源

一粒金砂(中级)

12
 
本帖最后由 47857872 于 2018-6-3 09:43 编辑
dcexpert 发表于 2018-6-2 21:14
micropython官方团队在ESP32上进展很慢,可能原因一是硬件本身bug,在就是为了先发展商业版本。所以国外 ...

这个是LoBo在20180516这个版本的changelist, 有很多有实用价值的功能开始work了


  1. Updates from April 04 - May 16:

  2. MicroPython core updated to the latest commit (1b7487e, 2018-05-16) from MicroPython master branch.
  3. esp-idf updated to "v3.1-dev-961-ga2556229", comit a2556229aa6f55b16b171e3325ee9ab1943e8552, from 2018-05-08
  4. Temporary solution for esp-idf bug (cannot set the QIO mode on some Flash chips)
  5. Added support for runtime detection of SPIRAM
  6. firmwares built with SPIRAM support can now run on boards without SPIRAM
  7. Added GPS module, Wiki
  8. Collecting gps data from separate FreeRTOS task (in background) is supported
  9. Added built-in function float_precision(), precision of floats can be now set at run time
  10. Added new method of initializing the array objects, size of the array object can be specified, uses much less heap space
  11. Updated mqtt module, Wiki
  12. uses new espmqtt library, new features and some bug fixes
  13. mqtt over websockets is now also supported
  14. Updated sys module
  15. added function espidf_info(), returns information about used esp-idf
  16. Added sys.tz() function o get or set the time zone
  17. The time zone is saved in NVS string and time zone is set on boot
  18. The time zone can be now preserved on reset, power off or deepsleep wake up
  19. Updated machine module
  20. Added SetStackSize() function to set the MicroPython stack size
  21. Added SetHeapSize() function to set the MicroPython heap size
  22. Both heap an stack sizes are set as NVS variables and are read at boot time to set the sizes, so the sizes may now be different than the compiled ones
  23. Updated machine.timer module, changed function name reshot() to reshoot()
  24. Updated machine.ADC module
  25. Fixed bug: adc.read() always returns 0
  26. Added support for ADC2
  27. other minor bug fixes and improvements
  28. Updated gc module
  29. added function collectif(), conditional collect if heap usage greater than specified
  30. optional argument can now be used with gc.collect() and gc.collectif() which enables printing some gc information
  31. gc.threshold() value must be > 20K
  32. gc.threshold() accepts additional argument which can set the gc debug level during automatic garbage collection
  33. Updated utimeq module, fixed bugs in getting/setting time values
  34. Updated display module, added text_x() and text_y() functions
  35. Fixed bug when mp_hal_ticks_base was not updated afer soft resets
  36. Updated network module, Wiki
  37. Operating in STA & AP mode at the same time (APSTA) is now supported
  38. ap_if.status('clients') now returns client's mac address and IP address
  39. Updated uart module, Wiki
  40. changes needed for gps module
  41. more reliable
  42. fixed critical bug which could cause crash after gc collect
  43. fixed bug when wrong parameter was returned to callback functions
  44. fixed issue where linefeed and pattern arguments were not able to accept character values > \x7f
  45. added option to set inverted mode for Rx, Tx, CTS, RTS
  46. enabled using hw flow controll if CTS and/or RTC pisn are defined
  47. write_break() function added which emits the break signal after data write
  48. Updated sockets module from latest official MicroPython
  49. Updated rtc module, fixed bug in setting time zone in ntp_sync() function
  50. microWebServer frozen module updated
  51. Some frozen modules updated: upip (frozen module, pypy URL updated, some issues with ssl fixed), urequests, logging
  52. SD card improvements
  53. Improved initialization, it is now possible to connect SD cards without external pull-ups
  54. high speed mode is now enabled for SD modes
  55. Updated _thread module, some improvements, better handling by garbage collect
  56. Updated BUILD.sh, added options  to select the comm port and/or baud rate from command line
  57. Some new options added to menuconfig:
  58. Using or not UNICODE can now be configured
  59. Using or not Finalizer
  60. Whether gc.collect() returns value
  61. MicroPython scheduler depth
  62. MicroPython thread GIL
复制代码

点评

这个硬件和我们常见的低成本ESP32开发板不一样,支持4M及以上psRAM。  详情 回复 发表于 2018-6-3 15:39
 
 
 

回复

1万

帖子

24

TA的资源

版主

13
 
47857872 发表于 2018-6-3 09:42
这个是LoBo在20180516这个版本的changelist, 有很多有实用价值的功能开始work了

这个硬件和我们常见的低成本ESP32开发板不一样,支持4M及以上psRAM。我们下半年来做一个吧。

点评

好 我先把这个的编译环境搭起来 手上的esp32可以先验证一部分可玩的  详情 回复 发表于 2018-6-3 16:04
 
 
 

回复

113

帖子

0

TA的资源

一粒金砂(中级)

14
 
dcexpert 发表于 2018-6-3 15:39
这个硬件和我们常见的低成本ESP32开发板不一样,支持4M及以上psRAM。我们下半年来做一个吧。

好 我先把这个的编译环境搭起来 手上的esp32可以先验证一部分可玩的
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/6 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表