Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By eduperez
#32516
shoelessone wrote:Also, if you read this, another stupid question that I'll find out soon enough and I think I already know but I'd like to confirm: In my use case I'll be powering 8 LEDs (10mA roughly each, which I believe is fine for the mcp23017), but I'm wondering where I should get "power" from. Can I just hook up Vcc and Ground from the esp8266? I don't want to "steal" power from the esp8266, or run too much current "through" the chip, but if I use the Vcc and Ground pins on the 8266 I'm basically just "sharing" power with it, is that correct? So assuming my power supply can handle the current draw (which in theory shouldn't be a problem as it's rated to 1A), that should be OK? Does this make sense/is it true?


Yes, as long as all devices are connected in parallel to the power source, you just need a powerful power source, and each device only grabs as much energy as it needs.
User avatar
By martinayotte
#32548
shoelessone wrote:Bonus question: Do I have to set the GPIO 0 and GPIO 2 pins in any special way in my code?


As IGRR mentioned, you need to call Wire.begin(0,2) (or Wire.pins()) before the the mcp.begin. Also, don't forget that you need PullUps on both GPIO2/GPIO0, not only to ensure proper boot mode, but also for the I2C bus itself, usually around 4K7.

For power, yes, it can be shared, as long as you have proper decoupling capacitor nearby the ESP power pins.
User avatar
By shoelessone
#32551 Thank you! That seems to have "fixed" the problem, and now things are working, SORT OF!

OK, now I'm into a real problem that is driving me crazy. I am guessing it's something really stupid, but..

I recorded a video (sorry, it's a terrible/annoying video!) that demonstrates the problem:

If you don't feel like listening to me mumble for the first 4 minutes, you can jump to 3m55s to see the problem in all it's glory :)



If you watch from the beginning you'll see me scratch my head, and I run through the circuit (in a somewhat confusing way, sorry!), but if you jump to 3m55s you can see the problem.

Basically, things seem to work, but then stop working after a random number of seconds (0-15?). Also, things will be working, and then i'll unplug/disconnect power, and plug everything back in 1 second later and it no longer works!?!

Also, When I say "switch pins" and say "two are working", what I SHOULD say is that I set two pins (0 and 1) on the mcp23017 as outputs, and they should both be turning on/off every second.

If anybody has any ideas about I might be doing wrong or missing, I'd really appreciate it! <3