I am having difficulty in driving a Pololu LACT12P linear actuator using a Jrk 12v12 controller connected to an Arduino serial port. The 12v12 is set up to use the UART serial mode, and the Arduino is set up to use its standard serial pins D0 for Rx and D1 for Tx.
Using this setup, I cannot get the motor to move at all, so I have tried various tests to see what is going on.
Firstly, I tried to drive the motor directly using the Pololu Jrk Configuration Utility (on a Windows 7 PC) via a USB connection. This works fine: I can drive the actuator to and fro, see the actuator position from the feedback value etc., etc. This seems to indicate that the power supply (12V 10A switched supply) and feedback connections to the controller are all OK.
Next, I tried to use the Pololu Serial Transmitter (v1.3) on the PC, in an attempt to send commands directly to the 12v12 (of course, without involving the Arduino at all). However, I cannot find any setup for this which produces any response at all. When I start the Serial Transmitter, I am offered two COM ports to connect to – COM4, which goes directly to the 12v12 TTL Port, and COM5, which goes to the Command Port. None of these seem very appropriate, since what I really want to do is send serial signals directly to the controller’s Rx pin and receive responses from its Tx pin. This doesn’t seem possible via a USB connection from the PC. So my question is: Do I need to use a USB-to-Serial converter to convert the USB signals into proper TTL serial signals (and vice versa) which I can then feed directly to the Rx/Tx pins on the controller? Or is there some simpler way which I have overlooked?
To send serial commands to the jrk through USB via the Serial Transmitter utility, the jrk controller’s serial interface should be set to “USB Dual Port” or “USB Chained”, and you should have it connect to the COM port that corresponds to the “Jrk 12v12 Command Port” entry in your Device Manager. You should not need a USB-to-serial converter to send commands to the jrk over USB. You could use a device like that to send the commands to the RX and TX pin, but I am not sure what that would accomplish, and it sounds like you are ultimately trying to control the jrk through serial commands from an Arduino. If this is the case, I can help you with that directly instead.
What Arduino board are you using? Could you make sure the RX and TX pins are connected correctly (the Arduino TX pin to the jrk’s RX pin and the Arduino RX pin to the jrk’s TX pin). Also, could you make sure you have a ground connection between the two devices? Could you post the Arduino sketch you are using to test the setup, as well as your jrk settings file? You can save the jrk’s settings file by selecting the “Save settings file…” option in the “File” menu of the Jrk Configuration Utility.
Thanks for the reply – it gave me just the piece of information I couldn’t find anywhere: I needed to set the Jrk 12v12 into Dual Port mode in order to test it via the Serial Transmitter. This enabled me to check that the 12v12 is working correctly.
The model of Arduino which I use is a Uno.
I’ve checked the serial Tx/Rx connections between the Arduino and the 12v12 once again, but they are just as they ought to be. And the GND pin on the 12v12 is indeed connected to Arduino GND. So the error must either be a fault in the Arduino, the sketch itself or (just possibly) the stand-alone power supply for the Arduino.
I enclose the sketch and the .cpp and .h files for the JrkSerial library which I have made for the Jrk 12v12 running in Serial UART mode. It seems fairly straightforward, but I may well have misunderstood something very basic! All comments will be gratefully received
Thanks once again for the help so far.
JrkSerial_test.ino (4.99 KB)
JrkSerial.cpp (2.86 KB)
JrkSerial.h (882 Bytes)
From a brief check, it looks like your serial commands are correct. However, I noticed that your library tries to initialize the Arduino hardware serial when JrkSerial() it is first called, which in your code happens before setup(). I suspect this is causing a problem. You might try making a separate init or begin function for JrkSerial and call it from setup().
Thanks for the tip! Moving the initialisation of the 12v12 controller hardware into a separate begin() function called from setup() solved the problem completely. I simply hadn’t thought this would be necessary.
Now everything works and I can control my greenhouse as planned