Timing tests have begun!

This slideshow requires JavaScript.

Yesterday’s problem, that riddled me for a few hours last night… was that I depended on an array stored in EEPROM to handle the menu system, and for the new AVR’s…. I didn’t initialize the EEPROM. I learned my lesson, I’ll always put a ‘List to do for new AVR’s’ at the top of my projects, so that when I am in that situation again, I’ll look at that list to make sure it works, the first time. Also save often. I was working on the below code, and had it almost finished, when my PC reset. Not fun (Ctrl + S)!

Luckily getting it working was one of the first things I did tonight, the other, was to setup both Wireless Testers (WT) for a timing experiment. They both have 16 MHz resonators, and I want to see how quickly they drift apart with time. So I have a test pin, A0 (PORT C pin 0), that is connected to both WT’s, and a single connected to 3.3V. Each has a 10K pulldown resistor. When I remove the wire from 3.3V, the test starts.

In the test, it gets the current time, compares it to the time the test started, and saves it to a 16GB SD card, and it does this every 100 ms. As I have found in my preliminary testing, sometimes a SD card write can take longer than a second. I have a flag that is set if the time hasn’t exceeded 100ms, at which point it waits until 100ms before taking another measurement. I am curious if as the file gets bigger, will it start to take longer to write to it? Can the arduino handle really big file sizes? I have it running right now, and I intend to leave it running all night.

With both systems working, both LCD’s and SDCards(If I don’t fry it tonight), I’ll start working on the design of the wireless testing plan. Contrary to this test, writing all of the data transferred to the SD card won’t be the objective, the objective will be to test the wireless modules. So a simple time stamp, as well as if the packet was received with the correct checksum, will be sufficient. I will create a simple python script to handle the data, so I won’t have to put it into excel to get the important statistics.

I am really looking forward to making the controller, and all of the little projects that are associated with it. Progress!!!

Here is a code Snippet:

if(mainarray[curse + offset] == COMPARETIME)
{ //save often, computer crashed, and took out this entire function :/ Live and learn
//Idea of this function, is to synchronize time between two systems, by connecting them
//to a common point, with a common voltage, that is changed at the same time.
//A0 is that common point (with 10k pull down resistors. Connect A0 to 3.3V first
lcd.print("Connect A0 to 3.3V");
while( analogRead(A0) 500){}; //depends on capacitance
time1 = micros();
//save to card
myFile = SD.open("CTime1.txt", FILE_WRITE);
time2 = time1;
//wait till time up
targettime = time2 + 25000; //100 ms between measurements
notime = 1; //if there isn't any time left, then this will show as 1
while(micros() 76) //button pressed
//save to SD card, when the abort happened
myFile = SD.open("CTime1.txt", FILE_WRITE);
//display to LCD


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s