Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request #4

Open
AdiXJain opened this issue Mar 15, 2015 · 48 comments
Open

Request #4

AdiXJain opened this issue Mar 15, 2015 · 48 comments

Comments

@AdiXJain
Copy link

can you upload a single sketch file for arduino... Or please tell me how to run the code...

@ComputerNerd
Copy link
Owner

To compile and upload this to your arduino uno run

make writeflash

To compile without uploading run

make

Note that this should work on other atmega328 based development boards or on a breadboard, but you may need to modify the makefile.

@ComputerNerd
Copy link
Owner

It looks like an extension to some code that I wrote. I would assume it works. My concern about the code is what has been added.

They are sending pixels in an extremely nonoptimal way. It is better to simply send binary data then it is to convert it to text. Text conversion is slow and unnecessary. You will end up transferring up to four times as much data as text than you would sending the data as is. It also takes CPU time to do the conversion which means an even slower framerate.

@ComputerNerd
Copy link
Owner

I have already done so much. To put this issue bluntly: I lack the motivation for some of these tasks. Others on the message board have made schematics and all you need to do is copy and paste the code into the Arduino IDE and rename a few functions. You will need to add WIFI support.

@ComputerNerd
Copy link
Owner

Use google. I do not use the Arduino IDE. Add some code to blink the led to tell if it uploaded. Also if you want to use my frame grabber on windows you will need port it.

@ComputerNerd
Copy link
Owner

I think the issue lies in the fact that you are not grasping the fact that I have code that is working and can be easily compiled. Just run

make writeflash

and the program will be compiled and uploaded to your board. No need to mess with the Arduino IDE.

@StoutRelic
Copy link

Thanks for all the help,
I want to make it work in ardiuno IDE because this is just one module of my project. I have to integrate some other hardware as well. So, what I did is I changed the main.c file to "sketch-name".ino and copied the code of ov7670.c to it. It compiled successfully. Then I did all the connection like you said in your readme file and after uploading code when I opened serial monitor nothing is displayed.

@ComputerNerd
Copy link
Owner

Please do not blindly copy code without understanding what it does. While I appreciate your politeness I understand that the end goal is to get me to do a larger proportion of your project for you.

My code does not send text (doing so is inefficient) and it does not use a baud rate that is supported by the serial monitor. Of course you will not see anything. You will need to come up with a program to capture the pixel data. My program can still function as a base see https://github.com/ComputerNerd/simpleFrameGrabber.

@StoutRelic
Copy link

Dude,
I am not trying to make you do anything extra. I just want you to give me a little support about the code you have already developed. I never asked you to do anything. I always only wanted your support.
Thanks

@ComputerNerd
Copy link
Owner

Support is something extra. Also you deleted most of your comments most likely in hopes to make your comment appear true when it is not. Please do not do that. Fortunately Github emails me whenever you posted a comment so it turns out that deleting the comments did not accomplish much.

That problem is I do not understand why you need support. I have already told you what you need to do.

Also for everyone's reference here is the deleted comments. The more recent comments are at the bottom of this post.

Edit: removed long code

Sir,
I want to capture image from my OV7670(w/o FIFO) and send it to my PC via Wi-Fi(ESP8266)(Which I know How to use) using Arduino Uno. I have read so many blogs and threads on internet but couldn't find simple and exact solution for the problem. I am a newbie in this and all I want is the simple wiring schema, code that can be used with Arduino IDE and the direction on how to proceed.
Thanks

Hello,
I am really thankful to you for doing this. I understand that you can not provide me with the kind of information I asking. Just clear few doubts,
1- Now this happened accidentally I was trying something else. As I told you before I want to make it work in arduino IDE in my windows. So what I did is I created an empty sketch and just copied all your files with main.c, ov7670.h and everything. Then when I opened the sketch in arduino IDE all those files get automatically opened in the IDE and when I compiled it compiles successfully then I uploaded to my arduino uno and it was successful. so, tell me is anything uploaded on my arduino or nothing is uploaded because my .ino file is empty.?
2- I made the connection according to the readme file, and when I opened serial monitor it shows nothing, i tried with all the baud rate. I don't know of it's suppose to happen or what.
3- Please tell me how to save this Image or how is it sent to my PC and how do I recieve it in my PC? I looked at your code simple grabber but it's for linux and I couldn't understand anything. please tell me another way to get the Image.

