Wiring OV7670 Camera to T4.0 and stream images

Hello, I am working on correctly wiring an OV7670 without FIFO RAM camera sensor to a teensy 4.0. My goal is to stream the images via USB to my computer (similar to this example). I haven't found a wiring diagram specifically for teensy 4.0. Below is how I think it should be done but I would appreciate guidance on this as I don't want to fry any components.

For reference, the labeled pin layout of the sensor is in the following picture with the exception that PWDN is labeled "PWNN" on my sensor: camera.png

I will power the sensor by an external power source rather than pulling power from teensy. Below is a table of the sensor pins and which pins I believe they should connect to on teensy 4.0 (OV7670 > T4).

Code:
3.3V > 3.3V power source
GND  > Common ground
SCL  > 19 (with 3.3V power and 10k resistor)
SDA  > 18 (with 3.3V power and 10k resistor)
VS   > 17
HS   > 16
PCLK > 12
MCLK > 23 (with voltage divider)
D7   > 7
D6   > 6
D5   > 5
D4   > 4
D3   > 3
D2   > 2
D1   > 1
D0   > 0
RST  > 3.3V
PWNN > Common ground

Finally, I believe that I need to add a couple resistors. I was having trouble finding documentation on this and did see a few conflicting resources. However, for the following I used the previously linked to example starting at the 4:42 mark of the video.

SCL - Has a 10k resistor from 3.3V power source to SLC on sensor and then a wire to pin 19 on teensy. (mark 5:33)
SDA - Same as SCL with a 10k resistor from 3.3V power source to SDA on sensor and then a wire to pin 18 on teensy. (mark 5:33)
MCLK - A voltage divider is necessary. There is a wire from common ground to a 1k resistor and a 680 Ohm resistor to pin 23 on Teensy. Between the resistors, I wire to MCLK on the sensor. (mark 4:43)

Please let me know if I have anything wrong with this set up. Thank you for reading my post!
 
Not sure if there is anything wrong or not with your setup. Several of us played with these a year or two ago and there is some interesting information on them in a few different threads.

like:
https://forum.pjrc.com/threads/63195-Problem-trying-to-read-OV7670-camera-under-IRQ-Teensy-4-0
https://forum.pjrc.com/threads/61537-SPI-TFT-OV7670-camera-project-on-teensy-4

Now if you had a T4.1 I would suggest looking at:
https://forum.pjrc.com/threads/64132-CSI-Camera-Library
As the T4.1 has enough pins to use the CSI sub-system of the IMXRT processor.

If you were using the MicroMod Teensy I would suggest looking at the stuff, we were playing with using FlexIO to read the camera.
Most of the stuff was in the Beta testing thread:
https://forum.pjrc.com/threads/66771-MicroMod-Beta-Testing

But on T4, the best stuff we were doing, was to use DMA to read in the pixel data, which implies you want all of the D0-7 to be on the same Teensy IO port.
Back then I was playing with the library: https://github.com/KurtE/Arduino_OV767X/tree/teensy_micromod

For the 4.1 doing DMA stuff I was using the pins:
Code:
#else
// For T4.1 can choose same or could choose a contiguous set of pins only one shift required.
// Like:  Note was going to try GPI pins 1.24-21 but save SPI1 pins 26,27 as no ...
#define OV7670_PLK   4
#define OV7670_XCLK  5
#define OV7670_HREF  40 // AD_B1_04 1.20 T4.1...
#define OV7670_VSYNC 41 // AD_B1_05 1.21 T4.1...

#define OV7670_D0    17 // AD_B1_06 1.22
#define OV7670_D1    16 // AD_B1_07 1.23
#define OV7670_D2    22 // AD_B1_08 1.24
#define OV7670_D3    23 // AD_B1_09 1.25
#define OV7670_D4    20 // AD_B1_10 1.26
#define OV7670_D5    21 // AD_B1_11 1.27
#define OV7670_D6    38 // AD_B1_12 1.28
#define OV7670_D7    39 // AD_B1_13 1.29
#endif
//      #define OV7670_D6    26 // AD_B1_14 1.30
//      #define OV7670_D7    27 // AD_B1_15 1.31


#endif

The T4 may not have 8 contiguous ones, so the DMA after processing is slightly more complex. Some of the threads show what some of us were using.
 
Hi KurtE. Thank you for the links. These are full of great info! I'm still struggling with the wiring of the camera to the T4.0. Any chance there is a diagram floating around somewhere that I haven't been able to uncover? This would be very helpful. Thanks.
 
Back
Top