Unresponsive OLED and dust sensor...Leonardo, Grove sheild Basic

Hey everyone, first post and I read all the guidelines and summoned my very best Google-Fu before posting here.

I am using the first incarnation of the Grove basic Shield with same companies dust sensor and 96x96 Oled display plugged into an Arduino Leonardo being powered by only USB. On both windows(7 64-bit) and Linux (Ubuntu 12.04 netbook) it is being recognized by the appropriate ports and the sketches are uploading without drama but I am getting no returns. Oled shows no sign of life and the sensor (both are using supplied sample code for testing purposes) is returning back to the port at the programmed intervals but the values are ..nothing. When I bought the components last week I hadn't realized there are much newer versions of this, what I am assuming is getting in the way, shield.

I was pretty tender with these things when they showed up but I can't rule out the possibility of having fried then OOTB. Pretty posative the Leonardo is functioning as it should but I can't speak for the rest.

Any help with even just verifying the functionality/compatibility of these components would be greatly appreciated.

and yes, I checked to make sure the pins and their receptacles have the same assignments....I think....

Thanks in advance!

~Just a baby CS major

Hi, as you know the Leonardo has some differences in pin assignments (taking the Uno as the reference board). The most apparent is that TX/RX are not connected to Usb. I don't know the shield, but if it sends some output on TX and the sketches listen to Serial they will never get output (the sketches should use Serial1 to talk to Leonardo's RX/TX).

I believe there are other differences in the mapping of analog pins, which may translate into different values for register bits. If the sketches don't just use high-level functions such as analogRead() but set register bits they may not work as expected. And now, having read the guidelines, you know that you should link the schematics of your shield and post/attach your code.

By the way, can you provide pointers to the dust sensor? I'm pretty interested in it and would like to know more.

ooops!

Shield wiki http://www.seeedstudio.com/wiki/index.php?title=Stem_-_Base_Shield#Introduction

OLED wiki [urk]http://www.seeedstudio.com/wiki/Grove_-_OLED_Display_96*96[/url]

Grove dust sensor http://www.epictinker.com/Grove-Dust-Sensor-p/sen12291p.htm

Code I am using is copied from the wikis of their respective components… apologies for the rookie mistakes

Also HUGE Apologies I cannot for the life of me find where I got the diagnostic code from…as much as I hate to paste…I will remove this if it considered poor form but I will cite the source when I can find it

(code in following post)

This script returns the following from the serial watcher
Port U6/U7 @ LOW U6/U7 @ HIGH inpPin Pin(LOW/HIGH)
02 1137 / 1113 1201 / 1196 03 0 / 0 Port test failed
03 1015 / 1020 1201 / 1147 04 0 / 0 Port test failed
04 0000 / 1196 4995 / 3691 05 0 / 1 Port test OK!
05 0805 / 0825 1035 / 1108 06 0 / 0 Port test failed
06 1196 / 0000 3657 / 4995 07 0 / 0 Port test failed
07 0444 / 0380 0688 / 0571 08 0 / 0 Port test failed
08 0463 / 0424 0610 / 0600 09 0 / 1 Port test OK!
09 0463 / 0439 0537 / 0527 10 0 / 1 Port test OK!
10 0478 / 0463 0546 / 0532 11 0 / 0 Port test failed
11 0493 / 0483 0556 / 0541 12 0 / 0 Port test failed
12 0415 / 0439 0781 / 0732 14 0 / 0 Port test failed
14 0502 / 0488 0537 / 0522 15 1 / 1 Port test failed
15 0532 / 0512 0561 / 0546 16 0 / 0 Port test failed
16 0532 / 0517 0561 / 0546 17 1 / 1 Port test failed
17 0537 / 0517 0581 / 0566 18 0 / 0 Port test failed
18 0551 / 0541 0600 / 0581 19 0 / 0 Port test failed
19 0561 / 0546 0600 / 0585 02 0 / 0 Port test failed

The code was experimental and this is my first shot with these systems which is why I tried to start with as modular a architecture as possible.

Hoping this does not mean board is DOA

Thanks for the reply!

UPDATE

source is from http://arduino.cc/forum/index.php/topic,27533.0.html

Thanks spatula!

/*
  Arduino inputs-outputs test
  Analog and digital pins are tested as digital i/o ports. Exceptions: 
  a) pins D0 and D1 are regarded as tested if USB-channel works well. 
  b) analog inputs A6 and A7 are tested in analoge mode
  
  The circuit:
  All Arduino pins D2...D12 and A0...A7 are connected to a common
  point via small resistors (200 Ohm).
  Ports' numbers are regarded as Arduino pins: D2...D12 are Ports 2...12
  D13 is tested visually with BLINK), then A0...A5 are Ports 14...19
  
  Idea: Each port pin (in sequence) is configured as output while 
  all other pins are inputs (without pullup resistors). The TESTED pin 
  sets HIGH and LOW levels and ATmega168 measures the voltage via A6 
  and A7 ADC channels. Then the pin is read via the next digital input.
  
  Operator can observe the results of complete test (a table is printed, 
  2 seconds are waited an the allports test is repeated) or he can give
  commands:
  s - toggles STEP mode. In the mode onle ome Port is tested and only in
  one level (initially HIGH). The result is printed and the test is repeated.
  When operator gives a SPACE command, the level is set to LOW and next
  SPACE increases the port number (level HIGH). So operator can test all 
  ports at both levels.
  The "b" command skips to the first Potr (number 2).
  The "q" command stops the program. 
*/