See I have used google enough and only answer I have got it your github repository or that it's not possible. Since you have done it only using arduino uno and OV7670(w/o FIFO) I want to just know exactly how to do it. please help

@ComputerNerd
Copy link
Owner

Also I just noticed you had an arduino.stackexchange.com question. It provided more information that let me provide an answer that may advance your progress in getting this to work see http://arduino.stackexchange.com/questions/10170/how-to-use-code-for-ov7670-in-arduino-uno/10194#10194.

@StoutRelic
Copy link

Sir,
You are probably elder than me and I never wanted to disrespect you and I actually never did. I can go on and on about what you said and then what I said but I think that's not necessary. I am sorry if you feel disrespected anyway possible, that is certainly not my intention.
Clearing the air about why I deleted my comments, I only deleted those comments just to shorten this big unnecessary conversation and because of the long code I posted. I never wanted accomplish anything with deleting the comments and If you want to keep it that's completely fine by me.
The problem with my project is that getting this camera to work is not my ultimate goal. I have to get this camera work and then integrate with other hardware in my project that's why even if I get it working in linux it still won't help my project. So, I need to get this code to work in Arduino IDE on windows platform.
And let me tell you that in my project I have to use OV7670 camera as a image capturing device and I need to get that image on my Matlab code via Wi-Fi for image processing and then display the result on LCD interfaced with my board.
I still am genuinely thankful for your code.

@ComputerNerd
Copy link
Owner

I worried about offending you as well. I can get harsh when I suspect that I am doing lots of work for someone without the favor ever returned.

Also thank you for providing me with more details on your project I have four words for you that may make your life easier:

Get a webcam.

You are sending this to your PC anyway so why not just skip the trouble and purchase a webcam. You can buy them on Ebay for less than $5.00 with shipping included (a price comparable to the ov7670). The quality can be improved by putting a better lens on the webcam.

The reason I did all this work for the OV7670 is because I wanted a standalone system that could be used for a low power dedicated time lapse machine as an example. I also wanted to experiment with Raw Bayer data and I need more control over the image sensor. Do you need any of this? If not get a webcam.

The reason these capture programs to the PC exist is primarily for testing purposes and any needed lens calibration.

How about this. Try and tell me why you think you need the OV7670.

@StoutRelic
Copy link

Hello,
Thanks for helping me.
Using Webcam is my "Plan B" as using it would make my device wired and the device I want to make is wireless and buying a wireless camera which can connect to the internet would not be cheap.
That's why I want to connect OV7670 to arduino to send images over Wi-Fi to my PC for image processing.
Although now this is getting too complicated and I do not have much time and I think even If I get OV7670 camera to work the image quality will be very poor for image processing. So, I think I should go for webcam.
let me know if you have another solution.
Thanks for all the help.

@Mr-Julien
Copy link

Hello,
Thank you for this program,
I am able to compile it on my Arduino Uno, but the hard part is to capture the pixel data. Could you give me the instructions to do so with your program: simpleFrameGrabber ?

Respectfully

@ComputerNerd
Copy link
Owner

@arpit-reddfox You can have a digital wireless camera. There is no reason why a webcam will force you to use wires. You could get a low cost single board computer such as a raspberry pi and use the raspberry pi camera or plug in a webcam to it's USB port(s).
@Mr-Julien it is just a matter of reading the serial data. Nothing complicated.

@silvergravel
Copy link

hi ComputerNerd,
i have been trying to get my ov7670 working with my arduino uno. I have been following your posts on the arduino forum extensively, and me being a noob am still very confused about a lot of things. anyway, ive decided to deal with my issues one by one. So for starters, im used to compiling and uploading code from the arduino IDE, so im unable to understand how to run the code that you have given. i have followed all the circuit connections as described by you ( including the pull up resistors & voltage regulator ) but am unable to understand how to upload the code onto the board! i do realize that you have explained how to do the same earlier in this post, but, if im supposed to type make writeflash then where exactly am i supposed to write it? im using a mac by the way.

