5 Replies Latest reply on Aug 23, 2017 7:50 AM by Intel Corporation

    Help ME!! AM2315 does not work.(Java UPM Library / Edison for Arduion board)

    dev_kor

      I bought AM2315 but it does not work.

       

      I follow example code

       

      My upm/mraa version

       

      I2C detect bus 6

      Please Help Me......

        • 1. Re: Help ME!! AM2315 does not work.(Java UPM Library / Edison for Arduion board)
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hi dev_kor,

          For this kind of issues with external devices and sensors, I recommend to double check the hardware connections first. How are you connecting the sensor exactly? Most of I2C issues are because of the hardware connection of the power lines or the data lines, so hopefully this is what is happening to you as well.

          You can check the following:

          1. Power supply
          2. Ground connection
          3. Pull up resistors
          It’s hard to provide other suggestions since I don’t have that specific sensor to run tests, but if you can detail how the connections are set, I might be able to help you debugging the issue.

          Have a nice day.

          Regards,
          Diego V.
          • 2. Re: Help ME!! AM2315 does not work.(Java UPM Library / Edison for Arduion board)
            dev_kor

            1. full code

            package iotdk.example;
            
            
            import upm_am2315.AM2315;
            import upm_xbee.XBee;
            
            
            public class SOS_Temp_Humi_AM2315 {
            static {
            try {
            System.loadLibrary("javaupm_am2315");
            System.loadLibrary("mraajava");
            } catch (UnsatisfiedLinkError e) {
            System.err.println(
            "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n"
            + e);
            System.exit(1);
            }
            }
            
            
            static int oneSec = 1000;
            static int halfSec = 500;
            static XBee xbee;
            static String deviceType = "TempHumiDevice";
            static String deviceState = "Nothing";
            
            
            public static void main(String[] args) {
            // Xbee Initialization
            xbee = new XBee(0);
            xbee.setBaudRate(9600);
            
            
            // tempHumi Thread Start
            tempHumi tempHumi_thread = new tempHumi();
            tempHumi_thread.start();
            System.out.println("TempHumi Device Start");
            
            
            // Xbee Massage Run
            while (true) {
            String pubStr = "{\"ctname\":\"" + deviceType + "\",\"con\":\"" + deviceState + "\"}\r\n";
            xbee.writeDataStr(pubStr);
            //System.out.println(pubStr);
            try {
            Thread.sleep(halfSec);
            } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            }
            }
            }
            
            
            static class tempHumi extends Thread {
            public void run() {
            float humidity = 0;
            float temperature = 0;
            
            
            // Instantiate the sensor
            AM2315 sensor = new AM2315(6, upm_am2315.javaupm_am2315Constants.AM2315_I2C_ADDRESS);
            sensor.testSensor();
            
            
            while (true) {
            // retrieving the humidity and temperature values
            humidity = sensor.getHumidity();
            temperature = sensor.getTemperature();
            
            
            System.out.println("Temperature : " + temperature + " Humidity: " + humidity);
            try {
            Thread.sleep(1000);
            } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            System.out.println("The following exception occurred: " + e.getMessage());
            
            }
            }
            }
            }
            }
            

             

            2. Library

            3. AM2315 Interface

            4. Connection

            5. Running

            ...

             

            What is the problem?...

            • 3. Re: Help ME!! AM2315 does not work.(Java UPM Library / Edison for Arduion board)
              Intel Corporation
              This message was posted on behalf of Intel Corporation

              Hi dev_kor,

              Thank you for the information.

              Unfortunately I don’t have the sensor to run tests with my Edison and it’s hard to know what the root cause of the issue is. I don’t think there is any issue with the code because you can run it properly, although the output is not the expected one.

              Instead of running the entire code, I recommend you to focus on the I2C device itself and try to get it recognized by the Edison first. My suggestions would be the following:

              1. Make sure the I2C sensor is effectively powered by the Edison with 5V. Make sure the GND pin is also connected properly.
              2. There are 2 data lines: SDA and SCL. They are labeled in the Arduino Expansion Board with those same names. However, you could also try using the pins A4 and A5 instead, they are internally connected to the I2C lines. This quick test would help you to know if there is some kind of hardware issue with the I2C pins.
              3. Make sure you are using correct pull up resistors. According to the datasheet, the recommended value for the pull up resistors is 4.7k.
              4. The I/O pins on the Arduino Expansion Board can work at 3.3V and 5V. Make sure they are set to work at 5V so the I2C sensor can be interfaced properly with the board.
              Those would be my suggestions. I have seen issues with I2C devices and there are some devices that simply don’t work for some reason. You can search for similar issues in the community to see how other users handled them. For example, in the following thread, it is suggested to check the I/O configuration in order to setup the I2C functionality: https://communities.intel.com/thread/117019

              I hope this helps.

              Regards,
              Diego V.
              • 4. Re: Help ME!! AM2315 does not work.(Java UPM Library / Edison for Arduion board)
                dev_kor

                I solved the problem.

                Am2315 works

                It returns temperature and humidity value only at about 3.5v

                if voltage exceeds about 4v, it retunrs trash value.

                There is no problem in Arduino Uno, but only in Edison.

                • 5. Re: Help ME!! AM2315 does not work.(Java UPM Library / Edison for Arduion board)
                  Intel Corporation
                  This message was posted on behalf of Intel Corporation

                  Hi dev_kor,

                  If that’s the case, you can try to set up the Arduino Expansion Board to work at 3.3V and see if you get better results. Check the following document to know how to set the board to work at 3.3V:  Intel® Edison kit for Arduino – Jumper Headers

                  Regards,
                  Diego V.