Jrk G2 21v3 I2C communication problem

Hello
I set up the motor and feedback using Pololu software and it works without any problem, but when I tried to read feedback and send target using Arduino and recommended library it doesn’t work properly.
for feed back it returns 0 or sometimes 65535.
for sending target motor won’t move.
Is someone used Arduino library with Jrk G2 21v3 ?

Hello.

I moved your post to the “Motor controllers/drivers and motors” section of the forum since it seemed more appropriate.

Could you post more details about your setup? What Arduino are you using and which example are you running? Could you post pictures that show all of your connections? Also, can you post your Jrk G2 settings file? You can save your settings file by selecting the “Save settings file…” option within the “File” drop-down menu in the Jrk G2 Configuration Utility.

Brandon

Hi BrandonM,
Thanks for answer. As I mentioned before the driver works perfectly with motor using USB, I almost tuned PID and it works fine
I wanted to send command using microcontroller but it failed.
I’m using ESP8266(NodeMcu) I’m using the same controller in another project to drive servo motors using I2C and PCA9685 without any problem.
Enclosed you can find the setting file.

jrk_settings.txt (2.0 KB)

BR
Reza

I forgot to say that which example I’m using the one you recommended in your website :

no one here to solve the problem ?

Thank you for the additional information.

Which of the examples are you running (there are 4 of them that come with that library), and have you modified them in any way? Do you have a scope or analyzer you can use to look at the signals? Also, I would still be interested in seeing pictures of your setup that show all of your connections.

Brandon

Hi BrandonM,
I’m using I2CGetFeedaback to read feedback(potentiometer) from Jrk and also tried I2CSetTarget to send setpoint to jrk.
I haven’t midified examples. I don’t have any scope or analyzer.
What I did, I downloaded I2c scanner sketch on my microcontroller and it found the device in address 11(0x0B) which shows that harware is correct.
Have you tried these examples with this hardware ? I wanted to order more Jrk for my project but if doesn’t work with I2C it will be useless.
Please find attach.

Thanks for posting the pictures and additional information. We have not specifically tested the Jrk G2 Arduino library on an ESP8266. I suspect you might be running into a bug in the ESP8266 Wire library. As discussed in this post by Kevin, it does not do a repeated start correctly when clock stretching is being done.

Similarly to the workaround Kevin mentions, you could try editing your JrkG2 library by searching for instances of:

Wire.endTransmission(false);

in JrkG2.cpp and replacing them with:

Wire.endTransmission();

Brandon

Hello
I was busy and couldn’t work on my project.
I found that I need voltage level shifter in order to connect ESP8266(3.3 v) to Jrk21v3(5V), after using level shifter for SDA and SCL signals, the motor rotate as program commands but after a while stops working, I also connected reset pin of ESP8266 to RST pin of Jrk21v3 everytime I push the reset button it starts again but it works for different duration everytime.
I also changed " Wire.endTransmission(false); " in JrkG2.cpp but it didn’t help.
Any other suggestion?

Can you double check that you changed all instances of Wire.endTransmission(false); in JrkG2.cpp to Wire.endTransmission();? There should be 3 instances in total.

What happens when it stops working? Do you get a red LED on the Jrk (indicating an error)? If so, can you connect the Jrk to your computer via USB and check the Jrk G2 Configuration Utility to see which error is being reported?

Can you post updated pictures (with your level shifter) that show all of your connections? Also, what are you using as a power supply?

Brandon

Hi BrandonM,
I tired my Jrk g2 with arduino Leonardo using I2C without any problem but I found the communication speed is not enough, I’m thinking to use a faster way to control 8 motors, I started testing analog input as command, I’m thinking to to have D/A and send analog commands to Jrk g2, but when I tested it, the PID didn’t work properly, it was like On/Off control, when was more than feedback it sent full output to motor and when the set point was less than feedback it sent full out put in opposite direction.
I had no problem with PID in I2C mode.
The question is, wis Jrk G2 21V3 PID controller works over analog command as well ?
I will check also the previous problem I had and I will come back to you, maybe it can help someone else.

BR
Reza

Hello.

Could you tell me more about what you are doing and why you think I2C is not fast enough?

Yes, the Jrk G2 controllers can accept an analog voltage as an input to control a motor. You can find more information about configuring the Jrk G2 for this input method in the “Setting up analog control” section of the Jrk G2 controller user’s guide. Using analog input should not change your PID or feedback settings; it only changes how you are commanding your set target.

Brandon

Hello,
It is a four legs robot, but since I want to have natural movement in the legs I wrote the program in this :
There are 4 for(i=0;i<500;i++) loop for each leg
They are moving each leg to the desire position,
Which happens by adding i value to the current position, means that in every cycle the legs are moving Only one step but when this happens fast it would be natural movement.
When I did the same thing using Jek G2 and arduino leonardo the movement was not fast enough, I’m guessing because of slower microcontroller and slower communication.

It is not clear to me from your description that the problem you described was due to communication speed. I suspect it could have more to do with the structure of your code. How you tried to quantify how much time your loop is taking compared to how short it would need to be to have the natural look you want? Also, how were you controlling the legs before switching to the Jrk G2 and Arduino setup?

Brandon