## Encoder Reading Error - Negative Values

Added by Ahmet Ethem DANIŞ 5 months ago

Thanks to Waijung2 support team, they let us use those blocksets.

I have a project about steering wheels, so i need to know every parts of reading an encoder.

I have 1024 ppr encoder. ( Omron E6B2-CWZ6C Rotary Encoder 1024 P/R Rpm )

I can read my encoder with "Encoder Read" block but it gives me values between 0-360 degree.

On the other hand, i should read it between -180 to +180. But when i turned my wheel left it started to go down from 360. it does not go down under 0.

Would you please help me on this ?

Thanks.

### Replies (2)

#### RE: Encoder Reading Error - Negative Values - Added by Chandima Jayaneththi (จันทิมา) 5 months ago

Hi Ahmet,

Thank you for your interests in using Waijung.

According to the above description, you have mentioned that you could able to get the encoder readings in terms of angles from 0 to 360 degrees. But your requirement is to get the readings from -180 to +180 degrees. In addition to that you mentioned that if you turns the encoder left it gives the readings from 360 and it goes down to 0 but it doesn't go lower than 0. If we assume that, you can get the readings from 0 to 360 when you turns the encoder right what you need to do is to implement an simulink algorithm to shift the positive range (0 to 360 degrees) to required range (-180 to +180 degrees).

Regards,

Chandima.

#### RE: Encoder Reading Error - Negative Values - Added by Ahmet Ethem DANIŞ 4 months ago

Thanks for your reply,

Actually i was looking forward to learn about that algorithm, also i need to figure that out how to design that algorithm, i shoul also edge it to -180 to +180 and the initial value of the encoder must be 0.

If you can give me an example about the algorithm, it would help me much in this situation.

Regards.

Ahmet Ethem DANIS