# GPIO Port Expander & 1-Wire (DS18B20)
This is an example to use PCF8574 (GPIO port expander) with the EcoBoard
You can easly use that example for an other application, but the code and the explication below are written for
EcoBoard board.
Feel free to collaborate and share suggestions for improvement
## GPIO Port Expander
EcoBoard allow you to use 6 additonal GPIO with the PCF8574 ([Datasheeet](https://www.ti.com/product/PCF8574). The outputs P1 to P6, will allow you to control the status of another device or an LED. However, the outputs can only provide 25mA. In some cases, this power may not be sufficient. It's the reason why, we added three MOSFET-P (IRML2244) on the outputs P0, P1, P2 and P3.
Thus, the outputs P0, P1, P2 and P3 of the J0, J1, J2 and J3 connectors can now supply up to 500mA.
P4, P5 and P6 outputs depend on the PCF8574.
P4 and P5 are connected to a LED D5 and D6
You wil see how to turn on/off the two LED connected to the PCF8574 (p5 & P6)
P4 is used to power the 1-Wire sensor.
## 1-Wire - Ds18B20 sensor
We will play with the DS18B20 sensor (Waterproof temperature sensor).
You can check the [EcoDs18b20 library](https://github.com/ecosensors/EcoDs18b20), as well. There is a very interresting section about the compensated temperature value, that you can apply here.
### Datasheet
* Operating voltage : 3.0 - 5.5VDC
* Precision (-10°C - +85°C) : ±0.5°C.
* Measuring range : –55°C à +125°C
### Sensor wire
Color | Pin
--- | ---
RED | 3V3
BLUE | GND
YELLOW | READ (with a 4.7K pullup)
Note: The color can be different for some sensors. Look at the datasheet
## Requirement
* Solder the Jumper JP_4 to P4 (not to 3V3)
* Solder the Jumper JP4 to UP (not DOWN) to have a 4.7kOhm pullup resistance on the READ pin (A4)
## WIRE
Connect the sensor to J4
**Important:** I used the DS18B20 to measure the soil temprature. It's important to never permanetly power the sensor. In other word, the sensor has to be powered only during a measure. It's the reason why, P4 of the GPIO port expender will power (or not) the sensors when needed.
* The red wire (POWER) is connected to pin P4 of the PCF8574. It will power the sensor when we need to ake a measure
* The yellow wire (READ) is connected to A4 of the ATSAM21 microcontroller **With a 4.7K pullup resistance**
## Libraries
Make sure you have the needed libraries in SKETSCHBOOK/Libraries/
Open Arduino IDE, and then go to **Sketch -> Add Library -> Manage Libraries**
Search and install
* Adafruit PCF8574 by Adafruit
* Adafruit BusIO (dependencies)
* OneWire
Close and reopen Arduino IDE
```
#include <Wire.h> // Need for I2C Bus
```
没有合适的资源?快使用搜索试试~ 我知道了~
(源码)基于Arduino的物联网生态板系统.zip
共34个文件
jpg:14个
md:10个
ino:6个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 60 浏览量
2024-11-24
02:55:03
上传
评论
收藏 1.34MB ZIP 举报
温馨提示
# 基于Arduino的物联网生态板系统 ## 项目简介 物联网生态板系统(EcoBoard)是一款基于ATSAMD21G18 ARM Cortex M0处理器的微控制器,运行频率为48MHz,逻辑电压为3.3V,与Arduino Zero兼容。该系统设计用于物联网应用,支持LoRaWAN和GPRSGPS通信模块,配备太阳能充电功能、EEPROM存储、MicroSD卡日志记录、GPIO扩展端口等,适用于环境监测、农业灌溉等多种场景。 ## 项目的主要特性和功能 LoRaWAN通信支持RFM699x(868MHz)模块,可连接LoRaWAN网关。 GPRSGPS模块未来将支持SIM808模块,实现GPRS和GPS功能。 太阳能充电内置BQ24074芯片,支持510V太阳能板输入,智能管理锂电池充电。 存储扩展1KB EEPROM用于存储参数,MicroSD卡用于日志记录。
资源推荐
资源详情
资源评论
收起资源包目录
(源码)基于Arduino的物联网生态板系统.zip (34个子文件)
LICENSE.md 21KB
assets
remorque-loarawan-solaire.jpg 254KB
.DS_Store 6KB
jp_1.jpg 19KB
charge-rate.jpg 25KB
ecoboard-lora.jpg 246KB
ecoboard.jpg 274KB
term.jpg 31KB
j0.jpg 30KB
lora.jpg 60KB
mosfet.jpg 26KB
pullupdown.jpg 26KB
input-current-limit.jpg 36KB
lorawan.jpg 75KB
lorawan-large.jpg 252KB
ntc.jpg 16KB
examples
.DS_Store 8KB
03_expander-1wire
03_expander-1wire.ino 5KB
README.md 3KB
05_rtc-lowpower
05_rtc-lowpower.ino 7KB
README.md 808B
04_multi-ds18b20
04_multi-ds18b20.ino 13KB
README.md 501B
06_rtc-sd-bme280
README.md 2KB
06_rtc-sd-bme280.ino 17KB
07_anemometer
README.md 1KB
01_bme280
01_bme280.ino 3KB
README.md 584B
02_eeprom
02_eeprom.ino 5KB
README.md 402B
README.md 1KB
Ecoboard.cpp 12KB
Ecoboard.h 2KB
README.md 2KB
共 34 条
- 1
资源评论
t0_54coder
- 粉丝: 2539
- 资源: 5602
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功