Show Posts
Pages: 1 ... 64 65 [66] 67 68 ... 97
976  Using Arduino / Project Guidance / Re: general ideas for data logging system on: May 31, 2012, 02:28:11 am
Thank Bob,   Wow  10000 posts ! you have been prolific, and a great help to our community.

I like those FRAMs that you linked to ( I must confess that I have been so busy in survival mode that I never get a chance to catch up on technology - which is why I am still using IDE 22 ! )

I think the Atmega could save a days worth anyway, I could get real miserly and save the queue type and teller number in one byte, and drop the date and seconds from the time served ( it must be the same day ) but it would be better to let them analys the data once a month if they wish.

I have thought of having a " backup" button for the supervisor to press to download to the card ( with a red light "do not remove card" while it is writing )

That way the buffer can carry on saving while he goes and dwonloads the data to his PC....

977  Using Arduino / Project Guidance / general ideas for data logging system on: May 31, 2012, 12:35:02 am
I have looked at some of the data logging ideas, but just need some advice on when to actually save data to the SD card ( as opposed to saving evey second/minute etc )

I am working on a queueing system , with a LED display showing the numbers of the current ticket being served, and by which teller.
There are in fact two types of ticket, "orders"  O and "collections" C , both of which are displayed.
The tellers simply press their O or C button to serve the next customer and the next consecutive number for that type will be displayed.

The data I wish to log is      1;  the ticket number  1-999
                                      2;  the type of transaction ( O or C )
                                      3;  date/time ticket printed
                                      4; date/time ticket number is displayed
                                      5;  teller number who pressed the button.

It is not a high throughput system, perhaps 100 customers a day, so I am not sure that I want to save to the SD card every time a button is pushed.
I will have a small lead acid battery for the electronics ( not the LEDs ) so that the current ticket count is not lost during power outages.

Should I buffer the data and perhaps log every hour or so?  or every day?
I know you shouldnt remove the card while operating, so perhaps I should have a button for the manager to press before removing the card, that backs up the latest data, and then changes a LED from red to green to say it is safe to remove?

978  Using Arduino / Project Guidance / Re: GPS clock almost working right - on: April 14, 2012, 11:14:20 am
Adding a 50 mS delay after the VW send command seems to have sorted it out,  I cannot remember when I removed it !

No that wasnt it either !

I am now puttting the free running timer in the display end, to take over if no gps received..
979  Using Arduino / Project Guidance / Re: GPS clock almost working right , getting closer ! on: April 14, 2012, 05:35:13 am
OK,  the problem seems to be at the display and data receiving end, see sketch below.

The data is coming in OK but it sometimes blanks, so it is thinking that it hasn't had data for 125 seconds.

It does come back on later.

I think I have seen a delay (50) after sending the shiftout data, but it seems to have disappeared along the line somewhere, could this be the trouble?

Any ideas out there ?

