Go Down

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

xKoldFuzionx

#240
Dec 26, 2013, 08:03 pm Last Edit: Dec 26, 2013, 08:11 pm by xKoldFuzionx Reason: 1
Well that sucks, I had written a reply and the server lost it.  Electronics don't like me this week.  Anything that functions on electricity of some kind is out to get me.  Lol, It'll be my luck that I somehow get shocked from my keyboard just re-writing this.  But, here goes.


Don't feel bad it took me a long time to get the ov7670 to work most of this was my silly errors I was a beginner at one point. When I started working with the ov7670 I could not even communicate with it using i2c it would not work. I did not relize that for i2c (sccb) communication to work you needed to feed a clock to it.  I remember getting it working and the colors I got out of the ov7670 were purple and green. I found out that there was some register that fixes this (it appears aturcitu is currently experiencing this issue) Yes it does affect rgb565 mode too. Working with these camera sensors have significantly advanced my skill both at a hardware level and a software level. I hope you keep going with your project seeing it finally work feels great and that is part of the reason why I made this topic so that other people interested in camera sensors can get to see their project work.


yeah, I was pretty excited to get that vc0706 working.  I had created quite the camera.  I literally was just 2 steps away from designing a prototype board so I could get it in the field and test it under the cold conditions of winter.  But at $33-$45, I can't justify buying a new one, since it's only 2MP.  But the experience I gained from working with it was priceless.

Quote

What do you mean "Put it to sleep"? Maybe there is a way to fix it. I can't imagine software causing damage to the sensor unless you disable the internal regulator or something which is unlikely that you did.


Well, there is a "power save mode" that I attempted to put it in.  The idea was that while there was no motion sensed over a 30 sec time span, the camera would go to sleep, then, when motion was detected, it would wake the camera up, take a picture, and the whole process would start over.  However, the module itself has it's own motion sensing function which I disabled because I wanted to use an infrared sensor(my thought was, if it's in the woods and a leaf blows by, or a blade of grass moves in the wind, infrared would be less likely to trigger the camera than motion sensed by the camera, as the camera was entirely too sensitive).  So, I think my code actually told it to sleep until the camera module sensed motion. Hah, oh well.  I had it crap out on me before, couldn't get it to respond to anything, either by manual commands, or the VC0706CommTool program.  I didn't touch it for a week or two, then one day was gonna show a friend that it was garbage and it magically came back to life.  To my knowledge, there is no on-board backup supply.  So, I'm thinking the caps just need to leak their stored current in order for it to naturally reset.

Quote

Could you please tell us where you are getting ov5642 sensor modules for the cost lest than an ov7670 module the cheapest ov5642 module I could find was $25.99 on ebay. The ov7670 can be purchased for $5.99 on ebay and includes free shipping just like the ov5642. I would like an ov5642 module myself.


Well, I think I paid somewhere around $20-$25 for my 5642, my 7670(bought this first, but realized I was in over my head and switched to vc0706) I think I paid $3.88 with shipping.  I've noticed on eBay that your searches depend entirely on how you word them.  When I found the 7670, I had just searced for "camera module" and came up with different results than when I searched for ov7670 or any other camera module.  Even including "arduino" in the search changed everything.  But since then, I haven't been able to find an ov7670 for under $8.  People keep bidding them up and I don't feel like paying over $8 for a 2MP camera module anymore.

Quote

Well the ov5642 is quite a bit different I am not sure if much of my code will help you with that unfortunately.


From what I've understood, the 56 and 76 are very similar.  Even if there are some major differences, understanding what you did with the 76(especially) the protocols(sending/receiving commands) would help me understand how to work the 56.  I read through that documentation for either of these, and I feel like I'm looking at a bunch of strange archaic symbols that mean nothing to me. Haha.  I was starting to understand the 76 when I first started looking into it, but then I couldn't figure out how in the world I was supposed to send those commands.  Reading your code is about the same to me.  I get it a little bit more now, but this is going to be a lengthy project and I'm expecting it will take me the better part of a year to get it all figured out.  The VC0706 came with an example sketch that I was able to piece together with the help of a few guys on this board how to make it all work.  This one, I want to understand more before I start getting into it.  I learn little by little every day, but having multiple examples to see different variations is a huge help.  Right now, you're about the only one who has shared anything (atleast that I've been able to find) about how you got this going.  Everyone else just wants you to buy the Arducam and cheat.  I don't even like using libraries, cuz I like to understand for myself how it works, first, then, either write my own, or use theirs.  It just makes more sense to me if I can see it, then do it, rather than just steal someone else's work.


