store permanently "servo" command on 28X1

Benjie

Senior Member
Hi Forum,
I have made a radio controlled position machine where I send for few instant the data via "serout" via radio while the power supply goes via wire and then it is witched-off. The receiver has a set of bistable relays and some servo's.
When the power is switched-on the servo's go through the "servo" command to initialise their pin which provokes a glitch on the servo's followed by the move to the received position via the command "servopos". I need to avoid the glitch and have the servo just moving smoothly to the new position.
How can I store permanently the initialisation (servo pin,75) such that at every power-on the servo's are not re-initialised but just driven to the new position?
Is it possible to use the "servo" command to position the servo to the received position (ex. servo pin,'position data') without going through the initialisation?
Are other solutions possible?

Thanks, Benjie
 

jedynakiewicz

Senior Member
Radio control servos often do twitch on powering up. This can be reduced, or eliminated, by puttting a pull-up or pull-down voltage bias on the control wire to the servo. Use a 10K resistor to connect the control wire to either + volts or -. Which one? Some servos require a pull-up and some work with a pull-down. You will just have to try it and see. Servos do behave in various ways when they do not have signal on line. Some will simply remain still, others will run to a mid-point. Generally the former is the case and the pull-up or pull-down sorts the problem.

Let us know how you get on.
 

Technical

Technical Support
Staff member
Do you mean replace the initialisation 'servo pin,75' with 'servo pin,lastposition'?

If so you can use read and write commands to save the lastposition in the PICAXE EEPROM memory during power-off.
 

westaust55

Moderator
@Benjie,
If the answers above do not assist, can you post your existing program code.
That will give folks here a better ideal of what you are currently doing and what can be recommended to overcome the problem you are experiencing.
 

Benjie

Senior Member
jedynakiewicz,
I tried the pull-down and pull-up resistors but the glitch persists; by the way the servos do not move when I power-down, they stay in the last position.
Technical,
I do not think that solve the problem: assume that I power-on and off while the servo setting remain the same........reading the last position from the EEprom would offer the same information and therefore useless. The glitch due to the servo initialisation will remain.
westaust55,
the application is a remote radio controlled tuner for radio hams composed of a bank a bi-stable relays and two variable capacitors. The Picaxe transmitter has a rotary encoder counting 1-256 to provide a binary data to set 7 relays and two bites to set the servos.
Here the receiver code:
#code

#rem
input:
pin3 is the serial data in
output pins:
servo0=5
servo1=6
1,2,3,4 are relays 2,3,4,5
0 is the command of the mode relay: 1=CLa 2=LCa 3=CLC
0 is the enable to all relays
input pin4 is configured as output to relay 0
input pin5 is configured as output to relay 1
b1 contains C1 data
b2 contains C2 data
b0 contains the inductor data
b4 is the mode data
b3 is the compare byte for b1
b5 is the compare byte for b2
#endrem

init:
#picaxe 28x1
setfreq em16
servo 6,75
servo 7,75

main:

serin 3,N2400_16,("ABC"),b1,b2,b0,b4
b3=b1*165/255+55 'att. needs to calibrate the servo (min 47 max 220..
'220-47=182
b5=b2*165/255+55
'sertxd (#b1," ",#b2," ",#b0," ",#b4,CR,LF)
'pause 200

gosub mode
gosub c1
gosub induct

c1:

servopos 6,b3
servopos 7,b5
return


mode:
if b4=3 then
high portc 5
high portc 4
elseif b4=2 then
high portc 5
low portc 4
elseif b4=1 then
low portc 5
high portc 4
endif
return

induct:

if bit0=1 then
high portc 6
else low portc 6
endif

outpin0=bit1
outpin1=bit2
outpin2=bit3
outpin3=not bit4
outpin4=not bit5
outpin5=not bit6

goto main
 
Top