Sodaq SARA and GROVE sensor compatibility

N00b question over here!

I’m working with the new Sodaq SARA for a school project. The SARA is really cool, but I’m a bit confused about the GROVE sensor ports. Are they only digital, or only analog, or do I need to code something special to use one sensor or another?

I have a sound sensor and a dust sensor over here.
Sound: wiki.seeedstudio.com/Grove-Sound_Sensor/
Dust: wiki.seeedstudio.com/Grove-Dust_Sensor/

When I connect the sound sensor to the right-hand Grove port and use the most basic code provided by Seedstudio (only changed the pin to A7, and replace Serial with SerialUSB) - it seems to work: the numbers are higher when there is sound in the testing room. Awesome!

But now I’m connecting the dust sensor to the same port, and also using the most basic code from Seedstudio. Changed the pin to A7 and replaced Serial with SerialUSB. That does not work: the result is always 0. Just like when you don’t connect any sensor at all.

The dust sensor does work. When i’m manually connecting the black Grove-cable to GND, the red one to 5V and the yellow one to D8 on the SARA, I do get values.

  • But why doesn’t it work on the default Grove-ports?

I think it has something to do with analog/digital. Can I configure the Grove-ports on the SARA for this? Or are they analog/digital only?

Bonus question: let’s say I want to add 3 Grove sensors.

Hi Richh94,

One grove sensor is an I2c grove connector, the other a combined analog and digital connector.
See here:

As for the extension board, the i2c hub makes no sense if you’re not going to use i2c devices.
The base shield you selected will suffice :slight_smile: .

As to why the dust sensor does not work when you select A7, I can’t really tell as I can’t seem to reproduce your error.
I can read digital values fine with A7.
Could you include a picture and the code?

Regards

1 Like

Thank you Thom! You’re really helping me here!
Don’t know why, but i thought the left-hand Grove port (top one on your image) would be A6 and the right-hand one (bottom one on the image) A7 :stuck_out_tongue: Stupid of me but I warned you that I’m a n00b haha :slight_smile:

But now I understand: you can use the lower Grove-port for analog and digital sensors, and the upper one for I2C devices (the hub is also only for I2C) :slight_smile:
If I want more analog or digital Grove sensors, I need to add the Grove shield.

For the dust sensor, the sensor is connected to the right Grove connector. I’m using this code, copied from http://wiki.seeedstudio.com/Grove-Dust_Sensor/:

#define dustPin A7
unsigned long duration;
unsigned long starttime;
unsigned long sampletime_ms = 30000;//sampe 30s ;
unsigned long lowpulseoccupancy = 0;
float ratio = 0;
float concentration = 0;

void setup() 
{
    SerialUSB.begin(9600);
    pinMode(dustPin,INPUT);
    starttime = millis();//get the current time;
}

void loop() 
{
    duration = pulseIn(dustPin, LOW);
    lowpulseoccupancy = lowpulseoccupancy+duration;

    if ((millis()-starttime) > sampletime_ms)//if the sample time == 30s
    {
        ratio = lowpulseoccupancy/(sampletime_ms*10.0);  // Integer percentage 0=>100
        concentration = 1.1*pow(ratio,3)-3.8*pow(ratio,2)+520*ratio+0.62; // using spec sheet curve
        SerialUSB.print(lowpulseoccupancy);
        SerialUSB.print(", ");
        SerialUSB.print(ratio);
        SerialUSB.print(", ");
        SerialUSB.println(concentration);
        lowpulseoccupancy = 0;
        starttime = millis();
    }
}

I also tried

#define dustPin A6
#define dustPin 6 
#define dustPin 7

The output is always

0, 0.00, 0,62

It does work when I connect black to GND, red to 5V and yellow to D8, and change dustPin to 8.

Hi Richh94,

Pin 6 and 7 are wholly different pins and on the other side of the board, these will return gibberish.
Pin A6 is not connected on the grove connector of the dust sensor.

Could you try 15?

Regards

1 Like

Pin 15 also gives me zero’s… so that does not work.

Why pin 15, if I may ask?
I tried the sound sensor (that uses AnalogRead) on A7 and that works ok.

Do you have other tips, or other pins which i could use?

Hi Ricch94,

I just took a look at the specs and I just noticed your problem, you’re trying to attach a 5V device to a 3.3V board.
Try connecting 5V, GND and A7 and see what happens.

Pin 15 is somewhat similar to A7, see variant.h. If you’re interested.

Regards.

So the Grove port outputs 3,3v only?

If that’s the case, how can someone use 5v and 3,3v sensors at once when using the Grove shield mentioned above? Is that not possible or do you need two shields?

But long story short: it’s not possible to use the 5v dust sensor with the built-in Grove port if I understand you correctly, because the Grove sensorport is 3,3v only.

The only way to make it work is to hard wire it yourself:

  • If I connect 5V and GND and read pin 8, it works.
  • If I connect 5V and GND and hold the yellow wire to the correct Grove-pin, and read pin A7, I still get 0,00 :stuck_out_tongue_winking_eye:

Can you explain me why?

Hi Ricch94,

Yes, what you’re saying is correct.
Please upload the following code and connect a cable to A7 and tap the GND/VCC.
Do you see any non 0 values?

/*
 Name:		GroveTester.ino
 Created:	5/2/2018 3:44:39 PM
 Author:	Thom
*/
#define dustPin 15
void setup()
{
	SerialUSB.begin( 115200 );
	pinMode( dustPin, INPUT_PULLUP );
}
void loop()
{
	uint32_t duration = pulseIn( dustPin, LOW );
	SerialUSB.println( duration );
}

Regards