Loading...
  Show Posts
Pages: 1 2 [3] 4 5 ... 81
31  Using Arduino / Interfacing w/ Software on the Computer / Re: getting rid of Strings on: April 13, 2013, 09:05:32 am
I am still struggling with this logger.  I have whittled down the code to test the receiving and logging of the data.

The code is attached , based onNick Gammons serial receive.There is still alot of extra stuff in setup not used in this test.

What I have done for testing, is linked the data in on the embedded pcb  ( pin 14 hardwire NSS ) to pin 14 0n an arduino board, plus pin 1 RXD to pin 1 of the arduino )  I disconnect the link to the pin 1 of the Arduino board when testing the embedded board.

I can run the code below with the chip plugged into the Arduino board, and it works fine, sees all thecheckpoints, and logs the data ( to a Terminal display )

If I take out the chip and plug it into the embedded pcb,it logs the data headings in the setup routine, but doesnt get past the checking if serial available ( which is coming in on pin 14 )

The grounds are common .

Any ideas, I musthave done something stupid here ...

32  Using Arduino / Project Guidance / Re: will an attiny work for this project ? on: April 10, 2013, 03:47:14 pm
Thanks,  that looks hopeful,  I will look into that when I can
33  Using Arduino / Project Guidance / will an attiny work for this project ? on: April 10, 2013, 08:16:58 am
I am busy on 3 projects at once, one is to supply some devices I designed with cmos chips before finding arduino .

The one part is a small timer/transmitter running on a 3v  CR2450 coin cel .

Every 24 hours roughly, it must send a  battery OK / system check code ( I am using a Holtek HT12E at the moment and a Hope cheap 443 MhzTx )

If an event is triggered it sends an immediate different code.

There is another cmos chip to handle the sensors,  and  I am using an HCF4060 for the timing, and my total battery current averages 30 microamps, so the 620mAh battery should last 2 years.

There are quite a few components on the board, so I was thinking that perhaps I should switch to an Attiny ?

Could I get the sleep mode to draw 30 microamps ?   Actually it could be 100 microamps with no hassle.

Would there be a problem with 24 hour timing, I have had a quick look, but there seem to be quite a few different types, I would need one I can program with arduino code of course.

I was thinking that if it could sleep with a watchdog ?  timer on, and everytime it awoke it could increment a counter to get to the 24 hours ?   I dont think the watchdog is very long on these things ?.

And is there an interupt to detect the event input ?  for immediate transmission  -- using WirtualWire  .

Before I try anything ( when I get some time ) I just want to know if it is feasible, for the next orders.

The cmos chips are cheap, but the pcb and assemblly costs quite a bit, perhaps it would balance out.

Any advice ?
34  Using Arduino / Interfacing w/ Software on the Computer / getting rid of Strings on: April 07, 2013, 11:04:31 am
I have been warned away from strings or Strings, so I have revamped an old project to get rid of them, but I have to send data , which is now a mix of chars and integers, via a RS232 link to a PC for logging.

The user will be using an excel type program to display how they like, so I could send an integer and tell them how to interpret the data?

I can send all the headers fine via newsoftserial  ( this project was done in v22 ) , and the Megunalink terminal displays all the headings i setup fine, but not the subsequent data.  ( the monitor displays fine - I have reduced the number of prints for testing)

I have tried sending with the normal hardware serial but wasted many days trying, so now I am using the NSS version.

I have spent a lot of time sorting out other silly errors, and my brain hurts !   

A bit of guidance will be appreciated....


Code:


(The part in setup logs fine, but not in the loop )


( in set up )


    Serial.print (clockyear);
    Serial.print(",");

    Serial.print(clockmonth); 
    Serial.print(",");
 
    Serial.print(clockday);
    Serial.print(",");
 
    Serial.print (clockhours);
    Serial.print(",");

    Serial.print (clockmins);
    Serial.print(",");
    if ( searching == HIGH ) {
      Serial.print ("searching,");
    }
    else {
      Serial.print ("locked,");
    }

    if ( queue == HIGH ) {
      Serial.print ("NORMAL,");
    }
    else {
      Serial.print ("EXPRESS,");
    }
    //  Serial.print("  TICKET NUMBER= ");
    Serial.print (number);
    Serial.print(",");
    Serial.print ("PRINTING");
    Serial.println(",");
   
   
and in loop :-





   hardwired.print ( clockyear);
    hardwired.print(",");

    hardwired.print(clockmonth); 
    hardwired.print(",");
 
 
 
    hardwired.print(clockday);
    hardwired.print(",");

    hardwired.print (clockhours);
    hardwired.print(",");

    hardwired.print (clockmins);
    hardwired.print(",");
    if ( searching == HIGH ) {
      hardwired.print ("searching,");
    }
    else {
      hardwired.print ("locked,");
    }

    if ( queue == HIGH ) {
      hardwired.print ("NORMAL,");
    }
    else {
      hardwired.print ("EXPRESS,");
    }

    hardwired.print (number);
    hardwired.print(",");
    hardwired.print ("PRINTING");
    hardwired.println(",");
   
  Serial.print (number);
    Serial.print(",");
    Serial.print ("PRINTING");
    Serial.println(",");
   hardwired.print (char () clockyear);
    hardwired.print(",");
    hardwired.print(clockmonth); 
    hardwired.print(",");
    hardwired.print(clockday);
    hardwired.print(",");
    hardwired.print (clockhours);
    hardwired.print(",");
    hardwired.print (clockmins);
    hardwired.print(",");
    if ( searching == HIGH ) {
      hardwired.print ("searching,");
    }
    else {
      hardwired.print ("locked,");
    }

    if ( queue == HIGH ) {
      hardwired.print ("NORMAL,");
    }
    else {
      hardwired.print ("EXPRESS,");
    }

    hardwired.print (number);
    hardwired.print(",");
    hardwired.print ("PRINTING");
    hardwired.println(",");
   
   
