embeded/raspberry pi2015. 7. 6. 18:47

결국은 비표준 통신이라.

GPIO로 쌩 고생을 시켜야하나...


/*

 *  dht11.c:

 * Simple test program to test the wiringPi functions

 * DHT11 test

 */


#include <wiringPi.h>


#include <stdio.h>

#include <stdlib.h>

#include <stdint.h>

#define MAXTIMINGS 85

#define DHTPIN 7

int dht11_dat[5] = { 0, 0, 0, 0, 0 };


void read_dht11_dat()

{

uint8_t laststate = HIGH;

uint8_t counter = 0;

uint8_t j = 0, i;

float f; /* fahrenheit */


dht11_dat[0] = dht11_dat[1] = dht11_dat[2] = dht11_dat[3] = dht11_dat[4] = 0;


/* pull pin down for 18 milliseconds */

pinMode( DHTPIN, OUTPUT );

digitalWrite( DHTPIN, LOW );

delay( 18 );

/* then pull it up for 40 microseconds */

digitalWrite( DHTPIN, HIGH );

delayMicroseconds( 40 );

/* prepare to read the pin */

pinMode( DHTPIN, INPUT );


/* detect change and read data */

for ( i = 0; i < MAXTIMINGS; i++ )

{

counter = 0;

while ( digitalRead( DHTPIN ) == laststate )

{

counter++;

delayMicroseconds( 1 );

if ( counter == 255 )

{

break;

}

}

laststate = digitalRead( DHTPIN );


if ( counter == 255 )

break;


/* ignore first 3 transitions */

if ( (i >= 4) && (i % 2 == 0) )

{

/* shove each bit into the storage bytes */

dht11_dat[j / 8] <<= 1;

if ( counter > 16 )

dht11_dat[j / 8] |= 1;

j++;

}

}


/*

 * check we read 40 bits (8bit x 5 ) + verify checksum in the last byte

 * print it out if data is good

 */

if ( (j >= 40) &&

     (dht11_dat[4] == ( (dht11_dat[0] + dht11_dat[1] + dht11_dat[2] + dht11_dat[3]) & 0xFF) ) )

{

f = dht11_dat[2] * 9. / 5. + 32;

printf( "Humidity = %d.%d %% Temperature = %d.%d *C (%.1f *F)\n",

dht11_dat[0], dht11_dat[1], dht11_dat[2], dht11_dat[3], f );

}else  {

printf( "Data not good, skip\n" );

}

}


int main( void )

{

printf( "Raspberry Pi wiringPi DHT11 Temperature test program\n" );


if ( wiringPiSetup() == -1 )

exit( 1 );


while ( 1 )

{

read_dht11_dat();

delay( 1000 ); /* wait 1sec to refresh */

}


return(0);

}


