Jump to content


Photo

Servo Glitches while PIC boots


  • Please log in to reply
19 replies to this topic

#1 Dimitris76

Dimitris76

    RC-Cam Regular

  • Trusted Member
  • PipPipPip
  • 127 posts
  • Location:Borås, Sweden

Posted 20 May 2010 - 12:50 PM

I have built myself this nice OSD - antenna tracker combo for FPV use that's called DakarOSD.

http://aeromodelismo...read.php?t=1849
(you can translate with Google translate)

Posted Image

Posted Image

So I have etched the PCBs and soldered all the components on them and they actually work as they are supposed to except for one little problem that's causing a lot of headache, frustration and lost working hour to my sleeps expense! :mad:

Every time I power up the antenna tracker the pan servo is jolting 5 times rhythmically and in-sync to the flashing LED - that is supposed to flash 5 times while booting.

This behavior has already killed one of my GWS 1Turn 360 degree servos which does NOT tolerate out of spec servo pulses.

As you see here:
Posted Image

the servo at start up jitters in 5 increments all the way out - almost 90 degrees towards one side. This servo is not the GWS 360degree one but a "normal" Hitec HS-485HB that has normal +/-60 degree range. I used this one for the video mounted on Servocity's tilt mechanics in order to show clearer what's going on.

These jolts are not turning the servo to this a specific angle. They just rotate it 90 degrees clockwise from the position it was when the power was applied on the circuit.
That means that if I turn for example the servo manually 90 degrees counterclockwise and turn the antenna tracker on it will jolt 5 times and end up approximately at the servo's center.

Having said that, after the booting sequence is over, the servos (both pan and tilt) are re centering and the antenna tracker starts tracking the aircraft perfectly! :)

This is NOT part of the software. The software flashes only the LED 5x at startup.

So I what I suspected until now is:
-Power supply problems: I am using 7805 linear regulators - one for the servos one for the board's ICs. I have big electrolytics and 0.1uF ceramics by the PIC's pins. Tried two different manufacturer's 7805 and external 5V power supplies with the same results.
-EMF interference from the LED traces/circuit: I have removed the LED and it's resistor and still got the same jolts.

Here is my board:
Posted Image

All the other guys that built these circuits are telling me that never experienced this problem.
Did you ever have this kind of glitches from a PIC?
Any suggestions/ideas that will help me save the time I have already invested in this project are welcome!

Regards,
Dimitris

#2 Mr.RC-Cam

Mr.RC-Cam

    RC-Cam Mentor

  • Admin
  • PipPipPipPipPip
  • 4,692 posts
  • Location:USA
  • Interests:R/C video and photography.

Posted 20 May 2010 - 04:30 PM

I've never seen a Dakar OSD system, so I'm no expert. However, I have a hunch though. At the board's two servo headers, install a 2.2K ohm resistor across servo signal and ground (one terminator resistor at each servo header). Does that change anything?

Regarding the other guys that are not experiencing this issue, are they using the exact same servos you are using? And when they do this test, are their servos mechanically unloaded like yours, or are they connected to the mass of an antenna tracker?
- Thomas

#3 Dimitris76

Dimitris76

    RC-Cam Regular

  • Trusted Member
  • PipPipPip
  • 127 posts
  • Location:Borås, Sweden

Posted 21 May 2010 - 08:32 AM

i just went out and bought some 2.2k resistors. I have already tried with a 220ohm one and didn't help at all though...

I am seriously thinking building your Landastic in order to slow down things a little and hopefully avoid hitting the servos mechanical limit. Less strain to the tracker's mechanic is an extra bonus too!

Alot of people are using the GWS 360degree winch servo for panning. I don't know if they test the setup without the antenna's weight but they don't report this glitch.

Dimitris

#4 Mr.RC-Cam

Mr.RC-Cam

    RC-Cam Mentor

  • Admin
  • PipPipPipPipPip
  • 4,692 posts
  • Location:USA
  • Interests:R/C video and photography.

Posted 21 May 2010 - 08:42 AM

i just went out and bought some 2.2k resistors. I have already tried with a 220ohm one and didn't help at all though...

If 220's didn't help then the 2.2K's won't help either.

From what you have described the problem does not appear to be a PIC "noise" or a typical power supply issue. To me it sounds like a firmware issue. But since others don't report the problem, and they are using the same setup, the whole affair is a mystery.

