Jump to content

Arduino project - Servo Exerciser - RCM&E Dec 2018


Recommended Posts

Posted by supertigrefan on 02/02/2019 10:03:41:

Is this the germination of a 'Home brew electronics' topic?

Edited By supertigrefan on 02/02/2019 10:03:59

As a slight variation on the servo exerciser project to illustrate the versatility and usefulness of such devices –

In F5B comps we have to “teach” the scoring system how our throttle works, so a couple of years ago I built a simple Arduino based device that accurately output the same pulse width as “Full Throttle” and “Off” from my Tx to save me fiddling about with Tx and receivers at a comp. The two positions are selected by a simple push button. The scoring system provides the power so I didn’t even need to bother about that.

It worked fine, but I now find I am using it with a Y lead and a battery to raise or lower electric retracts in the workshop or at the field without having to get the Tx out or connect the wing to the Rx - so useful!

Dick

throttle box.jpginitial experiments.jpg

Link to comment
Share on other sites

I have a sketch working on a 5V, 16MHz Pro Mini that measures an input servo pulse and outputs it reversed on one output and not reversed but slowed on a second output. I'm just adding an option in the sketch to reverse the slow output.

This should also work on a 3.3V, 8MHz Pro Mini, I have still to test it.

Currently, the slow time, from end to end, is set as a number of seconds in the sketch, fractional parts of a second are allowed. The code measures the time between input pulses and adjusts the slow movement to match.

The operation is to receive an input pulse and then generate the output pulses, if no input is being received, then no output is generated.

I now need to decide where to put the sketch code to make it available. Probably I'll put it up on Github as that is where all my other released code resides.

Arduino (Pro Mini) code I currently have there:

SportToHub - convert FrSky SPort sensors to the old hub format for the 'D' receivers.
SbusToPpm - 16 channel SBUS decoder
APM_Mavlink_to_FrSky - Convert Mavlink telemetry data to FrSky format

Mike

Link to comment
Share on other sites

Might be of limited interest but you can have my Reeduino code Chris, its a fully featured & accurate reeds emulation encoder with a few 'extras'. Its very well proven with many implementations in use.

Doc & Sketch are items P18 & P19 on the Archive page of www.singlechannel.co.uk

In fact if it helps you can take anything you fancy from there Chris.

Cheers
Phil

Edited By Phil Green on 02/02/2019 17:35:05

Link to comment
Share on other sites

I did a sketch for a friend who needed to delay the middle position of a 3-pos. switch operating a pneumatic landing gear and -doors. The idea was to hold a fixed mid-position for 4 seconds, irrespective of the switch position, to avoid a collision of the doors with the retracting wheel. The end positions of the door servo were to be left as received from the Tx/Rx for trimming purposes. I used the standard PWM read and write code, but found the output unstable, jumping about 20-30 microseconds about every second. I eventually resorted to using fixed endpoints as well, leaving the trimming to be done mechanically or by altering the PWM values.

Max.

Link to comment
Share on other sites

Posted by Phil Green on 02/02/2019 17:34:46:

Might be of limited interest but you can have my Reeduino code Chris, its a fully featured & accurate reeds emulation encoder with a few 'extras'. Its very well proven with many implementations in use.

Doc & Sketch are items P18 & P19 on the Archive page of www.singlechannel.co.uk

In fact if it helps you can take anything you fancy from there Chris.

Cheers
Phil

Edited By Phil Green on 02/02/2019 17:35:05

Phil that's most generous, thank you.

If I do anything at all I'll be sure to PM/speak to/email you first.

Link to comment
Share on other sites

Code and a picture showing the connections are now on Github here: **LINK**

I've now tested this on both a 5V, 16MHz Pro Mini and a 3.3V, 8MHz Pro Mini. A hardware timer is used for input capture and both outputs, so there should be no jitter.

No doubt we could add some enhancements later.

Mike

Edited By Mike Blandford on 02/02/2019 20:03:48

Link to comment
Share on other sites

That sounds really useful for slowing flaps down, Mike. Especially with the option to change the direction of one of the channels.

Would it be possible to add an output intended to drive landing lights that comes on at a preset channel position? i.e. - Landing flap selected.

I guess it might have to have an external transistor added to carry the required current?

This would make this one useable as a servo reverser, servo slow or a switch. Or any combination of them all.
Link to comment
Share on other sites

It must be later already!

Github updated with a switch output on IO2 (also on the LED output to help see it operating).

There are some defines near the top of the sketch where you define the switching point and the switching level. I've also allowed for some hysteresis to prevent the switch output "jittering".

I haven't updated the wiring picture (yet).

Only one of the outputs is slowed at present.

Mike

Edited By Mike Blandford on 02/02/2019 22:32:03

Link to comment
Share on other sites

is there space on the chip to add a 'sub trim' adjust - I can't think of much else a "flap doctor" would need!