[링크 : http://www.uugear.com/portfolio/dht11-humidity-temperature-sensor-module/] 


+

2015.07.14

입김불고 얼음대고 온도 변화주기

$ gcc dht11.c -lwiringPi

$ sudo ./a.out

Raspberry Pi wiringPi DHT11 Temperature test program

Humidity = 63.0 % Temperature = 26.0 *C (78.8 *F)

Data not good, skip

...

Humidity = 85.0 % Temperature = 30.0 *C (86.0 *F)

...

Humidity = 80.0 % Temperature = 25.0 *C (77.0 *F)
Humidity = 73.0 % Temperature = 24.0 *C (75.2 *F)
Humidity = 73.0 % Temperature = 23.0 *C (73.4 *F)
Humidity = 71.0 % Temperature = 22.0 *C (71.6 *F)


소스상 GPIO 4 / 7번 핀을 사용하므로 적절하게 연결!


전체구성은 대충 이런 느낌적인 느낌으로



Posted by 구차니

월급도둑 모드 ㅋㅋㅋㅋ

유닛 테스트라고 해야하나.. 결과를 두고 하는거라 은근 잼나고

생각할게 많은 녀석..


TapeEquilibrium










[링크 : https://codility.com/programmers/]

'개소리 왈왈 > 직딩의 비애' 카테고리의 다른 글

8월...  (0) 2015.08.01
아 빔프로젝터 사고 싶다.  (0) 2015.07.18
자바의 앞날은..  (0) 2015.07.03
아씨... 오실로스코프 하나 질러?  (0) 2015.06.21
카드값 폭발!  (0) 2015.06.18
Posted by 구차니
embeded/raspberry pi2015. 7. 5. 18:16

라즈베리에서 하긴 귀차나서 ㅋㅋㅋ

일단 PC에서 테스트



데이터 시트 상으로는.. 이런 순서로 데이터가 되어잇고

38400bps 로 전송한다고 하는데.. jpeg라고는 하지만..

하나 받으려면 꽤 걸리겠네 ㄷㄷ

[링크 : http://www.linksprite.com/upload/file/1291522825.pdf]


프로그램은.. 다른 사이트에서 찾아서 테스트

기본값대로 테스트 했고, USB 시리얼 포트만 COM2로 이동 시켜서 수행

속도를 올리기 위해서는 baudrate를 올리는 것도 방법 일 듯 하다.


320x240

38400  14초

115200 5초

드럽게 오래걸리네.. 그런데 640x480이랑 차이가 없는거 보면.. 프로그램 문제일수도..

(그냥 640x480으로 받는게 아닐까 싶다.


배선은..

가지고 있는 녀석들이 순서가 안 맞아 케이블을 꼬아서

RX -TX - Vcc - GND로 연결되는걸

RX -TX - GND - Vcc 로 바꾸어주고


시리얼이니 당연히(!) RX-TX꼬아서 USB to Serial에 연결해 주었다.


USB 시리얼 부터

TXD - 주황 - D2 - RXD

RXD - 노랑 - D3 - TXD

GND - 갈색 - GND - GND

Vcc - 빨강 - Vcc - Vcc(5V)


[링크 : http://store.cutedigi.com/infrared-jpeg-color-camera-serial-uart-rs232-level/]

[링크 : https://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/LSY201evaluationsoftware.exe]

Posted by 구차니
embeded/raspberry pi2015. 7. 4. 12:48

테스트 회로에는 이렇게 되어 있어서..

6V 입력에 220옴으로.. LED를 output에 연결하라고 되어 있긴한데..

막상 출력을 재보니..

5V 입력에 1.8V 출력


불밝기가 엄청 약하다...

GPIO 에서 3.3V 톨러런스니까.. 1.8를 1로 인식하겠지?




최대 탐지거리는 6미터 라는데. 최소로 하면 한 50cm 정도 되는듯(실험치)

그리고 시간은.. 최소 5초 정도.. 중간으로만 놔도 언제 꺼지나 세다가 포기하는 수준이라..

일단은 최소로 해놓고 쓰면 될 것으로 보인다.


Sensitivity range: up to 20 feet (6 meters) 110° x 70° detection range

Power supply: 3V-9V input voltage, but 5V is ideal.


If the Rtime potentiometer is turned all the way down counter-clockwise (to 0 ohms) then

Tx = 24576 x (10K) x 0.01uF = 2.5 seconds (approx)

If the Rtime potentiometer is turned all the way up clockwise to 1 Megaohm then

Tx = 24576 x (1010K) x 0.01uF = 250 seconds (approx)


[링크 : https://learn.adafruit.com/downloads/pdf/pir-passive-infrared-proximity-motion-sensor.pdf] 



귀찮으니.. GPIO1번에 연결하고 읽어오기


pi@raspberrypi ~ $  gpio readall

 +-----+-----+---------+------+---+-Model B2-+---+------+---------+-----+-----+

 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |

 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+

 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |

 |   2 |   8 |   SDA.1 |   IN | 1 |  3 || 4  |   |      | 5V      |     |     |

 |   3 |   9 |   SCL.1 |   IN | 1 |  5 || 6  |   |      | 0v      |     |     |

 |   4 |   7 | GPIO. 7 |   IN | 1 |  7 || 8  | 1 | ALT0 | TxD     | 15  | 14  |

 |     |     |      0v |      |   |  9 || 10 | 1 | ALT0 | RxD     | 16  | 15  |

 |  17 |   0 | GPIO. 0 |  OUT | 0 | 11 || 12 | 0 | IN   | GPIO. 1 | 1   | 18  |

 |  27 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |

 |  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |

 |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |

 |  10 |  12 |    MOSI |   IN | 0 | 19 || 20 |   |      | 0v      |     |     |

 |   9 |  13 |    MISO |   IN | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |

 |  11 |  14 |    SCLK |   IN | 0 | 23 || 24 | 1 | IN   | CE0     | 10  | 8   |

 |     |     |      0v |      |   | 25 || 26 | 1 | IN   | CE1     | 11  | 7   |

 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+

 |  28 |  17 | GPIO.17 |   IN | 0 | 51 || 52 | 0 | IN   | GPIO.18 | 18  | 29  |

 |  30 |  19 | GPIO.19 |   IN | 0 | 53 || 54 | 0 | IN   | GPIO.20 | 20  | 31  |

 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+

 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |

 +-----+-----+---------+------+---+-Model B2-+---+------+---------+-----+-----+


pi@raspberrypi ~ $ gpio read 1

0

pi@raspberrypi ~ $ gpio read 1

1

pi@raspberrypi ~ $ gpio read 1

1

pi@raspberrypi ~ $ gpio read 1

1

pi@raspberrypi ~ $ gpio read 1

1

pi@raspberrypi ~ $ gpio read 1

1

pi@raspberrypi ~ $ gpio read 1

1

pi@raspberrypi ~ $ gpio read 1

1

pi@raspberrypi ~ $ gpio read 1

1

pi@raspberrypi ~ $ gpio read 1

1

pi@raspberrypi ~ $ gpio read 1

1

pi@raspberrypi ~ $ gpio read 1

1

pi@raspberrypi ~ $ gpio read 1

1

pi@raspberrypi ~ $ gpio read 1

1

pi@raspberrypi ~ $ gpio read 1

1

pi@raspberrypi ~ $ gpio read 1

1

pi@raspberrypi ~ $ gpio read 1

1

pi@raspberrypi ~ $ gpio read 1

1

pi@raspberrypi ~ $ gpio read 1

1

pi@raspberrypi ~ $ gpio read 1

0

pi@raspberrypi ~ $ gpio read 1

0

pi@raspberrypi ~ $ gpio read 1

0 


5초 정도

Posted by 구차니

웬지 이번 판결이...

oracle JRE / JDK 외에는 사용불가! 판정 같아서

(java를 좋아하진 않지만) 언어에게 사형선고가 되어버린 기분?


구글, 오라클 저작권 소송 패소…제조사 파장 갈까

[링크 : http://news.naver.com/...?mode=LSD&mid=sec&sid1=105&oid=029&aid=0002291504&viewType=pc]

Posted by 구차니
embeded/raspberry pi2015. 7. 2. 22:42

일단.. 귀차니즘으로.. 5V USB 파워를 그냥 서보에 연결해서 사용

180도에 0.9~1.1초에 가깝게 걸리는 듯(약간 부족하게 움직이다 돌아오는거 봐서는)

전압이 낮아서인가.. 전류가 부족한건가..

스펙상으로는 4.8V에 60도 0.2초 정도였으니 3배면 0.6초이고

그러면 거의 인지 가능할 만큼 그거보다 빨리 움직여서 멈춰있는 시간이 있어야 할텐데 -_-


아무튼.. 동영상에서 찾은 것에 비해서도 꽤 늦은 느낌..


$ gpio pwm 1 30; sleep 1; gpio pwm 1 110; sleep 1;gpio pwm 1 30; sleep 1; gpio pwm 1 110; sleep 1 



Posted by 구차니
embeded/raspberry pi2015. 7. 2. 22:31

wiiring pi 설치방법


$ sudo apt-get install git-core

$ mkdir ~/src

$ cd ~/src

$ git clone git://git.drogon.net/wiringPi

$ cd wiringPi

$ git pull origin

$ ./build 


[링크 : http://wiringpi.com/download-and-install/]

Posted by 구차니

음.. 둘다 AT 명령어로 하는건가? 신기하네..




[링크 : http://eleparts.co.kr/EPX386TK] zig-bee



[링크 : http://eleparts.co.kr/EPXCK7VN] bluetooth spp


'하드웨어 > Network 장비' 카테고리의 다른 글

망할 iptime 외부접속 보안 설정  (0) 2016.11.03
z-wave  (0) 2015.09.10
intelligent hub?  (0) 2014.11.27
DM9161 phy address  (0) 2013.06.19
iptime n104-r3  (0) 2012.12.23
Posted by 구차니

스펙상으로는

60도 움직이는데 0.2~0.15초

180도 한계이니 0.6~0.45 초인데

왕복하면 멈추는 시간 제외하고 대충 1.2초?

[링크 : http://www.eleparts.co.kr/EPXCDH9A]


아무튼.. 내가 제어하는게 머가 문제가 있나 싶었는데

정상 속도가 맞는듯..

[링크 : https://www.youtube.com/watch?v=WjQRYt8ydGE]


비싼 녀석인건지.. 전압이 높아서 인지 모르겠지만..

후덜덜한 속도를 보이네..

[링크 : https://www.youtube.com/watch?v=v5FYpeea4V8]

[링크 : https://www.youtube.com/watch?v=r4tFyXrcwVU]

'하드웨어 > 모터(motor)' 카테고리의 다른 글

스테핑 모터 회로 구성  (0) 2015.11.04
L6470 SPI daisy chain  (0) 2015.10.14
보유중인 스테퍼 모터 칩들  (0) 2015.06.22
스테핑 모터 정리 2  (0) 2014.08.05
스테핑 모터 도착 - FL42STH33-0956A  (2) 2014.02.19
Posted by 구차니
하드웨어/Storage2015. 6. 30. 22:00

synology DSM의 해킹/무료 버전

synology 제품들은 ARM 코어 기반인데..

어떤 원리로 돌아가는지는 미지수..


x86용 port 라고 해야하나...

웹과 기반 시스템을 추출해서 유사하게 했다고 해야하려나?


[링크 : http://xpenology.com/forum/]

[링크 : http://xpenology.me/downloads/]

'하드웨어 > Storage' 카테고리의 다른 글

synology DS213j SVN server 설치  (0) 2015.10.19
microSD 슬롯 락 관련  (2) 2015.08.06
DS213j 하이버네이트 정상작동중!  (0) 2015.06.25
Synology DS213j DSM5.2 업데이트!!!  (0) 2015.06.09
ds cloud 이상 CPU/RAM 사용  (0) 2015.06.02
Posted by 구차니