Peter Goldsbury
Member
Has anyone else found that the touch imput levels vary massively with temperature?
Here are are the results of some tests today on input B.6
7.6 degrees C open 6642 touched 6784
13.5 degrees C open 6761 touched 6889
19.7 degreesC open 9444 touched 10200
That suggests that using absolute thresholds will be very unreliable
I now use the self tuning algorithm below, but it is still unreliable at temp extremes with the thresholds it uses of around 500 on and 300 off relative to the open reading.
These were done with a solar powered floating picaxe connected via the direct PC serial out port Com1. I have used AXE 027 cable too but its plug has gone intermittent so I have had to suspend that.
Note: in another application I am getting strange readings using the Pulsein command which also seem to be temperature dependent. Could it be that the resonator frequency is changing ? I doubt this becase the SERTXD seems to contuinue to work normally.
CAN ANYONE GIVE ME ANY ADVICE TO GET AROUND THIS PLEASE??
Here is the code I use. The rest of the code ( memory almost full) seems to continue to work as expected.
; ************************************
; Touch key control
; Autotune Touch sensors backgound task (don't do this for positive changes eg when a key preseed)
; these are sensitve to battery voltge temp etc so need Auto tune - say 128 smoothing to get average
:FIRST TEST ;DEFAULT touch16 [%10010010], touch_enter, ww1 ; scan touch sensors and save (Touch default values)
; @5.5 v 7949 and 8926 touched
; @2.5 v 8049 and 9125 touched
; so try set level at 8500
touchin: ;goto touchin10 ; TEMP JUMP OVER UNTIL DEBUGGED
let ww1 = looptimer & mask7 ; scan every 7 loops (appr 1 secs) (diff timeslot
if ww1 != 5 then goto touchin10 ; not time for a scan yet so jump on;l
if mode_notouch = 1 then goto touchin10
touch16 [%10010010], touch_enter, ww1 ; ; scan touch sensors and save
read touchenter_tunel, ww2l ; get the tuned level (this is preset on reboot to around 15,000
read touchenter_tuneh, ww2h
let ww3 = ww2 + touch_enterhigh
If ww1 > ww3 then goto touchin02 ; is this passed the key pressed threshold?
; no key pressed so add 1/128th of this reading to tuning level
touchin01: let ww3 = ww2 + touch_enterlow
If ww1 > ww3 then goto touchin10
let ww3 = ww1/128
let ww4 = ww2/128 ; reduce cumulative tune value by 16th
let ww2 = ww2 - ww4
let ww2 = ww2 + ww3 ; add 16th of latest reading
write touchenter_tunel, ww2l
write touchenter_tuneh, ww2h
let battery_pulse = 1 ;; set flag to pulse battery volts on next touch
let mode_comtest = 0 ; if touch released then clear comtest
goto touchin10
; process for a key touched to action it
touchin02:
If ww1 > ww3 then goto touchin03 ; is the key still pressed eg past threshold?
goto touchin10
; process for key first touched to pulse out battery voltage
touchin03: if battery_pulse = 0 then goto touchin04 ; if comtest already running jump over batt volts
peek battery0_volts, ww1l ; access battery volts
wb1 = ww1l / 10 ;Isolate the 10's
gosub pulseout
wb1 = ww1l // 10 ;Isolate the 1's
gosub pulseout
let battery_pulse = 0 ; battery volts pulsed so dont repeat it
; process to carry out comtest- bleeping when each station packet received when button held touched
touchin04: let mode_comtest = 1 ; set coms test flag to trigger recive
touchin10:goto scanloop ; all done so go back to scan loop
pulseout:
do until wb1 = 0
sound sounder,(70,100,0,100)
dec wb1
loop
nap 6
return '
Here are are the results of some tests today on input B.6
7.6 degrees C open 6642 touched 6784
13.5 degrees C open 6761 touched 6889
19.7 degreesC open 9444 touched 10200
That suggests that using absolute thresholds will be very unreliable
I now use the self tuning algorithm below, but it is still unreliable at temp extremes with the thresholds it uses of around 500 on and 300 off relative to the open reading.
These were done with a solar powered floating picaxe connected via the direct PC serial out port Com1. I have used AXE 027 cable too but its plug has gone intermittent so I have had to suspend that.
Note: in another application I am getting strange readings using the Pulsein command which also seem to be temperature dependent. Could it be that the resonator frequency is changing ? I doubt this becase the SERTXD seems to contuinue to work normally.
CAN ANYONE GIVE ME ANY ADVICE TO GET AROUND THIS PLEASE??
Here is the code I use. The rest of the code ( memory almost full) seems to continue to work as expected.
; ************************************
; Touch key control
; Autotune Touch sensors backgound task (don't do this for positive changes eg when a key preseed)
; these are sensitve to battery voltge temp etc so need Auto tune - say 128 smoothing to get average
:FIRST TEST ;DEFAULT touch16 [%10010010], touch_enter, ww1 ; scan touch sensors and save (Touch default values)
; @5.5 v 7949 and 8926 touched
; @2.5 v 8049 and 9125 touched
; so try set level at 8500
touchin: ;goto touchin10 ; TEMP JUMP OVER UNTIL DEBUGGED
let ww1 = looptimer & mask7 ; scan every 7 loops (appr 1 secs) (diff timeslot
if ww1 != 5 then goto touchin10 ; not time for a scan yet so jump on;l
if mode_notouch = 1 then goto touchin10
touch16 [%10010010], touch_enter, ww1 ; ; scan touch sensors and save
read touchenter_tunel, ww2l ; get the tuned level (this is preset on reboot to around 15,000
read touchenter_tuneh, ww2h
let ww3 = ww2 + touch_enterhigh
If ww1 > ww3 then goto touchin02 ; is this passed the key pressed threshold?
; no key pressed so add 1/128th of this reading to tuning level
touchin01: let ww3 = ww2 + touch_enterlow
If ww1 > ww3 then goto touchin10
let ww3 = ww1/128
let ww4 = ww2/128 ; reduce cumulative tune value by 16th
let ww2 = ww2 - ww4
let ww2 = ww2 + ww3 ; add 16th of latest reading
write touchenter_tunel, ww2l
write touchenter_tuneh, ww2h
let battery_pulse = 1 ;; set flag to pulse battery volts on next touch
let mode_comtest = 0 ; if touch released then clear comtest
goto touchin10
; process for a key touched to action it
touchin02:
If ww1 > ww3 then goto touchin03 ; is the key still pressed eg past threshold?
goto touchin10
; process for key first touched to pulse out battery voltage
touchin03: if battery_pulse = 0 then goto touchin04 ; if comtest already running jump over batt volts
peek battery0_volts, ww1l ; access battery volts
wb1 = ww1l / 10 ;Isolate the 10's
gosub pulseout
wb1 = ww1l // 10 ;Isolate the 1's
gosub pulseout
let battery_pulse = 0 ; battery volts pulsed so dont repeat it
; process to carry out comtest- bleeping when each station packet received when button held touched
touchin04: let mode_comtest = 1 ; set coms test flag to trigger recive
touchin10:goto scanloop ; all done so go back to scan loop
pulseout:
do until wb1 = 0
sound sounder,(70,100,0,100)
dec wb1
loop
nap 6
return '



