Connect First Sensor to Breadboard

Hello there,

I have a Raspberry Pi 3 B+ and breadboard. I have also bought the Soil Temperature/Moisture Sensor - SHT10. How do I learn how to connect this thing up to the breadboard, and then ultimately the RPi?

For a non-electrical person, I’ve looked at the SHT10 Datasheet, but that did not appear to tell me what wire goes where etc. Are these the instructions:

Four wires: Red = VCC (3-5VDC), Black or Green = Ground, Yellow = Clock, Blue = Data

I should be able to connect this sensor direct to the breadboard and then the RPi right? I don’t need a microcontroller or analogue to digital converter etc.?

Thanks so much.

Hi Kirk,

There is a recommended circuit diagram in the datasheet on page 5:
image

You will need to wire in a pullup resistor between VCC/VDD (Red) and Data (Blue).Note that there has been a slight revision with different wire colours so we need to update our product page (I’ve added it to our todo list). Checkout Adafruit’s product page for the latest information: https://www.adafruit.com/product/1298

Checkout the pinout for a Raspberry Pi to see where to connect this to on a Pi:

And yes, that’s correct. You’ll be able to power this from the 3.3v rail on the Pi and communicate with it directly using I2C, as per this tutorial:

Regards,
Oliver
Support | Core Electronics

1 Like

Thanks so much @Oliver. Really appreciate the guidance.

2 Likes

I’ve now successfully hooked up the temperature and CO2 sensors to my RPi via the breadboard. I connected the 4 wires from the SHT10 to the breadboard into 4 new rows. From my CO2 sensor, I jumpered 4 cables as follows:

  1. VDD to Red (VCC)
  2. GND to Black (Ground)
  3. TX/SCL to Yellow (Clock)
  4. RX/SDA to Green (Data)

I then added a 10kOhm resistor - I’m hoping this is right: one end in the row with the Red cable and the other end in the row with the Green cable. Is this correct? Is this now a pullup resistor?

Running sudo i2cdetect -y 1 shows me the 2 addresses of my other 2 sensors, but not this SHT10.

Have I done something wrong?

Thanks again,
Kirk.

Hi Kirk,

That should be correct, there would have been a resistor provided as well. Just elimate issues, have you tried disconnecting your other sensors and running the SHT10 by itself?

1 Like

I have just given that a go now @Mitchell, and no luck. The SHT10 is now directly connected (via the breadboard) to the RPi by itself. I can’t seem to get any value when running sudo i2cdetect -y 1. Are there other things I can do to troubleshoot this?

Cheers.

Can you show us a photo of your wiring?

Hi @Oliver33, I hope these photos help. Given that all my wires from the RPi to the breadboard are all black, it will likely be impossible to tell from the photos how I’ve wired it, so here is what I’ve done:

  1. GPIO Pin 1 to Red
  2. GPIO Pin 9 to Black (Ground)
  3. GPIO Pin 5 to Yellow (Clock)
  4. GPIO Pin 3 to Green (Data)

I also have the resistor that came in the pack in both the Red and Green rows.

This shows the RPi, my breadboard with the two other sensors (not currently connected), and the SHT10 coloured wires hooked up to the RPi.

A close-up of the breadboard wiring:

Top view:

Does this help? Do you need a different view perhaps?

Cheers.

2 Likes

I think everyone in this thread gets some egg on face. This sensor uses the same pinout as I2C, but it’s not I2C compatible - however, you can connect it to I2C without harm or mis-reading.

Here’s a python library you can use to read data from the sensor:

2 Likes

This is a wonderful pick-up @Oliver33. Thanks for this. Hoping not to sound too dumb, but what does this actually mean from the perspective of getting it working? I have been through the I2C tutorials, so I understand what it is, but how do I actually connect then ‘communicate’ with this sensor, given I have 2 others that are working using I2C?

Thanks again.

1 Like

If you want to use them simultaneously you have two options:

  1. Connect the SHT sensor to a different pair of GPIO pins for its special Clock and Data
  2. Write code that switches the mode of the I2C Pins between normal GPIO (for use with the special SHT library) and I2C

The first one’s definitely going to be much easier. Follow the instructions on this page for installation, then check out the examples.py example script:

If you haven’t done this before, here’s the relevant section from Core’s Pi Beginner’s Workshop:

1 Like

Thanks again @Oliver33. I don’t want to use them ‘exactly simultaneously’. The intent really was just to read from each sensor say every hour or so. The readings don’t need to be simultaneous, but as long as they’re close in time. So the idea was to simply call each sensor in turn around every hour, so is option 1 still okay or is there a better solution?

Now just whilst I think of it, some of the libraries for the sensors seem to have methods for turning the sensor on / off (i.e., putting it in some sort of rest mode I guess). Is this necessary, or do you simply just keep them ‘on’?

1 Like

:flushed: :sweat_smile:

Egg on face indeed! Oops, sorry @Kirk!

I’d recommend going with Oliver’s option 1:

It’ll be much simpler and easier to set up in practice.

As for sleeping, it depends on the sensor and application. I can see in the sensor datasheet they recommend keeping the sensor in sleep mode for at least 90% of the time to limit self-heating to below 0.1°C - more important for relative humidity readings than temperature readings actually.

Excellent. Really appreciate that again @Oliver and @Oliver33.

So just to confirm:

  1. I should hook up the other 2 sensors back to how I had them previously (as that was working)?; then
  2. Wire up the SHT10 like this:
  • GPIO pin 17 (3.3V) to Red
  • GPIO pin 25 (Ground) to Black
  • GPIO pin 12 (GPIO 18) to Green
  • GPIO pin 16 (GPIO 23) to Yellow

And use this Python call to initialise the object:
with SHT1x(18, 23, gpio_mode=GPIO.BCM) as sensor: ...

Is that about right?

No worries, and yep, looks right to me :slight_smile:

We finally got there! All three sensors are now working. Thanks so much for all your assistance @Oliver, @Oliver33 and @Mitchell.

:smiley: :ok_hand:

2 Likes