Seeeduino LoRaWAN W/GPS with Grove - I2C High Accuracy Temp&Humi Sensor (SHT35)(101020592)  and  Grove - 3-Axis Digital Accelerometer(±1.5g)(101020039)

I am using the Seeeduino LoRaWAN W/GPS with Grove - I2C High Accuracy Temp&Humi Sensor (SHT35)(101020592) and Grove - 3-Axis Digital Accelerometer(±1.5g)(101020039)
I am using the latest Arduino IDE software and have successfully installed the Libraries.
When I use the examples it does not output any real data from the SHT35 or the 3 axis accelerometer. I am using the examples with no modifications. WHen I don’t hook the grove boards up, it throws an error. When the boards are hooked up, it acts proper, but no real data. I am including the readouts from the both grove board examples.
Do I need to address them differently? They are both I2C boards connected directly to the Seeeduino LoRaWAN W/GPS with Grove.
This is the output from the accelerometer. It does not change when moving at all.
This is using the ADXL345 demo code with no modificationsvalues of X , Y , Z: 0 , 0 , 0
X=0.00 g
Y=0.00 g
Z=0.00 g

This is the output from the SHT35. It does not change from this data at all.This is using the basic_demo example with no modifications.read data :
temperature = 130.00 ℃
humidity = 100.00 %

It seems pretty basic overall to use, but having no luck.
Any advice?

I think it is the incompatibility of I2C port with two devices at the same time. I suggest you to test each sensor separately.@darbeau

Hi @Baozhu,

I have done both separately. They both report incorrect values.

Is there anything I can do to verify? I don’t have any other seeediono systems.

I have tried the I2C detector tool example, but it doesn’t detect anything.

I am a beginner, but I can troubleshoot with the right tools and nudges in the right way. Just didn’t think things brand new from seeeduino would not work out of the box like this.

Thanks,
Dan

I’m really sorry that I’m going to test it out today, and I feel very guilty for making you unhappy. @darbeau

Hi @Baozhu,

Please don’t feel guilty, let’s figure this out, it will help others too.

Thanks,
Dan

I’m sorry to have caused you any trouble, but I’ve found the reason for it here.


Here is a pin that controls the corresponding power supply. We need to open it.
So the following code needs to be added to the code that needs to use the Grove interface.

    pinMode(38, OUTPUT);
    digitalWrite(38,1);

Here is the full code:

/*
    basic_demo.ino
    Example for MCP9600

    Copyright (c) 2018 Seeed Technology Co., Ltd.
    Website    : www.seeed.cc
    Author     : downey
    Create Time: May 2018
    Change Log :

    The MIT License (MIT)

    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    THE SOFTWARE.
*/

#include "Seeed_SHT35.h"


/*SAMD core*/
#ifdef ARDUINO_SAMD_VARIANT_COMPLIANCE
    #define SDAPIN  20
    #define SCLPIN  21
    #define RSTPIN  7
    #define SERIAL SerialUSB
#else
    #define SDAPIN  A4
    #define SCLPIN  A5
    #define RSTPIN  2
    #define SERIAL Serial
#endif

SHT35 sensor(SCLPIN);


void setup() {
    SERIAL.begin(115200);
    delay(10);
    SERIAL.println("serial start!!");
    if (sensor.init()) {
        SERIAL.println("sensor init failed!!!");
    }
    delay(1000);
    pinMode(38, OUTPUT);
    digitalWrite(38,1);
}


void loop() {
    u16 value = 0;
    u8 data[6] = {0};
    float temp, hum;
    if (NO_ERROR != sensor.read_meas_data_single_shot(HIGH_REP_WITH_STRCH, &temp, &hum)) {
        SERIAL.println("read temp failed!!");
        SERIAL.println("   ");
        SERIAL.println("   ");
        SERIAL.println("   ");
    } else {
        SERIAL.println("read data :");
        SERIAL.print("temperature = ");
        SERIAL.print(temp);
        SERIAL.println(" ℃ ");

        SERIAL.print("humidity = ");
        SERIAL.print(hum);
        SERIAL.println(" % ");

        SERIAL.println("   ");
        SERIAL.println("   ");
        SERIAL.println("   ");
    }
    delay(1000);
}

@darbeau

Hi @Baozhu,

That worked for the SHT35, thank you. What about the Accelerometer?(ADXL345) Is the a pin that needs to be activated for that as well?

I used the example code and added the :slight_smile:
delay(1000);
pinMode(38, OUTPUT);

But it still reads 0’s

Thanks for your support so far.

Dan

These two lines of code need to be added whenever the Grove interface is used. @darbeau