#define VERSION 1

#define SHORT_TICK 50
#define LONG_TICK 2000
#define smillis() ((long)millis())

#define TESTED port[OutIndx]
#define READ port[InpIndx]

typedef enum TEST_PHASE { RUN, DIGITAL_HIGH, DIGITAL_LOW} phases; 

const int port[] =     // All ports that are to be tested
// 0 1 2 3 4 5 6 7 8  9  10        11 12 13 14 15 16     it is "Indx"
 { 2,3,4,5,6,7,8,9,10,11,12,/*13,*/14,15,16,17,18,19};
//D2D3D4D5D6D7D8D9D10D11D12   D13  A0 A1 A2 A3 A4 A5
const byte portsNmb = sizeof(port)/2;

  byte Return[ portsNmb][2];    // for accumulating the result of test
  int InpIndx, OutIndx, i, j;
  int inpHiLevel[ portsNmb][2], inpLoLevel[ portsNmb][2];
  char s[80], Char;
  long StopTime, Millis, TickDuration;
  phases Phase = RUN;
 
void setup()
{
  for( InpIndx = 0; InpIndx < portsNmb-1; InpIndx++) 
  {
    pinMode( READ, INPUT);
    digitalWrite( READ, LOW);
  }
  Serial.begin(9600);
  Serial.println( " ");
  Serial.print( "Arduino Nano ports test.       version: ");
  Serial.println(VERSION);  
  Serial.println( "DrVlas, 2010");
  Serial.println( " ");
  OutIndx = 0;  
  TickDuration = SHORT_TICK;
}
/********************************************* L O O P *************************/
void loop()
{
/************************************** Timeout 1 ******************************/  
  Millis = smillis();
  if( Millis - StopTime > 0)
  {
//    Serial.print(StopTime); Serial.print( " "); Serial.println( Millis);
    StopTime = (Millis / TickDuration + 1) * TickDuration;
    pinMode( 13, OUTPUT);            // BLINK output is not tested as others
    digitalWrite( 13, HIGH);
    
 /******************************* Get command and parse it ************/    
    if( Serial.available() > 0)
    {
      Char = Serial.read();
      switch( Char)
      {
        case 'b':          // BEGIN command
        case 'B':
          OutIndx = 0;
          break;
        case 's':          // STEP toggle command
        case 'S':
          if( Phase == RUN)
          {
            Phase = DIGITAL_HIGH;      // Set STEP mode
            TickDuration = LONG_TICK;
          }
          else 
          {
            Phase = RUN;
            TickDuration = SHORT_TICK;
          }
          break;
        case ' ':          // Next port command
          switch( Phase)
          {
            case DIGITAL_HIGH: Phase = DIGITAL_LOW;  break;
            case DIGITAL_LOW: 
              pinMode( TESTED, INPUT);
              digitalWrite( TESTED, LOW);        
              if( ++OutIndx >= portsNmb) { OutIndx = 0; }
              Phase = DIGITAL_HIGH;  
          } 
          break;
        case 'q':
        case 'Q':
          Serial.println( " ");
          Serial.println( "Thanks for using the program!"); 
          Serial.println( " "); 
          while(1) ;
      }
    }    
    pinMode( 13, INPUT); 
    digitalWrite( 13, LOW);        // High impedance state of the pin
    
/******************************* Output and Input ********************/    
    pinMode( TESTED, OUTPUT);
    if( (Phase == DIGITAL_HIGH) || (Phase == RUN))
    {
      digitalWrite( TESTED, HIGH);
      InpIndx = OutIndx + 1;
      if( InpIndx >= portsNmb) InpIndx = 0;      
      inpHiLevel[OutIndx][0] = map( analogRead(6), 0, 1024, 0, 5000);
      inpHiLevel[OutIndx][1] = map( analogRead(7), 0, 1024, 0, 5000);
      Return[InpIndx][1] = digitalRead( READ);
    }

    if( (Phase == DIGITAL_LOW) || (Phase == RUN))
    {
      digitalWrite( TESTED, LOW);
      inpLoLevel[OutIndx][0] = map( analogRead(6), 0, 1024, 0, 5000);
      inpLoLevel[OutIndx][1] = map( analogRead(7), 0, 1024, 0, 5000);
      Return[InpIndx][0] = digitalRead( READ);
    }

    if( Phase == RUN)
    {
      pinMode( TESTED, INPUT);
      digitalWrite( TESTED, LOW);        
      if( ++OutIndx >= portsNmb) { OutIndx = 0; }
    }
    pinMode( 13, OUTPUT);   
    digitalWrite( 13, LOW);
    
/******************************* Print results of test ******/     
    switch( Phase) 
    {
      case RUN:
        if( OutIndx == 0) 
        {
          Serial.println( "Port    U6/U7 @ LOW    U6/U7 @ HIGH  inpPin  Pin(LOW/HIGH)");
          for( i = 0; i <= portsNmb-1; i++)
          {
            j = (i+1==portsNmb? 0:i+1);
            sprintf( s, " %02d     %04d / %04d     %04d / %04d    %02d       %d / %d", 
            port[i], inpLoLevel[i][0], inpLoLevel[i][1], inpHiLevel[i][0], inpHiLevel[i][1],
            port[j], Return[j][0], Return[j][1]);
            Serial.print( s);  
            if( Return[j][1] && (!Return[j][0])) Serial.println( "    Port test OK!");
            else                                 Serial.println( "    Port test failed");
          }
          StopTime += (2*LONG_TICK);
        }
        break;
      case DIGITAL_HIGH:
        i = OutIndx;
        j = (i+1==portsNmb? 0:i+1);
        sprintf( s, "Port %02d HIGH    %04d / %04d    %02d       %d", 
        port[i], inpHiLevel[i][0], inpHiLevel[i][1], port[j], Return[j][1]);
        Serial.print( s);  
        if( Return[j][1]) Serial.println( "    Port test OK!");
        else              Serial.println( "    Port test failed");
        break;
      case DIGITAL_LOW:
        i = OutIndx;
        j = (i+1==portsNmb? 0:i+1);
        sprintf( s, "Port %02d LOW     %04d / %04d    %02d       %d", 
        port[i], inpLoLevel[i][0], inpLoLevel[i][1], port[j], Return[j][0]);
        Serial.print( s);  
        if( !Return[j][0]) Serial.println( "    Port test OK!");
        else               Serial.println( "    Port test failed");
        break;
      default: Serial.println( "Error in CASE");  
    }    // End of PRINT section
  }             // End of Timer1 handling
}                        // End of loop()

