Coder Social home page Coder Social logo

woodong11 / raspberry_pi_mini_project_bundle Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 45 KB

라즈베리파이와 각종 센서를 이용한 미니 프로젝트 모음입니다.

Python 64.54% C 31.22% Makefile 4.24%
gpio i2c raspberry-pi spi 7-segment piezo-buzzer rfid device-driver kernel-module ioctl

raspberry_pi_mini_project_bundle's Introduction

Raspberry_Pi_mini_project_bundle


라즈베리파이와 각종 센서를 이용한 미니 프로젝트 모음입니다.

이용 기기

Requirement

Raspberry Pi 5

weather_pjt.py

날씨측정과 온도계를 OLED로 출력합니다.

  1. 현재 온도를 BMP 280으로 얻어냅니다. (실내온도)
  2. 현재 시간을 OLED에 출력합니다. (리눅스 명령어 사용)
  3. REST API와 wget 명령어로 날씨 정보를 인터넷에서 얻어옵니다. (실외 온도)

    93BAA774-AD6D-4CA9-BE70-73DE1A893F13


prepare for bmp 280


$ git clone https://github.com/pimoroni/bmp280-python
$ cd bmp280-python
$ sudo ./install.sh


prepare for oled

$ cd ~ && mkdir oled
$ cd ./oled
$ wget https://files.waveshare.com/upload/2/2c/OLED_Module_Code.7z
$ sudo apt-get install p7zip
$ 7zr x ./OLED_Module_Code.7z
$ cd ./OLED_Module_Code/RaspberryPi/python/
$ sudo python3 setup.py install


oled sample test

$ cd ./example/
$ python3 OLED_0in96_test.py


get REST API key

참고: https://icedhotchoco.tistory.com/entry/OpenWeatherMap-%EB%82%A0%EC%94%A8-API

run


소스코드 change to yours! 부분에 자신의 API key, 원하는 도시로 변경합니다.
$ `python3 weather_pjt.py`

mood_light.py


red, green, blue 버튼을 눌러 자기가 원하는 색상을 만들 수 있는 무드등입니다.
1. R, G, B 각 버튼을 누를수록 색상 값이 밝아집니다. 2. 한 컬러에 대해 최대 밝기가 된다면, 다시 가장 어두운 컬러로 변경됩니다. 3. SMD RGB 센서를 이용했습니다.


run

$ python3 mood_light.py

rfid_access_system.py

라즈베리파이의 rfid 센서를 이용해 허가된 사용자만 출입을 허용하는 시스템입니다.

  1. 시스템 준비 단계: 초록 led 3번 깜빡임 후 "ready" 출력
  2. 허가된 이용자 - 출입 인증 성공: Welcome 메시지 출력, 출입 카운팅, 파란 led 한 번 깜빡임
  3. 허가된 이용자 x - 출입 실패 시: LED2 5번 빠르게 깜빡임


ready for RFID

$ cd ~ && mkdir rfid
$ cd ./rfid
$ git clone https://github.com/pimylifeup/MFRC522-python
$ cd ./MFRC522-python/sudo python3 setup.py install

라즈베리 파이 5는 아래의 과정을 진행해야 합니다.

MFRC522.py 편집

`cd ~/rfid/MFRC522-python/mfrc522` `vi MFRC522.py`

vi로 들어가서, import RPi.GPIO as GPIOfrom gpiozero import DigitalOutputDevice 로 바꿔준다

led_toggle.py

특정 LED를 켜고 끌 수 있는 제어 쉘을 제작합니다.

  1. H/W 준비물 : LED 3개, 220옴 저항 3개
  2. 만약 on 상태라면 off로, off 상태라면 on 으로 변경



run

$ python3 led_toggle.py
원하는 숫자 (1~3) 중 하나 입력

7_segment_timing.py

타이밍에 맞춰 버튼을 누르면 불빛이 나오는 게임을 제작합니다.

  1. H/W 준비물 : 7segment, 220옴 저항 3개, LED 2개, 레이저 모듈, 버튼 1개
  2. FND는 0 ~ 9 까지 Up Counting -> 9 ~ 0 까지 Down Counting 진행 반복
  3. 정확히 FND 숫자 7이 나오는 타이밍에 버튼을 누르면 : 연결된 LED 2개와 레이저 모두, 3초간 깜박거림



run

$ python3 led_toggle.py

ikon_love_scenario.py

image


사랑을 했다 노래의 첫 소절을 피에조 부저로 노래합니다.

run


$ `python3 ikon_love_scenario.py`

device_driver.py

도전3 [주의] 해당 라즈베리파이5 커널의 버전은 6.6.23-v8-16k+ 입니다. 낮은 버전일 경우 함수의 인자가 달라 에러가 날 수 있습니다.

App 파일을 만들어서 만들어진 device file인 /dev/deviceFile 에 read / write 할 수 있게 합니다.
insmod → hello ssafy 출력
rmmod → goodbye ssafy 출력
open() → I’m beginner! 출력
close() → I’m Master! 출력


run

한 터미널에서 커널space를 확인합니다.
$ dmesg -w
다른 터미널에서 user space로 실행합니다.
$ make
$ sudo insmod devicedriver.ko
$ sudo chmod 666 /dev/deviceFile
$ ./app
$ sudo rmmod devicedriver

device_driver_ioctl.py

도전4

[주의] 해당 라즈베리파이5 커널의 버전은 6.6.23-v8-16k+ 입니다. 낮은 버전일 경우 함수의 인자가 달라 에러가 날 수 있습니다.
app.c 에서 cmd / arg 2개의 인자를 유저로부터 입력 받아 커널에서 출력합니다.
ioctl를 사용했습니다.
cmd 입력 범위 : 3~6 (3 : age, 4 : birth month, 5 : birth day, 6 : phone number)


run

한 터미널에서 커널space를 확인합니다.
$ dmesg -w
다른 터미널에서 user space로 실행합니다.
$ make
$ sudo insmod devicedriver.ko
$ sudo chmod 666 /dev/deviceFile
$ ./app
원하는 숫자 4개 입력
$ sudo rmmod devicedriver


raspberry_pi_mini_project_bundle's People

Contributors

woodong11 avatar

Watchers

 avatar

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.