Hi @Baozhu,

I have added it the ADXL demo code, but it doesn’t work. Can you advise?

You can send me your ADXL demo and I’ll check and test it for you. @darbeau

Hi @Baozhu,

/*****************************************************************************/
//	Function:    Get the accelemeter of X/Y/Z axis and print out on the
//					serial monitor.
//  Hardware:    3-Axis Digital Accelerometer(��16g)
//	Arduino IDE: Arduino-1.0
//	Author:	 Frankie.Chu
//	Date: 	 Jan 11,2013
//	Version: v1.0
//	by www.seeedstudio.com
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2.1 of the License, or (at your option) any later version.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
//
/*******************************************************************************/

#include <Wire.h>
#include <ADXL345.h>


ADXL345 adxl; //variable adxl is an instance of the ADXL345 library

void setup() {
    Serial.begin(9600);
     pinMode(38, OUTPUT);
    digitalWrite(38,1);
    adxl.powerOn();

    //set activity/ inactivity thresholds (0-255)
    adxl.setActivityThreshold(75); //62.5mg per increment
    adxl.setInactivityThreshold(75); //62.5mg per increment
    adxl.setTimeInactivity(10); // how many seconds of no activity is inactive?

    //look of activity movement on this axes - 1 == on; 0 == off
    adxl.setActivityX(1);
    adxl.setActivityY(1);
    adxl.setActivityZ(1);

    //look of inactivity movement on this axes - 1 == on; 0 == off
    adxl.setInactivityX(1);
    adxl.setInactivityY(1);
    adxl.setInactivityZ(1);

    //look of tap movement on this axes - 1 == on; 0 == off
    adxl.setTapDetectionOnX(0);
    adxl.setTapDetectionOnY(0);
    adxl.setTapDetectionOnZ(1);

    //set values for what is a tap, and what is a double tap (0-255)
    adxl.setTapThreshold(50); //62.5mg per increment
    adxl.setTapDuration(15); //625us per increment
    adxl.setDoubleTapLatency(80); //1.25ms per increment
    adxl.setDoubleTapWindow(200); //1.25ms per increment

    //set values for what is considered freefall (0-255)
    adxl.setFreeFallThreshold(7); //(5 - 9) recommended - 62.5mg per increment
    adxl.setFreeFallDuration(45); //(20 - 70) recommended - 5ms per increment

    //setting all interrupts to take place on int pin 1
    //I had issues with int pin 2, was unable to reset it
    adxl.setInterruptMapping(ADXL345_INT_SINGLE_TAP_BIT,   ADXL345_INT1_PIN);
    adxl.setInterruptMapping(ADXL345_INT_DOUBLE_TAP_BIT,   ADXL345_INT1_PIN);
    adxl.setInterruptMapping(ADXL345_INT_FREE_FALL_BIT,    ADXL345_INT1_PIN);
    adxl.setInterruptMapping(ADXL345_INT_ACTIVITY_BIT,     ADXL345_INT1_PIN);
    adxl.setInterruptMapping(ADXL345_INT_INACTIVITY_BIT,   ADXL345_INT1_PIN);

    //register interrupt actions - 1 == on; 0 == off
    adxl.setInterrupt(ADXL345_INT_SINGLE_TAP_BIT, 1);
    adxl.setInterrupt(ADXL345_INT_DOUBLE_TAP_BIT, 1);
    adxl.setInterrupt(ADXL345_INT_FREE_FALL_BIT,  1);
    adxl.setInterrupt(ADXL345_INT_ACTIVITY_BIT,   1);
    adxl.setInterrupt(ADXL345_INT_INACTIVITY_BIT, 1);
}

void loop() {

    //Boring accelerometer stuff
    int x, y, z;
    adxl.readXYZ(&x, &y, &z); //read the accelerometer values and store them in variables  x,y,z
    // Output x,y,z values
    Serial.print("values of X , Y , Z: ");
    Serial.print(x);
    Serial.print(" , ");
    Serial.print(y);
    Serial.print(" , ");
    Serial.println(z);

    double xyz[3];
    double ax, ay, az;
    adxl.getAcceleration(xyz);
    ax = xyz[0];
    ay = xyz[1];
    az = xyz[2];
    Serial.print("X=");
    Serial.print(ax);
    Serial.println(" g");
    Serial.print("Y=");
    Serial.print(ay);
    Serial.println(" g");
    Serial.print("Z=");
    Serial.print(az);
    Serial.println(" g");
    Serial.println("**********************");
    delay(500);

}

Serial to SerialUSB @darbeau

