Encoder count via serial
6 years 1 month ago #29532780
by giantpt
Encoder count via serial was created by giantpt
Hello,
I am doing a project where I'll have to control 2 roboteq controllers with an Arduino board, the arduino will have to get the encoder counts from both controllers in order to sync them according to the counts.
My question is if the counts over serial are in real time and reliable enough for the aduino to have a nice sync during operation.
I think that it is important to mention that when I say sync, it is not a real sync, I mean, one roboteq has to increase or decrease rpm to aquire a certain encoder count according to the count of the other controller. In a certain moment controller A has to have a certain speed and position and the B has to have another completely different.
I know that it might be a bit confusing but I can't reveal the exact project "secrets" for now, I just need to know how fast and reliable the encoder signal is over serial to be read by the arduino.
Thank.
Kind regards
I am doing a project where I'll have to control 2 roboteq controllers with an Arduino board, the arduino will have to get the encoder counts from both controllers in order to sync them according to the counts.
My question is if the counts over serial are in real time and reliable enough for the aduino to have a nice sync during operation.
I think that it is important to mention that when I say sync, it is not a real sync, I mean, one roboteq has to increase or decrease rpm to aquire a certain encoder count according to the count of the other controller. In a certain moment controller A has to have a certain speed and position and the B has to have another completely different.
I know that it might be a bit confusing but I can't reveal the exact project "secrets" for now, I just need to know how fast and reliable the encoder signal is over serial to be read by the arduino.
Thank.
Kind regards
Please Log in or Create an account to join the conversation.
6 years 1 month ago #29532781
by blake
Replied by blake on topic Encoder count via serial
Yes the encoder data is transmitted over serial in real time. You should get accurate sync with very minimal lag
Please Log in or Create an account to join the conversation.
6 years 1 month ago #29532782
by giantpt
Replied by giantpt on topic Encoder count via serial
Hi Blake,
That's great news!!!!
Tell me one more thing, which is the best way to operate? Write a script inside the controller to send the encoder count over serial or being the arduino to request it all the time?
Cheers
That's great news!!!!
Tell me one more thing, which is the best way to operate? Write a script inside the controller to send the encoder count over serial or being the arduino to request it all the time?
Cheers
Please Log in or Create an account to join the conversation.
6 years 1 month ago #29532783
by blake
Replied by blake on topic Encoder count via serial
We do not work with controls via Arduino first hand very often so I cannot tell you which option would be better. I do know that other customers have used both methods but I do not know which has been found to be the easiest method.
One note, if you don't know already, is that our controllers use RS232 serial protocol while Arduino uses TTL. You will need to use an RS232 - TTL Adapter in order for them to be able to communicate with one another.
One note, if you don't know already, is that our controllers use RS232 serial protocol while Arduino uses TTL. You will need to use an RS232 - TTL Adapter in order for them to be able to communicate with one another.
Please Log in or Create an account to join the conversation.
6 years 1 month ago #29532794
by giantpt
Replied by giantpt on topic Encoder count via serial
Hi Blake,
I am used to connect arduinos to roboteqs since 2011 but only for simple commands.
I think I will try to put the roboteq to constantly send the counts over serial, can you advise me about the best script on the controller side to use for that?
I guess thats the most reliable way to do it instead of having the arduino to request it all the time X times per second.
Thank you
Regards
I am used to connect arduinos to roboteqs since 2011 but only for simple commands.
I think I will try to put the roboteq to constantly send the counts over serial, can you advise me about the best script on the controller side to use for that?
I guess thats the most reliable way to do it instead of having the arduino to request it all the time X times per second.
Thank you
Regards
Please Log in or Create an account to join the conversation.
6 years 1 month ago #29532795
by blake
Replied by blake on topic Encoder count via serial
You would simply need to use the MicroBasic script Print() function to output the encoder data on the serial bus.
For example:
Finally, you'll want to be sure that your print output port is set to "Serial" and not "USB". This is done using the SCRO command (page 280 of our user manual)
Scripting needing on the Arduino side to capture serial data I do not know.
For example:
Encoder_count = getvalue(_C, 1) 'reads encoder 1 counts, sets to variable "Encoder_count"
Print(Encoder_count, "\r") 'prints the encoder counts.
Finally, you'll want to be sure that your print output port is set to "Serial" and not "USB". This is done using the SCRO command (page 280 of our user manual)
Scripting needing on the Arduino side to capture serial data I do not know.
Please Log in or Create an account to join the conversation.
6 years 1 month ago #29532796
by giantpt
Replied by giantpt on topic Encoder count via serial
Thank you Blake once again,
Look, I have an old SDC2130 (2012) that I use for my tests before I jump to the big HBL's, now I was reading its data sheet and it says on the pinout board that it has a TTL channel on pins 6 and 7, is this true or do I really have to use the RS232 on pins 2 and 3 as usual with the help of a serial to TTL converter?
Thanks
Look, I have an old SDC2130 (2012) that I use for my tests before I jump to the big HBL's, now I was reading its data sheet and it says on the pinout board that it has a TTL channel on pins 6 and 7, is this true or do I really have to use the RS232 on pins 2 and 3 as usual with the help of a serial to TTL converter?
Thanks
Please Log in or Create an account to join the conversation.
6 years 1 month ago #29532797
by blake
Replied by blake on topic Encoder count via serial
You have an old version of the SDC datasheet, please see the current one
HERE.
Those pins were reserved for TTL at one point but it was never implemented. Pins 6 & 7 are actually now the CANH and CANL pins. You will need an RS232 - TTL adapter.
Those pins were reserved for TTL at one point but it was never implemented. Pins 6 & 7 are actually now the CANH and CANL pins. You will need an RS232 - TTL adapter.
Please Log in or Create an account to join the conversation.
6 years 1 month ago #29532798
by giantpt
Replied by giantpt on topic Encoder count via serial
Hi,
I am using an old datasheet because my SDC2130 is also old (SN R0159). It was electronically updated by Mr. Cosma back in 2011 to work with a new firmware, he replaced one component on the board.
Cheers
I am using an old datasheet because my SDC2130 is also old (SN R0159). It was electronically updated by Mr. Cosma back in 2011 to work with a new firmware, he replaced one component on the board.
Cheers
Please Log in or Create an account to join the conversation.
6 years 1 month ago #29532799
by giantpt
Replied by giantpt on topic Encoder count via serial
Blake, I have one more question that I think I can include in this topic..
As I said, I'll have 2 HBL's working togheter in a non sync way and bothe controlled by a microcontroller that we can assume as an arduino.. I wonder if it is possible to implement a security feature to this equation... if for any reason one of the controllers stop or stall by an internal problem or even because a serial comunication interruption, I need the other to stop imediately too because it will be really dangerous and can injure people if it doesn't happen.
How can I achieve this?
I thought about having both controller linked to each other by a CAN line only for this function, is this the right way? How?
Thanks
As I said, I'll have 2 HBL's working togheter in a non sync way and bothe controlled by a microcontroller that we can assume as an arduino.. I wonder if it is possible to implement a security feature to this equation... if for any reason one of the controllers stop or stall by an internal problem or even because a serial comunication interruption, I need the other to stop imediately too because it will be really dangerous and can injure people if it doesn't happen.
How can I achieve this?
I thought about having both controller linked to each other by a CAN line only for this function, is this the right way? How?
Thanks
Please Log in or Create an account to join the conversation.
Moderators: tonysantoni
Time to create page: 0.079 seconds