文章归档

Hand-On Tutorial for Raspberry Pi DIY project

树莓派读取DHT11

Overview 在本文中将介绍如何用树莓派读取温湿度传感器DHT11 温湿度数据。温度湿度模块看起来简单,只有三个引脚(实际4个接口,有一个脚悬空),但仔细一想,3个引脚分别作为VCC、GND、DATA用,因为传给树莓派GPIO的只有高电平、低电平,那么怎么来读取温度数字和湿度数字呢?这么一想,并不简单!因为引脚少,它需要高低变化的时序信号来表达数值,还有一些其它信号如开始信号等等。所以得先深入了解一下DHT11模块了。 DHT11时序介绍 1)数据帧格式 DHT11会向主机发送40位(5子节)数据,第一二个子节数据表示温度值;第三四个子节数据代表湿度值;最后一个子节是校验码。如果数据无误的情况下,前4个子节的和等于校验码。 2)握手阶段 默认状态下DATA脚为高电平,主机端GPIO发送开始信号,首先拉低DATA脚至少18ms,然后拉高DATA脚20-40us等待DHT11的响应信号 一旦DHT11收到开始信号,DHT11将向主机发送响应信号,同时将DATA脚拉低80us作为响应,然后DHT11拉高DATA脚80us,握手完毕。 3)数据发送阶段 一次的湿度和温度数据,DHT11需要发送40bits数据,每一位数据之前都以50us低电平开始,随后的高电平时序信号,持续26us-28us的表示这一位是0,持续70us表示这一位是1,然后继续50us低电平,紧接着下一位的高电平开始。 数据 '0': 数据 '1': Parts 为了完成本项目需要用到如下器件 Pi3 x1 DHT11 x1 杜邦线 x3 Hardware 硬件连接很简单,将DHT11的VCC接到Pi的3.3V;DHT11的GND接到Pi的GND;DHT11的DATA接到Pi的GPIO14(BCM编码方式),关于GPIO的识别请参考: How to read Raspberry Pi i/o pin diagram (GPIO pin graph) Software 本文将介绍2中方式读取DHT11数据,一种是Python方式读取,一种是C语言方式读取。 1)Python方式 在任一路径下(如/home/pi)用nano新建一个dht11-test.py文件

文章分类 Raspberry Pi Project

Use Raspberry Pi to get light strength data with photoresistor

Objective In this project, we will use Raspberry Pi to get light strength data with photoresistor . As raspberry pi can not handle analog input, we need an A/D adapter to convert analog voltage into digital signal. You can  select either

文章分类 Raspberry Pi Project, Tutorial & eBook

Use raspberry pi to get IR remote code

Objective In this project, we will connect an Infrared remote control receiver to Raspberry Pi. After an IR remote controller key is pushed, Raspberry Pi will decode the signal and display the key code on the terminal. Parts: 1 pc

文章分类 Raspberry Pi Project, Tutorial & eBook

Use NodeMCU to display MQTT IOT message on I2C1602 LCD

About NodeMCU NodeMCU is a very popular Micro controller with wifi access. It is based on ESP8266 - a cheap but powerful chip  and fully support Arduino IDE. If you familiar with Arduino IDE, you can program NodeMCU in no time.

文章分类 Arduino Parts & Projects, Raspberry Pi Project

Use Raspberry Pi display temperature/humidity to i2c LCD screen

Objective: In this project, we will get temperature and humid data from DHT11 and send it to Raspberry Pi, then display the temperature and humid on 16x2 LCD screen. If you don’t know what is GPIO layout, check our tutorial

文章分类 Raspberry Pi Project, Tutorial & eBook

Raspberry Pi 3.5" HDMI touch screen installation guide

QQ20161122095746

Note:  The Installation guide is about customized image which is combinated 3.5" LCD driver and a fresh OS (Raspbian, Kali, or Ubuntu). It's simple to install both 3.5" LCD driver and a fresh OS at once. You can choose different

文章分类 Raspberry Pi Project, Tutorial & eBook

Use rapsberry Pi to drive U-BLOX NEO-6M GPS module

792px-GPSEZ5

Objective: In this project, we will use raspberry Pi2  to drive U-BLOX NEO-6M GPS module to get latitude, longitude, altitude,speed etc. U-BLOX NEO-6M GPS module does not support Pi3 , for more info about  U-BLOX NEO-6M , read http://osoyoo.com/2016/10/25/use-mega2560-to-drive-gps/ Connection Raspberry Pi GPS Module 3.3V

文章分类 Raspberry Pi Project

Use raspberrypi and AD converter to make a MP3 music player

DSC_6793

In this project, we will use potentiometer to control the volume of  music player. As raspberry pi can not accept analog signal from potentiometer , we need to use ADC module to convert analog signal to digital signal before sending it to

文章分类 Raspberry Pi Project

Using Raspberry Pi to drive BMP180

hgreagadfgvb

Objective: In this project, we will use raspberry pi to get environment temperature, pressure  from BMP180 sensor and calculate  attitude, then display the result to monitor. Parts and Devices 1 x raspberry Pi3 1 x GPIO to Breadboard 40-pin breakout

文章分类 Raspberry Pi Project

Using Raspberry Pi to drive relay

fdhhtgh

Objective: Relay is a signal-controlled switch. In this project, we will use Raspberry pi to drive relay and control the on/off of a LED light. After running the code from Pi, the LED will turn on and off LED every

文章分类 Raspberry Pi Project

Meta