About the test code (here I guess is the source: http://arduino.cc/forum/index.php?topic=27533.0), did you really connect all those resistors? I didn't, so I got some random results with most failures and a few successes, not unlike yours. But honestly I wouldn't start my diagnosis from the pins.

Trying to address one problem at a time, what happens with the example dust sensor without the display attached? You should start from an empty board+shield, connect the sensor's adapter to the shield's D8 and upload the example sketch: opening the serial monitor (have you set the baud rate at 9600?), what are the results?

The OLED uses I2C. Make sure your connections are going to the "new"I2C header pins and not the transitional A4 and A5. Those won't work on the Leonardo. The grove base shield does not appear to have this provision.

0,0.00,0.62 0,0.00,0.62 0,0.00,0.62 0,0.00,0.62

is all I've been getting :( and it is plugged into D8 OLED still shows no sign of life and is wired to the IIC

Also I am using the Grove wire bundles made to work with these components.

Sorry for the Ignorance, am working on the for a C/c++ project and am not as framiliar with the harware as maybe I should be.

As I said, if you are plugging into the port marked "I2C" ( never heard of IIC) on the grove shield, it will not provide the proper connection.

The grove shield was designed expecting I2C to be on A4 and A5. That is not the case for the Leonardo.

Ok thanks James, after educating myself a little I'm now noticing the SCL and SDA pins, like you said don't transfer from the Leonardo to the Grove basic.

Am i going to need resistors to connect The OLED to the board? Is this even a good idea with the shield in place? Can I just strip the wire and go for it? Can I split the difference and pull the ground and voltage off of the shield and communicate directly with the controller?

Pretty sure I can guess the answers to moost of those questions but I'm holding out on the possibility the last option may be plausible.

I will test the other components at school tomorrow on an older incarnation of the Arduino.

The simplest thing might be to get a Uno.

Alright, ran out and grabbed an uno...more suprisingly Radio Shack is still around?!?!

9600baud and dust sensor picks up nothing

OLED still comatose

sad face..

Update OLED LIVES***

My teeth are worn down to nubs but it all works! Thanks everyone!

Did you have to gnaw them? Anyway, glad to know :), and thanks for sharing the dust sensor info.

Solistice: My teeth are worn down to nubs but it all works! Thanks everyone!

What did you do to make them work?

spatula:
Did you have to gnaw them? Anyway, glad to know :), and thanks for sharing the dust sensor info.

Hi, please tell us how you was able to deal with this sensor?
I receiving 0,0.00,0.62 from this sensor the most of the time on three different boards (UnoR3, Duemilanove and Nano)…
Tried to add some “debugging” info and see most of the time there are no impulses…

starttime = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
dur = 0 / sum_before = 0 / sum_after = 0
0,0.00,0.62

Without “debug” now just receiving data below and thinking it’s more likely some terminal issues (no idea…):
0,0.00,0.62
0,0.00,0.62
591058,1.97,1018.78
118171,0.39,204.93
404652,1.35,697.80
470674,1.57,811.35
259382,0.86,448.09
97274,0.32,168.87
6109,0.02,11.21
0,0.00,0.62
605301,2.02,1043.37
0,0.00,0.62
85862,0.29,149.16
409487,1.36,706.12
140048,0.47,242.65