Go Down

Topic: ov7670 with both arduino uno and now mega (Read 93890 times) previous topic - next topic

rock5566r

Hi! I'm a beginner of electronics. I'm wondering that can I use uno3 to control OV7670 with FIFO to take a picture and save it as a file. Then send it to my PC by using Ethernet shell. Is it possible to do that?

Thanks in advance.

rock5566r

Koepi

#286
Mar 09, 2014, 04:07 pm Last Edit: Mar 11, 2014, 10:31 pm by Koepi Reason: 1
I'm also absolutely new to Arduino, will shortly have 5 different Arduino Nano versions.

But I also ordered the cheap non-FIFO OV7670 (and also the FIFO version which seems only to be usable with different platform like RasPi). After reading through this thread I realized that the 2k SRAM definitly is insufficient. Thus I also ordered 5 pieces of 16MBit SPI eeproms, and SOIC8-to-DIP sockets to carry them. Quite cheap, actually altogether about 7 Euros. If I understand SPI/I2C correctly, I share the MISO/MOSI/SCK line and only need one pin for addressing each of the different devices like EEPROM and SDCARD. My idea is to fetch the image without the FIFO byte-by-byte and directly write through to the EEPROM (it supports writing even single bytes according to the data sheet) which could even hold 2 images in 640x480x3 RAW format (921KByte x 2). As soon as it is stored in EEPROM, I have all the time in the world to copy that over to SDcard.
My project is a long-time observation with 1 image per day, for example each evening at 18h one image (RTC is also on the way). I would put the Arduino-timelapse-cam somewhere where it is dry but the nature is well visible. From theory, the Arduino needs so little power, for one image per day, that with a single LiIon 18650 battery charge it should give me 365 images without needing any service. ;)

Do you have any suggestions if I'm on the right track?
Is there maybe some 8 MBit RAM module out there which could be used via SPI?
Is this camera a total loss and I should spend the money on a JPEG camera, about triple to quadruple the price?

I hope I won't need to stress your help too much and too often as soon as the items arrive :D

Another thought about the FIFO version. A friend suggested - if I need to pause read-out for writing the data, instead of using the /RE pin which isn't available in pinout, set the RCLK (read clock) to 0. Sounds plausible as solution.

Thanks a million,
Best regards,

Koepi

Edit4: Some major cleanup with properly using links, additional info about FIFO camera module...

angeleye9

Hi Mr arduino;
I am getting an completeley white image from OV7670+fifo driven by Arduino mega. Do you have any idea why this is happen?

marcioferrari



I submitted a pull request that may solve some issues but I doubt it will work. There are two problems first of all the Ethernet shield that you are using uses pins 2,4,10,11,12,13 you appear to have pins 2 and 4 hooked up to the ov7670 also I think that the function you are using to send data to the wiznet 5100 is too slow try directly sending the data without using those silly arduino library functions.


Hum... so, my function that sends the pixels to the server is slow? Well, I will change this, I just need to finish the article about the project... hehe
And the shield ethernet is using the pins 10,11,12 and 13. I think that just this. The pin 4 is used for the sdCard, so I disabled it. The registers are right?

dtsonchev

Hello
My name is Desislav,  am Bulgarian.
Advance I want to apologize for my bad English.
I have the ARDUINO MEGA, LCD and camera MT9D111
I downloaded the code and https://github.com/ComputerNerd/arduino-camera-tft,
and I have two problems:
1. Can you give me a wiring diagram of the three modules?
2. When I try to compile my project out error:
Error 15 exiticon.h: No such file or directory, this file miss.
Thank PRELIMINARY.

jonpwn

sorry for the grave digging.. i am absolutely stumped and not sure about a few things. I am using the OV7670 with FIFO buffer, the 22 pin header version.

Do i need to do ANYTHING to the control registers upon boot up? I want to use all default settings, YUV, no gain or any DSP of any kind. My intention is to read every other byte and grab the Y byte for each pixel. I am under the impression that if i want to use the default registers, I do not need to use sccb interface to do anything. Is this wrong?

also is anyone familiar with the FIFO version? If so, is my initalization sequence and data read correct per the data sheet for al422b? (i am implementing a bit banging process because I am using raspberry pi)

apply power to module:
write_reset = low;    //resetting read and write addresses to 0 (beginning)
read_reset = low;
write_reset = high;
read_reset = high;

write_enable = high;     //allow ov7670 to write to FIFO

to read data from FIFO:
write_enable = low;
output_enable = low;  //active low
read_reset = low;
read_clock = low;    //allow one RCK cycle for reset cycle
read_clock = high;
read_clock = low;  //one more cycle
read_clock = high;  //finish reset cycle
read_reset = high;
read_clock = low;
grab first byte
read_clock = high;

and so on for 300K pixels

