Show Posts
Pages: [1] 2 3 ... 6
1  Using Arduino / Programming Questions / Re: 1st code on: April 16, 2014, 10:54:29 am
It sounds like you need to uninstall and reinstall the IDE. All the examples should compile without errors.

The names of your variables or labels are up to you as long as the variables don't start with a number.

-transfinite
2  Using Arduino / General Electronics / Re: Open a door with a smartphone and an arduino uno on: April 16, 2014, 09:50:00 am
You can create a simple webserver on the Arduino that your phone can connect to with a browser to change the state of an LED. Once you have success with that, you can change the state of the door, as well as the LED.

There are a number of examples on the Arduino Playground that explain how to use the Ethernet shield to set up a webserver.

http://playground.arduino.cc/Main/InterfacingWithHardware#Communication
http://playground.arduino.cc/Code/WebServer

-transfinite
3  Using Arduino / Programming Questions / Re: 1st code on: April 16, 2014, 09:25:57 am
Even with no hardware, you can download the Arduino IDE and compile your code. If you do this you will find a number of simple errors.  Variables cannot start with a number.  So on line 27 change:
  const int 1ButtonPin = 2;
to
  const int ButtonPin1 = 2;

Same for lines 28, 29.  On line 58, bledPin is not defined.  You meant BledPin. 
1buttonState (line 36) is not defined, nor is 2buttonState or 3buttonState.

Most of these are just syntax errors that the compiler will find for you.

-transfinite
4  Using Arduino / Networking, Protocols, and Devices / Re: Establish connection between Arduino + Ethernet shield and Node.js web server. on: February 06, 2014, 05:24:04 pm
Not quite what you asked for, but take a look at bitlash-commander.  It provides some instruction for talking to Arduino with node.js:

  https://github.com/billroy/bitlash-commander

If you get it working, you'll be many steps closer to what you are trying to do.

-transfinite
5  Using Arduino / LEDs and Multiplexing / Re: How can I use multiple 3-digit 7-segment displays on: January 02, 2014, 01:37:40 pm
If you use i2c 7 segment displays, you can add multiple sets of digits fairly easily, otherwise, you may need a Mega to have enough pins.

Adafruit, and others have i2c 7 segment displays, but usually in sets of 4 not 3 as you need.  You can use the Adafruit matrix driver backpack to wire 3 sets of digits, and control them with i2c:  http://www.adafruit.com/products/1427

-transfinite
6  Using Arduino / LEDs and Multiplexing / Re: Bedroom led lightning on: January 02, 2014, 12:33:13 pm
Zambo,

The code doesn't look too bad to me. As for the wiring, that you may want to hide.   :-)
I'd consider using a prototype shield, and use point to point wiring to make it look neater, and more permanent. Then mount it in a plastic or wooden enclosure.

The second photo is really small, but it looks like a nice project. Is it bright enough that you don't need any additional room lighting?

-transfinite
7  Using Arduino / Networking, Protocols, and Devices / Re: rf2401 problem with mega 2560 on: December 18, 2013, 06:17:13 pm
The download link is on this page:
  https://github.com/maniacbug/RF24

Here is the direct link:
  https://github.com/maniacbug/RF24/archive/master.zip


-transfinite
8  Community / Exhibition / Gallery / Re: GPS time-date on: December 17, 2013, 05:38:13 pm
Nice write up. Thanks for the links to the GPS sources also.

I'm using Jack Christensen's timezone library to determine when daylight saving time hits, and update the GMT offset:

  https://github.com/JChristensen/Timezone

That would save you a switch at the expense of some flash.

It would be even cooler to use the GPS to determine the GMT offset depending upon the location of the GPS.  That's only useful if the clock plans to change location from time to time.

-transfinite
9  Using Arduino / Networking, Protocols, and Devices / Re: Please review my RF24 IoT network on: October 03, 2013, 09:06:32 pm
There's a bug in the new node code.  I added some print statements in the base to print the received temp, humidity, and pressure.  In the new node code I added one line to set the pressure to a constant:

  header.sensor.temp = 18.8;
  header.sensor.pressure = 30.1;

In the prior versions of node, I would receive the temp and pressure values on the base, but with the current version I receive an ovf (overflow) for the pressure. The temp is still ok. Seems like a fencepost error somewhere, but I haven't found it yet.

-transfinite

10  Using Arduino / Networking, Protocols, and Devices / Re: Arduino pro mini and nRF24l01 on: October 01, 2013, 04:17:41 pm
Since you've confirmed the LCD works, you should try a simple example sketch to test the communication between the nRF24l01+ modules.

Take a look at the examples here, using the mirf library: http://arduino-info.wikispaces.com/nRF24L01-Mirf-Examples

The 3.3V version of the pro mini should be a good match for the nRF24l01+ module.