Mr_arduino

Ok that makes more sense now I though that when you were talking about the vc7670 I though you were talking about the ov7670 but now I realize that they are two different things however I assume you are talking about this https://www.adafruit.com/products/397 if so you relize it is only 0.3 MP not 2.0 MP. I agree that it is too expensive.

nerdroide

Hello guys. I'm brazillian and all of you are very amazing. Really. Well, I don't speak english very well, so you will forgive me about my mistakes. Mr_Arduino I would like to know if you could take a look in my code and tell me what could be are wrong.
https://github.com/nerdroid/OV7670-Project
It's my git. I really appreciate.

Mr_arduino

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.

xKoldFuzionx


Ok that makes more sense now I though that when you were talking about the vc7670 I though you were talking about the ov7670 but now I realize that they are two different things however I assume you are talking about this https://www.adafruit.com/products/397 if so you relize it is only 0.3 MP not 2.0 MP. I agree that it is too expensive.


I was actually talking about [link]http://www.ebay.com/itm/VC0706-3-3V-Camera-Module-TTL-UART-Jpeg-CVBS-For-AVR-STM32-Arduino-Compatible-/171000874348?pt=LH_DefaultDomain_0&hash=item27d072456c]this one[/link], but looks like they're the same thing.  I originally bought the one at Radio Shack for about $45.  That said it was a 2.0MP camera board.  How can you tell it was only .3MP?  I didn't see that anywhere on my info.

Mr_arduino

Is the maximum output resolution 640x480 (vga) if so
640x480/1000000=0.3072

sakeear

hey Mr Arduino, im very sorry about language. Im not good at English. I baught Arduino mega 2560 board and ov7660 CMOS camera (With out FIFO). i want to take and image stream and save it in a SD card. I have sucessfully operated the SD card and its ,working perfectly. I like to know .How shold i connect camera sensor to the board and get it work out. actually i like to know about how the pins need to connect or give me a clue. if u can plz help me. thanks alot!!

nerdroide


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?

xKoldFuzionx


Is the maximum output resolution 640x480 (vga) if so
640x480/1000000=0.3072


That would mean that even the OV7670 is only a .3 MP camera and the reason I originally bought that was cuz it boasted 2MP.  Well, this is great information to know, thanks!


xKoldFuzionx

Mr_Arduino, can you explain something to me about your code?  I was looking it over, and I'm unclear as to why wrReg() is a "byte" rather than a "void".  I don't understand why that is.

Mr_arduino

So you could check for errors if you wanted to.

xKoldFuzionx

ok, Gotcha, so essentially, saving as a byte will allow you to say :

Code: [Select]

Serial.println(wrReg(regID, regDat));



this would print out what you sent?

Sorry, most everything I've seen just uses a Serial.print() function to debug, this whole byte thing is a bit new to me.

Mr_arduino

#252
Dec 30, 2013, 01:42 am Last Edit: Dec 30, 2013, 01:45 am by Mr_arduino Reason: 1
Yes you can do that but it returns 0 or 1 it does not return what was sent in this case. What you are seeing is a function returning a value. Returning an error/success value is just one application for functions returning a value you should read https://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Fcplr240.htm

xKoldFuzionx

Ok, gotcha, so, like the old school days of computing when that's all it would return is a 1 or 0.  I'm learning.  I saved that page, I'll probably end up reading it tomorrow and if I have more questions, I'll be sure to send them your way. 

On a side note, after looking over your code, I think I see (for the most part) what you did to get results from the camera.  I think I see now how to program the 0V5642.  I'm just gonna have to figure out the wiring for it.  The datasheet I was looking at only has (from what I can see, so far) the wiring for hooking up the actual sensor instead of the module.  I didn't see anything yet about pullups, but I'm not done looking through it, and I also have another datasheet for it, so I need to look that one over still.  Seems like this camera won't be too difficult. Also, according to that calculation you gave me, the 7670 is only .3MP?  I could have sworn when I bought it, it was a 2MP.  SMH, oh well, eventually I'll get to that one and get it running.

nerdroide

Mr_Arduino, I would like to know the best way to do my code to work in your opinion. I would to use the SD card or I must to leave in that way?
Thanks for your help man. You're very good. I really appreciate your help.  XD

Go Up