오리온

카시오페아

큰곰자리

 

내가 아는게 이게 전부이긴 한데

평소에는 못보던 이상한게 있어서 찰칵!

좌상단 1/3 위치 즘에 먼가 별이 뭉쳐있는게 있는데

 

부랴부랴 우분투에 stellarium 깔고 찾아보는데 흐음..?

엄청 확대해야 이렇게 몰려있는 녀석이 하나 보이는데 설마?

 

'개소리 왈왈 > 사진과 수다' 카테고리의 다른 글

병아리 목욕  (0) 2020.05.08
병아리 2마리 획득  (0) 2020.04.29
숯불. 불꽃  (0) 2020.01.27
네이트온 휴면계정 전환  (0) 2020.01.25
두번째로 볼펜 다 씀  (0) 2019.12.19
Posted by 구차니
embeded/raspberry pi2020. 3. 12. 17:51

헐.. wiringpi 프로젝트 종료? 아무튼 그럼 이걸 쓰면 안되려나..?

일단은 소스를 찾아야 하니 mirror 된 git을 발견 해당 저장소의 소스를 사용하고 복사해서 수정한다.

$ git clone https://github.com/WiringPi/WiringPi.git

$ cd WiringPi/example

$ cp lcd.c lcd2.c

$ vi lcd2.c

$ gcc lcd2.c -o lcd2 -lwiringPi -lwiringPiDev

