AXE110 datalogger timing problem

I am having some trouble with timing on my AXE110 Datalogger.

Battery Power supply 4.7 volts

I am trying to collect data each second for several mins.

If I use pause command and set logging period to one second and 60 readings, it takes 90 secs.

If I use sleep command and set logging period to one second and 60 readings, it takes 30 secs.

Has anyone any idea why this is happening

David Miles
 
Hi Jeramy.
Thank you for you offer to help.
The code was from the Wizards.
Code:
'AXE110 PICAXE-18X - New Datalogger Mission Program
'Automatically generated by Wizard
 
'LED will flash green as readings are taken.
 
'Data can be retrieved after mission (LED red) by Datalink tool (F9).
'Use Datalink options: Baud rate - 4800, Sensors - 1, Send G - Enabled
 
' *******************
' ***** Options *****
' *******************
 
'Title - 
'Date - 30/11/2008
'Time - 19:17:55
 
'Options Selected
'Sensors:
'Sensor 0 - Not used
'Sensor 1 - Sensor 1
'Sensor 2 - Not used
'Sensor 7 - Not used
 
'Memory:
'No of readings = 60
'1 x 24LC256
 
'Outputs:
'Bi-colour LED
'SPE002 Piezo sounder
 
'Logging Period:
'Pause command
'Hours: 0 Mins: 0 Secs: 1 
 
' ********************
' ***** Symbols *****
' ********************
 
'Symbol definitions
symbol data0 = b0
symbol data1 = b1
symbol data2 = b2
symbol data7 = b3
symbol top_address = w2 '(b4 + b5)
symbol address = w3 '(b6 + b7)
symbol temp_word = w4 '(b8 + b9)
symbol temp_byte = b10
symbol hours = b11
symbol mins = b12
symbol secs = b13
symbol day = b0
symbol month = b1
symbol COM = 44 'comma
symbol RET = 13 'carriage return
symbol LFEED = 10 'line feed
 
'Preload sensor names and title into data memory
EEPROM 0,(0,0)
EEPROM 16,("Light")
EEPROM 32,("Sensor 1")
EEPROM 48,("Sensor 2")
EEPROM 64,("Temperature")
EEPROM 80,(" ")
 
 
' ***************************
' ***** Initialisation *****
' ***************************
 
init:
    high 5 ' write protect eeprom
'reload the last address from data memory
    read 0,b6
    read 1,b7
 
 
' *********************************
' ***** Main loop - read data *****
' *********************************
 
'Now read each sensor
main:
    high 3 ' flash LED
 
    readadc 1,data1
 
    low 3 ' end of flash LED
 
    sound 0,(50,50) ' make a piezo beep
 
' *****************************
' ***** Now Save the Data *****
' *****************************
 
'Now save the data
save_data:
    low 5 ' write enable eeprom
 
'Single 24LC256. Input0 from address 0, input1 from address 4096
'Single 24LC256. Input2 from address 8192, input7 from address 12288
 
    if address > 4095 then memory_full
    i2cslave %10100000, i2cslow, i2cword
    temp_word = address + 4096    writei2c temp_word,(data1)
    pause 10
    readi2c temp_word,(temp_byte)
    if temp_byte <> data1 then ee_error
 
'increment address and save in data memory
inc_address:
    high 5 ' write protect eeprom
 
    let address = address + 1
    write 0,b6
    write 1,b7
    if address > 60 then memory_full
 
 
' ***********************
' ***** Time Delays *****
' ***********************
 
'Now do time delay
'Secs:
    pause 1000
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! <<< EDIT THIS LINE
 
'now do next reading
    goto main
 
 
' *************************
' ***** Error Routine *****
' *************************
 
'Memory error - flash LED red/green'
ee_error:
    high 2
    low 3
    pause 500
    low 2
    high 3
    pause 500
    goto ee_error
 
' ***********************
' ***** Memory Full *****
' ***********************
 
'Memory is full - LED red'
memory_full:
    high 2
 
' ****************************
' ***** Datalink Routine *****
' ****************************
 
'Datalink routine to transmit data
read_init:
    high 5 ' write protect eeprom
    let address = 0
 
'Get top address from data memory (w2=b4+b5)
 
    read 0,b4
    read 1,b5
 
'Wait for G character sent from software
    serin 6, N4800, ("G") 'Wait for GO signal
 
'Transmit the titles
    serout 7,N4800,("Address",COM,"Sensor 1",COM," ",RET,LFEED)
 
'Now read the data
read_data:
'Single 24LC256. Input0 from address 0, input1 from address 4096
'Single 24LC256. Input2 from address 8192, input7 from address 12288
 
    if address > 4095 then all_done
    i2cslave %10100000, i2cslow, i2cword
    temp_word = address + 4096
    readi2c temp_word,(data1)
 
'transmit data 
tx_data:
    serout 7,N4800,(#address,COM,#data1,RET,LFEED)
 
    let address = address + 1
    if address = top_address then all_done
    goto read_data
 
'finished so send NULL
all_done:
    serout 7,N4800,(0)
    goto read_init
 
Last edited by a moderator:

eclectic

Moderator
David.

I've just tried this:

60 @1 sec. Light only readings. (temp on a DS18B20 takes ~0.7 s)

I started timing after the blue “loading-bars” had finished.

Experiment repeated twice.

“Pause” timings ~ 61 sec. (which sounds about right).

“Sleep” timings ~ 2 (two) seconds.

Then, I had a look at the Wizard generated program.
Pic 1 shows NO sleep breaks.
(Sleep = 2.3 sec. So, it can't be used in a one second routine.)

Set the Wizard for 60 readings of one minute each.
Pic 2

Hope this helps.
 

Attachments

axe110 datalogging timing problem

Hi Eclectic.
I'm afraid I didn't fully understand your reply.
I understood up to "61 secs- sounds about right" .
After that I am lost. Can you explain further?
David
 

eclectic

Moderator
David.
I'm too sleepy to try and explain fully at the moment, but ...

Manual 2, page 168.
One "Sleep" is worth ~ 2.3 seconds.
So, you can't measure seconds with bigger units.

Both of my pics were taken using the Sleep command.
The first was using the One second steps. ( nothing seconds )

The next used one minute gaps
(26 x 2.3 = ~ 60 seconds)

e
 

BeanieBots

Moderator
Have you tried setting "logging period" in the wizard to use the DS1307 RTC?
It will always be more accurate than any software solution.
 
axe110 datalogger timing problem

Hi BeanieBots.

No,I haven't tried the DS1307 option because I don't have the chip. If you think it will enable me to take readings each second ( approx ) then I will get one. Do you know that it would be that accurate, have you tried it?
David
 

Technical

Technical Support
Staff member
All you need to do is simply edit this line to a smaller value:

pause 1000

This is creating a 1 second delay (1000 ms) between each beep / read of sensors / write to eeprom.

But the beep / read of sensors / write to eeeprom all takes time to execute, particularly the beep ("sound 0,(50,50)" command). Therefore the actual time between each sensor reading is currently 1000ms PLUS the processing time.

So simply reduce the pause value so it is 1000 MINUS the processing time. You need to loose 30 seconds over 60 loops (90 to 60, = 0.5s per loop) so try a value of 'pause 500' to start with.
 

BeanieBots

Moderator
As you stated 1 second "approx", then the solution offered by Technical is your best bet.
If you want very accurate timing, then the RTC chip is the best bet.
Yes it is accurate (a few 10's of seconds/month) and yes I have tried it.
 
Top