Do you have a scope? If you do, then watch the servo signal during initialization. I think you will see a deliberate signal pulse at each unwanted servo jump. These would confirm a firmware issue.

If you don't have a scope, then what does your voltmeter read on the servo signal during initialization? {Hint: It should be 0 volts.} The meter won't show any unwanted pulses, but at least you can confirm the PIC's port pin was correctly initialized to an active low state.

I am seriously thinking building your Landastic ...

I think the RCFS-V2 would be a better band-aide than Landtastic for this problem. But, solving the real problem would be best.

Lastly, post the schematic you are using. Maybe something in the implementation will stand out and a forum member can help solve it.
- Thomas

#5 Kilrah

Kilrah

    RC-Cam Mentor

  • Trusted Member
  • PipPipPipPipPip
  • 2,079 posts
  • Location:Switzerland
  • Interests:Modelling, electronics, computers

Posted 21 May 2010 - 10:10 AM

Are you sure your LED and servo pins wouldn't be shorted together by any chance?

Really looks like your PIC sends the LED pulses to the servo as well, the behavior matches that too.

A digital servo shouldn't be affected as it will ignore non-standard pulses, you could try one if everything else fails. But you might get throw-limited as a drawback.

Edited by Kilrah, 21 May 2010 - 10:11 AM.


#6 Mr.RC-Cam

Mr.RC-Cam

    RC-Cam Mentor

  • Admin
  • PipPipPipPipPip
  • 4,692 posts
  • Location:USA
  • Interests:R/C video and photography.

Posted 21 May 2010 - 11:33 AM

Are you sure your LED and servo pins wouldn't be shorted together by any chance?

Good point, this deserves investigation. Home etched PCB's sometimes end up with intermittent hairline copper shorts, so be on the lookout for such things.