8 pin roll call in no particular order:

  1. A/D input for speed control
  2. discrete switch input for channel #2 reverse
  3. A/D input for subtrim for channel #2
  4. PWM servo input
  5. PWM servo output #1
  6. PWM servo output #2
  7. +ve
  8. -ve

think that's the 8 pins all used up?

Link to comment
Share on other sites

Nigel, if you follow Mike's link you'll see that this is implemented on an Arduino board, not an 8 pin chip.

Speed control and reverse are changed by altering the software.

You make a good point about trim though, although that could be taken care of by using one of these in each channel.

I guess we're in great danger of "mission creep" here.
Link to comment
Share on other sites

Just using a 8-pin chip is not really good enough for real control functions, although fine for exerciser functions. The reason is the 8-pin device is using an internal clock generator that is not accurate enough to give reliable results as the temperature and voltage changes. You need a clock controlled by a crystal (or resonator).

When I wrote the code, I assumed you would want either the slow function of the reverse function. In each case, sub-trim is easily handled on the Tx. I have, however, added the option to reverse the slow output!

I would not recommend using an analog input, I assume controlled by a pre-set pot, to adjust the sub-trim, particularly on an IC powered model.

You could adjust the centre position of the reversed output in the code. The reversing operation is done by taking the input pulse, subtracting 1500uS, changing the sign then adding the 1500uS back on. This is actually done by just subtracting the input pulse width from 3000uS, you get the same answer.

To adjust the centre position, just add an offset to this calculation:
CENTRE_PULSE_TIME * 2 - ServoPulse

like:
CENTRE_PULSE_TIME * 2 - ServoPulse + ( SLOW_ADJUST_SCALE * offset)

where offset is in uS.

Mike

Link to comment
Share on other sites

I'm already following the "terrible customer" model!

Really, I'm just chucking some ideas in the pot.

Mike, thanks for that, I'm fairly green on Arduinos, but you're right, if we are brewing up our own code to put on the thing, then subtrim can be built in to the code and "pre-adjusted" to suit the servos being using.

Edited By Nigel R on 04/02/2019 17:03:31

Link to comment
Share on other sites

  • 1 month later...

OK, You got me interested!
I've been half-interested in the Arduino before, but never got round to it, so this article decided me to have a go. I bought an Arduino Uno hobby kit, and played around for a bit.
I then put together a servo cycler on the breadboard, and once I sorted it out, made a hard version using an Arduino Nano (raw - without pins), a regulated 5V supply (7805) to supply power, and a power distribution pin-board. Two sets of outputs rotate 180 ~ 0 ~180, the other set do 180 ~ 90 ~ 0 ~ 90 ~ 180 This allows centres to be checked).
There is a pot to control the speed of the cycle, so that I can tune each servo to maximise the workload. It will take several servos at once, but the regulatior is only 1.5 Amps, so only two or three at once so far. I was surprised how much current even small servos draw in the cycler!

Great fun, and I'm sure the precursor to many more projects...

Steve.

 

servocycler1.jpg

Edited By Steve Dunne on 04/03/2019 17:06:25

Link to comment
Share on other sites

Well, I built the servo tester so I've been testing servos...disgust

Very surprised by the results - a mixture of digital and analogue, cheap and expensive, used and new.
I fitted a Turnigy wattmeter in line with the 2-cell lipo to monitor the current in use as the servos were cycling.

They showed 150mA to 320mA when running the cycle at full speed, with peaks showing 500mA to 800mA.
This was at no-load, just sat on the bench. I shudder to think what happens under flight loadings!

Having said that, I monitor the re-fill of my LiFe batteries during each after-flying-day session, and generally show only 60-80mAH per flight (8-10 minutes in the air) so only averaging 500milliAmps across 5 or 6 servos in flight. Just shows how gently I fly!wink
I must put the wattmeter in a plane sometime, when I am planning some serious stick-stirring flights...

Also - when I attached (four, separately) Hitec HS5685MH (High Voltage) servos, there was no response whatsoever. They just sat there undisturbed.
Has anyone any suggestions why?
They work perfectly when attached to various commercial servo testers in my box.
All my other servos, Hitec, Futaba, Spektrum, and various lesser-known names, all worked fine.

Puzzled!

Steve.

Edited By Steve Dunne on 09/03/2019 15:58:27

Link to comment
Share on other sites

Steve that's all very interesting.

I think that the reason some servos might not respond would be due to the signal pulses only being 3.3V.

I thought this would be OK because (I thought) most modern receivers do exactly the same.

It would be interesting to try the 5V version of the Arduino to see if they would respond to that, I'm sure they would. Or maybe try something like this to boost the signal.

Link to comment
Share on other sites

Hi Chris, thanks for the suggestions.

I am using the Arduino Nano, which is a 5 volt device, and the servos have non-extended, thick, twisted connecting cable. I think it must be something to do with the signal shape - I'll try to refix my oscilloscope tomorrow and look at the outputs in comparison to a commercial tester.

Steve.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...