[vc_row][vc_column width=”1/1″][vc_column_text]Why do I need that?
Here is a picture shows the GPIO definition of pcDuino8 UNO. As you can see there should be
6 ADC channels on Arduino header J7. But the truth is the Allwinner H8 processor on UNO
doesn’t have any available ADCs.
The implementation is made by another header J10 (not soldered), connecting to an
additional ADC board which has ADI AD7997 12-bit ADC on it.[/vc_column_text][vc_tour][vc_tab title=”Add AD7997 ADC module to UNO” tab_id=”1449796428-1-19″][vc_column_text]Here comes the ADC module:
You got three options to connect UNO with ADC module:
1. Just solder the module onto UNO;
2. Solder a 90° header on UNO and connect it to the module with wires (may cause
unstable readings);
3. Solder 90° headers on both UNO and ADC module, male and female. Like this
picture:
[/vc_column_text][/vc_tab][vc_tab title=”Compile the arduino lib for UNO” tab_id=”1449796428-2-13″][vc_column_text]Additional package(s) are needed before using libarduino for UNO:\
sudo apt-get install libi2c-dev i2c-tools git
Fetch the Arduino lib for UNO:
git clone https://github.com/nightseas/libarduino_uno
Clean and Compile the lib:
cd libarduino_uno make clean make
[/vc_column_text][/vc_tab][vc_tab title=”Create a test program” tab_id=”1449796871383-2-4″][vc_column_text]Create new .c files in sample folder and modify Makefile to compile it. For example I want to
create helloADC.c to read the values from all six ADC channels.
#include <core.h> int adc_id = 0; void setup() { } void loop() { for(adc_id=0; adc_id<6; adc_id++) { int value = analogRead(adc_id); // get adc value printf("ADC%d value is %d\n",adc_id, value); delay(1000); // wait for one sec } }
Add a line after OBJS=… and add the name of your program (without suffix ‘.c’).
OBJS = i2c_rtc_test spi_nfc_test adc_test led_test OBJS += helloADC
Compile and run:
make sudo output/helloADC
[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row][vc_row][vc_column width=”1/1″][/vc_column][/vc_row]
Leave a Reply
You must be logged in to post a comment.