also, once the code does upload, what am i supposed to look out for? will successful compilation of the code initate an applet on my screen within which i would be able to see my camera feed?

please could you help sort out this confusion of mine! it would be of great help!

thanks!

@eranws
Copy link

eranws commented May 28, 2015

Hi,
I have successfully compiled the project in arduino IDE, simply concatenated main.c and ov7670.c ov7670.h into .ino file

didn't test it with the camera yet, but it uploaded to my arduino (Duemilanove)
Tell me if it worked for you...

see here:
https://github.com/eranws/ov7670-no-ram-arduino-uno

@TodorGinchev
Copy link

Dear "ComputerNerd", thank you very much for sharing your work with us. I think there are a lot of people trying to get work the ov7670 and the documentation about it very good (check datasheet), but people expect to find already existing code which will take a picture with just calling a function like takeApictureForMe(). That is the problem with most of the people who work with Arduino, they have libraries for everything.

Your code works, of course, and is compatible with a lot of microcontrollers, not just the Arduino's Atmega328. I am amazed that ONLY the user "eranws" was able to copy paste your work into an Arduino project AND compile it successfully (and actually it work). What could possibly go wrong if you copy-paste? I don't get it.

Dear eranws,
Your code works, indeed. Thank you for "converting" it into .ino project so that every Arduino "programmer" could use it. The next step would be converting the received data.

I suggest everyone to take a look at the datasheet of the module, because otherwise even if you get it work, some day it could (it will) stop and you won't know why because you won't be able to debug.

@ComputerNerd
Copy link
Owner

I have gotten a bit behind on issues so I will respond to them in reverse chronological order.

@TodorGinchev Yes I understand your point and my program comes close to that. I already have a takeApictureForMe() function called captureImg(). However before using it all you need to do is initialize the camera by calling camInit() and then set the resolution by using the setRes() function and set the pixel format using setColorSpace(). Then you can use the captureImg() function and it will send pixel data over UART.

I would not be surprised if more people had success creating an INO; it is just that he posted about it. You are right not much can go wrong when copying and pasting.

@eranws Tell me if it works. I will be interested to find out.

@silvergravel I am confused by your post just as your are confused about mine. There is no way an applet will magically appear. You can use my frame grabber to capture an image https://github.com/ComputerNerd/simpleFrameGrabber

To know that the code is working watch the TX LED light if it blinks/stays on it is working. If the LED on pin 13 is blinking it is not working.

@themathgeek13
Copy link

@ComputerNerd - I am a beginner to using I2C, and I found the LED 13 blinking when I used your simpleFrameGrabber program. Could you tell me some possible reasons for this?

I really appreciate the help you are providing, and for spreading the joy of electronics! :)

@silvergravel
Copy link

thanks guys

@eranws thanks for compling the code in arduino IDE! i did manage to compile and upload computerNerd's code through the terminal though my project involves interfacing with a few other sensors etc, so your arduino version is going to be of huge help for that! still have to try the code though.

@ComputerNerd thanks for the reply! im going to go ahead and try to compile the frameGrabber code..

@themathgeek13
Copy link

@silvergravel - tell me if simpleFrameGrabber works for you. For me it is showing a green pixelated image which does not correspond to anything in front of it.

@ComputerNerd - I got I2C working, but the problem of the green image is still there. Any suggestions?

Thanks.

@TodorGinchev
Copy link

Yes, you have 3 parameters if I am not wrong: baud rate, resolution and format. You have to match the parameters of the Arduino program with those of your FrameGrabber.

I had not time to try it, but I will. Hope it will work.

@TodorGinchev
Copy link

And BTW, it's not I2C, the data is sent via UART and the protocol that controls the camera is similar to I2C but it's not the same thing

@abbanerjeersm
Copy link

@TodorGinchev - can you please suggest a ready made solution to grab and view the image generated on USART ?

@themathgeek13
Copy link

@TodorGinchev - yes, you were right, I2C is not the same as SCCB, but for our purposes using this camera they can be considered the same, right? Anyway, I checked that the baudRate is 1M, the resolution is qQVGA. I still get extremely pixellated and noisy images. I really have no idea why it doesnt work. Any ideas?

