Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

I do not have any reedings in RUN MODE from MPU6050........

kalmeyer
2020-07-27
2024-03-29
  • kalmeyer - 2020-07-27

    Hello everyone!
    I am using Codesys ver 3,5 on Raspberry Pi and I want to use a Gyro MPU6050
    I have installed Gyro MPU6050 from "I2C masters" (it is there as default)
    But I do not have any reedings in RUN MODE
    Must I install a library?
    What am I missing?

    I would be very glad if you have any advices on how to proceed?
    Thank you everyone for your help!

     
  • i-campbell

    i-campbell - 2020-07-27

    Do you have 'always update variables' set to disabled?

    If so, you need to use the variables in code before they will be updated.

     
  • kalmeyer - 2020-07-28

    Thanks for reply.......
    Do you think I should make this setting in: codesys or in Raspberry?
    In fact, I do not know what you mean when you write: use variables in code before update.
    Do you know codesys?
    Hope you can answer me again
    / Klaus

     
  • kalmeyer - 2020-07-30

    Hi Cambell
    I'm trying to understand what you're advising me to do and maybe I'm just not good enough.
    When I stand on the MPU6050 and right click - Edit I / O I do not have the image you sent me .......
    Can you help me further?
    I am very grateful for your answers and I hope I solve the problem so I can move forward with my task.
    / Klaus

     
    • Morberis

      Morberis - 2020-07-31

      Always update variables is available if you go to the device tree and look under PLC Settings under the device.

      For what @icampbell is talking about the variables won't be refreshed unless they're used somewhere in your code. Like an input variables POU. For instance if I'm connected up to 1 of my PLC cards and I'm looking the variables like %IX4.4 won't change unless %IX4.4 or a variable I've mapped it to is being read in a POU. That POU also has to be configured in Task Configuration and running. Basically if a devices variables aren't being used in your code it won't be updated. Sorry icampbell I've mostly repeated what you said.

      Here is the help file page on it.

       

      Last edit: Morberis 2020-07-31
  • i-campbell

    i-campbell - 2020-08-03

    Hello kalmeyer. I was telling you something wrong, the Gyro MPU6050 driver is built slightly different to other drivers.

    Make sure the address is correct in Gyro_MPU6050 > IΒ²C-Bus Parameters > IΒ²C address

    Access the variables in your code using: Gyro_MPU6050.lrAX, Gyro_MPU6050.lrGX etc.

     
  • kalmeyer - 2020-08-04

    Hello everyone
    Thank you very much for your answer.
    The problem is solved when I had bought an MPU6050 that was faulty.
    I activated the GYRO MPU6050 directly from CoDeSys and I got reedings immediately in RUN MODE.
    Thank you very much for the help ....

     
    • mecke96 - 2023-03-03

      I have some issues with my MPU6050 and RaspberryPi 4. I tested it on an arduino and it worked there but is was "slow" on inputs, Maybe just a bad example code i run.

      I have added the Device and Lib. But i get no readings like you. Is there anything i miss here or might it be that mine is broken to?

       
  • mecke96 - 2023-03-11

    Got me another MPU6050. But had the same issue. But i noticed a strange thing. If i run a .py script on the R-Pi, and then open Codesys i get readings, But they are not stable. If i Reboot the R-pi and dont run the .py script i dont get any readings again. Why do i have to run a .py script to get the readings in Codesys?

     
  • mimodia1 - 2024-03-29

    Good morning, mecke96. Exactly the same thing happens to me, although I have not done the part of executing a .py file. It only reads the temperature and the counter, but the other values are zero as in your image "no readings". I have tested the MPU6050 device on an Arduino and it works. Could you tell me if you solved it?

     

    Last edit: mimodia1 2024-03-29

Log in to post a comment.