mobile and vehicular network lab [2015-fall] wnfa lab1 - camcom camera communication hsin-i,wu...

37
Mobile and Vehicular Network Lab [2015-Fall] WNFA lab1 - CamCom Camera Communication Hsin-I,Wu 2015/3/13

Upload: kerry-henry

Post on 27-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

[2015-Fall] WNFA lab1 - CamCom

[2015-Fall] WNFA lab1 - CamComCamera CommunicationHsin-I,Wu2015/3/13Mobile and Vehicular Network LabOutlineIntroductionTransmitterReceiverGradeMobile and Vehicular Network LabIntroductionMobile and Vehicular Network LabVLCVisible Light Communication

Mobile and Vehicular Network Labhttp://www.wikid.eu/images/e/e9/Visible_Light_Communication.jpg4Hw1 intro

Mobile and Vehicular Network LabTransmitterMobile and Vehicular Network LabTx-hardwareZigduino x2 http://goo.gl/TjM2uQ

LEDs x2Resistors 250 x6+ x1

Mobile and Vehicular Network LabTx-hardwareNotice : there must be resistors () in the circuit

Mobile and Vehicular Network LabTxmessage bytes behavior of LEDsYou can use anything to represent bits:color, frequency, luminance, waveform, duplication, Dont forget the low sampling rate of camera (30fps)Get extra score if people cannot notice the behavior of LEDsRange your score with data rateMobile and Vehicular Network LabTx-ZigduinoDelay()int ledPin = 13; // LED connected to digital pin 13

void setup(){ pinMode(ledPin, OUTPUT); // sets the digital pin as output}

void loop(){ digitalWrite(ledPin, HIGH); // sets the LED on delay(1000); // waits for a second digitalWrite(ledPin, LOW); // sets the LED off delay(1000); // waits for a second}

Mobile and Vehicular Network LabTx-ZigduinoCTC modeClear Timer on Compare (timer == OCRnA)Generate accurate square wavesall done by hardware, wont affected by interruptCan simultaneously use all 3 timers easily.

Mobile and Vehicular Network LabTx-ZigduinoCTC modeSet the corresponding bits in TCCRnX(n=1,2,3 X=A,B) registers for mode selection and timer prescalerSet OCRnX for frequency(OCRnA) or delay(OCRnB,OCRnC)Frequency = 16M / prescaler / OCRnA / 2Additional support : interrupt handler (see document)

Mobile and Vehicular Network LabTx-ZigduinoCTC modevoid setup() {// use Timer1, set control registers herepinMode(5, OUTPUT);pinMode(6, OUTPUT);pinMode(3, OUTPUT);TCCR3A = _BV(COM3A0) | _BV(COM3B0) | _BV(COM3C0);TCCR3B = _BV(WGM32) | _BV(CS32) | _BV(CS30);OCR3A = 32767;OCR3B = 16383;OCR3C = 8191;}void loop(){// change OCRnX values to manipulate frequencyOCR3A = 32767, OCR3B = 16383, OCR3C = 8191;delay(10000); // this may not be so accurateOCR3A = 16383,OCR3B = 8191,OCR3C = 4095;delay(10000);}Mobile and Vehicular Network Lab13Tx-Zigduino

Mobile and Vehicular Network LabTx-ZigduinoCSnXn:timer nX:2X11/8/64/256/1024 1/2/3/4/50001/0010/0011/0100/0101Ex. timer 3 n=3CS3X prescaler=102450101201 _BV(CS32) | _BV(CS30)

Mobile and Vehicular Network Lab15Tx-ZigduinoCTC modeFor more detailshttps://strawberry-linux.com/pub/doc8266.pdfhttps://static.squarespace.com/static/511f4f0de4b09463c7605f13/t/5275c478e4b07e72f74c7442/1383449720133/zigduino-v6c-schematic.pdfMobile and Vehicular Network LabTCCR3Ap.27616Tx-frequency

stripes to get freq.Mobile and Vehicular Network Labhttp://www.iconpng.com/png/handdraw-iphone/iphone.pnghttp://www.yee-cheng.com/img/%E7%87%88%E6%B3%A1.gif17Rolling ShutterGlobal Shutter VS. Rolling ShutterA GLOBAL SHUTTER exposes the entire imager simultaneously.

Mobile and Vehicular Network Labhttp://dvxuser.com/jason/CMOS-CCD/18Rolling ShutterGlobal Shutter VS. Rolling ShutterThe rolling shutter actually exposes different portions of the frame at different points in time, rolling through the frame.

Mobile and Vehicular Network Labhttp://dvxuser.com/jason/CMOS-CCD/19Rolling Shutter

Mobile and Vehicular Network Labhttp://dvxuser.com/jason/CMOS-CCD/20Tx-luminanceFast PWM (with OCRnA top)Pulse-width modulationCan be used to control duty cyclehttp://arduino.cc/en/Tutorial/SecretsOfArduinoPWM( pins are different )Differences in luminance and ratio of light/dark stripe width

pinMode(6, OUTPUT);TCCR3A = _BV(COM3B1) | _BV(WGM31) | _BV(WGM30);TCCR3B = _BV(WGM32) | _BV(WGM33) | _BV(CS32) | _BV(CS30); OCR3A = 8191;OCR3B = 2047; // 25% duty cycleMobile and Vehicular Network Lab/all=B/A21Tx-colorRGBHSV

Mobile and Vehicular Network LabReceiverMobile and Vehicular Network LabRx-hardwareCamera of your smart phone

Notice:fps30Mobile and Vehicular Network LabRxvideo ( image ) get LEDs behavior bytes messageVideo to image:ffmpeg i input.avi ouput%d.jpg(supported by windows, linux, and OS X)Counting Stripes : need some DIPfind LED position, image diff, color histogram, edge detection, Fourier transform, auto-correlation, 3 basic ways : DIP, FFT, auto-correlation

Mobile and Vehicular Network LabDIP:FFT:time->freq.Auto:(pixel)25Rx-an example pseudo codefor all images{read image;find bounding box // where are the stripescalculate row powercount stripes to get freq. // through DIP or FFTget output bit by freq.}Mobile and Vehicular Network LabGradeMobile and Vehicular Network Lab

Grade

Deadline:4/2(Thur.) 23:59 email to [email protected] subject:[WN]lab1_teamXX[WN]lab1_teamXX.zipsource code(tx + rx)Report(.pdf)Demo-4/9(Thur.)Please register the demo slot. And come to CSIE R424 at that time. http://goo.gl/YyM8QFAll you should do are :1. Transmit the character string given by TA2. Record the videos3. Decode and get the messageGradeTx (20% + 10% for not noticed by human eyes + 10% data rate)Rx : Video Decode (20% + 10% for accuracy)Report : describe what team members have done(in detail), and problems encountered (20%)Bonus: real time... (5%)Mobile and Vehicular Network Lab90% Lab ()10% -2.5 ~ 2.5 0 (ex 0.25/0.25/-0.25/-0.25)

Report

Mobile and Vehicular Network Lab 1 : 0 = Lab

2 : 1 Free Rider -2.5 -10 = Lab 10 2.5 10 = Lab + 10

Mobile and Vehicular Network Lab A B Free Rider(s)

A 90 % B 90% + 10%A 90 % B Lab A Lab A B Lab A A

Mobile and Vehicular Network LabContact to TAs :facebook https://www.facebook.com/groups/wn15spring/Email : [email protected] hour : Thur. 16:00~17:00@ CSIE R424Mobile and Vehicular Network LabappendixMobile and Vehicular Network LabZigduinoFirst program Blink.ino

Mobile and Vehicular Network LabZigduino

COMxZigduinoMobile and Vehicular Network LabZigduinoserial port monitor text I/Osee Examples 08. StringsUse the serial monitor to communicate

Mobile and Vehicular Network Labffmpeg

Ffmpeg.exevideoMobile and Vehicular Network Labffmpeg

Mobile and Vehicular Network Labffmpeg -i IMG_6578.MOV -f image2 %d.png38