Code:
//     GPS clock receiver using twin wire and virtualwire
    
    #include <VirtualWire.h
    
    #define latchPin 19  // rck
    #define clockPin 18  // sck
    #define dataPin 16   // ser in
    
    unsigned long prevmillis =0;
    
    int hourunits;
    int hourtens;
    int minunits;
    int mintens;
     int temptens;
    int tempunits;
  
    const byte digitTable [10] = {
   B11111110, B10110000, B11101101, B11111001, B10110011,  //  first bit for switching on degree C letter
   B11011011, B11011111, B11110000, B11111111, B11111011};
    
    void setup()
    { Serial.begin(9600); // Debugging only
    
      pinMode ( latchPin, OUTPUT);
      pinMode ( clockPin, OUTPUT);
      pinMode ( dataPin, OUTPUT);
    
       digitalWrite(latchPin, LOW);
      
    shiftOut(dataPin, clockPin, LSBFIRST, B00000000);  // clear display
    shiftOut(dataPin, clockPin, LSBFIRST, B00000000);
    shiftOut(dataPin, clockPin, LSBFIRST, B00000000);
    shiftOut(dataPin, clockPin, LSBFIRST, B00000000);
    shiftOut(dataPin, clockPin, LSBFIRST, B00000000);
    shiftOut(dataPin, clockPin, LSBFIRST, B00000000);
    
      digitalWrite(latchPin, HIGH);
      
    
      vw_set_rx_pin(9);        // set Rx
      vw_setup(2000); // Bits per sec
      vw_rx_start();    
    }
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    void loop ()
    {
      //        CHECK FOR INCOMING MESSAGE  
      uint8_t buf[VW_MAX_MESSAGE_LEN];
      uint8_t buflen = VW_MAX_MESSAGE_LEN;
      if (vw_get_message(buf, &buflen)) // if data received update displays
      {
         hourunits = buf[0];
         hourtens = buf[1];
         minunits = buf [2];
         mintens = buf [3];
         temptens = buf [4];
         tempunits = buf [5];
          
      show ();  // runs the display function
      
     prevmillis = millis ();  //  resets the timeout blanking timer
      }//  end of if message received
      
      if ( millis () - prevmillis >= 125000 )   //  if no update received within 125 seconds, clears the display
      {
      digitalWrite(latchPin, LOW);
           shiftOut(dataPin, clockPin, LSBFIRST, B00000000);  // clear display
           shiftOut(dataPin, clockPin, LSBFIRST, B00000000);
           shiftOut(dataPin, clockPin, LSBFIRST, B00000000);
           shiftOut(dataPin, clockPin, LSBFIRST, B00000000);
           shiftOut(dataPin, clockPin, LSBFIRST, B00000000);
           shiftOut(dataPin, clockPin, LSBFIRST, B00000000);
       digitalWrite(latchPin, HIGH);  
      }  
        Serial.println(prevmillis, BIN);
    }  //  end of loop  
 
 
    
    void show ()
    {
      
      int  HU = digitTable [hourunits];
      int  HT = digitTable [hourtens];
      int  MU = digitTable [minunits];
      int  MT = digitTable [mintens];
      int  TU = digitTable [tempunits];
      int  TT = digitTable [temptens];
      
      digitalWrite(latchPin, LOW);
    
         shiftOut(dataPin, clockPin, LSBFIRST, TT);
         shiftOut(dataPin, clockPin, LSBFIRST, TU);
      shiftOut(dataPin, clockPin, LSBFIRST, HU);  
      shiftOut(dataPin, clockPin, LSBFIRST, HT);
      shiftOut(dataPin, clockPin, LSBFIRST, MU);
      shiftOut(dataPin, clockPin, LSBFIRST, MT);
      
      digitalWrite(latchPin, HIGH);
         Serial.println(" sending data ");
  
    }  // end of showT function
    
   
    
980  Using Arduino / Project Guidance / Re: Arduino and LM35DZ Centigrade thermistor. on: April 14, 2012, 01:36:33 am
There are 1024 analog " steps" read by the analog input
981  Using Arduino / Project Guidance / Re: GPS clock almost working right on: April 14, 2012, 01:34:17 am
Mine is much the same, but I have written my code to blink the LED until there is a new valid sentance, then stay solid while locked.  It just seems more logical to me.

The millis clock is fine as it doesnt drift more than a second over 5 hours ( I unplugged the gps backup battery to test this )
This is fine as I dont expect it to lose lock for more than a minute.
It corrects on aquisition of valid sentance again.

We don't have WWV here in Africa , we havn't even got fast ADSL yet ( mine downloads at 340K and they call it fast :-) )

To test the drift I sync the PC clock to time.windows before and at the end of measurements.

I have only seen the GPS lose signal once in 6 months of playing with these.  In fact it is extremely difficult to make it lose lock, even with the antenna facing down, and an aluminium pot over it.

I use VirtualWire through a "real wire" as I might want to use an RF link on some similar projects ( plus its versatile with choosing the serial pin )
982  Using Arduino / Project Guidance / Re: need ideas on what connector to use to connect temp probe to arduino project box on: April 13, 2012, 08:26:23 pm
Also bear in mind that if plugging in with power on,  stereo plugs momentarily short out the connections ..
983  Using Arduino / Project Guidance / Re: GPS clock almost working right on: April 13, 2012, 07:54:09 pm
I wasnt charmed when I checked the Lotto last night though :-)

