'본좌급 분류'에 해당되는 글 168건
- 2016.02.20 ubuntu server 설치기..
- 2016.01.16 tvheadend 관련 링크 저장
- 2016.01.12 tvheadend 설치 2
- 2015.06.12 콘트롤러를 제작하다 #1 1
- 2015.06.11 컨트롤용 보드용 코드를 짜다.
- 2015.06.11 자작 조종기를 살리다.
- 2015.06.11 오랜만에...
- 2013.04.22 새로운 블루투스 모듈 bt_board v1.5 2
- 2013.02.19 이클립스에서 플러긴 설치시 오류
- 2013.02.15 WELADA 모스카토
ubuntu server 설치기..
1) iso image 파일을 이용하여 우분투 설치
2)
$ sudo su -
$ apt-get update && apt-get install debootstrap
$ cd /opt
$ mkdir -p /opt/vaults
$ mkdir -p /opt/debian7
$ debootstrap --arch=amd64 wheezy /opt/debian7 http://ftp.kr.debian.org/debian
$ cp /etc/hosts /opt/debian7/etc/
$ cp /etc/resolv.conf /opt/debian7/etc/
$ mkdir -p /opt/debian7/opt/vaults
$ cd /opt/
$ nano chwheezy.sh
$ chmod a+x chwheezy.sh
#!/bin/bash
mount -t proc proc /opt/debian7/proc
mount -t sysfs sysfs /opt/debian7/sys
mount --bind /dev /opt/debian7/dev
mount --bind /dev/pts /opt/debian7/dev/pts
mount --bind /opt/vaults /opt/debian7/opt/vaults
LANG=C.UTF-8 chroot /opt/debian7 /bin/bash
umount /opt/debian7/opt/vaults
umount /opt/debian7/dev/pts
umount /opt/debian7/dev
umount /opt/debian7/sys
umount /opt/debian7/proc
$ cd /opt/
$ ./chwheezy.sh
[ch]$ nano /root/.bashrc
PS1='\u@[wheezy]:\w\$ '
cd /opt/
[ch]$ nano /etc/apt/sources.list
deb http://ftp.kr.debian.org/debian/ wheezy main contrib non-free
deb-src http://ftp.kr.debian.org/debian/ wheezy main contrib non-free
deb http://security.debian.org/ wheezy/updates main contrib non-free
deb-src http://security.debian.org/ wheezy/updates main contrib non-free
deb http://ftp.kr.debian.org/debian/ wheezy-updates main contrib non-free
deb-src http://ftp.kr.debian.org/debian/ wheezy-updates main contrib non-free
[ch]$ apt-get update
tvheadend 관련 링크 저장
구축하는데 참고했던 자료들 공유합니다.
http://www.netmanias.com/ko/?m=view&id=blog&no=7505
http://www.netmanias.com/ko/?m=view&id=blog&no=5672
http://clien.net/cs2/bbs/board.php?bo_table=cm_nas&wr_id=13608&sca=&sfl=wr_name%2C1&stx=BitLocker
http://blog.naver.com/netmaniascom/80177837442
http://2cpu.co.kr/bbs/board.php?bo_table=nas&wr_id=7938
http://blog.naver.com/alelclels/220261519364
http://cafe.naver.com/mk802/11205
http://cafe.naver.com/mk802/8578
네이버EPG
http://cafe.naver.com/mk802/13407 (멤버 등급 때문에 못 읽는다고 나오면 네이버에서 "네이버 epg 삽질의 결과" 검색)
http://cafe.naver.com/mk802/13449 (멤버 등급 때문에 못 읽는다고 나오면 네이버에서 "네이버 epg 업데이트 + 또 업데이트” 검색)
KODI 블루투스 음질 안 좋을 때 해결법
http://huper.tistory.com/268
Tvheadend 클라이언트 종류
https://tvheadend.org/projects/tvheadend/wiki/Clients
tvheadend 설정 방법
1) ip 가져오기
# tcpdump -w igmp.log igmp
셋탑을 이용하여 채널 변경.
모든 채널 한번씩 지정한 후에 ctrl+C 로 저장
# tcpdump -vnn -r igmp.log src host 192.168.x.x | grep 'igmp v2 report' > iplist.txt
이 때에 192.168.x.x 은 셋탑의 ip 주소
2) port 가져오기
# php a.php
# cp muxes /home/hts/.hts/tvheadend/input/iptv/networks/xxxxxxxxxxxxxxxxx -a
# chown hts.video /home/hts/.hts/tvheadend/input/iptv/networks/xxxxxxxxxxxxxxxxxx/muxes -R
tvheadend 설치
먼저 iptv 에서 data를 뿌려주는 서버의 주소를 알아야 한다. 각 채널당 하나씩 모두 파악해야한다.
이를 위하여 네트워크 상에서 돌아다니는 데이터를 보여주는 wireshark (와샥)을 컴퓨터에 먼저 설치한다.
https://www.wireshark.org/#download
에서 다운받을 수 있다.
iptv 는 기본적으로 data를 보내주는데 멀티캐스팅을 이용한다.
멀티캐스트를 받기 위해서는 일단 공유기에서 멀티캐스팅을 지원해야하는데,
와샥(wireshark) 으로 서버의 ip를 딸 컴퓨터 & tvheadend 가 깔린 디바이스 & iptv 셋탑을 멀티캐스팅 그룹으로 묶은 후에,
셋탑을 켜면 와샥으로 멀티캐스팅 패킷이 물밀듯 들어온다.
이 때에 udp 주소 및 포트를 적어둔다.
data가 매우 많으므로 와샥을 중지/시작 을 반복하며 data를 받으며, 모두 받은 후에는 공유기에서 멀티캐스팅 그룹에서 컴퓨터를 제외시킨다
(공유기에 부하가 많이 발생할 수 있다)
와샥 없이 ip 주소와 port 를 알 수 있는 방법이 있다.
tcpdump 와 iperf 를 사용하는 것이다.
iperf -s -u -B 226.94.1.1 -i 1
tcpdump -w igmp.log igmp
번외편 : raspbin 설치
준비물
sd 메모리, sd formatter, win32 disk image
rasbian 에서 wheezy 이미지 다운 -> zip 파일을 풀면 ...img 파일 생성
SD 카드를 포맷하고 disk imager 로 굽는다.
SD 카드를 라즈베리파이에 넣고 전원 온
설치..또 설치
도중 config 화면에서 SD 로 PARTITION 확장
한글은 굳이 설치할 필요 없지만 간혹 키보드가 안먹는 경우.. "|" 등이 안 먹는 경우가 있으므로 이 때에 키보드는 설치해준다.
행여 이 스텝을 건너뛰었다면 후에 쉘에서
$ sudo raspi-config
를 통해 다시 설정할 수 있다.
rasbian 설치가 끝나면,
$ sudo apt-get update
$ sudo apt-get upgrade
tvheadend 설치
쉬울 줄 알았으나 아래 링크처럼 막상 tvheadend 에 있는 설치 가이드대로 하면 잘 되지 않는다.
https://www.tvheadend.org/projects/tvheadend/wiki/AptRepository
대신 다음과 같이 하면 깔린다.
일단 key 등록
$ curl http://apt.tvheadend.org/repo.gpg.key | sudo apt-key add -
에디터로 sources.list 업데이트 한다.
$ sudo vi /etc/apt/sources.list
막줄에 다음 라인 추가
deb http://apt.tvheadend.org/stable wheezy main
<우분투 14.04 의 경우엔 다음과 같이 된다.)
deb http://apt.tvheadend.org/stable trusty main
저장소 리스트 업데이트
$ sudo apt-get update
설치
$ sudo apt-get install tvheadend
콘트롤러를 제작하다 #1
자작 송신기 - 수신기 - 아두이노 - 인버터 - 모터
궁극적으로는
스마트폰 <-> 블루투스 - 아두이노 - 인버터 - 모터
를 생각하고 있지만 안드로이드 앱을 제작해본적이 없어서 이것은 뒤로 미루고 있습니다.
(안드로이드 개발 관련 AIDE 라고 기가막힌 앱이 있더군요. 이걸 좀 볼까 합니다)
어쨌든, 수신기에서 나오는 시그널을 아두이노에서 잘 받아들이는지 확인하기 위해서, 보드를 땜질하고 간단하게 코딩을 하여 확인을 했습니다.
컨트롤용 보드용 코드를 짜다.
#include <Wire.h>
#include <EEPROM.h>
#include <pins_arduino.h>
#define MOTOR_1 (3)
#define MOTOR_2 (9)
#define MOTOR_3 (10)
#define MOTOR_4 (11)
//PIN assignment
#define CHANNEL_NUM (3) // use ar7000 satelite receiver - spektrum
#define THROTTLEPIN (2)
#define STEERPIN (4)
#define AUXPIN (5)
#define RECIEVER_SENSITIVITY (10)
#define MOTOR_SENSITIVITY (10)
int16_t rcCommand1 = 0;
int16_t rcCommand2= 0;
int16_t rcCommand3= 0;
int16_t rcCommand4 =0;
uint8_t pinRcChannel[3] = {THROTTLEPIN,STEERPIN,AUXPIN};
uint8_t PCintLast = 0;
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// main loop
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
uint32_t previousTime = 0;
uint32_t currentTime = 0;
uint32_t deltaTime = 0;
uint32_t meanTime = 0;
uint32_t rcTime = 0;
uint8_t armed = 0;
short commandFilter(short old_val, short new_val)
{
short ret;
ret = constrain(new_val,old_val-RECIEVER_SENSITIVITY,old_val+RECIEVER_SENSITIVITY);
return ret;
}
short MotorFilter(short old_val,short new_val) {
short ret;
ret= constrain(new_val,old_val-MOTOR_SENSITIVITY,old_val+MOTOR_SENSITIVITY);
return ret;
}
typedef struct {
uint16_t edgeTime;
int16_t Width;
} pinTimingData;
pinTimingData pin1;
pinTimingData pin2;
pinTimingData pin3;
pinTimingData pin4;
SIGNAL(PCINT2_vect) {
uint8_t mask;
uint16_t cTime;
uint16_t temp;
cTime = micros();
mask = PIND ^ PCintLast;
PCintLast = PIND;
// mask is pins [D0-D7] that have changed.
// chan = pin sequence of the port. chan begins at D2 and ends at D5
// because we are here, at least one pin [D2-D5] changed
// avoiding a for() is more than twice faster !
if (mask & (1<<THROTTLEPIN)) {
if (!(PIND & 0x01 << THROTTLEPIN)) temp = cTime - pin1.edgeTime;
pin1.Width = (int16_t)(temp - 1120); // minimum throttle
pin1.edgeTime = cTime;
}
if (mask & (1<<STEERPIN)) {
if (!(PIND & 0x01 << STEERPIN)) temp = cTime - pin2.edgeTime;
pin2.Width = (int16_t)(temp - 1500);
pin2.edgeTime = cTime;
}
if (mask & (1<<AUXPIN)) {
if (!(PIND & 0x01 << AUXPIN)) temp = cTime - pin3.edgeTime;
pin3.Width = (int16_t)(temp - 1500);
pin3.edgeTime = cTime;
}
}
// Configure each rc pin for PCINT
void configureReceiver() {
uint8_t chan;
PCMSK2 = 0;
for (chan=0; chan < 4; chan++) {
pinMode(pinRcChannel[chan], INPUT);
// PCINT activated only for specific pin inside [D0-D7] , [D2-D5] for this tricopter
PCMSK2 |= digitalPinToBitMask(pinRcChannel[chan]);
}
PCICR = 0x01 << 2; // PCINT activated only for [D0-D7] port
}
void setup() {
pinMode (13, OUTPUT);
Serial.begin(115200);
delay(100);
configureReceiver();
previousTime= micros();
meanTime = 1500;
digitalWrite(13,HIGH);
}
const long windUp = 1000;
void loop() {
int numc;
short temp1, temp2;
float error;
float dTerm;
float timeFactor;
float invTimeFactor;
float tmp;
rcCommand1 = commandFilter(rcCommand1,pin1.Width);
rcCommand2 = commandFilter(rcCommand2,pin2.Width);
rcCommand3 = commandFilter(rcCommand3,pin3.Width);
rcCommand4 = commandFilter(rcCommand4,pin4.Width);
Serial.print(rcCommand1);
Serial.print(",");
Serial.print(rcCommand2);
Serial.print(",");
Serial.print(rcCommand3);
Serial.print(",");
Serial.print(rcCommand4);
Serial.println();
currentTime = micros();
deltaTime = currentTime - previousTime;
previousTime = currentTime;
meanTime = (39*meanTime + deltaTime)/40;
timeFactor = deltaTime/meanTime;
invTimeFactor = meanTime/deltaTime;
//++++++ motor control ++++++++++++++++++++++++++++++++++
temp1 = rcCommand1;
constrain(temp1,0,255);
analogWrite(MOTOR_1,temp1);
temp1 = rcCommand2;
constrain(temp1,0,255);
analogWrite(MOTOR_2,temp1);
temp1 = rcCommand3;
constrain(temp1,0,255);
analogWrite(MOTOR_3,temp1);
temp1 = rcCommand4;
constrain(temp1,0,255);
analogWrite(MOTOR_4,temp1);
delay(100);
}
자작 조종기를 살리다.
PCB 에 남아있는 실크를 보니 2009 라고 써있는 것 보니 무려 5년전에 만든 것이네.
창고의 박스에서 꺼내 먼지를 털어내니 여기 저기 망가지고 볼품없다.
게다가 어떻게 구동되는지 기억조차 가물가물..했는데
마침 코드가 블로그에 남아있어 복기하는데 큰 도움을 줬다.
취미를 모두 접는 바람에 최초 실험을 할때에 준비할게 많아 영 귀찮았지만,
꾹 참고 해서 결국 성공.
"귀찮음을 이겨내야 훌륭한 어른이 될 수 있다"
새로운 블루투스 모듈 bt_board v1.5
Bluetooth protocal : Bluetooth Specification v2.0+EDR
Frequency : 2.4GHz ISM band
Modulation : GFSK(Gaussian Frequency Shift Keying)
Emission power : <=4dBm, Class 2
Sensitivity : <=-84dBm at 0.1% BER
Speed : Asynchronous: 2.1Mbps(Max) / 160 kbps, Synchronous: 1Mbps/1Mbps
Security : Authentication and encryption
Profiles : Bluetooth serial port
CSR chip : Bluetooth v2.0
Wave band : 2.4GHz-2.8GHz, ISM Band
Protocol : Bluetooth V2.0
Power Class : (+6dbm)
Reception sensitivity: -85dBm
Voltage : 3.3 (2.7V-4.2V)
Current : Paring – 35mA, Connected – 8mA
Temperature : -40~ +105 Degrees Celsius
User defined Baud rate : 4800, 9600, 19200, 38400, 57600, 115200, 230400,460800,921600 ,1382400.
Dimension : 26.9mm*13mm*2.2mm
- Default serial port setting : 9600, N, 8, 1
- Pairing code : 1234
- Running in slave or master role
Pinout
- Key : ??
- Vcc : 3.6v to 6v
- GND
- TXD : link to opposite side RX (TTL 3v3 on this revision)
- RXD : link to opposite TX (TTL 3v3 on this revision)
- STATE : HIGH : command mode, LOW : operation mode.Active command mode with a 10K pull-up resistor.
- Onboard red led (PIO9) : Used to control LED indicating paring. It will be steady on when paring is successful.
Note that I/O is 3v3 TTL level, and does not accept 5v. To convert to/from, for instance, an Arduino, you can use a voltage divider or with two resistor where one is a pull-down, like in open brain wave interface hardware for RX and a FET for TX. This is true for this actual revision, 1.05. Version 1.2 accepts 5v level signals. You can also use a level shifter, likethis one. Note that newer MCU uses directly 3.3v, and thus the JY-MCU is useable directly (Stellaris Launchpad, STM32 Discovery..).
Command mode
Default serial port setting in command mode : 9600, N, 8, 1
Use a serial adapter like uartsbee, and connect the JY-MCU using local serial port (the bluetooth port will not answer to AT commands).
Use NOTHING end line : no CR nor LF.
Test using plain « AT » command : the board must answer « OK » if ready to answer AT commands.
Activation
Poweroff, put a 10k pull-up resistor on the « state » pin (PIO11), power on.
Command list
Command | Answer | Values |
AT+PINxxxx | OKsetPIN | Set pairing code |
AT+BAUDx | OkxxxxxxxxBAUD | 1(1200bps), 2(2400bps), 3 (4800bps) , 4 (9600bps) , 5 (19200bps) , 6 (38400bps) , 7 (57600bps), 8 (115200bps) , 9 (230400bps) , A (460800bps), B (921600bps), C (1382400bps) |
AT+NAMExxxxxx | OKsetname | |
AT + ROLE = 1 | OK | 1 to set as master, 0 to set a slave |
to come back to normal mode, power down, remove pull-up, and power up.
Note : with build-in reset circuit, reset is completed automatically after powered on.
이클립스에서 플러긴 설치시 오류
이클립스에서 ADT 플러그인을 깔려고 할 때에
다음과 같은 에러 메세지를 만날 경우
Cannot complete the install because one or more required items could not be found. ....
웹검색결과 indigo 이상 버전에서 하면 된다 했지만 이미 나는 Juno 인걸~
음..뭐지?
살짝 고민해봤는데 원인은 eclipse 를 관리자 버전으로 실행시켜야한다는 것. (window 7일 경우이다)
WELADA 모스카토
4병에 만몇천원해서 싼 맛에 샀는데, 모스카토 다스티에서 단맛을 뺀 와인이라고 생각하면 될듯.
내 입맛엔 맞지 않았다.
저렴한 와인이라, 병뚜껑이 코르크가 아니다.