Jrk 12v12 Help Needed

I have a jrk 12v12, and all I want to be able to do with it is control the speed and direction of a motor. I don’t have or need feedback.

I needed to do something similar with my micro maestro 6, and it was easy (since that is part of pololu’s USB sdk).

All of this will be controlled from a windows computer via USB. I was able to write a program in C# to control my servos through the micro maestro. Is there some sample code for me to do what I need with the jrk? Or even better, can I control the jrk like a free-spinning servo (controlling speed and direction only) from the maestro?

Any sample code would be nice. I prefer C#, but anything would be helpful.

Thanks!

If you want to control the Jrk from a computer, can put the Jrk in USB Dual Port or USB Chained mode and send serial commands to the Jrk’s Command Port (one of its two virtual COM ports). You can use the Microsoft .NET SerialPort class in your C# program. Serial ports can be less convenient than the native USB interface in several ways, but it would work. We don’t have any sample code for this, but the SerialPort class is easy to figure out and the command protocol is documented in the Jrk User’s Guide.

You could also wait for us to add the Jrk to the Pololu USB SDK (which might be soon now that we know it is needed) and then control it just like you are already controlling the Maestro in your C# program.

Alternatively, the Jrk is made for giant servo-type applications so you can control it from the Micro Maestro Servo Controller. If you put your Jrk in pulse width input mode and connect it’s RX line to one of the Maestro’s signal outputs (and also connect the Jrk’s ground to the Maestro’s ground) then the pulses generated by the Maestro will be measured by the Jrk and interpreted as the input for the system. The feedback mode should be None (speed control mode). You should use input scaling so that the Maestro’s shortest pulse corresponds to full-speed reverse (target=1648) and the Maestro’s longest pulse corresponds to full-speed forward (target=2648). To turn off the motor, you can set the target of the Maestro channel to 0 and the Maestro will stop sending pulses on the line, thus making the Jrk have a “Input Invalid” error.

-David

Thanks!

I saw all those serial command numbers in the guide, but had no idea how to use them. Using the maestro might be easier since I already have a working program for it.

If you can’t tell, I’m new to this whole robotics stuff, but have always wanted to do something cool with it (the most I’ve done is RC cars and planes as a teenager).

I recently decided that it’d be really cool to be able to control a model train over the internet (with a video feed from the train itself) (since trains are really the only model-anything that wouldn’t be killed by a couple seconds of latency on the video feed). I’ll post some more info on this when it’s finished for anyone interested. All that’s left to do is the programming.

Cool project idea. You should check out this other forum thread where someone made an arm that they control over the internet using the Micro Maestro.

- Ryan

Ok, I have it all working, except it breaks every once in a while. I don’t even know where to start to troubleshoot it.

Here’s my setup:

Computer USB is connected to the Maestro. Channel 3 signal is connected to the RX on the Jrk. The ground on the Jrk (the one 2 slots over from the Rx) is connected to the servo channel 3 ground on the Maestro. Is that correct? (I noticed that the signal still gets sent even when my 5V servo power source is disconnected (which is just an altered USB cable)).

On the Jrk itself, I have a 10V connection (which comes through the track and through the wheels) going into the VIN and ground, and the A and B go to the train motor. Sometimes I also have the USB connected just to watch for errors, but it works and doesn’t work both with and without the USB.

Every once in a while, while the train is going around the track, it stops. It seems to stop for various reasons. The Jrk’s Red LED will be on (when I check the voltage that it’s getting, it’s the 10V that I expect). I can’t see the errors because the Jrk seems to have frozen, and the USB utility won’t connect again until I disconnect and connect the USB cable. My theory here is that it loses voltage for a fraction of a fraction of a second, and that causes it to freeze. Is that likely? (this has always been one of my concerns with trains).

Other times, it’s the maestro that seems to have issues. It loses connection, sometimes giving me “access denied.” (my program is just an altered version of the USB example that comes with the sdk). The green light will be completely off until I disconnect and reconnect the USB cable.

