Arducam library!

@robotjackie I’m pretty sure you still need pull up resistor on the i2c lines. I needed them with my 3v i2c temp sensor.

1 Like

As @RWB correctly stated I2C requires pull-up resistors.
The reason is that the I2C devices (master and slave) only actively pull the communication lines LOW and rely on pullups to bring the line back up HIGH once they stop pulling LOW (letting go of the line).
Without pull-ups the lines will not go properly HIGH and the Photon will (erronously) block.

This can also cause green blinking.

And if you don't need cloud connection (e.g. at uni) you might want to consider adding SYSTEM_MODE(SEMI_AUTOMATIC). To be able to OTA flash your Photon in this mode, you'd either have to go into Safe Mode or add some means to call Particle.connect() (e.g. via a button).

Ahhhh! I learn so much from this. Thanks! I’ll test this tonight, and it really solves a problem I had with the green blinking. I’m so glad that the Photon has such an awesome community - it’s why I chose it over the last uC I was working on (Microchip + Harmony, which I swear no one in the world has ever known enough to help anyone on).

What value for the resistors? 4.7k? The wiring is that the resistor goes from I2C pin to 3V3, and then a separate wire goes from camera to I2C pin right?

I’ll let you know how it goes tonight / tomorrow.

1 Like

@robotjackie There is a great knowledgeable community behind the Particle devices and its sure does make all the difference in the world when it comes to getting unstuck when you run into something that stops you in your tracks.

I sure do hope you can get the camera function working, it would be such a handy feature.

I used 1K resistors on my I2c lines and they worked just fine.

1 Like

@robotjackie, 4.7K is fine and the wiring is as you describe. :smile:

1 Like

@peekay123 Are there any advantages to using 4.7k resistors on the pull up lines vs using 1k resistors.

Is there less power loss when using 4.7k vs 1k. For a battery operated device which would you recommend?

@RWB, the required value for the pull-ups is influenced by the used I2C frequency, impedance of your signal lines and the current your devices can/should sink when pulling the line LOW.

Higher values usually increases the rise time, lower values increase the current to sink, so your job is to find a good compromise and 4k7 is a good one for most short wire settings.

This is a good read about this
http://www.edn.com/design/analog/4371297/Design-calculations-for-robust-I2C-communications

2 Likes

@ScruffR is dead on as usual. The other thing to keep in mind is when using multiple I2C breakouts with built-in resistors, the effective pull-up resistance is reduced due to the parallel resistors. Choosing 4.7K resistors also allows for a couple of parallel pull-ups without reducing the resistance too much.

3 Likes

Okay, unfortunately my Photons are still stuck in "green flashing mode," and neither of the Photons I have are able to get my code flashed, or connect to the Internet, after I tried to use I2C between Photon and an OV7670 camera without those pullup resistors!
I've tried pressing Reset and setting Safe mode, which both still lead to flashing green. (Still offline, according to Dashboard.)
DFU mode, WiFi network reset, and Listening mode flash their respective colors, but in all of these settings, my mobile Particle app can't find the device to connect to, nor can terminal serial's "particle setup" command. See below:

I have detected a Photon connected via USB.
? Would you like to continue with this one? Yes
! The Photon supports secure Wi-Fi setup. We'll try that first.

! PROTIP: Wireless setup of Photons works like a wizard!
! PROTIP: We will automagically change the Wi-Fi network to which your computer is connected.
! PROTIP: You will lose your connection to the internet periodically.

No nearby Photons detected. Try the particle help command for more information.

Next, I tried to flash the code through CLI. I had tried this before the "green flashing bug" and it had worked. But serial doesn't find my Photon:

Including:
tryme.ino
attempting to flash firmware to your device DeepDishCamera
Flash device failed
[object Object]

Any ideas on what I could do? If this is caused by not pulling up I2C pins to HIGH, what could I do? Is there a way I can manually pull up the I2C pins, and is it just SCL that needs to be pulled or both SCL and SDA?


P.S. @peekay123 Is your name a reference to the main character Peekay from "The Power of One"?

@robotjackie to enter safe mode you have to do the following:

Press both the Setup + Rest buttons at the same time.
First release the reset button and keep holding the Setup button until you see the purple LED.
Once you see the purple LED let go of the Setup button and it will reset real quick and then startup in Safe mode.

Not sure if your doing that already or not. It took me a couple try’s to figure that out.

Yup I’ve done that, thanks! I can get it in each of the modes, but the outcome is what I described in the post above.

@robotjackie Both SCL & SDA need to be pulled up.

Use 4.7k resistors and connect one side to 5v or 3.3v + line. Then connect the other end of the resistor to the SCL & SDA pins. That will pull the lines High anytime there is no communication.

@robotjackie

To turn the Wifi off and let the processor boot up regardless of the WiFi status add these lines above the Setup

SYSTEM_THREAD(ENABLED);
SYSTEM_MODE(MANUAL);

This code will let the Photon startup without the Cloud WiFi connection. The LED will be breathing White in color.