/*****************************************************************************/
//	Function:    Get the accelemeter of X/Y/Z axis and print out on the
//					serial monitor.
//  Hardware:    3-Axis Digital Accelerometer(��16g)
//	Arduino IDE: Arduino-1.0
//	Author:	 Frankie.Chu
//	Date: 	 Jan 11,2013
//	Version: v1.0
//	by www.seeedstudio.com
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2.1 of the License, or (at your option) any later version.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
//
/*******************************************************************************/

#include <Wire.h>
#include <ADXL345.h>


ADXL345 adxl; //variable adxl is an instance of the ADXL345 library

void setup() {
    SerialUSB.begin(9600);
     pinMode(38, OUTPUT);
    digitalWrite(38,1);
    adxl.powerOn();

    //set activity/ inactivity thresholds (0-255)
    adxl.setActivityThreshold(75); //62.5mg per increment
    adxl.setInactivityThreshold(75); //62.5mg per increment
    adxl.setTimeInactivity(10); // how many seconds of no activity is inactive?

    //look of activity movement on this axes - 1 == on; 0 == off
    adxl.setActivityX(1);
    adxl.setActivityY(1);
    adxl.setActivityZ(1);

    //look of inactivity movement on this axes - 1 == on; 0 == off
    adxl.setInactivityX(1);
    adxl.setInactivityY(1);
    adxl.setInactivityZ(1);

    //look of tap movement on this axes - 1 == on; 0 == off
    adxl.setTapDetectionOnX(0);
    adxl.setTapDetectionOnY(0);
    adxl.setTapDetectionOnZ(1);

    //set values for what is a tap, and what is a double tap (0-255)
    adxl.setTapThreshold(50); //62.5mg per increment
    adxl.setTapDuration(15); //625us per increment
    adxl.setDoubleTapLatency(80); //1.25ms per increment
    adxl.setDoubleTapWindow(200); //1.25ms per increment

    //set values for what is considered freefall (0-255)
    adxl.setFreeFallThreshold(7); //(5 - 9) recommended - 62.5mg per increment
    adxl.setFreeFallDuration(45); //(20 - 70) recommended - 5ms per increment

    //setting all interrupts to take place on int pin 1
    //I had issues with int pin 2, was unable to reset it
    adxl.setInterruptMapping(ADXL345_INT_SINGLE_TAP_BIT,   ADXL345_INT1_PIN);
    adxl.setInterruptMapping(ADXL345_INT_DOUBLE_TAP_BIT,   ADXL345_INT1_PIN);
    adxl.setInterruptMapping(ADXL345_INT_FREE_FALL_BIT,    ADXL345_INT1_PIN);
    adxl.setInterruptMapping(ADXL345_INT_ACTIVITY_BIT,     ADXL345_INT1_PIN);
    adxl.setInterruptMapping(ADXL345_INT_INACTIVITY_BIT,   ADXL345_INT1_PIN);

    //register interrupt actions - 1 == on; 0 == off
    adxl.setInterrupt(ADXL345_INT_SINGLE_TAP_BIT, 1);
    adxl.setInterrupt(ADXL345_INT_DOUBLE_TAP_BIT, 1);
    adxl.setInterrupt(ADXL345_INT_FREE_FALL_BIT,  1);
    adxl.setInterrupt(ADXL345_INT_ACTIVITY_BIT,   1);
    adxl.setInterrupt(ADXL345_INT_INACTIVITY_BIT, 1);
}

void loop() {

    //Boring accelerometer stuff
    int x, y, z;
    adxl.readXYZ(&x, &y, &z); //read the accelerometer values and store them in variables  x,y,z
    // Output x,y,z values
    SerialUSB.print("values of X , Y , Z: ");
    SerialUSB.print(x);
    SerialUSB.print(" , ");
    SerialUSB.print(y);
    SerialUSB.print(" , ");
    SerialUSB.println(z);

    double xyz[3];
    double ax, ay, az;
    adxl.getAcceleration(xyz);
    ax = xyz[0];
    ay = xyz[1];
    az = xyz[2];
    SerialUSB.print("X=");
    SerialUSB.print(ax);
    SerialUSB.println(" g");
    SerialUSB.print("Y=");
    SerialUSB.print(ay);
    SerialUSB.println(" g");
    SerialUSB.print("Z=");
    SerialUSB.print(az);
    SerialUSB.println(" g");
    SerialUSB.println("**********************");
    delay(500);

}
1 Like

Did you actually try it?

It still puts out zero’s

Dan

Where is your ADXL connected? You can take a picture and show it to me. I’ll test it for you using the same splice you did. @darbeau