亿迅智能制造网
工业4.0先进制造技术信息网站!
首页 | 制造技术 | 制造设备 | 工业物联网 | 工业材料 | 设备保养维修 | 工业编程 |
home  MfgRobots >> 亿迅智能制造网 >  >> Manufacturing Technology >> 制造工艺

Python/MicroPython Sensor Logger with Google Sheets

用于将传感器值记录到 Google Sheet 的系统。微控制器与服务器之间利用HTTP请求进行通信,利用gspread将数据写入在线电子表格。

您需要按照以下链接中的说明设置对电子表格的访问权限。

http://gspread.readthedocs.io/en/latest/oauth2.html

将 D0 引脚连接到 RST: 必须连接才能从 Deepsleep 唤醒。

+ :在 Wemos 上达到 3.3v

- :在 Wemos 上接地

信号 :到 Wemos 上的 A0

像往常一样,如果您在自己的项目中需要帮助来实现这一点,请给我留言,我会尽快回复您。

原理图

代码

import machineimport urequestsimport timertc =machine.RTC() # deepsleeprtc.irq 的时钟(trigger=rtc.ALARM0,wake=machine.DEEPSLEEP)adc =machine.ADC(0) #引脚读取传感器电压######################传感器校准################### ####上右值逆* 1000上左#干燥空气=759(0%)=1.31752305665349143610013175231#水=382(100%)的值=2.61780104712041884816753926702#差异=1.30027799046692741206740751471#1(%)=0.0130027799046692741206740751471hours =STR(时间.localtime()[3])mins =str(time.localtime()[4])secs =str(time.localtime()[5])if int(secs) <10:secs ='0' + secsif int (mins) <10:mins ='0' + minstimestr =hours + ':' + mins + ':' + secsvariable =(((1 / adc.read()))* 1000) / 0.01300277990466927412067407511010if) :variable =100if variable <0:variable =0url ='http://192.168.1.2:8000/solomon'headers ={'content-type':'application/json'}data ='{"Value":"% s", "时间":"% s"}' % (variable, timestr)resp =urequests.post(url, data=data, headers=headers) # 发送请求print(resp.json())rtc.alarm(rtc.ALARM0, 25000) # 设置闹钟25 秒machine.deepsleep() # 进入睡眠状态...

来源:Python/MicroPython Sensor Logger with Google Sheets


制造工艺

  1. Raspberry Pi 温度记录器
  2. Python 和 Raspberry Pi 温度传感器
  3. 带 RPi 的线跟踪传感器
  4. 带有 RPi 的环境传感器 API
  5. ThingSpeak 温度监视器与 Raspberry Pi
  6. 带有 Raspberry Pi 和湿度传感器的 Aeroponics
  7. Python/MicroPython Sensor Logger with Google Sheets
  8. 使用 Raspberry Pi 和 Python 构建机器人
  9. 带有示例的 Python 字符串计数()
  10. 带有示例的 Python round() 函数
  11. 带有示例的 Python map() 函数
  12. Python - 使用 C 进行扩展编程