This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BOOSTXL-SENSHUB: Sesnhub-Boosterpack-read all sensor in one program

Part Number: BOOSTXL-SENSHUB
Other Parts Discussed in Thread: EK-TM4C1294XL

Hi ,

I try to make a program where i have all the sensors of the senshub boosterpack in the terminal. I can't make that the program read all the sensors and send the data on the terminal. anyone can help me with the construction of the program ??.

i take the examples but it doesn't help me to make a newest, i¿m used a tiva c connected launchpad TM4C1294XL

thank you for your help.

  • My friend - you note, "Inability to succeed with ALL Sensors" - but do not note your ability to succeed with ANY Sensors?

    Are you able to make your program read any sensors? If so - is it not best to - "one by one" add sensors - each time testing & verifying that - each newly added sensor - "works" w/your program?

    This systematic - limited to "One at a Time" method is called, "KISS" - and "Speeds, Eases, Enhances" your design efforts. By contrast - attempting to "Do too much - at the same time" almost always - results in failure - thus takes (far) longer - demoralizes - and is exhausting.

    Might you attempt to make ONE Sensor (alone) work w/in your program - and then report?
  • Hi, I'm do the examples of all sensor and it is work perfectly but I need to read the other sensor so you say is most easy to take one by one but what I have to do to see the value of the sensor on the terminal I have to make other program that take that value?!?
  • Is there a particular issue you have run into? I understand that you will have to understand each example well so that you can integrate them into a single example.
  • Hi,

    i understand for read the sensors i need a semaphore in the I2C that says when open and send the value of the sensor after of that it has to be reopened to read other but i don't know how to make it you can help me with this.

    thanks
  • Here is a document that explains I2C operation. http://www.ti.com/lit/an/slva704/slva704.pdf

    Here is how it describes the operation of the master reading a slave.

    There is no need for semaphores, particularly in the case of a single master, which is what you describe.

  • Hi Bob,

    so you say that i want to do is put all the sensors like a global variables and called from other that is correct??

    thanks.
  • No, that is not what I am saying. Perhaps I don't understand your question. You have a sensor hub booster pack ( BOOSTXL-SENSHUB) on an EK-TM4C1294XL Launchpad and you want to read all of the sensors and display the results in a terminal emulator on a PC right?

    There are examples on how to read each sensor in the TivaWare directory: C:\ti\TivaWare_C_Series-2.1.4.178\examples\boards\ek-tm4c1294xl-boostxl-senshub

    Start with one simple example, maybe the humidity sensor. Build that example and get it to work. Next build the pressure transducer example. Now add the function for the pressure transducer (BMP180) to your humidity sensor example.  You need to insert the code to initialize the pressure transducer:

        //
        // Initialize the BMP180.
        //
        BMP180Init(&g_sBMP180Inst, &g_sI2CInst, BMP180_I2C_ADDRESS,
                   BMP180AppCallback, &g_sBMP180Inst);
    
        //
        // Wait for initialization callback to indicate reset request is complete.
        //
        while(g_vui8DataFlag == 0)
        {
            //
            // Wait for I2C transactions to complete.
            //
        }
    

    You will need to insert code to read the pressure and print it:

            BMP180DataPressureGetFloat(&g_sBMP180Inst, &fPressure);
            //
            // Convert the pressure to an integer part and fraction part for
            // easy print.
            //
            i32IntegerPart = (int32_t) fPressure;
            i32FractionPart =(int32_t) (fPressure * 1000.0f);
            i32FractionPart = i32FractionPart - (i32IntegerPart * 1000);
            if(i32FractionPart < 0)
            {
                i32FractionPart *= -1;
            }
    
            //
            // Print Pressure with three digits of decimal precision.
            //
            UARTprintf("Pressure %3d.%03d\t\t", i32IntegerPart, i32FractionPart);
    

    I suggest you keep the functions for each transducer in a separate file and then call the appropriate initialization and read functions from main. You should create header files that prototype your functions. I think this is really more about how to write C code, than the TM4C or the Sensor hub. Perhaps I have missed the point of your difficulties.  

  • Kevin Andrey Delgadillo said:
    I'm do the examples of all sensor and it is work perfectly but I need to read the other sensor

    Believe that (both) vendor here & we outsiders cannot grasp your (real) need due to the CONFLICT in meaning your (quoted sentence) above presents.

    • You note first that, "All sensors - work perfectly" do you not?    
    • And then you introduce "the other sensor" - which you (also) need to read!      And we are told (nothing) about that (other) sensor!

    Is that "other sensor" included within your earlier note of "ALL Sensors?"    Or - is it completely new & different - and NOT part of "All Sensors?"

    You may need to spend more time in (more) carefully describing your requirement - it is (still) unclear - despite your multiple posts...   I've tried to outline the difficulty we have with your description.