One useful test: The PIC is in a socket. Remove it and carefully bend the LED port pins out of the way (don't break them off!). Re-install the PIC. If the servo problem goes away, then there is a LED<->SERVO signal problem on the PCB. No doubt you've done something like this, but try it one more time for good measure.

Fatherly advice: Suspect everything, especially the things you have already checked.
- Thomas

#7 Dimitris76

Dimitris76

    RC-Cam Regular

  • Trusted Member
  • PipPipPip
  • 127 posts
  • Location:Borås, Sweden

Posted 21 May 2010 - 11:59 AM

Thomas,

unfortunately I don't have a scope. Can one of these software soundcard-based scopes be up to the task?

The RCFS-V2 with it's out of range pulse rejection could indeed solve the problem. Does the Landtastic let any out of spec servo pulse go through - even if it's under 0.8ms or over 2.2ms?

Another solution would be making a small auxiliary circuit with a 555 and a NPN transistor to power up the servos with a few sec delay!

Dimitris

PS Just bent pin 12 (the LED's pin) out of the socket and tried it... same S@#%!

#8 Mr.RC-Cam

Mr.RC-Cam

    RC-Cam Mentor

  • Admin
  • PipPipPipPipPip
  • 4,692 posts
  • Location:USA
  • Interests:R/C video and photography.

Posted 21 May 2010 - 12:23 PM

Can one of these software soundcard-based scopes be up to the task?


I'm not sure it would ID the actual problem. Soundcard scopes typically have AC coupled inputs and they don't play well with slow rep rates or DC levels. So they might add more confusion to this particular problem. But having said that, try it out anyways (just don't bet the farm that it will show you an obvious problem).

The Landtastic will ignore unusual R/C pulses. However, the RCFS-V2 is more sophisticated at validating the servo signal.

Although I am still thinking this is a firmware issue, can you post a schematic of what you have built?
- Thomas

#9 Dimitris76

Dimitris76

    RC-Cam Regular

  • Trusted Member
  • PipPipPip
  • 127 posts
  • Location:Borås, Sweden

Posted 21 May 2010 - 12:46 PM

Although I am still thinking this is a firmware issue, can you post a schematic of what you have built?


Certainly, here is the schematic:
http://aeromodelismo...20&d=1248365157

and the only addition to that is a MAX202 RS232 driver (with 4x 0.1uF capacitor per datasheet) connected on data out (pin 17)

The power supply is with two 7805 regulators (one for servo mechanics and one for the tracker's ICs) with 330uF electrolytics at input/output plus 0.1uF at various other points along the output (one right by the PICs power supply pins).

Dimitris

UPDATE: I have powered the servo through an ESC and observed some interesting behavior:
http://s12.photobuck...nt=EMIlynx1.flv

I don't even have to touch the brown signal cable and it brings the servo violently to it's mechanical limits !!!!????

#10 Dimitris76

Dimitris76

    RC-Cam Regular

  • Trusted Member
  • PipPipPip
  • 127 posts
  • Location:Borås, Sweden

Posted 21 May 2010 - 12:55 PM

The Landtastic will ignore unusual R/C pulses. However, the RCFS-V2 is more sophisticated at validating the servo signal.


What do you mean "will ignore unusual R/C pulses"? Will it ignore and let them pass through to the servo or ignore the incoming out of range pulses and replace them with the minimum/maximum allowable/normal pulse length (0.8-2.2ms)?

#11 Mr.RC-Cam

Mr.RC-Cam

    RC-Cam Mentor

  • Admin
  • PipPipPipPipPip
  • 4,692 posts
  • Location:USA
  • Interests:R/C video and photography.

Posted 21 May 2010 - 02:07 PM

Certainly, here is the schematic:


I had seen the public schematic, but I assume you have redrawn it with your additions. Can you post the schematic you used to create the PCB?

and the only addition to that is a MAX202 RS232 driver (with 4x 0.1uF capacitor per datasheet) connected on data out (pin 17)

If the board will work with the MAX202 removed, then pull it off the socket for now.

The power supply is with two 7805 regulators (one for servo mechanics and one for the tracker's ICs) with 330uF electrolytics at input/output plus 0.1uF at various other points along the output (one right by the PICs power supply pins).

I looked at the Vreg stability caps and the 0.1uF on the second 7805 is missing (not stuffed in photo, PCB location empty). This cap should be stuffed or you risk Vreg oscillation (something I have seen many times). If the oscillation occurs then all sorts of weird things may emerge. The other 0.1uF's on the +5 buss do not count; the Vreg's stability cap must be installed directly next to it, from +5Vout to Gnd. I also recommend a ceramic 0.22uF - 0.33uF directly at each Vreg, across Vin and Gnd.

By the way, what is going to be used to power this board? A 2S LiPO may not have sufficient voltage (should be above 7.0V for reliable 7805 operation) and a 3S will probably cause the servo's Vreg to run hot with the heatsink I see being used.

I don't even have to touch the brown signal cable and it brings the servo violently to it's mechanical limits !!!!????

I watched the video several times. Unfortunately, I really don't understand how things are wired. What I think I am seeing is that the Servo Gnd is connected to the PIC's board for some reason, but servo power is disconnected from the board and directly routed to the BEC. The servo signal wire is also disconnected from the board and connected to a bare brown wire on a unused harness. Is this correct? If it is, then redo the test with all the servo wires disconnected from the PIC board and turn off EVERYTHING that is not needed. Move the servo test to another room and see if your hand's moving still affects the servo. Use the information you gather to locate what may be an unexpected EMI source. This info may of course not have any significance to the real problem, but you never know.


What do you mean "will ignore unusual R/C pulses"? Will it ignore and let them pass through to the servo or ignore the incoming out of range pulses and replace them with the minimum/maximum allowable/normal pulse length (0.8-2.2ms)?

Landstastic was designed seven years ago, so I don't recall the little details. I believe it uses a previous good pulse value if the pulse widths are unusual. I don't want to sound like a parrot, but I think the RCFS-V2 would be a better choice if you want to filter bad servo pulses.
- Thomas

#12 Dimitris76

Dimitris76

    RC-Cam Regular

  • Trusted Member
  • PipPipPip
  • 127 posts
  • Location:Borås, Sweden

Posted 22 May 2010 - 01:27 AM

About the video:

I was about to power up the servo with the ESC, with common ground to the Lynx and holding the signal cable straight on the bent out pin 22. But before I power up the Lynx I have noticed the glitches due to my hand moving around.

The photo is old - I have populated the board with all the caps and then some more. The 7805 on the top right though has a it's 0.1uF ceramic staight on it's output but the GND is a little further away...

Dimitris

#13 Mr.RC-Cam

Mr.RC-Cam

    RC-Cam Mentor

  • Admin
  • PipPipPipPipPip
  • 4,692 posts
  • Location:USA
  • Interests:R/C video and photography.

Posted 22 May 2010 - 08:41 AM

I was about to power up the servo with the ESC, with common ground to the Lynx and holding the signal cable straight on the bent out pin 22. But before I power up the Lynx I have noticed the glitches due to my hand moving around.

I just tested a servo in similar conditions. I get similar movement. Appears to be due to 60Hz power line frequency in the environment getting into the unterminated servo input. For now, this does not seem to be a valuable symptom.

The photo is old - I have populated the board with all the caps and then some more.

Good to hear.

I think this is about as far as I can help so maybe another forum member will have some suggestions. A good performing o-scope would be ideal to use at this point.

But, one last thing. Check the PIC's fuse settings you programmed into it. Pay very close attention to the FOSC bits.
- Thomas

#14 Dimitris76

Dimitris76

    RC-Cam Regular

  • Trusted Member
  • PipPipPip
  • 127 posts
  • Location:Borås, Sweden

Posted 22 May 2010 - 01:18 PM

Fuse settings?

What is this? I have used that little program that comes with PICkit2 and I have not been asked at any point about fuse settings. I just clicked "open", browsed to the hex file and then clicked "write"... Did I miss something?

Dimitris

#15 Mr.RC-Cam

Mr.RC-Cam

    RC-Cam Mentor

  • Admin
  • PipPipPipPipPip
  • 4,692 posts
  • Location:USA
  • Interests:R/C video and photography.

Posted 22 May 2010 - 02:34 PM

The PIC data sheet will explain the fuse settings (chapter 19, configuration settings). Your chip programmer will set these from the hex file if they were included in the file. It is always wise to review them to make sure they are correct when you program the device (project documentation supplied by the firmware author usually will discuss the correct values to use).
- Thomas

#16 Mr.RC-Cam

Mr.RC-Cam

    RC-Cam Mentor

  • Admin
  • PipPipPipPipPip
  • 4,692 posts
  • Location:USA
  • Interests:R/C video and photography.

Posted 22 May 2010 - 07:49 PM

You mentioned that other Dakar users do not report the startup servo problem. I did a quick Google and found this comment about the Dakar tracker:
"If there's one comment about the software of the Lynx is that there's no dampening on the servo drive, so the antenna can whack around something silly when you first power up and the system hasn't sync'd up etc."

Full text is here (see page 9):
http://www.ianjohnst...=8&limitstart=8
- Thomas

#17 Dimitris76

Dimitris76

    RC-Cam Regular

  • Trusted Member
  • PipPipPip
  • 127 posts
  • Location:Borås, Sweden

Posted 23 May 2010 - 12:19 PM

I have been in contact with Ian. He is describing the problem as random quick movement within normal servo range. He using a servo slow to take care of it.

#18 Mr.RC-Cam

Mr.RC-Cam

    RC-Cam Mentor

  • Admin
  • PipPipPipPipPip
  • 4,692 posts
  • Location:USA
  • Interests:R/C video and photography.

Posted 23 May 2010 - 01:33 PM

Based on the previous information you have provided, I still believe the solution would involve the tracker's software. That said, your best fix for now would be to do whatever is easiest for you.
- Thomas

#19 Dimitris76

Dimitris76

    RC-Cam Regular

  • Trusted Member
  • PipPipPip
  • 127 posts
  • Location:Borås, Sweden

Posted 23 May 2010 - 02:00 PM

The board's behavior is still a mystery and having troubleshot the hardware part as much as I can, I'll blame the software for now and call it a day.

My crude solution is this:
Posted Image
sorry for the blurry photo - iphones are not real cameras...
Posted Image
Posted Image

which is a delay circuit based on a 555 IC and a relay, that powers up the servos after a 1.5sec delay - enough for them to "miss" this jolting phase.
I might sit down and etch a proper PCB for this add-on card someday as I hate perfboards, but for the moment it works!

Dimitris

#20 Mr.RC-Cam

Mr.RC-Cam

    RC-Cam Mentor

  • Admin
  • PipPipPipPipPip
  • 4,692 posts
  • Location:USA
  • Interests:R/C video and photography.

Posted 23 May 2010 - 08:34 PM

Glad to hear it is solved with the external circuit.
- Thomas