Discussion forum for the BasicX family of microcontroller chips.
Data Logging - sibs_0_09 - Oct 15 12:46:50 2008
Hello all,
My name is Jeremy and I'm working on a Senior Design Project at the
University of Alabama in Huntsville.
My team project is a weather balloon with a video camera attached to a
motor and gyro to implement a stabilization system so that the
camera's picture will spin in the opposite direction of the payload
spin. This will make the video look stationary instead of spinning
with the payload.
We have working code for the motor control via basic x24 controller
using Pulse width modulation and an H-Bridge chip. The gyro feeds
into the micro controller and with that data in the code the direction
and speed for the motor is sent through the H-Bridge to the motor.
With my design explained, I am also storing the data sent by the gyro
so that we can have the actual spin of the package and be able to show
that verses the video data we obtain.
My problem is with the data recording, here is the code for what i
have so far. When i recall the data it gives me ridiculously small or
huge numbers that i know aren't correct. I didn't think it was an
addressing issue because I am recalling a variable as Single (4 bytes)
and a variable Byte (1 Byte) and that is what my address increments
are. If anyone can look over my code and see what I have done wrong I
would greatly appreciate it.
Thanks a lot,
Jeremy
The code below is the data logging code
Element Size = 4 in this code (b/c a Single is 4 bytes)
I should be getting numbers like 0.814590
I am actually getting numbers like 2.3E-38 after recalling data.
When taking the data I debug.print it to the screen and it's correct.
So, I know that i should be recording it correctly.
code:
'-------------------------------------------------------------------------------
Private Sub DataLog( _
ByVal SpinRate As Single, _
ByVal StartAddress As Long, _
ByVal EndAddress As Long, _
ByVal CurrentAddress As Long, _
ByVal Minute As Byte)
'So that no data will be written over when the EndAddress is reached
the sub program
'will be exited
If (CurrentAddress > EndAddress) Then
Exit Sub
End If
'Stores SpinRate Data at Specified Address
'CurrentAddress is then changed by the sample width
Call PutEEProm(CurrentAddress, SpinRate, ElementSize)
CurrentAddress = CurrentAddress + CLng(ElementSize)
'Stores a Reference time Data at Specified Address that will be used to
'reference SpinRate data to Video Data collected from experiment
'CurrentAddress is then changed by the sample width
Call PutEEProm(CurrentAddress, Minute, ElementSize)
CurrentAddress = CurrentAddress + CLng(ElementSize\ElementSize)
End Sub
'-------------------------------------------------------------------------------
Private Sub UploadData( _
ByVal SpinRate As Single, _
ByVal Minute As Byte, _
ByVal StartAddress As Long, _
ByVal EndAddress As Long)
' This procedure reads data stored in EEPROM and transmits the data to
' the serial port.
Dim Address As Long
Address = StartAddress
Do
' Read the data.
Call GetEEPROM(Address, SpinRate, ElementSize)
Debug.Print CStr(SpinRate)
Address = Address + CLng(ElementSize)
Call GetEEPROM(Address, Minute, ElementSize)
Debug.Print CStr(Minute)
Address = Address + CLng(ElementSize\ElementSize)
Debug.Print
Loop Until (Address >= EndAddress)
Debug.Print "EOF"
End Sub
'-------------------------------------------------------------------------------
------------------------------------

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )
Re: Data Logging - Darren Olson - Oct 15 13:04:34 2008
HI Jeremy,
I am also working on a wildlife project that is doing something similiar but
not a balloon. Our payload is a live Elk.
What camera are you using?
Thanks,
Darren
On Wed, Oct 15, 2008 at 12:40 PM, sibs_0_09
wrote:
> Hello all,
>
> My name is Jeremy and I'm working on a Senior Design Project at the
> University of Alabama in Huntsville.
>
> My team project is a weather balloon with a video camera attached to a
> motor and gyro to implement a stabilization system so that the
> camera's picture will spin in the opposite direction of the payload
> spin. This will make the video look stationary instead of spinning
> with the payload.
>
> We have working code for the motor control via basic x24 controller
> using Pulse width modulation and an H-Bridge chip. The gyro feeds
> into the micro controller and with that data in the code the direction
> and speed for the motor is sent through the H-Bridge to the motor.
>
> With my design explained, I am also storing the data sent by the gyro
> so that we can have the actual spin of the package and be able to show
> that verses the video data we obtain.
>
> My problem is with the data recording, here is the code for what i
> have so far. When i recall the data it gives me ridiculously small or
> huge numbers that i know aren't correct. I didn't think it was an
> addressing issue because I am recalling a variable as Single (4 bytes)
> and a variable Byte (1 Byte) and that is what my address increments
> are. If anyone can look over my code and see what I have done wrong I
> would greatly appreciate it.
>
> Thanks a lot,
>
> Jeremy
>
> The code below is the data logging code
> Element Size = 4 in this code (b/c a Single is 4 bytes)
> I should be getting numbers like 0.814590
> I am actually getting numbers like 2.3E-38 after recalling data.
> When taking the data I debug.print it to the screen and it's correct.
> So, I know that i should be recording it correctly.
> code:
>
> '----------------------------------------------------------
> Private Sub DataLog( _
> ByVal SpinRate As Single, _
> ByVal StartAddress As Long, _
> ByVal EndAddress As Long, _
> ByVal CurrentAddress As Long, _
> ByVal Minute As Byte)
>
> 'So that no data will be written over when the EndAddress is reached
> the sub program
> 'will be exited
> If (CurrentAddress > EndAddress) Then
> Exit Sub
> End If
>
> 'Stores SpinRate Data at Specified Address
> 'CurrentAddress is then changed by the sample width
>
> Call PutEEProm(CurrentAddress, SpinRate, ElementSize)
> CurrentAddress = CurrentAddress + CLng(ElementSize)
>
> 'Stores a Reference time Data at Specified Address that will be used to
> 'reference SpinRate data to Video Data collected from experiment
> 'CurrentAddress is then changed by the sample width
>
> Call PutEEProm(CurrentAddress, Minute, ElementSize)
> CurrentAddress = CurrentAddress + CLng(ElementSize\ElementSize)
>
> End Sub
>
> '----------------------------------------------------------
> Private Sub UploadData( _
> ByVal SpinRate As Single, _
> ByVal Minute As Byte, _
> ByVal StartAddress As Long, _
> ByVal EndAddress As Long)
>
> ' This procedure reads data stored in EEPROM and transmits the data to
> ' the serial port.
> Dim Address As Long
> Address = StartAddress
>
> Do
> ' Read the data.
> Call GetEEPROM(Address, SpinRate, ElementSize)
> Debug.Print CStr(SpinRate)
> Address = Address + CLng(ElementSize)
>
> Call GetEEPROM(Address, Minute, ElementSize)
> Debug.Print CStr(Minute)
> Address = Address + CLng(ElementSize\ElementSize)
>
> Debug.Print
> Loop Until (Address >= EndAddress)
>
> Debug.Print "EOF"
>
> End Sub
>
> '----------------------------------------------------------
>
[Non-text portions of this message have been removed]
------------------------------------
______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )Re: Data Logging - Chris - Oct 15 13:26:26 2008
Three things.
1. Is Spin and ADC value? If so why don't you save your values as integers and convert
them to
singles when you download the data? That would double your storage space.
2. ElementSize\ElementSize is a poor representation of 1.
"Call PutEEProm(CurrentAddress, Minute, ElementSize)"
"Call GetEEPROM(Address, Minute, ElementSize)"
Minute is only 1 byte and your telling Put/Get EEPROM it\'s 4 bytes.
Regards,
Chris
----- Original Message -----
From: sibs_0_09
To: b...@yahoogroups.com
Sent: Wednesday, October 15, 2008 9:40 AM
Subject: [BasicX] Data Logging
Hello all,
My name is Jeremy and I'm working on a Senior Design Project at the
University of Alabama in Huntsville.
My team project is a weather balloon with a video camera attached to a
motor and gyro to implement a stabilization system so that the
camera's picture will spin in the opposite direction of the payload
spin. This will make the video look stationary instead of spinning
with the payload.
We have working code for the motor control via basic x24 controller
using Pulse width modulation and an H-Bridge chip. The gyro feeds
into the micro controller and with that data in the code the direction
and speed for the motor is sent through the H-Bridge to the motor.
With my design explained, I am also storing the data sent by the gyro
so that we can have the actual spin of the package and be able to show
that verses the video data we obtain.
My problem is with the data recording, here is the code for what i
have so far. When i recall the data it gives me ridiculously small or
huge numbers that i know aren't correct. I didn't think it was an
addressing issue because I am recalling a variable as Single (4 bytes)
and a variable Byte (1 Byte) and that is what my address increments
are. If anyone can look over my code and see what I have done wrong I
would greatly appreciate it.
Thanks a lot,
Jeremy
The code below is the data logging code
Element Size = 4 in this code (b/c a Single is 4 bytes)
I should be getting numbers like 0.814590
I am actually getting numbers like 2.3E-38 after recalling data.
When taking the data I debug.print it to the screen and it's correct.
So, I know that i should be recording it correctly.
code:
'----------------------------------------------------------
Private Sub DataLog( _
ByVal SpinRate As Single, _
ByVal StartAddress As Long, _
ByVal EndAddress As Long, _
ByVal CurrentAddress As Long, _
ByVal Minute As Byte)
'So that no data will be written over when the EndAddress is reached
the sub program
'will be exited
If (CurrentAddress > EndAddress) Then
Exit Sub
End If
'Stores SpinRate Data at Specified Address
'CurrentAddress is then changed by the sample width
Call PutEEProm(CurrentAddress, SpinRate, ElementSize)
CurrentAddress = CurrentAddress + CLng(ElementSize)
'Stores a Reference time Data at Specified Address that will be used to
'reference SpinRate data to Video Data collected from experiment
'CurrentAddress is then changed by the sample width
Call PutEEProm(CurrentAddress, Minute, ElementSize)
CurrentAddress = CurrentAddress + CLng(ElementSize\ElementSize)
End Sub
'----------------------------------------------------------
Private Sub UploadData( _
ByVal SpinRate As Single, _
ByVal Minute As Byte, _
ByVal StartAddress As Long, _
ByVal EndAddress As Long)
' This procedure reads data stored in EEPROM and transmits the data to
' the serial port.
Dim Address As Long
Address = StartAddress
Do
' Read the data.
Call GetEEPROM(Address, SpinRate, ElementSize)
Debug.Print CStr(SpinRate)
Address = Address + CLng(ElementSize)
Call GetEEPROM(Address, Minute, ElementSize)
Debug.Print CStr(Minute)
Address = Address + CLng(ElementSize\ElementSize)
Debug.Print
Loop Until (Address >= EndAddress)
Debug.Print "EOF"
End Sub
'----------------------------------------------------------
[Non-text portions of this message have been removed]
------------------------------------

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )
Re: Data Logging - sibs_0_09 - Oct 15 13:27:34 2008
Hi Darren,
We are using a Coolpix S200 I believe. Due to weight limitations for
the package we had to go with a light weight camera. Plus that was
available to us in the lab. If you need Hi Res I would probably go
with something else.
--- In b...@yahoogroups.com, "Darren Olson"
wrote:
>
> HI Jeremy,
>
> I am also working on a wildlife project that is doing something
similiar but
> not a balloon. Our payload is a live Elk.
>
> What camera are you using?
>
> Thanks,
>
> Darren
>
> On Wed, Oct 15, 2008 at 12:40 PM, sibs_0_09 wrote:
>
>
> [Non-text portions of this message have been removed]
>
------------------------------------
______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )Re: Data Logging - sibs_0_09 - Oct 15 13:53:57 2008
That might be it, I thought I changed all my ElementSizes to the proper
numbers.
I'll have to check and see if it works later on today. I guess I was
just frustrated and missed that simple statement.
Spin is an ADC value, but i do need it stored to a few decimal places at
least. I need to know a certain voltage reading to determine the
correct amount of Spin for my payload.
ElementSize/ElementSize is a poor representation of 1, I was just trying
that to make sure that it wasn't messing up because I put a '1' in my
code.
I'll try the change and get back to see if it worked.
Thanks a lot!,
Jeremy
--- In b...@yahoogroups.com, "Chris"
wrote:
>
> Three things.
> 1. Is Spin and ADC value? If so why don't you save your values as
integers and convert them to
> singles when you download the data? That would double your storage
space.
>
> 2. ElementSize\ElementSize is a poor representation of 1.
> "Call PutEEProm(CurrentAddress, Minute, ElementSize)"
> "Call GetEEPROM(Address, Minute, ElementSize)"
> Minute is only 1 byte and your telling Put/Get EEPROM it\'s 4 bytes.
> Regards,
>
> Chris
>
> ----- Original Message -----
> From: sibs_0_09
> To: b...@yahoogroups.com
> Sent: Wednesday, October 15, 2008 9:40 AM
> Subject: [BasicX] Data Logging
> Hello all,
>
> My name is Jeremy and I'm working on a Senior Design Project at the
> University of Alabama in Huntsville.
>
> My team project is a weather balloon with a video camera attached to
a
> motor and gyro to implement a stabilization system so that the
> camera's picture will spin in the opposite direction of the payload
> spin. This will make the video look stationary instead of spinning
> with the payload.
>
> We have working code for the motor control via basic x24 controller
> using Pulse width modulation and an H-Bridge chip. The gyro feeds
> into the micro controller and with that data in the code the
direction
> and speed for the motor is sent through the H-Bridge to the motor.
>
> With my design explained, I am also storing the data sent by the
gyro
> so that we can have the actual spin of the package and be able to
show
> that verses the video data we obtain.
>
> My problem is with the data recording, here is the code for what i
> have so far. When i recall the data it gives me ridiculously small
or
> huge numbers that i know aren't correct. I didn't think it was an
> addressing issue because I am recalling a variable as Single (4
bytes)
> and a variable Byte (1 Byte) and that is what my address increments
> are. If anyone can look over my code and see what I have done wrong
I
> would greatly appreciate it.
>
> Thanks a lot,
>
> Jeremy
>
> The code below is the data logging code
> Element Size = 4 in this code (b/c a Single is 4 bytes)
> I should be getting numbers like 0.814590
> I am actually getting numbers like 2.3E-38 after recalling data.
> When taking the data I debug.print it to the screen and it's
correct.
> So, I know that i should be recording it correctly.
> code:
>
> '----------------------------------------------------------
> Private Sub DataLog( _
> ByVal SpinRate As Single, _
> ByVal StartAddress As Long, _
> ByVal EndAddress As Long, _
> ByVal CurrentAddress As Long, _
> ByVal Minute As Byte)
>
> 'So that no data will be written over when the EndAddress is reached
> the sub program
> 'will be exited
> If (CurrentAddress > EndAddress) Then
> Exit Sub
> End If
>
> 'Stores SpinRate Data at Specified Address
> 'CurrentAddress is then changed by the sample width
>
> Call PutEEProm(CurrentAddress, SpinRate, ElementSize)
> CurrentAddress = CurrentAddress + CLng(ElementSize)
>
> 'Stores a Reference time Data at Specified Address that will be used
to
> 'reference SpinRate data to Video Data collected from experiment
> 'CurrentAddress is then changed by the sample width
>
> Call PutEEProm(CurrentAddress, Minute, ElementSize)
> CurrentAddress = CurrentAddress + CLng(ElementSize\ElementSize)
>
> End Sub
>
> '----------------------------------------------------------
> Private Sub UploadData( _
> ByVal SpinRate As Single, _
> ByVal Minute As Byte, _
> ByVal StartAddress As Long, _
> ByVal EndAddress As Long)
>
> ' This procedure reads data stored in EEPROM and transmits the data
to
> ' the serial port.
> Dim Address As Long
> Address = StartAddress
>
> Do
> ' Read the data.
> Call GetEEPROM(Address, SpinRate, ElementSize)
> Debug.Print CStr(SpinRate)
> Address = Address + CLng(ElementSize)
>
> Call GetEEPROM(Address, Minute, ElementSize)
> Debug.Print CStr(Minute)
> Address = Address + CLng(ElementSize\ElementSize)
>
> Debug.Print
> Loop Until (Address >= EndAddress)
>
> Debug.Print "EOF"
>
> End Sub
>
> '----------------------------------------------------------
>
> [Non-text portions of this message have been removed]
>
------------------------------------

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )Re: Data Logging - dcsoup64 - Oct 16 12:32:14 2008
We also used the Coolpix S200 because it was available in the lab. It
turned out to be a pretty nice camera. I liked that you could program
it to take pictures at 30 second intervals or so until you ran out of
memory.
A tip for your launch: Use some silica gel or your windows will fog
up. Luckily we still got some great shots of the upper atmosphere with
the UAH name in the shot.
As far as the coding, we had similar issues but with a GPS. As
mentioned in the other post, we changed the elementsize to an actual
number while troubleshooting and it worked fine.
Here is a sample of our code:
sub savedata()
....
Call PutEEPROM(Current_EEPROM_Address, bMin, 2)
Current_EEPROM_Address=Current_EEPROM_Address + 2
Call PutEEPROM(Current_EEPROM_Address, bSecGPS, 2)
Current_EEPROM_Address=Current_EEPROM_Address + 2
...
...
sub uploaddata(....)
Call GetEEPROM(Address, bMin, 2)
Debug.Print CStr(bMin);
Debug.Print ":";
Address = Address+2
Call GetEEPROM(Address, bSecGPS, 2)
Debug.Print CStr(bSecGPS);
Debug.Print ", ";
Address = Address+2
--- In b...@yahoogroups.com, "sibs_0_09"
wrote:
>
> Hi Darren,
>
> We are using a Coolpix S200 I believe. Due to weight limitations for
> the package we had to go with a light weight camera. Plus that was
> available to us in the lab. If you need Hi Res I would probably go
> with something else.
>
> --- In b...@yahoogroups.com, "Darren Olson"
> wrote:
> >
> > HI Jeremy,
> >
> > I am also working on a wildlife project that is doing something
> similiar but
> > not a balloon. Our payload is a live Elk.
> >
> > What camera are you using?
> >
> > Thanks,
> >
> > Darren
> >
> > On Wed, Oct 15, 2008 at 12:40 PM, sibs_0_09 wrote:
> > >
> > [Non-text portions of this message have been removed]
>
------------------------------------

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )Re: Data Logging - sibs_0_09 - Oct 24 13:02:54 2008
Thanks Everyone,
I got my code to work. The problem was in the PutEEProm Sub program.
I passed the address by value and for some reason it kept saving over
the same address repeatedly. I changed it to pass by reference and it
fixed the problem.
Thank You all for the other errors you caught.
Jeremy
------------------------------------

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )