I2C not working for Gun Safe Hygrometer [SOLVED]

Greetings! Just purchased a Spark Core in hopes of making a hygrometer for my gun safe. The other components are a HTU21D humidity sensor on a breakout board with pull-up resistors and a LCD screen. Thanks to the HTU21D library I did not have to do hardly any coding!!! I wired everything up and can not seem to get the humidity sensor to read. Dug out the multimeter to do some troubleshooting and the strangest thing happened. When I measure voltage from SCL to GND on the breakout board it works!!! When I removed the multimeter leads it stopped again. Figured it had something do do with the pull-up resistors, so I removed the solder blob and still had no success. I put the solder blob back and it still only works while measuring voltage. I measured Ohms from both SDA and SCL to ground and they are both reading 4.7 kOhms. Any suggestions on what to do next? Thanks!!!

@Praetorian07, do you have the sensor board ground solidly connected to the Spark ground? How are you powering the sensor board? :smile:

Power is from 3v3* and ground is connected to the adjacent GND.

@Praetorian07 Try powering off the 3.3V line (unfiltered) instead.

you could try a stronger pull-up I now there have been some issues with the i2c, but this use used a stronger pull-up and it seemed to help i2c thread link

Thanks for the suggestions guys. I stumbled across Figure 32 in the microcontroller datasheet yesterday. I put a 100 Ohm resistor between the sensor and the Spark Core on both the clock and data lines and it is working great!

Hi @Praetorian07

It is very interesting that you needed the series resistors. They are used to slow down the edges of the signals and reduce ringing in certain situations, but generally are not required.

Do you have long wires between the Spark and the humidity sensor?

1 Like

The sensor was originally hooked up with 6" breadboard jumper wires when it was not working.

My breadboard was small enough that I could eliminate the wires and was able to use the resistors to directly connect the sensor when I “fixed” it.

Glad it is working for you–marking it solved! I think that sensor has a processor with soft i2c in it based on the datasheet–it is spec’ed for very slow operation. The max speed of the sensor is the min speed of the Spark core.

Can I ask how the WiFi signal works if the antenna is inside the safe? Or do you somehow mount the core or antenna outside the metal box?