[링크 : http://wiringpi.com/wiringpi-deprecated/]

  [링크 : https://github.com/WiringPi/WiringPi]

 

별로 도움이 안될 배선 사진. jpg

 

넣을 위치가 마땅찮아 대충 끼워넣는 동영상.avi

 

링크 블로그의 내용 그대로 사용한다.

LCD  1번핀(VSS) --- RPI3  6번핀(ground), 가변저항의 왼쪽 다리

LCD  2번핀(VDD) --- RPI3  2번핀(+5V), 가변저항의 오른쪽 다리

LCD  3번핀(VE, VO) --- 가변저항의 가운데 다리

LCD  4번핀(RS) --- RPI3 26번핀(GPIO 7)

LCD  5번핀(RW) --- RPI3 14번핀(ground)

LCD  6번핀(EN,E) --- RPI3 24번핀(GPIO 8)

 

LCD 11번핀(D4) --- RPI3 11번핀(GPIO 17)

LCD 12번핀(D5) --- RPI3 12번핀(GPIO 18)

LCD 13번핀(D6) --- RPI3 13번핀(GPIO 27)

LCD 14번핀(D7) --- RPI3 15번핀(GPIO 22)

LCD 15번핀(LED+) --- RPI3   4번핀(+5V)

LCD 16번핀(LED-)  --- RPI3 34번핀(ground)


약간(!) 수정한 소스는 아래와 같다.

크게 바뀌는 건 별로 없고, 배선상의 문제로 아래의 코드로 4,5,6,7 에서 0,1,2,3 으로 변경해야 한다.

  if (bits == 4)
    lcdHandle = lcdInit (rows, cols, 4, 11,10, 0,1,2,3,0,0,0,0) ;
//  lcdHandle = lcdInit (rows, cols, 4, 11,10, 4,5,6,7,0,0,0,0) ;

 

전체 소소는 아래와 같다.

$ cat lcd2.c
/*
 * lcd.c:
 *      Text-based LCD driver.
 *      This is designed to drive the parallel interface LCD drivers
 *      based in the Hitachi HD44780U controller and compatables.
 *
 *      This test program assumes the following:
 *
 *      8-bit displays:
 *              GPIO 0-7 is connected to display data pins 0-7.
 *              GPIO 11 is the RS pin.
 *              GPIO 10 is the Strobe/E pin.
 *
 *      For 4-bit interface:
 *              GPIO 4-7 is connected to display data pins 4-7.
 *              GPIO 11 is the RS pin.
 *              GPIO 10 is the Strobe/E pin.
 *
 * Copyright (c) 2012-2013 Gordon Henderson.
 ***********************************************************************
 * This file is part of wiringPi:
 *      https://projects.drogon.net/raspberry-pi/wiringpi/
 *
 *    wiringPi is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU Lesser General Public License as published by
 *    the Free Software Foundation, either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    wiringPi is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public License
 *    along with wiringPi.  If not, see <http://www.gnu.org/licenses/>.
 ***********************************************************************
 */

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

#include <unistd.h>
#include <string.h>
#include <time.h>

#include <wiringPi.h>
#include <lcd.h>

#ifndef TRUE
#  define       TRUE    (1==1)
#  define       FALSE   (1==2)
#endif

static unsigned char newChar [8] =
{
  0b11111,
  0b10001,
  0b10001,
  0b10101,
  0b11111,
  0b10001,
  0b10001,
  0b11111,
} ;


// Global lcd handle:

static int lcdHandle ;

/*
 * usage:
 *********************************************************************************
 */

int usage (const char *progName)
{
  fprintf (stderr, "Usage: %s bits cols rows\n", progName) ;
  return EXIT_FAILURE ;
}


/*
 * scrollMessage:
 *********************************************************************************
 */

static const char *message =
  "                    "
  "Wiring Pi by Gordon Henderson. HTTP://WIRINGPI.COM/"
  "                    " ;

void scrollMessage (int line, int width)
{
  char buf [32] ;
  static int position = 0 ;
  static int timer = 0 ;

  if (millis () < timer)
    return ;

  timer = millis () + 200 ;

  strncpy (buf, &message [position], width) ;
  buf [width] = 0 ;
  lcdPosition (lcdHandle, 0, line) ;
  lcdPuts     (lcdHandle, buf) ;

  if (++position == (strlen (message) - width))
    position = 0 ;
}


/*
 * pingPong:
 *      Bounce a character - only on 4-line displays
 *********************************************************************************
 */

static void pingPong (int lcd, int cols)
{
  static int position = 0 ;
  static int dir      = 0 ;

  if (dir == 0)         // Setup
  {
    dir = 1 ;
    lcdPosition (lcdHandle, 0, 3) ;
    lcdPutchar  (lcdHandle, '*') ;
    return ;
  }

  lcdPosition (lcdHandle, position, 3) ;
  lcdPutchar (lcdHandle, ' ') ;
  position += dir ;

  if (position == cols)
  {
    dir = -1 ;
    --position ;
  }

  if (position < 0)
  {
    dir = 1 ;
    ++position ;
  }

  lcdPosition (lcdHandle, position, 3) ;
  lcdPutchar  (lcdHandle, '#') ;
}


/*
 * waitForEnter:
 *********************************************************************************
 */

static void waitForEnter (void)
{
  printf ("Press ENTER to continue: ") ;
  (void)fgetc (stdin) ;
}


/*
 * The works
 *********************************************************************************
 */

int main (int argc, char *argv[])
{
  int i ;
  int lcd ;
  int bits, rows, cols ;

  struct tm *t ;
  time_t tim ;

  char buf [32] ;

  if (argc != 4)
    return usage (argv [0]) ;

  printf ("Raspberry Pi LCD test\n") ;
  printf ("=====================\n") ;

  bits = atoi (argv [1]) ;
  cols = atoi (argv [2]) ;
  rows = atoi (argv [3]) ;

  if (!((rows == 1) || (rows == 2) || (rows == 4)))
  {
    fprintf (stderr, "%s: rows must be 1, 2 or 4\n", argv [0]) ;
    return EXIT_FAILURE ;
  }

  if (!((cols == 16) || (cols == 20)))
  {
    fprintf (stderr, "%s: cols must be 16 or 20\n", argv [0]) ;
    return EXIT_FAILURE ;
  }

  wiringPiSetup () ;

  if (bits == 4)
    lcdHandle = lcdInit (rows, cols, 4, 11,10, 0,1,2,3,0,0,0,0) ;
//  lcdHandle = lcdInit (rows, cols, 4, 11,10, 4,5,6,7,0,0,0,0) ;
  else
    lcdHandle = lcdInit (rows, cols, 8, 11,10, 0,1,2,3,4,5,6,7) ;

  if (lcdHandle < 0)
  {
    fprintf (stderr, "%s: lcdInit failed\n", argv [0]) ;
    return -1 ;
  }

  lcdPosition (lcdHandle, 0, 0) ; lcdPuts (lcdHandle, "Gordon Henderson") ;
  lcdPosition (lcdHandle, 0, 1) ; lcdPuts (lcdHandle, "  wiringpi.com  ") ;

  waitForEnter () ;

  if (rows > 1)
  {
    lcdPosition (lcdHandle, 0, 1) ; lcdPuts (lcdHandle, "  wiringpi.com  ") ;

    if (rows == 4)
    {
      lcdPosition (lcdHandle, 0, 2) ;
      for (i = 0 ; i < ((cols - 1) / 2) ; ++i)
        lcdPuts (lcdHandle, "=-") ;
      lcdPuts (lcdHandle, "=3") ;

      lcdPosition (lcdHandle, 0, 3) ;
      for (i = 0 ; i < ((cols - 1) / 2) ; ++i)
        lcdPuts (lcdHandle, "-=") ;
      lcdPuts (lcdHandle, "-4") ;
    }
  }

  waitForEnter () ;

  lcdCharDef  (lcdHandle, 2, newChar) ;

  lcdClear    (lcdHandle) ;
  lcdPosition (lcdHandle, 0, 0) ;
  lcdPuts     (lcdHandle, "User Char: ") ;
  lcdPutchar  (lcdHandle, 2) ;

  lcdCursor      (lcdHandle, TRUE) ;
  lcdCursorBlink (lcdHandle, TRUE) ;

  waitForEnter () ;

  lcdCursor      (lcdHandle, FALSE) ;
  lcdCursorBlink (lcdHandle, FALSE) ;
  lcdClear       (lcdHandle) ;

  for (;;)
  {
    scrollMessage (0, cols) ;

    if (rows == 1)
      continue ;

    tim = time (NULL) ;
    t = localtime (&tim) ;

    sprintf (buf, "%02d:%02d:%02d", t->tm_hour, t->tm_min, t->tm_sec) ;

    lcdPosition (lcdHandle, (cols - 8) / 2, 1) ;
    lcdPuts     (lcdHandle, buf) ;

    if (rows == 2)
      continue ;

    sprintf (buf, "%02d/%02d/%04d", t->tm_mday, t->tm_mon + 1, t->tm_year+1900) ;

    lcdPosition (lcdHandle, (cols - 10) / 2, 2) ;
    lcdPuts     (lcdHandle, buf) ;

    pingPong (lcd, cols) ;
  }

  return 0 ;
}

[링크 : https://webnautes.tistory.com/1111]

'embeded > raspberry pi' 카테고리의 다른 글

라즈베리 파이 카메라 케이블이 이상해  (0) 2020.03.15
라즈베리 프로젝트?  (0) 2020.03.14
미세먼지(웹 크롤링) 표시용 장치  (0) 2020.03.11
라즈베리 node.js gpio  (0) 2020.03.10
라즈베리 python gpio  (0) 2020.03.10
Posted by 구차니
embeded/raspberry pi2020. 3. 11. 21:14

음.. 일단 구상은 했는데 구체화를 못해서 어떻게 만들어야 할지 감이 안와서 끄적끄적

 

1. 라즈베리 파이 사용(아두이노 ethernet 실드에 파싱하려니 무리일 느낌)

2. CLCD로 현재 온도 / 습도 / PM2.5 / PM10 의 정보 출력

아침에는(AM 6~9시 정도?) 오늘 비올 확율 출력

저녁에는(PM 9~12시 정도?) 새벽 온도 출력(보일러를 고민하기 위해?)

3. 웹 파싱 혹은 API 부분

기상청 정보, 공공 API 혹은 포탈 정보중 어떤걸 쓸지 고민

3. 데이터베이스

데이터베이스 공부할겸 축적해놓고 마지막 정보를 끌어오는 정도로 하려면

sqlight가 무난하려나? postgresql을 써볼까 고민중(WAS 구성해서)

4. LED

미세먼지 수치에 따라서 Green / Yellow / Red 를 출력

25ug 씩 끊어서 2/2/4개를 할까 고민중

레벨 미터 식으로 출력하자니 미세먼지가 안 좋을수록 녹색이 더 많이 불이 들어와서 고민중

a. 귀찮으니 레벨 미터 방식으로 25ug씩 출력

b. on/off 식으로 녹색 -> 노랑 -> 빨강으로 색이 옮겨가는 식으로 나쁠수록 숫자를 줄여나가기(가독성이..)

c. 걍 7 segment 사용해서 출력(CLCD에도 출력은 하지만)

5. 미세먼지 농도에 따른 릴레이 및 사용시간 적산

2개의 relay를 이용해서 필터 2개를 미세먼지 상황에 따라 자동으로 on/off

2개니까 심하지 않을 경우 하나씩 번갈아 가면서 쓰도록 하여 모터 및 필터 수명 연장을 하도록 함

 

이정도면 되려나..

미세먼지 단계에 따른 정책이 가장 귀찮네... LED를 빼버릴까..

 

+

일단 국내 기준은 아래와 같다.

보통이 31~80 으로 50정도로 꽤 넓은 편이라 보통인 경우가 많았구만..

[링크 : https://bluesky.seoul.go.kr/finedust/common-sense/page/10?article=745]

'embeded > raspberry pi' 카테고리의 다른 글

라즈베리 프로젝트?  (0) 2020.03.14
rpi clcd / wiringpi deprecated  (0) 2020.03.12
라즈베리 node.js gpio  (0) 2020.03.10
라즈베리 python gpio  (0) 2020.03.10
waveshare rpi lcd (a)와 (c)  (0) 2020.03.09
Posted by 구차니
개소리 왈왈/독서2020. 3. 11. 14:00

백수모드 하면서 육아에 조금더 집중을 해보고 싶어서

지하철에 있는 무인 도서관에서 빌린 책.

 

나이대를 0~5세로 잡고 있는 책이라 첫애는 이 나이를 좀 벗어 나고 둘째는 적용이 가능하긴 한데

나이대를 조금 더 높여서 다른 책을 읽어봐야 하는 생각이 든다.

 

아무튼.. 이 책이 마음에 드는 점은 부모에게 해결책을 제시해준다는 것이다.

비록 그게 돈과 사람을 쓰는 일이지만 이상적이지 않으며 현실적인 대답을 준다는 것

그게 오히려 나에게는 속이 시원했다.

 

아이에게 잘해주려면 보육자가 스트레스가 없어야 하는데

그 스트레스를 줄이기 위해서 베이비시터를 써라라고 솔찍하게 적은 책 얼마나 될까?

 

[링크 : http://www.yes24.com/Product/Goods/59421822]

Posted by 구차니
개소리 왈왈/독서2020. 3. 11. 13:57

철지난 책을 이제야 읽는 느낌이긴 하지만 (2018년 출간)

이 책을 읽으면서 내가 한때 GMO에 대해 가졌던 고민

 

"시간을 들여서 교배를 하고 특정 품종을 만들어 가는 행위와

DNA를 수정해서 변경하는 행위에 어떠한 차이가 있는가?"

GMO에 대해서 그렇게 까지 반대할 필요가 있었던 걸까?라는 생각이 들었다.

 

 

책이 조금 두껍지만(370페이지) 크게 지루하지 않게 읽을수 있는 책이다.

조금은 생명공학 쪽으로 다시 해보고 싶은 생각이 들게 하는 책

 

[링크 : http://www.yes24.com/Product/Goods/61810822]

 

+

[링크 : http://www.addgene.org/]

Posted by 구차니
embeded/raspberry pi2020. 3. 10. 21:26

'embeded > raspberry pi' 카테고리의 다른 글

rpi clcd / wiringpi deprecated  (0) 2020.03.12
미세먼지(웹 크롤링) 표시용 장치  (0) 2020.03.11
라즈베리 python gpio  (0) 2020.03.10
waveshare rpi lcd (a)와 (c)  (0) 2020.03.09
라즈베리 2B + waveshare 35c + MAME  (0) 2020.03.08
Posted by 구차니
embeded/raspberry pi2020. 3. 10. 21:22

아래 방법은 기본적으로 되는 듯 한데(2020년 배포 버전, 기본 패키지 상태)

import RPi.GPIO as GPIO

 

다른 방법은 안된다. (별도로 설치가 필요한듯)

일단은 위의 방법이 되면 되니 파이썬 공부할겸 한번 해봐야겠다.

(일단 파이썬이라면 인터넷 접속이랑 파싱이 편할테니..)

 

[링크 : http://www.hardcopyworld.com/gnuboard5/bbs/board.php?bo_table=lecture_rpi&wr_id=4]

'embeded > raspberry pi' 카테고리의 다른 글

미세먼지(웹 크롤링) 표시용 장치  (0) 2020.03.11
라즈베리 node.js gpio  (0) 2020.03.10
waveshare rpi lcd (a)와 (c)  (0) 2020.03.09
라즈베리 2B + waveshare 35c + MAME  (0) 2020.03.08
rpi retro / GPIO  (0) 2020.03.08
Posted by 구차니
게임2020. 3. 10. 17:46

전에는 그렇게 하고 싶어서 샀던걸로 기억을 하는데 지금까지 못하고 있는 중

옛날 게임(?)을 뒤늦게 하다 보니 한글 패치 있는건 마음에 드네.

 

[링크 : http://hanfield.egloos.com/1124407]

'게임' 카테고리의 다른 글

magicka 챕터 4까지 완료!  (0) 2020.03.21
magicka 시작!  (0) 2020.03.20
메트로 2033 공략  (2) 2020.01.12
페이데이 스팀버전 한글패치  (0) 2019.07.17
DCS World 해봄  (4) 2018.04.08
Posted by 구차니
embeded/arduino(genuino)2020. 3. 9. 21:30

회로와 소스는 아래 링크 참조

[링크 : https://www.arduino.cc/en/tutorial/knob]

 

예전에 커넥터를 분해해버려서 저런 용도로 밖에 못 쓰는 서보

eleparts꺼를 뜯을걸 왜 hitec을 했을까 ㅠㅠ

 

변형한 소스는 아래와 같은데 별 건 없음

#include <LiquidCrystal.h>
#include <Servo.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int potpin = 0;
int raw;
int val;
Servo myservo;

void setup() {
  myservo.attach(9);
  
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.leftToRight();

//  lcd.setCursor(0, 0);
//  lcd.print("T:-10C H:100% R:50% PM12");
//
//  lcd.setCursor(0, 1);
//  lcd.print("PM1:100 PM25:100");
}

void loop() {
  char str[20];
  raw = analogRead(potpin);
  val = map(raw, 0, 1023, 0, 180);
  sprintf(str, "%4d %3d", raw, val);
  
  lcd.setCursor(0, 0);
  lcd.print(str);

  myservo.write(val);                  // sets the servo position according to the scaled value
  delay(15);                           
}

 

 

'embeded > arduino(genuino)' 카테고리의 다른 글

오랫만에 지름  (2) 2020.04.07
RGB LED 저항값  (0) 2020.03.14
arduino knob 변형 adc 값 읽기  (0) 2020.03.09
arduino nano + CLCD  (0) 2020.03.07
arduino ide ubuntu에서 한글 깨질때  (0) 2020.02.17
Posted by 구차니
embeded/arduino(genuino)2020. 3. 9. 20:58

원래 값으로 읽어 보니 0~1023 사이의 값으로만 읽혀 온다.

10bit ADC 라 그런가?

 

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int potpin = 0;
int val;

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.leftToRight();
}

void loop() {
  char str[20];
  val = analogRead(potpin);
//  val = map(val, 0, 1023, 0, 180);
  sprintf(str, "%5d", val);
  
  lcd.setCursor(0, 0);
  lcd.print(str);
}

[링크 : https://www.arduino.cc/en/tutorial/knob]

 

아무튼 겸사겸사 CLCD 밝기 조정도 겸사겸사 성공!

 

+

도대체.. 돈들여서 커다란 가변저항이랑 노브는 왜 샀을까.. 그냥 있던걸로 해볼 걸 ㅠㅠ

'embeded > arduino(genuino)' 카테고리의 다른 글

RGB LED 저항값  (0) 2020.03.14
arduino servo / knob 예제 실행  (0) 2020.03.09
arduino nano + CLCD  (0) 2020.03.07
arduino ide ubuntu에서 한글 깨질때  (0) 2020.02.17
e-paper 모듈 (아두이노 HAT)  (0) 2019.04.17
Posted by 구차니