GithubHelp home page GithubHelp logo

epaper_clock's Introduction

所用的硬件

  • 树莓派3
  • 微雪4.3寸串口电子墨水屏
  • DHT22温湿度传感模块

硬件连接

屏幕 树莓派
DIN TX(GPIO14)
DOUT RX(GPIO15)
GND GND
VCC 3V
DHT22 树莓派
DOUT 1-Wire(BCM4)
GND GND
VCC 3V
DHT22 DOUT引脚也可以接到其他gpio脚上,不过要相应的修改home_air_sensor.py中read_retry第二个参数

准备软件环境

禽兽,放开那个串口。。

树莓派的串口默认是用于linux串口终端登录用的,如果要通过串口控制屏幕,就需要把它解放出来~

树莓派3的串口BUG

在释放串口之前,我们要先解决一下树莓派3的BUG(如果用1,2代请忽略这一步)树莓派3的硬件串口被分配分配给了蓝牙模块,而GPIO14和GPIO15的串口是由内核模拟的,不稳定(可以说基本不能用),所以首先要把GPIO14和GPIO15改成硬件驱动

第一步 确保SD卡刷了最新的raspbian jessie镜像

第二步 系统启动,并连接了网络

第三步 执行

sudo apt-get update
sudo apt-get upgrade

第四步 编辑 /boot/config.txt 添加一行

dtoverlay=pi3-miniuart-bt

最后 禁用自带蓝牙

sudo systemctl disable hciuart

释放串口

编辑 /boot/cmdline.txt,默认是下面这样

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

或者这样

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 kgdboc=serial0,115200 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

console=ttyAMA0,console=serial0,kgdboc=***这两个参数删掉 变成下面这样

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

之后sudo reboot重启系统 串口就可以正常使用了

安装软件依赖

sudo apt-get install python-requests python-lxml python-serial git build-essential python-dev
git clone https://github.com/adafruit/Adafruit_Python_DHT.git
cd Adafruit_Python_DHT
sudo python ./setup.py install

准备串口屏幕的图片和字体资源

这个串口屏是通过TF卡加载字体和图片资源的(好坑爹的设计。。),所以你需要准备一张TF卡,格式化为 FAT32 文件系统,分配单元大小选择 4096 字节,然后把tf_card文件夹中的文件全部copy到TF卡根目录,并把TF卡查到屏幕的卡槽里。串口屏的更多资料见:http://www.waveshare.net/w/upload/archive/4/4a/20150408073133!4.3inch-e-Paper-UserManual-CN.pdf

终于可以运行了~~

在运行之前先编辑一下weather_time_render.py,找到下面2行,把注释取消掉,运行时会把屏幕TF卡中的文件加载到屏幕自带的NandFlash中,之后就不需要插TF卡了~~

# screen.load_pic()
# time.sleep(5)

运行脚本

sudo ./home_air_sensor.py
./weather_fetcher.py
./weather_time_render.py

没有特殊情况,屏幕将和成品显示同样的画面,第一次运行之后就可以把加载图片的2句代码再次注释掉了~

成品

the clock

epaper_clock's People

Contributors

emptyhua avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

epaper_clock's Issues

有关更换字体

字体格式只能是.fon吗? 有什么好办法能查看它吗?.ttf文件可以吗? 自带的.fon文件我好像没找到办法可以查看它 有什么好办法吗?

剩余多少纸的思路

加个传感器来获取抽纸这一事件,一般纸抽大概都是200张的。所以能估算个百分比剩余纸量。

传感器用超声测距的可行?

新版本微雪4.3 e-paper 屏幕旋转参数

今天收到了新的微雪4.3 e-paper, 运行这份代码发现屏幕旋转方向不对。查询了官网firmware更新后得知现在旋转指令有变化,参见:

== How to update the firmware ==
Description: Change the name of the firmware to "firmware.bin" and save it to your micro SD card. Then insert the card to the 4.3inch e-Paper UART module. Power up the module, the indicator LCD will be off and then will be turned on after about 10 seconds.
After firmware update, please remove the SD card and delete the firmware to prevent repeatedly update during booting up.

Note:
1, only the 4.3inch e-Paper UART module sold after June 2017 supports firmware update.
2, if the SD card cannot be read, try to format the SD card to 2048-byte cluster size & FAT32.
   if the card still cannot be read, connect the pin 3 (DIN) and pin 4 (DOUT) to GND.
3, you have to power up the module while updating.

Changes:
firmware20151222.bin {
    Initial release
}
firmware20170513.bin {
    [+] Fix some bugs
    [+] Supports 90 and 270 rotation. 
        The command to rotate 180 in the older version becomes 90 rotation in the new one.
    [+] Chinese font size settings and English font size settings are no longer different.
}
firmware20170612.bin {
    [+] Improve stability
}
firmware20170718.bin {
    [+] Set orientation 180 (A5 00 0A 0D 02 CC 33 C3 3C A0)
    [+] Set orientation 270 (A5 00 0A 0D 03 CC 33 C3 3C A1)
    [+] Nand full erase (A5 00 09 50 CC 33 C3 3C FC)
}

== 如何更新固件 ==
说明:把需要的固件改名为firmware.bin放入micro SD卡中,然后把micro SD卡插入到4.3inch e-Paper UART 模块中。
上电之后,模块的指示灯处于熄灭状态,等待10秒钟左右,直到指示灯常亮,此时固件写入成功。
固件更新完成之后,请取下SD卡并删除固件,以免每次开机都进行更新。

注意:
1,只有2017年6月之后出货的4.3inch e-Paper 才支持固件更新。
2,如果无法读取SD卡,请试着把micro SD卡格式化为2048字节的FAT32。
   如果依然无法读取,则请把模块的pin 3 (DIN)和pin 4 (DOUT)接地。
3,更新固件的时候,模块必须上电。

== 如何更新韌體 ==
說明:把需要的韌體改名為firmware.bin放入micro SD卡中,然後把micro SD卡插入到4.3inch e-Paper UART 模組中。
上電之後,模組的指示燈處於熄滅狀態,等待10秒鐘左右,直到指示燈常亮,此時韌體寫入成功。
韌體更新完成之後,請取下SD卡並删除韌體,以免每次開機都進行更新。

注意:
1,只有2017年6月之後出貨的4.3inch e-Paper 才支持韌體更新。
2,如果無法讀取SD卡,請試著把micro SD卡格式化為2048位元組的FAT32。
   如果依然無法讀取,則請把模組的pin 3 (DIN)和pin 4 (DOUT)接地。
3,更新韌體的時候,模組必須上電。

版本变更:
firmware20151222.bin {
    初始发布
}
firmware20170513.bin {
    [+] 修复一些bug。
    [+] 支持90度、270度旋转。原本旋转180度的指令变成旋转90度。
    [+] 字体大小设置不再区分中文字体大小设置和英文字体大小设置。
}
firmware20170612.bin {
    [+] 提高稳定性
}
firmware20170718.bin {
    [+] 设置旋转180 (A5 00 0A 0D 02 CC 33 C3 3C A0)
    [+] 设置旋转270 (A5 00 0A 0D 03 CC 33 C3 3C A1)
    [+] Nand 全擦除(A5 00 09 50 CC 33 C3 3C FC)
}

也就是之前的ROTATION_180 实际上是旋转了90度。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.