@themathgeek13
Copy link

@abbanerjeersm - I heard that the minicom monitor utility for Ubuntu is extremely useful for UART...but I dont know how to view images using this utility. Try it out, tell me how it goes.

@abbanerjeersm
Copy link

@themathgeek13 : Unfortunately I use windows 7 - so installing linux seems to be a long way round. Lets see ...

@TodorGinchev
Copy link

A ready made solution is the frame grabber. If you need Linux, you can always use a virtual machine, that is what I do because I still need windows for my work and cannot fully migrate to Linux.

@themathgeek13 you at still missing the format, maybe that's your problem, you have raw, rgb565, etc

@themathgeek13
Copy link

@TodorGinchev - thanks for the suggestion, but that was not it. I tried all three formats, and it didnt work. I am using a 20.025 MHz quartz crystal oscillator for the clock signal. Does it need to be less than the Arduino's 16MHz for it to work? Does the HREF pin need to be connected anywhere? I dont think so, but I cannot find any other problems...

@abbanerjeersm
Copy link

@themageek13: No the clock frequency has no bearing on the UNO frequency if
you use a standalone oscillator. I suspect that the issue is with the setup
of registers for ov7670. Did you already look at
http://forum.arduino.cc/index.php?topic=159557.0 for different
documentations like ov7670 Application notes ?

On Thu, Jun 11, 2015 at 12:26 PM, themathgeek13 [email protected]
wrote:

@TodorGinchev https://github.com/TodorGinchev - thanks for the
suggestion, but that was not it. I tried all three formats, and it didnt
work. I am using a 20.025 MHz quartz crystal oscillator for the clock
signal. Does it need to be less than the Arduino's 16MHz for it to work?
Does the HREF pin need to be connected anywhere? I dont think so, but I
cannot find any other problems...


Reply to this email directly or view it on GitHub
#4 (comment)
.

@TodorGinchev
Copy link

Mmm, actually I am now having the same problem, I am receiving the data but not able to convert it into image with the FrameGrabber. But I didn't spent enough time debugging, I'll do it later. The program is showing "random" pixels...

@silvergravel
Copy link

@themathgeek13 no. the simpleFrameGrabber is just not compiling for me. it gives me a bunch of warnings and ends with - ld: library not found for -lSDL
clang: error: linker command failed with exit code 1 (use -v to see invocation)

im on a mac btw. could it be because im on a mac? i did install the SDL framework.