Is there anything else I can do to troubleshoot this? And if it’s a sudden voltage drop that’s causing the jrk to freeze, is there any way to regulate that? I suspect it’s only happening for hundredths of a second at a time. Could it also be bad inputs from the maestro that are causing it to freeze?

Thanks for any help

Edit: Here are some pictures: (about 1MB each, although still a little blurry… hopefully they help)
lbarrettanderson.com/t1.jpg
lbarrettanderson.com/t2.jpg

Hello, LBarrettAnderson.

Thanks for attaching the two pictures! It helps me tell what is going on.

A good first step in troubleshooting is to try to make the simplest possible system the exhibits the problem. You should try disconnecting the motor form the Jrk and see if the problems still occur.

Your connections are all correct. Your altered USB cable is not necessary because you have no servos connected to the Maestro; I recommend disconnecting it so we can rule out any problems that it might be causing. (You should also know that servos don’t have to be powered at exactly 5 V (refer to the datasheet), and a typical USB port on a computer will NOT supply enough power for servos.)

The Jrk should be able to recover from temporary errors if your settings are good. Do you have any latched errors enabled on the Jrk? You should send us your Jrk settings file and your Maestro settings file so we can take a look at them.

When you get the Maestro “access denied” error, do you have the Maestro Control Center open at the same time? It will auto-connect to the Maestro when you plug it in, which might be why you are getting the access denied error when you try to run your own program.

Bad inputs from the Maestro should not cause the Jrk to freeze, but if there is a bug in the Jrk firmware then it is possible.

This behavior you are seeing on both devices where you can’t connect to them until you unplug and replug the USB cable: I’ve seen this happen on some computers whenever there is some sort of electrical disruption. Basically, if the USB device draws too much current from the USB port for some reason, the computer might respond by turning off power to that port. When the Maestro’s green LED turns off, what are the other LEDs doing?

-David

Thank you so much

With your advice I got rid of all of the stuff that I didn’t need, and it seems to work now. The USB ports must have been turning off because of that rigged connector (I also broke my maestro, but eventually figured out how to reset it).

Tomorrow I’m getting a 12V power supply which should also eliminate some of the other issues I’m having (I’m using one that came with a used train set, and it decides to stop working every once in a while).

All that’s left is to mount a camera on some servos to be able to rotate it.

Now here’s something I’m thinking about, and I know it’s much more complicated than I currently understand, but maybe someone can tell me how feasible this is:

The 12V power supply that I’m getting is rated for 10 amps of current. What would happen if I attached the wheels to an inverter (one of those small car ones) (through some upgraded wires (I think 16 gauge)), which in turn powered my laptop? (eventually I’ll replace it with a netbook or some very small computer). I don’t like the idea of going from AC to DC to AC to DC, but I don’t want to run 110V through the tracks, and (maybe I’m making this up) I get the feeling that an inverter would help protect my laptop’s power supply in some way.

I could also go wireless and control everything that way, but that would require a wifi-capable camera, and who knows what kind of power source.

Edit: Youtube video of me telling my friend what to do:


(all being controlled over the internet through my server, not just networked).

I’m glad you got it working, and thanks for the cool video!

What do you mean when you say the Maestro broke (temporarily)? Was the green light double-blinking?

What is the Maestro doing besides controlling the Jrk?

-David

Right now it isn’t controlling anything else. Eventually it’ll also control 2 servos.

When it wasn’t working, none of the LEDs were coming on. Green, orange/yellow, red, none. Having it plugged in for a while, I did see some of them come on for a fraction of a second (once), but they just stayed off… until I reset it (I really had no idea what I was doing to reset it, but I ran some electricity in different directions on the RST and ground).

That’s weird. Unless the RST line was stuck low for some reason, manipulating the RST line should not have been any better than cycling power. If you ever find a way to reproduce the problem I’d like to know what it is.

-David

It may have been a coincidence that it started working after I did that, I suppose. I think it may have happened originally due to my carelessness, allowing it to contact some other wires that it should not have been contacting.

I’ll let you know if it happens again.

(And just so you know, it didn’t have anything to do with USB shutting itself down – I tried it on a different computer and got the same results).