Thats a great little clock you made there !
984  Using Arduino / Project Guidance / Re: GPS clock almost working right on: April 13, 2012, 12:56:49 pm
True Bob,   I am going to leave this running to see if the tweaks have solved it, its just such a simple sketch that I can't believe it has a bug :-)

I really dont need more than 2000 for any reason.  The VW library is so stable in all my other sketches, I am sure its not the problem.
985  Using Arduino / Project Guidance / Re: GPS clock almost working right on: April 13, 2012, 12:30:32 pm
I think I heard about your clock, I tried to monitor the clock drift and vary the interval to compensate, but I am not experienced enough and it all went pear shaped :-)

So I checked the gps receiver for drop out ( I have an LED showing valid sentance received ) and it never flashes, so my freerunning clock I just let run if  the gps were to drop out.
I tested it by lifting the battery supply to the gps, the LED flashed to show no data received , and 6 hours later, the clock was within a second of the computer clock.

I am not expecting more than a minute of gps signal loss, and when it comes back it resets the freerunning clock time and millis clock anyway, so it is perfectly in sync again.

The signal through the cable is perfect ( its the 3rd wire of a 5 metre core mains cable that carries the 12v for the LEDs etc ) at the faster 2000 rate, so I am going to take it much faster, I dont know what governs the choice of baud rate  if the waveforms are good, and I am only sending 6 bytes once a minute  ????
986  Using Arduino / Project Guidance / Re: GPS clock almost working right on: April 13, 2012, 10:30:16 am
I havn't even checked to see what was connected where , with pin 1 plugged into 2 on the socket etc, perhaps I have blown some ports that I am not using, but its still running , the 5v reg has a thermal limiter that probably limited the damage, but I couldn't touch the chip for about a minute !

I have done the lotto tonight just in case, Friday the 13th might stay lucky for me !
987  Using Arduino / Project Guidance / Re: GPS clock almost working right on: April 13, 2012, 09:21:56 am
Well I managed to catch it while in the fault condition, and saw that the VW data was going out OK, but when I scoped the input pin on the display micro, it came back on.  Could be poor connection on the IC socket ?
I cleaned the socket with some switch cleaner and also doubled the baud rate both ends ( up from 1000 to 2000 )

Switched on ( on Friday 13th ) and nothing !  I left it a couple of minutes to verify the minute, but smelled burning :-(  the 5v regulator and the Atmega burnt my fingers.

I had plugged the micro in one pin offset, and it is my last chip !

Being the optimist, when it had cooled down enough to touch, I plugged in the chip correctly, and voila ! its working,  what a lovely chip , no wonder the Arduino is so succesful.

I often plug the chips in backwards in the middle of the night, and they can take it without damage.

So now I must wait to see if the intermittent fault shows up again.  It might have been a clash with the data rate too low ??

I will see.  I have also corrected the unsigned long  millis declaration........
988  Using Arduino / Project Guidance / Re: GPS clock almost working right on: April 13, 2012, 12:48:24 am
LOL,    I meant if my gps receiving box hung up !
989  Using Arduino / Project Guidance / Re: GPS clock almost working right on: April 13, 2012, 12:44:19 am
True..

I will change it anyway, and perhaps I will let the clock wait for 5 minutes before blanking,  or even put another free running clock in the display micro to take over if nothing is coming in...not ideal as it might show the wrong time if the gps unit  one hangs up for a week :-(
990  Using Arduino / Project Guidance / Re: GPS clock almost working right on: April 12, 2012, 10:20:17 pm
Ah !  I have just noticed that I defined

 long previousMillis = 0; 

instead of the normal unsigned long, so perhaps this was overrunning when the unit had been on a long time ( it gets set to millis () at one point )    ??

Pages: 1 ... 64 65 [66] 67 68 ... 97