-transfinite
11  Using Arduino / Networking, Protocols, and Devices / Re: Please review my RF24 IoT network on: October 01, 2013, 11:15:32 am
After having time to think about it (but not enough time to actually test it), the code I posted without the delay missed the point of checking for serial availability without pausing. The call to beARelay()is not supposed to be inside the if(currentMillis... block. That defeats the whole purpose of it.  To make it more explicit, I'd move the check for serial out of beARelay, and back into the main loop like this:

Code:
long previousMillis = 0;

void loop(void){
  unsigned long currentMillis = millis();

  if(currentMillis - previousMillis > 3000){
    previousMillis = currentMillis;
   
    header.ID = random(1, 0xffff);   // Identify this packet
    xmit(header.ID);                 // Send some data
    wait(MAX_RETRIES, header);       // Wait for it to be acknowledged
  }
 
  if (Serial.available()){
beARelay();
  }
}

Hopefully, that makes sense.

On large hop counts- I noticed that since the fix to the relay, I'm only seeing large hop counts when I'm at the edge of the radio's range.  I was seeing this when I moved a node upstairs.  I moved the relay just a few inches closer (and away from a metal lamp), and it ran overnight without a non-zero hop count.

I just ordered a RF24 radio with an external antenna to see how that affect the range.

-transfinite
12  Using Arduino / Networking, Protocols, and Devices / Re: Please review my RF24 IoT network on: September 30, 2013, 12:59:26 pm
That is more readable, but I don't understand why you reallocate header in xmit() and beARelay()when it is already a global variable. I'd leave the redeclaration of HEADER header out.

Also, as in the original node, the delay(3000) and then checking for Serial.available() just doesn't seem like a good idea. The delay should be removed, and replaced with something like:

Code:
long previousMillis = 0;

void loop(void){
  unsigned long currentMillis = millis();

  if(currentMillis - previousMillis > 3000) {
    previousMillis = currentMillis;
   
    header.ID = random(1, 0xffff);    // Identify this packet
    xmit(header.ID);                       // Send some data
    wait(MAX_RETRIES, header);       // Wait for it to be acknowledged
    beARelay();
  }
}

Otherwise, it's all good.

-transfinite
13  Using Arduino / Networking, Protocols, and Devices / Re: Arduino pro mini and nRF24l01 on: September 29, 2013, 06:35:28 pm
The schematic at the URL posted has the nRF24l01+ powered at 5VDC. Those devices require 3.3VDC for power. The pins are 5V tolerant, but the device still has to be powered at 3.3V.

If you are not seeing anything on the LCD, try copying the

   displayMessage( cacheMessage, copyrightMessage );

statement, and put it right after the lcd.noAutoscroll(); line in setup().  You should at least see the copyrightMessage on the LCD.  If not, double check your wiring.  You might try it without the nRF24l01+ in place.

-transfinite
14  Using Arduino / Networking, Protocols, and Devices / Re: Please review my RF24 IoT network on: September 28, 2013, 10:23:34 am
I noticed the missing braces yesterday while I was getting rid of the gotos from node.ino. I just couldn't deal with them any longer.
This seems to be working for me. I mostly just added a while loop. Posted in its entirety for clarity.

Code:
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"

RF24 radio(9,10);

#define RELAYBROADCAST(x) (0xAA00000000LL + x)
#define NODEACK(x) (0xCC00000000LL + x)

struct SENSOR{
  float temp;
  float humidity;
  float pressure;
};

struct HEADER{
  long type;
  long hops;
  long src;
  long ID;
  SENSOR sensor;
};

  HEADER header;

  long cnt[10] = {};
  byte cntID = 0;
  byte retries = 0;             //how many times have we tried to rx
  const byte MAX_RETRIES = 5;  //how many times will we try?
 

void setup(void){
  Serial.begin(57600);
  radio.begin();
  radio.setRetries(15,15);
  radio.enableDynamicPayloads();
  randomSeed(analogRead(0));
  Serial.println("node starting...");
  radio.openReadingPipe(1 ,NODEACK(1));
  radio.openWritingPipe(RELAYBROADCAST(2));
  radio.startListening();
 }

void loop(void){
  header.ID = random(1, 0xffff);    //this is above the label for testing
  while (retries < MAX_RETRIES) {

    radio.stopListening();
    header.type = 3;
    header.hops = 0;
    header.src = 0xabcd;
   
    header.sensor.temp = 78.8;
    Serial.println(header.ID, HEX);
    //send a relay broadcast to any relay that can hear
    radio.openWritingPipe(RELAYBROADCAST(1));
    radio.write( &header, sizeof(header), true );
    radio.startListening();
    // Wait here until we get a response, or timeout (250ms)
    unsigned long started_waiting_at = millis();
    bool timeout = false;
    while ( ! radio.available() && ! timeout )
      if (millis() - started_waiting_at > 200 )
        timeout = true;

    // Describe the results
    if ( timeout ){
      Serial.print("NACK");
      retries++;
    }
    else {
      long src;      //ack returns just the header.ID, so check what was returned with what was sent
      radio.read( &src, radio.getDynamicPayloadSize() );
      if (src == header.ID) {
        Serial.print("ACK: "); Serial.println(src, HEX);
        retries = 0;
        break;
      }
    }
  }
 
  retries = 0;
  delay(3000);

  //testing
if ( Serial.available() )
  {
    radio.stopListening();
    Serial.read();
    header.type = 3;
    header.hops = 0;
    header.src = 0xabcd;
    header.ID = random(1, 0xffff);

    Serial.println(header.ID, HEX);
  //send a relay broadcast
  radio.openWritingPipe(RELAYBROADCAST(2));
  bool ok = radio.write( &header, sizeof(header), true );
  radio.startListening();
  }
}

-transfinite
15  Using Arduino / Networking, Protocols, and Devices / Re: Please review my RF24 IoT network on: September 26, 2013, 10:52:37 am
JohnHoward, how are you supplying 3.3v to the RF module from the pro minis? Or are you using the 3.3v version of the mini?

I'm mostly using nano's, but since the pro minis are so cheap on ebay these days, I'm thinking I won't even use headers. I'll just solder wires directly from the mini to the rf24 module and to a temp sensor to minimize cost and space.

-transfinite
Pages: [1] 2 3 ... 6