output_enable = high;
write_enable = high

thank you very much for all your help

vvavepacket

#291
Apr 22, 2014, 04:17 am Last Edit: Apr 24, 2014, 09:42 am by vvavepacket Reason: 1
anybody tried to use the 'Wire.h' to write registers in OV7670?

Thanks

AlienXdani

:D opinion? https://www.kickstarter.com/projects/254449872/pixy-cmucam5-a-fast-easy-to-use-vision-sensor

vvavepacket

Does anybody here have success in writing registers like 0x01 and 0x02, 0x03?

I can write to registers like 0x80, etc.. but I can't write those first range registers..

Thanks

Koepi

#294
Apr 30, 2014, 05:41 pm Last Edit: Apr 30, 2014, 07:47 pm by Koepi Reason: 1
Just to give some info about my progress: I currently am fiddling with the non-FIFO version on a STM32F103 - it can cope with the data and speed way better than a poor 8-bit ATmega. It also has way more GPIO pins. I didn't take a too close look at the FIFO version, but it should be much easier to fetch the data as you don't react on PCLK as signal for reading the input byte, but instead toggle/clock RCLK. (And as the question came up and I had it myself: No, you don't need any I2C initialisation of the cam. It spits out YUV, 640x480 at the provided XCLK frame rate. And having the possibility to talk to the camera with I2C is sure nice. I need that for setting a prescaler on XCLK to get the data rate down.)

I now found some very cheap offers for JPEG cameras with higher resolution - namely the MD9T111 (1600x1200, 2 Mpix, ordered here) Mr.arduino is using now, and a OV5642 (2592x1944, 5MPix, for example here). The first one is less than 15 Euros shipped, the last one did cost me 19,50 Euros this morning. Just use Google for the chip, it'll guide you to the cheaper eBay offers, while eBay doesn't even show those when using the eBay search(!).

Both cameras offer the advantage of higher resolution, better image quality and already usable JPEG image output; their JPEG encoder also offers a (very small but) slightly intelligent FIFO buffer with a tripple-stage data rate reduction scheme (clock slowdown) until buffer overrun ;) Ideal solution for my timelapse-camera idea.

Anyhow, I will still be fiddling around with the just little cheaper OV7670 based cams as I already have those and it's a good training.

Mr_arduino

Though I regret taking a break from responding to everyone that is what happend so I will now go in reverse order and answer peoples questions.
Koepi Good to hear that you are making good progress Koepi. I admit to not having done much with camera modules in a while. I plan to this weekend or whenever I can find some time. The reason I played for the ov7670 in the first place was time lapse reasons. I find the flexibility of controlling the camera in a way desired by the programmer to be beneficial for higher quality time lapses.

Mr_arduino


Does anybody here have success in writing registers like 0x01 and 0x02, 0x03?

I can write to registers like 0x80, etc.. but I can't write those first range registers..

Thanks

Yes vvavepacket I have had success writting to registers. Have you considered just copying and pasting the code I have written that writes to registers and using that. You may need to make some modifications but it should work for your needs.

Mr_arduino


:D opinion? https://www.kickstarter.com/projects/254449872/pixy-cmucam5-a-fast-easy-to-use-vision-sensor
I have not done much research on the project but it is kind of an inspiration as in I want to make a product myself one day based on a more powerful cmos sensor that has ready to use code and such and I am glad to know that there is a good market for that.

Mr_arduino

#298
May 06, 2014, 04:30 am Last Edit: May 06, 2014, 05:00 am by Mr_arduino Reason: 1

anybody tried to use the 'Wire.h' to write registers in OV7670?

Thanks

Yes I have done such in fact I have really old code that does just that see http://pastebin.com/1nnRc5qL the function of interest is called wrReg. I have cleaned up the code and posted it below
Code: [Select]

byte wrReg(unsigned char regID, unsigned char regDat){
Wire.beginTransmission(sensor_addr >> 1);
Wire.write(regID);
Wire.write(regDat);
if(Wire.endTransmission()){
return 0;
while(1);
}
delay(1);
return 1;
}

Before using the function please add this to setup()
Code: [Select]
Wire.begin();
Also you will need to add
Code: [Select]
#define sensor_addr 0x42
To your code

I will try and get to more questions tomorrow.

Mr_arduino

#299
May 06, 2014, 11:53 pm Last Edit: May 07, 2014, 12:09 am by Mr_arduino Reason: 1

Do i need to do ANYTHING to the control registers upon boot up?

Yes but I have found that by modifying registers you can get better picture quality. I remember the first pictures I took with the ov7670 they looked like the hue was shifted. By better configuring the registers I fixed the wrong colors.
Quote

also is anyone familiar with the FIFO version?

I keep forgetting to buy one I plan to at some point in time.

Go Up