as for the ov7670-no-ram-arduino program, it uploads onto the board but the led 13 light stays on and the tx light doesnt blink, so looks like im unable to make this program work either. :(

@TodorGinchev
Copy link

Let's see. Here you have the .ino file and the compiled frameGrabber:
https://www.dropbox.com/sh/kk3m1wspzb93abn/AADH8BeijpVxk2V-X25qLy6wa?dl=0

The parameters between them are already matched (I think I did it correctly). So you only need to program the Arduino. If the RX LED of the Arduino is not blinking, then you did something wrong.

After that, run the grabber with the command ./grab 320 240 yuv422 500000 /dev/ttyUSB0 1

You should get the image. I don't, maybe because I am using a VM.

@TodorGinchev
Copy link

BTW @ComputerNerd I got segm fault sometimes:

$ ./grab 160 120 yuv422 500000 /dev/ttyUSB0 1
160 120 1 4101 1
120
Div 63
Segmentation fault (core dumped)

@TodorGinchev
Copy link

Things that I may be doing wrong:

pin 11 (the clock generated for the cam) I use it as 0 to 5V clock, not 0 to 3.3V. So the only thing that can go wrong is that the rising/falling time of the signal is so big that affects the readings of the camera (I have a signal where 2.49V is "Low limit" and 2.51 is "High limit" and the camera is expecting 1.64V as Low and 1.67V as high. But I think the rising/falling time should be neglegible and therefore there would be no difference between 5V or 3.3V clock (expect the fact that the camera can get burned hehe).

The divider (register 0x11) is also to be taken into account, so I matched it also (25 for raw VGA and 21 for yuv422 qVGA) but I'm still not getting the desired signal. I indeed receive data, but the grabber considers it as "junk bytes".

Any other ideas of what paramers I'm missing?

@themathgeek13
Copy link

@TodorGinchev - I tried your code as well, but I am getting the same random pixel output as before.

@silvergravel - I am using Ubuntu 14.04 and I don't know anything about the Mac...maybe you need some libraries...check on Google.

@abbanerjeersm
Copy link

I found this on internet for register settings. I am still waiting for my
ov7670 to be shipped before I can start coding on it, but perhaps one of
you could try it ?

http://mirrors.neusoft.edu.cn/rpi-kernel/drivers/media/i2c/ov7670.c

On Fri, Jun 12, 2015 at 2:12 PM, themathgeek13 [email protected]
wrote:

@TodorGinchev https://github.com/TodorGinchev - I tried your code as
well, but I am getting the same random pixel output as before.

@silvergravel https://github.com/silvergravel - I am using Ubuntu 14.04
and I don't know anything about the Mac...maybe you need some
libraries...check on Google.


Reply to this email directly or view it on GitHub
#4 (comment)
.

@ComputerNerd
Copy link
Owner

@TodorGinchev The reason you are getting a segmentation fault is because I forgot to mention that this program uses protocol version zero not version one so thus the last parameter should be a zero when using this program. You have a one for the last parameter.

@abbanerjeersm I can tell that you did not read a response I sent to you about the fact that I got the registers from the Linux kernel driver as well. This looks like an older version however.

@abbanerjeersm
Copy link

@ComputerNerd : The latest datasheet I found on internet was version 1.9 - and I found many versions of linux drivers floating arround. For someone who wants to just get an image from this module is not particularly an easy learning curve. Anyways - I want to make the code more readable than yours - so I plan to make a arduino library for ov7670 when I get mine to test with.

@ComputerNerd
Copy link
Owner

@abbanerjeersm Please post the link to version 1.9.

@abbanerjeersm
Copy link

@ComputerNerd : Here it is. I found this originally on http://wenku.baidu.com/view/ddb7362e0066f5335a812174.html?re=view but have created a new link in an english language website http://www.filedropper.com/ov7670-version191

@ComputerNerd
Copy link
Owner

That is the datasheet for the ov7660. The registers are very similar and it provides more information that is relevant to the ov7670. Thank you for reminding me of the existence of said sensor. In fact I believe that the ov7660 is better than the ov7670 as it is code compatible with the ov7670 but has larger pixels so that should mean better lowlight performance. I do not own an ov7660 but I would like to.

@silvergravel
Copy link

@TodorGinchev not able to get the RX to blink :( im beginning to wonder if my connections are wrong. these are the connections have used -
circuit diagram
except for the voltage divider for which i have connected as following (PCLK is wrong. it should be XCLK i think) -
circuit diagram correction

im gonna undo the connections are redo them again, and hope something changes, but other than that im really not sure what to do next :(

@robottman
Copy link

@TodorGinchev could you send the link for the .ino file and the compiled frameGrabber please.
The link that you sent before doesn’t work.
https://www.dropbox.com/sh/kk3m1wspzb93abn/AADH8BeijpVxk2V-X25qLy6wa?dl=0
Thanks

@TodorGinchev
Copy link

Don't have it anymore, but just copy/paste the code that you get, this will do the work but of course you won't know how the camera operates...

@zackhaikal
Copy link

zackhaikal commented Dec 1, 2016

@ComputerNerd using cmd ?

To compile and upload this to your arduino uno run
make writeflash
To compile without uploading run
make
Note that this should work on other atmega328 based development boards or on a breadboard, but you may need to modify the makefile.

@themathgeek13 Regarding the simpleFrameGrabber program that you've been trying , the LED 13 still blinking or already solved?
@eranws The onboard LED on my Arduino Uno keeps flckering after uploading your code. I think there's something in your code that disturb the onboard LED. For your information, the Blink example works just fine. So, i'm guessing that my Arduino still ok.

@natthalip
Copy link

Hi. I need help!!! @ComputerNerd
What is variable of the value that we get from module camera (pixel).
I just want the value from camera to do something else.
Can you tell me please?
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests