We're no longer updating This wiki!!

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:adccontrol [2014/07/01 16:23]
ruppi [Variable Resister]
en:adccontrol [2014/07/01 16:26] (current)
ruppi [Software]
Line 1: Line 1:
 +====== Overview ======
 +
 + This document explain how to control ADC on the Odroid ADK board by Android ADK App.**
 + ​PIC24FJ64GB002 is going to try read ADC value from voltage at the battery and the Variable Resistor, and transfer to Android ADK App.**
 + ADK App display the result based on the ADC value.
 +----
 + 이 문서는 Odroid ADK Board 를 이용하여 ADC 를 제어하는 Android ADK app 를 설명한다. ​
 + ​PIC24FJ64GB002 칩은 밧데리와 가변저항의 전압을 ADC 값으로 읽어 와서, Android ADK app 으로 전달한다. ​
 + ​Android ADK App 는 ADC 값을 바탕으로 화면에 결과를 표시한다. ​
 +
 +====== What you need ======
 +  * ADK Board
 +  * ADK IO Kit 
 +  * Mini Breadboard
 +  * Variable Resister x 1ea 
 +  * jumper wires
 +====== Knowledge Base ======
 +===== Variable Resister =====
 + 
 +* Symbol
 +{{:​en:​vResister.jpg}}
 +
 +===== ADC(Analog to Digital Converter) =====
 +Please refer to PIC24F Family Reference Manual, Sect. 17 10-Bit A/D Converter.([http://​ww1.microchip.com/​downloads/​en/​DeviceDoc/​39705b.pdf])
 +
 +====== Circuit ======
 +{{:​en:​Odroid_ADK_ADC_fz.png?​520}}
 +{{:​en:​Odroid_ADK_ADC_pic.png}}
 +
 +====== Schematic ====== ​                  
 +{{:​en:​Odroid_ADK_ADC_schem.png}}
 +
 +====== Video ======
 + ​[http://​www.youtube.com/​watch?​v=gjGIvDDPYD4]
 +
 + ​[[Play(http://​www.youtube.com/​embed/​gjGIvDDPYD4?​hl=ko&​fs=1)]]
 +
 +====== Software ======
 +**ADK** ​
 +**svn check out**
 +**http://​dev.odroid.com/​svn/​accessory/​trunk/​ODROIDAccessoryADCDemo**
 +
 +<​code>​
 +    private void initDevice() {
 +        Log.e(TAG, "​initDevice"​);​
 +        // fix bug 
 +        // You must call function to use GPIO input mode, if firmware version is 1.0 
 +        initI2C();
 +        initBMP180();​
 +        // fix bug 
 +        initADC(true);​
 +    }   
 +</​code>​
 +초기화 후 handler에서 battery 값과 ADC 값을 읽어 표시하면 됩니다. ​
 +<​code>​
 +        accessoryManager.read(commandPacket);​
 +
 +    switch(commandPacket[0]) {
 +        case RECEIVED_LETTER_ADC: ​                     ​
 +            value = (short) (commandPacket[3] << 8); 
 +            value |= (short) (commandPacket[4] & 0x00ff);
 +            updateADC(value);​
 +            break;
 +                ​
 +        case RECEIVED_LETTER_BATT:​
 +            value = (short) (commandPacket[3] << 8); 
 +            value |= (short) (commandPacket[4] & 0x00ff);
 +            updateBatt(value);​
 +            break;
 +</​code>​
 +**Bluetooth**
 +
 +**svn check out** 
 +
 +**http://​dev.odroid.com/​svn/​accessory/​trunk/​ODROIDBluetoothADCDemo**
 +
 +**svn check out**
 +
 +**http://​dev.odroid.com/​svn/​accessory/​trunk/​ODROIDBluetoothADCDemo**
 +
 +ADK 펌웨어에서는 자동으로 ADC와 Battery 값을 보내 주지만, BaB 펌웨어에서는 request해야 보내 줍니다.
 +그래서 Timer를 두어 protocal로 request를 보내고 받아서 처리하면 됩니다.
 +<​code>​
 +private void getADC() {
 +        //​Log.e(TAG,​ "​getADC"​);​
 +        Message msg = Message.obtain(handler,​ SEND_LETTER_ADC_CONFIG,​ ADC_PORT, 0);
 +        handler.sendMessage(msg);​
 +    }
 +
 +private void getBattery() {
 +        //​Log.e(TAG,​ "​getBattery"​);​
 +        Message msg = Message.obtain(handler,​ SEND_LETTER_BATT,​ 0, 0);
 +        handler.sendMessage(msg);​
 +    }
 +</​code>​
  
CC Attribution-Share Alike 3.0 Unported
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0