-->
Page 1 of 3

I2C on nodemcu hardware (not with nodemcu firmware)

PostPosted: Sun Apr 12, 2015 4:39 am
by rab
Anyone got I2C working with the nodemcu dev board? If so is there some magic to it? I'm using the code from the IoT example from the esp8266 sdk, trying to talk to a DS3231 module, and I get nothing. Any specific GPIOs I need to use on the dev board because of how they are wired up?

Re: I2C on nodemcu hardware (not with nodemcu firmware)

PostPosted: Thu Apr 16, 2015 3:11 am
by rab
Ok, to answer my own question, after some playing: I2C works fine with GPIO-4/5 (D2 & D1 on the nodemcu board respectively), but not the default (in the example code) of GPIO-2/14 (D4 & D5). The difference appears to be a pull-up on GPIO-2 , while you do need pull-ups on the I2C lines I already had them on my RTC module, so I guess double pull-ups doesn't work, or double on one and single on the other (I'm more into the programming side of this than the electronics so I don't know for sure). I suppose if you don't have didn't have pull-ups on your I2C module you'd need to use GPIOs that do on the nodemcu board, e.g. D3/D4. Hope that helps someone else in the same situation.

Re: I2C on nodemcu hardware (not with nodemcu firmware)

PostPosted: Thu Apr 23, 2015 12:27 pm
by kolalde
First, thanks for posting, reading more about this board board I bought, ZS042, I should have done some homework before I selected. I'm just learning.

Two questions:

1) I wanted to use these with other I2C devices, same lines, and I've already got the needed pull-ups in the circuit. Do folks just cut the traces on a board that already contains them? I guess I could pull my pull-ups, would be easier. Just wondering, I've seen a range us pull-ups used, should 2 sets of 4.7k pull-ups work?

I also came across this:
http://forum.arduino.cc/index.php?topic=278270.0

2) Seems like some suggested using a LIR2032 battery, but will that work? The schematic in the post looks like Vcc is dumped into the battery after passing through a 200ohm resistor and a 4148 diode. So 21mA at 4v3 sounds right (did I get that right if powered from 5v? and I measured it at 4v2 and 17mA), but is there a need to cut off charging at some point?

Thanks,
ko

Re: I2C on nodemcu hardware (not with nodemcu firmware)

PostPosted: Thu Apr 23, 2015 12:43 pm
by rab
Can't help you with question one I'm afraid, as I've already confessed my electronics ability is a little sub-par at the moment.

As for question two, these boards are designed to run with LIR2032 and have a trickle charger. There is no automatic way to shut this off (or any manual way without disconnecting power to the device entirely). My understanding is that it doesn't need to be shutoff.

The LIR2032 is pretty low capacity compared with a CR2032 though - you'd expect a backup battery on an RTC to last several years, but I've seen people do the calculations and the LIR2032 won't last a full year. Of course you probably only need it to last short periods and it'll recharge in between, so that's probably not too important. What might be more important is you can't run the board off 3.3v and expect it to charge the battery. I've stuck a normal CR2032 in, should keep the RTC going for a decade and I can run it at the same voltage as the esp8266. To do this just remove the diode to disable the trickle charge circuit.