4 Replies Latest reply on Jan 19, 2015 8:57 AM by EduinoPi

    Edison + Arduino Expansion + DFRobot I/O Expansion Shield v7: cannot get readings from Digital pins.

    EduinoPi

      Hi

       

      I am trying to connect various sensors to the IO Expansion shield mounted ontop of the Arduino break-out for Edison.

       

      I am trying to connect the following sensors/components:

       

      1. An I2C 20x4 LCD

      2. HC-SR04 Ultrasonic

      3. DFRobot Temperature and Humidity sesor

      4. Joystick module ( analogue thumbstick )

       

      I have connected them as follow to the IO Expansion board:

       

      1. LCD connected to the I2C connectors on IO Expansion board, and I got this working; ie, I can actually display text to the LCD display.

      2. Ultrasonic sensor: GND,VCC and pins 7 & 8

      3. Temperature & Humidity sensor: GND, VCC and pin 4 (tried 3 as well)

      4. Analogue stick: GND, VCC and pins 13, 12 & 11 for X, Y and Button respectively.

       

      I am not doing anything with the analogue joystick in my code yet, other than registering the pins for input.

       

      What I am getting currently is only output to the LCD screen, but my temp and echo sensors does not "return" anything.

       

      Any suggestions/help?

       

      PS - if anyone can also add suggestions as to reading from the analogue sticks so I can switch display modes; eg, if I press stick in X direction, I only show temp and humidity, Y direction = distance from echo sensor?

      Thanks in advance for any assistance.

        • 1. Re: Edison + Arduino Expansion + DFRobot I/O Expansion Shield v7: cannot get readings from Digital pins.
          EduinoPi

          Oops, forgot to post the code: Disclaimer - the code is not mine, It's mostly from the examples of the various sensors obtained from manufacturers websites.

           

          #include <Wire.h>

          #include <LiquidCrystal_I2C.h>

          #include <dht11.h>

          dht11 DHT;

          #define DHT11_PIN 3

          #define echoPin 8 // Echo Pin

          #define trigPin 7 // Trigger Pin

          #define xPin 13

          #define bPin 12

          #define yPin 11

           

           

          LiquidCrystal_I2C lcd(0x27,20,4);

           

           

          int maximumRange = 600; // Maximum range needed

          int minimumRange = 0; // Minimum range needed

          long duration, distance; // Duration used to calculate distance

           

           

          void setup() {

          Serial.begin (9600);

          pinMode(trigPin, OUTPUT);

          pinMode(echoPin, INPUT);

          pinMode(xPin, INPUT);

          pinMode(bPin, INPUT);

          pinMode(yPin, INPUT);

              lcd.init();

              lcd.backlight();

              lcd.setCursor(0, 0);

              lcd.print("Hum:(%), Temp:(C)");

          }

           

           

          void loop() {

          /* The following trigPin/echoPin cycle is used to determine the

          distance of the nearest object by bouncing soundwaves off of it. */

          digitalWrite(trigPin, LOW);

          delayMicroseconds(2);

           

           

          digitalWrite(trigPin, HIGH);

          delayMicroseconds(10);

           

          digitalWrite(trigPin, LOW);

          duration = pulseIn(echoPin, HIGH);

           

          //Calculate the distance (in cm) based on the speed of sound.

          distance = duration/58.2;

           

          if (distance >= maximumRange || distance <= minimumRange){

          //lcd.print("out of range");

          }

          else {

          lcd.print(distance);

          }

           

          int chk;

            chk = DHT.read(DHT11_PIN);    // READ DATA

            lcd.setCursor(0, 3);

            lcd.print(chk);

            lcd.print(DHT.humidity);

            lcd.println(DHT.temperature);

            delay(1500);

          }

          • 2. Re: Edison + Arduino Expansion + DFRobot I/O Expansion Shield v7: cannot get readings from Digital pins.
            EduinoPi

            I found one problem - the default voltage setting on the DFRobot IO board is set to 3,3v, when changing to 5v, things are starting to look better, BUT, I still cannot get anything from the temp sensor. Distance sensor now works fine, and another sensor ( tilt switch ) also works.

             

            I keep getting a "timeout" error on the temp sensor.

            • 3. Re: Edison + Arduino Expansion + DFRobot I/O Expansion Shield v7: cannot get readings from Digital pins.
              DiegoV_Intel

              Hi EduinoPi,

               

              Unfortunately I don't have the hardware you are using to try to replicate the issue. However, there is a thread regarding the same temperature sensor you are using that you might find interesting: Re: DHT workaround for Galileo and Galileo Gen2 using 2 pins instead of one. The thread is for Galileo so I'm not sure if it will work for Edison in the same way, but you could try it.

               

              For the ultrasonic sensor there is a similar workaround. I know you are not getting issues with it but here is the thread if you want to check it for future references: 3 Pin ultrasonic sensor in galileo. This is a thread for Galileo too, but for this one, I was able to test it using Edison and it worked.

               

              Finally, for the analogue thumbstick, I found this following description on how to set it up: Arduino - JoyStick. I hope you find this guide useful at least as a starting point.

               

              I invite you to post the results of your tests. Go ahead and try the suggestion for the temperature sensor.

               

              Regards,

              Diego.

              • 4. Re: Edison + Arduino Expansion + DFRobot I/O Expansion Shield v7: cannot get readings from Digital pins.
                EduinoPi

                Thanks again - I cannot believe I made the mistake again with trying a 3 pin sensor that uses one pin for both in and out on the Edison.