35  Using Arduino / Networking, Protocols, and Devices / Re: assigning values from serial.read to an array on: April 06, 2013, 01:57:18 am
I put in an extra element as an ID and message start signal, so there are 11 now.
36  Using Arduino / Networking, Protocols, and Devices / Re: assigning values from serial.read to an array on: April 06, 2013, 12:08:53 am
Thanks Paul,
A nights sleep helped too.

The first number is the equipment ID number which I will always make > 99, to sync the message ( and the buffer now 11 locations ) so I got this working as below

I will not be using negative numbers so I ditched that bit

Code:
void processNumber (const long n)
{
  if ( n >99 ) {
    buffcounter =0 ;
  }
 
  buf [buffcounter] = n;

  Serial.print (" buff ");  
  Serial.print (buffcounter);
  Serial.print ("     =  ");
  Serial.println ( buf [buffcounter ]);


  buffcounter ++;  
  if ( buffcounter > 10 ) {
    buffcounter = 0 ;
  }


37  Using Arduino / Networking, Protocols, and Devices / assigning values from serial.read to an array on: April 05, 2013, 02:20:49 pm
After getting away for a while with some very naive code to receive serial data, I am now doing it properly :-)

Nick Gammons very helpful explanation   http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=11425&page=1
works fine, when I send from one arduino to the other.

The sketch as below prints out 10 numbers as predicted.

I dont understand the code in the switch statements,  but what I need to do is to simply allocate each number to buf[10] .

I can then use the array for logging.

It looks simple but the code has confused me. 






Code:
// Example of receiving numbers by Serial
// Author: Nick Gammon
// Date: 31 March 2012

const char startOfNumberDelimiter = '<';
const char endOfNumberDelimiter   = '>';

void setup ()
  {
  Serial.begin (115200);
  Serial.println ("Starting ...");
  } // end of setup
 
void processNumber (const long n)
  {
  Serial.println (n);
  }  // end of processNumber
 
void processInput ()
  {
  static long receivedNumber = 0;
  static boolean negative = false;
 
  byte c = Serial.read ();
 
  switch (c)
    {
     
    case endOfNumberDelimiter: 
      if (negative)
        processNumber (- receivedNumber);
      else
        processNumber (receivedNumber);

    // fall through to start a new number
    case startOfNumberDelimiter:
      receivedNumber = 0;
      negative = false;
      break;
     
    case '0' ... '9':
      receivedNumber *= 10;
      receivedNumber += c - '0';
      break;
     
    case '-':
      negative = true;
      break;
     
    } // end of switch 
  }  // end of processInput
 
void loop ()
  {
 
  if (Serial.available ())
    processInput ();
   
  // do other stuff here
  } // end of loop
38  Community / Bar Sport / Re: The spinning tube trick. on: March 28, 2013, 06:11:23 pm
What got me was that it appears to rotate about its centre, the slomo shows how it works though
39  Using Arduino / Displays / Re: can 2 lcds share one 3 wire 595? on: March 28, 2013, 06:09:26 pm
Thanks Bill, thats good news.

I will be leaving the backlight on for this project, so thats no issue,  I will try and write a simple sketch to try/post.
40  Community / Bar Sport / Re: The spinning tube trick. on: March 28, 2013, 06:53:58 am
Got me too !
41  Using Arduino / Displays / can 2 lcds share one 3 wire 595? on: March 27, 2013, 11:25:06 pm
I have been searching and there seem to be a lot of  2 and 3 wire libraries ( and posts )  plus some posts on sharing multiple lcds using the normal 6 wires.

If I were to use a 3 wire library ( whichever is best nowdays ),    can I disconnect the E pins from the lcds and parallel up all the other data pins from the single 595.

I would need 2 extra pins for the 2 Enables, which I could drive from my sketch independantly from the library.

The LiquidCrystal3W would think it is writing to one display, but I would latch the data to the appropriate LCD latch after sending to the 595 ?   Or is this not how it works?

Or perhaps I could use the 2 wire version, and then have N displays using 2+N pins.

If I was experienced enough to mess with libraries,  perhaps it would be possible to use the 4 data pin mode of the LCDs, and have 2 of the 595 outputs to latch either LCD enable pin ,    but I am not !

I dont think that would work as the latch would be too late....
42  Using Arduino / Networking, Protocols, and Devices / Re: reliable datagram RF22 library question on: March 25, 2013, 08:01:38 pm
That does look good, I will see how the SIM20 pans out, its quite handy only using 3 pins.
43  Using Arduino / Networking, Protocols, and Devices / Re: Need a 1KM range RF module for arduino on: March 25, 2013, 03:30:05 pm
The link says 100m range.

I am gtting 500m range with SIM20 modules without just a 17cm wire, they say you can get 1500m.
44  Using Arduino / Programming Questions / Re: AT+ command problem with SIM20 transceiver on: March 25, 2013, 05:50:59 am
Thanks,

I did look at Nicks site, I dont kow how I missed that.  It loooks very good, I will go over it again when I get a minute.  Crazy day !
45  Using Arduino / Programming Questions / Re: AT+ command problem with SIM20 transceiver on: March 24, 2013, 06:16:36 am
 // read from SIM and fill the buffer until you get OK;
  // when you get OK change awaiting_response to false

Can anyone give me a simple example of how to fill the buffer. I am used to VirtualWire doing this, but I am not using that here...

Pages: 1 2 [3] 4 5 ... 81