oloturia/ovcam

为什么没有任何反应

Closed this issue · 27 comments

xc597 commented
为什么没有任何反应

Sorry I can't read chinese.
What's the issue?

xc597 commented

Do you have a wiring diagram for all the pins, such as pwdn,rst. I wired according to your code and ran it in arduino due without any reaction

Ah! OK!
I don't have the wired Arduino here where I live, but in the next days I can go to my lab to check if I disassembled the wiring. I'll check and make some photos.

Anyway, the wiring is defined in the first part of the sketch. For example #define PCLK 32 means that you have to wire the pin PCLK on the cam to pin 32 on the Arduino. To speed up the image capturing, the pins I chose are all from the PortC bus, Arduino's digitalRead() function is too slow for the cam, so I have to read the bus directly from the register. Be aware of that if you change the pins within the defines.

Remember also that the OV7670 is wired to the I²C, if you're using a Due or similar you have to connect SDA on the Arduino to SIOD on the cam and SCL on the Arduino to SIOC on the cam. You can check if you wired it correctly with the I²C tester sketch in the Arduino IDE's example. IIRC HREF pin is not used.

Another thing: Due has two USB. One is for programming and the other for communication. The sketch uses the second, because the programming one is too slow.

If you set up everything correctly, the two python scripts can help you to decode the image and write a file, or see it live with the tkinter interface. You can just check if the Arduino is doing something just opening the serial with screen, putty or the embedded program in the Arduino IDE. You should see some bytes flowing.

I haven't checked this project for a long time, so I can't be really helpful, sorry :(

xc597 commented

Thank you for your reply. As a beginner, I am looking for some cases of arduino due connecting ov7670, but I find such examples are too few. I should have all the wiring correct according to what you said. If you have time to verify that your code can work, I will be more motivated to stick to this work. Thank you for your serious reply, which will also be part of my motivation to move forward

OK I found the project... disassembled. I tried to rewire but it's not working right now. It just sends a lot of REG ERROR 0xnn. It seems that something is wrong with the I²C communication.
I almost forgot that you have to put two pull up resistors as the cam board (at least, my board) doesn't provide them. They are two 4.7k or 10k resistors that connect SDA and SCL to +3.3v.

OK, i tested again and there was indeed a problem with the I²C (Arduino Due has two I²C ports, the one I used in the sketch is SDA and SCL the other is SDA1 and SCL1). Now it's capturing something.
test

xc597 commented
xc597 commented

I'm excited to see your images.

xc597 commented

Or can I add your contact info and ask you a question, I'd appreciate it!

SAM_7291
As you can see, the wiring is a bit messy...

Anyway I used the connections from the defines in the first part of the sketch, leaving HREF unconnected, +3.3v (my cam is 3.3v compliant) and GND as usual, SIOC to SCL and SIOD to SDA, both of them connected to +3.3v with a resistor.

Maybe I can help you if you show me your wiring.

xc597 commented
xc597 commented
xc597 commented

I have read your wiring, why is it different from the wiring method in arduino.due?

xc597 commented

this is my wiring
9183269d5d3766cab3e745c9c726c9d
2bf5310bd01dac1709e9cccdb3e5477

xc597 commented

pwdn and href are not connected

xc597 commented

this is my result
image

xc597 commented

sometime is this result
image

xc597 commented

I observe the code logic, it seems that this is successful, but I do not see the output image, how should I output the image captured by the camera

xc597 commented

I found that during the run, my SerialUSB.available() was always equal to 0, so I couldn't get into the if, so I couldn't capture the image

xc597 commented

Am I supposed to type something into the console? Please forgive me so many questions, I am really the first contact with hardware, a little don't know what to do

xc597 commented

This is the image I displayed, it is strange that your code has not changed, why your image is normal, but mine is like this
out

READY is a good result, it means that the I²C is working. Also it's transmitting something, albeit not the intended image, but it's transmitting. Usually I tended to get this kind of results at the beginning, when I misunderstood how the SYNCs work.

The console (the one in the tkinter python script) can be used to check the value or write a value into the registers. By altering the values you can change, for example, the brightness etc. the full list is in the datasheet:
https://www.electronicscomp.com/datasheet/ov7670-sensor-datasheet.pdf

Sorry I completely forgot PWDN, it should be connected with GND or to a PIN that is down. It's used to place the cam in standby (1=standby, 0=on).
I'm going to update the README.md now.

xc597 commented
xc597 commented

Sure, you can "follow" me on github. Be aware that I'm not a super-expert anyway.
Can I mark the issue as "resolved"?

xc597 commented