RF Pan Tilt on 2x Pro Mini 328p 5V servo jitter.

I am making a wireless pan tilt bracket for my home security camera. I'm utilizing 2 Pro Mini 328p's running at 5 volts, and a set of 433mhz RF transmitter and receiver.

I first developed the servo movement on one board via a 2 axis analog joystick. I had great smooth accelerations and movement. Than I added in the other board, moved the joystick over, and set the transmit/receive pair.

I am utilizing the standard Servo library and a modified VirtualWire library that operates on timer2 for it's required interrupts instead of timer1 since the Servo library requires that for driving the servo's. Everything successfully compiles. I am running the Servo's on a separate ULTRA beefy 10 Amp desktop supply with 450uf caps for added insurance. Obivously this is not a "not enough power" issue. And the serial readout on the receiver shows a beautifully rock solid stream of the appropriate Joystick inputs. My servos' signal pins are on 5 and 6.

When I power the system on both pan and tilt servo's jitter +/- 4 or so degrees in each direction. The whole entire time. I have control of them more or less, all be it, jittery, and jumpy control.... But successful wireless control, well succesfullish. Note that the transmitter and receiver pair are about an inch from each other. Just in case anyone was thinking this was a dropped RF signal issue.

Obviously I am not generating my servo signals properly. At least that is what I assume. Am I flawed in thinking that I can use the virtual wire on timer 2 and still utilize the Servo library. Also before anyone suggests I have tried using soft serial, and virtual wire. The jitter is there, but just different problems in controlling the servo's smoothly.

Anyway. I can throw another pro mini into the mix and use direct serial communication between them to split the tasks of servo control, and RF receiver. But of course I'd rather limit my receiving servo control foot print since it makes the security camera that much bigger.... but not a huge deal.

Thoughts?

Code is attached.

Receiver & Servo Control.cpp (6.19 KB)

Transmitter.cpp (1.82 KB)

The Servo library uses interrupts for timing so any code that disables interrupts for more than a microsecond (like the SoftwareSerial library) will cause jitter in the servos.

I noticed this on the VirtualWire download page:

"END OF LIFE NOTICE

This VirtualWire library has now been superceded by the RadioHead library RadioHead: RadioHead Packet Radio library for embedded microprocessors RadioHead and its RH_ASK driver provides all the features supported by VirtualWire, and much more besides, including Reliable Datagrams, Addressing, Routing and Meshes. All the platforms that VirtualWire supported are also supported by RadioHead.

This library will no longer be maintained or updated, but we will continue to publish it for the benefit of the the community. Nevertheless we recommend upgrading to RadioHead where possible."

Anyway. I can throw another pro mini into the mix and use direct serial communication between them to split the tasks of servo control, and RF receiver.

Another option would be the Pololu Maestro servo controller, which is essentially jitter free. Pololu - Micro Maestro 6-Channel USB Servo Controller (Assembled)

Yeah, the Virtual Wire library is deprecated, but I have had no luck getting the Radiohead library to work with my setup. Even tried the basic transmit/Receive example sketches and nothing was working where everything was working with virtual wire. I triple checked wiring, etc... Working on the RadioHead google group to figure that out.

I just tried switching out the standard Servo library for another (ironically) deprecated library PWMServo. According to the documentation the main difference being that PWMServo does not utilize any interrupts to produce the signal. I did see a slight bump in smoothness, but still every few degrees it hesitates for a fraction of a second and continues on. It looks like a low res stepper motor.

Interestingly enough evey now and again it will have 10-20 degrees of smooth movement. But it acts almost as if I have servo positioning commands piling up, that are then in quick succession executed.

I'm sure this is a coding issue, whether in my code, or the libraries I Am using because i have seen successfully controlled uno based rc cars, etc, that are using a similair RF link + servo control.

As far as getting a Pololu Maestro. I'd be all for that, but I have handles of pro mini's lying around, and $20 is a bit steep considering my abundance of minis.

I'll report back if I figure a better library setup.