-
Aptina AR0130 has arrived
07/11/2015 at 05:00 • 0 commentsWe plan to use Aptina AR0130 USB Camera for testing the UVC drivers on Raspberry also because it has a great spectral response, we're going to do some NIR photo tests.
-
First Approach
07/08/2015 at 06:33 • 0 commentsThe first approach goal is interfacing an USB camera with Raspberry Pi, triggering the camera with a button, saving a photo and finally do these tasks with an auto-run program on startup.
In the following project logs I'll post details on the development process.
-
Checking MT9D111 communication
07/08/2015 at 06:10 • 3 commentsFor checking the MT9D111 two wire interface I started wiring the camera module to an Arduino Nano. Then, I programmed the Arduino based on the 16 Bit Register Read and Write Examples in page 9 to 11 of the Developer Guide.
Wiring:
MT9D111 ------ Arduino
GND ------------ GND
XCLK ----------- D9
VCC ------------ 5V
GND ------------ GND
SCL ------------- A5
SDA ------------- A4
After a few hours trying to generate the 8Mhz clock on Arduino, I realize that timer1 could perform that task without compromising other functions such as delay() and millis().
Finally, the results were successful, Arduino could write and read registers in MT9D111 Camera Module with these two custom functions:
write_reg(register_address, page, data_msb, data_lsb)
read_reg(register_address);
/* Author: Jose Barreiros Date: 01/June/2015 This code is Arduino Nano compatible, the READ CODE is based on the work of Anthony Balducci: https://github.com/anthonybalducci/MT9D111-Teensy-3.1/blob/master/MT9D111_16-bit_Register_Read_Example.ino Useful note from Anthony Balducci code: "The MTD9111 Developer Guide states that 0xBA and 0xBB are the default read/write addresses respectively. However, it is important to note, while converting 0xBA and 0xBA to binary at first 'appears' to give us two distinct addresses: (Write) 0xBA --> 10111010 (Read) 0xBB --> 10111011 The two values only different in their LSB (least significant bit), or in this case, the first value on the 'right'. The '0' / '1' in this position is what specifies the write (0) or read (1) condition accordingly. In the Arduino language the LSB read/write portion is already built into the Wire.write / Wire.read commands, thus the original register addressess specified must be truncated by the read/write bit to seven bits, leaving us with 1011101 --> Ox5D in both cases." */ #include <Wire.h> #include <avr/io.h> #include <util/delay.h> #include <TimerOne.h> #include <avr/interrupt.h> #define TMR1 0 //Timer1 used for 8Mhz PWM Output void setup() { delay(500); //Initial delay Wire.begin(); // join i2c bus as master Serial.begin(9600); Serial.println("MT9D111 Camera Module + Arduino Nano"); Serial.println("Read and Write 16-bit register value example"); Serial.println("* Read expected value = 0x1519 from Register 0x00"); Serial.println("* Write value = 0xA5F0 to Register 0x20:1"); Serial.println(); //Generating 8MHZ PWN on pin9 pinMode(9, OUTPUT); // output pin for OCR2B TCCR1B |= (1 << CS10); //selecting prescaler 0b001 (Tclk/1) TCCR1B &= ~((1<<CS12) | (1<<CS11)); // turn off CS12 and CS11 bits TCCR1A |= ((1<<WGM11) | (1<<WGM10)); //Configure timer 1 for TOP mode (with TOP = OCR1A) TCCR1B |= ((1<<WGM13) | (1<<WGM12)); TCCR1A |= (1 << COM1A0); // Enable timer 1 Compare Output channel A in toggle mode TCCR1A &= ~(1 << COM1A1); TCNT1 = 0; OCR1A = TMR1; init1(); //perform code just 1 time } void loop() { } void init1(){ int16_t a; delay(500); //wait until start Serial.print("Read result from register 0x00"); a=read_reg(0); Serial.println(); Serial.print("0x"); Serial.println(a, HEX); //print result Serial.println(); Serial.print("Read original data from register 0x20:1"); a=read_reg(32); Serial.println(); Serial.print("0x"); Serial.println(a, HEX); //print result Serial.println(); //Enable this part for writing register // Serial.print("Writing 0xA5F0 in register 0x20:1"); // Serial.println(); // write_reg(32,1,165,240); // Serial.print("Read new value from register 0x20:1"); //a=read_reg(32); // Serial.println(); //Serial.print("0x"); //Serial.println(a, HEX); //print result //Serial.println(); } void write_reg(int direccion, int page, int data_msb, int data_lsb){ delay(5); //5ms Wire.beginTransmission(93); // transmit to device 93, Camera Module Wire.write(240); //page register address Wire.write(0); Wire.write(page); //select page 0/1/2 Wire.endTransmission(1); // stop transmitting Wire.beginTransmission(93); // transmit to device 93, Camera Module Wire.write(direccion); //register address 8bit, decimal Wire.write(data_msb); //msb Wire.write(data_lsb); //lsb Wire.endTransmission(1); // stop transmitting } int16_t read_reg(int direccion){ delay(5); //5ms Wire.beginTransmission(93); // transmit to device 93, Camera Module Wire.write(direccion); //register address 8bit, decimal Wire.endTransmission(1); // stop transmitting Wire.requestFrom(93,2,1); //request value form device 93, 2 bytes with stop bit int16_t result = ((Wire.read() << 8) | Wire.read()); //read 16 bits return result; }
-
Designing the enclosure
06/21/2015 at 04:59 • 0 commentsOne of the most important part of the project is the enclosure desgin. The enclosure should allowed to place and replace the custom filter, and assemble different sensor arrays (2x1, 3x1 , etc.)
Video
Our solution is a modular design which has a detachable front lid to place the filter between the CMOS sensor and the lens.
For assembling the modules in an array, each camera has four strong magnets in each side, and a dip connector to synchronize the trigger and data.
In the back lid it has a power button, micro SD card slot, micro USB connector and a dip connector for accessing the controller .
The 3d design was done in Solidworks and will be 3d printed for testing.
-
Components II
06/21/2015 at 04:54 • 0 commentsBecause of the large learning curve of the project. We have two approaches to start learning the technical issues of the system.
FIRST APPROACH
- Raspberry Pi (In future would be replaced with Oduino-W)
- USB Camera with Aptina AR0130
- I2C micro SD Reader
SECOND APPROACH
- SMT32 F4 Dev Board
- MT9D1111 Camera Module
- I2C micro SD Reader
In the following posts, you will find project logs of the two approaches.
The final system is expected to be based on our own custom board.