Show Posts
|
|
Pages: [1] 2 3 ... 7
|
|
1
|
Using Arduino / Networking, Protocols, and Devices / Re: nRF24L01+ and roles
|
on: May 23, 2013, 08:45:43 am
|
Perhaps i should post some code that might help, this is the modules part, and at the end of the loop part you can see the if, where i want the role thing. //RX
#include <RF24Network.h> #include <RF24.h> #include <SPI.h> #include <printf.h> #include <OneWire.h> #include <DallasTemperature.h>
//########################### DS18B20 MAIN #############################
// Data wire is plugged into pin 6 on the module #define ONE_WIRE_BUS 6 // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) OneWire oneWire(ONE_WIRE_BUS); // Pass our oneWire reference to Dallas Temperature. DallasTemperature sensors(&oneWire);
//########################### NRF24L01 MAIN #############################
// nRF24L01(+) radio attached using Getting Started board RF24 radio(8,7); // Network uses that radio RF24Network network(radio); // Address of our node const uint16_t this_node = 1; // Address of the other node const uint16_t other_node = 0; // How often to send 'hello world to the other unit const unsigned long interval = 2000; //ms // When did we last send? unsigned long last_sent; // How many have we sent already unsigned long packets_sent; // Structure of our payload struct payload_t { float temperatura; unsigned long ms; unsigned int order; unsigned long counter; };
void setup(void) { Serial.begin(57600); Serial.println("RF24Network/examples/helloworld_rx/"); sensors.begin(); SPI.begin(); radio.begin(); network.begin(/*channel*/ 90, /*node address*/ this_node); }
//########################### NRF24L01 LOOP #############################
void loop(void) { // Pump the network regularly network.update(); // Is there anything ready for us? while ( network.available() ) { // If so, grab it and print it out RF24NetworkHeader header; payload_t payload; network.read(header,&payload,sizeof(payload)); Serial.print("Received packet #"); Serial.println(payload.counter); Serial.print(" Milisegundos "); Serial.println(payload.order); Serial.print(" Temperatura remota "); Serial.println(payload.temperatura); Serial.print(" Order "); Serial.println(payload.ms); if (payload.order == 1) { //Change mode and send temp
temp(); }
}
//########################### DS18B20 VOID #############################
void temp() { sensors.requestTemperatures(); // Send the command to get temperatures
Serial.print(" Arduino Temperature: "); Serial.println(sensors.getTempCByIndex(0)); // Why "byIndex"? You can have more than one IC on the same bus. 0 refers to the first IC on the wire delay (1000); }
|
|
|
|
|
2
|
Using Arduino / Networking, Protocols, and Devices / nRF24L01+ and roles
|
on: May 23, 2013, 08:14:57 am
|
Hello all, once again... I have a couple of questions about the roles on nRF24L01+. I'm using the RF24 lib, my "network" wont be a tree, but a star, where i have my main equipment, and the individual modules will communicate only with the main. at the moment i have my main recieving and the nodes transmitting but what i really need is to have the nodes in receive mode and when they get a specific request it will automatically change his own role to send the answer to the main, example: Temperature Main Module Ask temp -------------------------------> receive request receive ack (automatic) <------------------------------- send ack (automatic) change to receive mode -------------------------------- change to send mode receive answer <------------------------------- send answer send ack (automatic) -------------------------------> receive ack (automatic) change to send mode -------------------------------- change to receive mode The http://maniacbug.github.io/RF24/pingpair_8pde-example.html is long and a bit confusing to me to be honest, im looking for an extremelly easy, small code example that dont need human interation like printf("*** PRESS 'T' to begin transmitting to the other node\n\r"); Other question: is it really need to set pipes? what about the // sets the role of this unit in hardware. Connect to GND to be the 'pong' receiver // Leave open to be the 'ping' transmitter const int role_pin = 7;
what does he mean by that? Thanks in advance and sorry for the looong noob post
|
|
|
|
|
5
|
Using Arduino / Microcontrollers / Re: Arduino Mega with NRF24L01+ and NRF24L01+ with Atmega328p
|
on: May 15, 2013, 04:26:49 pm
|
Unfortunatly i'm back with some bad news :S first of all, ill post my code on each side then the connections... Arduino Side (tx) /* Copyright (C) 2011 James Coliz, Jr. <maniacbug@ymail.com>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. */
#include <RF24Network.h> #include <RF24.h> #include <SPI.h>
// nRF24L01(+) radio attached using Getting Started board RF24 radio(49,53); // Network uses that radio RF24Network network(radio); // Address of our node const uint16_t this_node = 1; // Address of the other node const uint16_t other_node = 0; // How often to send 'hello world to the other unit const unsigned long interval = 2000; //ms // When did we last send? unsigned long last_sent; // How many have we sent already unsigned long packets_sent; // Structure of our payload struct payload_t { unsigned long ms; unsigned long counter; };
void setup(void) { Serial.begin(57600); Serial.println("RF24Network/examples/helloworld_tx/"); SPI.begin(); radio.begin(); network.begin(/*channel*/ 90, /*node address*/ this_node); }
void loop(void) { // Pump the network regularly network.update(); // If it's time to send a message, send it! unsigned long now = millis(); if ( now - last_sent >= interval ) { last_sent = now; Serial.print("Sending..."); payload_t payload = { millis(), packets_sent++ }; RF24NetworkHeader header(/*to node*/ other_node); bool ok = network.write(header,&payload,sizeof(payload)); if (ok) Serial.println("ok."); else Serial.println("failed."); } } Connections: nrf24l01+ Arduino Mega 2560 1-GND GND 2-VCC 5v 3-CE 53 or 49 4-CSN 49 or 53 5-SCK 52 6-MOSI 51 7-MISO 48 ATMega328p on breadboard (RX) //RX
#include <RF24Network.h> #include <RF24.h> #include <SPI.h>
// nRF24L01(+) radio attached using Getting Started board RF24 radio(49,53); // Network uses that radio RF24Network network(radio); // Address of our node const uint16_t this_node = 0; // Address of the other node const uint16_t other_node = 1; // How often to send 'hello world to the other unit const unsigned long interval = 2000; //ms // When did we last send? unsigned long last_sent; // How many have we sent already unsigned long packets_sent; // Structure of our payload struct payload_t { unsigned long ms; unsigned long counter; };
void setup(void) { Serial.begin(57600); Serial.println("RF24Network/examples/helloworld_tx/"); SPI.begin(); radio.begin(); network.begin(/*channel*/ 90, /*node address*/ this_node); }
void loop(void) { // Pump the network regularly network.update(); // Is there anything ready for us? while ( network.available() ) { // If so, grab it and print it out RF24NetworkHeader header; payload_t payload; network.read(header,&payload,sizeof(payload)); Serial.print("Received packet #"); Serial.print(payload.counter); Serial.print(" at "); Serial.println(payload.ms); } } Connections: nrf24l01+ ATMega328p 1-GND GND 2-VCC 5v 3-CE 14 4-CSN 15 5-SCK 19 6-MOSI 17 7-MISO 18 Results: On Arduino (tx) with CE on 53 and CSN on 49 RF24Network/examples/helloworld_tx/ Sending...failed. Sending...failed. Sending...failed. only with CSN on 49 Sending...RF24Network/examples/helloworld_tx/ Sending...failed. Sending...failed. Sending...failed. Without CE or CSN RF24Network/examples/helloworld_tx/ Sending...ok. Sending...ok.
Something must be wrong and im too blind/newb to see. Maybe the pins on ATMega328p (breadboard)? maybe arduino? maybe both? I tried to be as explicit as possible and btw, the code was from http://maniacbug.wordpress.com/2012/03/30/rf24network/Thanks in advance
|
|
|
|
|
9
|
Using Arduino / Microcontrollers / Arduino Mega with NRF24L01+ and NRF24L01+ with Atmega328p
|
on: May 12, 2013, 04:31:54 pm
|
|
Hello all,
im here, trying to get help to get myself out of misery... I've been searching for info on how to achieve my goal, but i still couldn't find :S
Basically i have an Arduino Mega 2560, 2x NRF24L01+ (5v capable) and an Atmega328p on a breadboard... I would like to know the connections i should make, since i have already found several versions and none worked... I know that this post asks for a lot, but im quite desperate...
First Step:
NRF24L01+ / Arduino Mega 1-GND GND 2-VCC VCC 3-CE ? 4-CSN ? 5-SCK ? 6-MOSI ? 7-MISO ? 8-IRQ ?
Can you fill the ? please
Second Step:
NRF24L01+ / Atmega328p (breadboard with 16mhz crystal)
1-GND GND 2-VCC VCC 3-CE ? 4-CSN ? 5-SCK ? 6-MOSI ? 7-MISO ? 8-IRQ ?
Can you fill the ? please
The purpose of this is to use the arduino to activate a relay on the breadboard and then receive the completed order
If i know that the hardware part is correct, i can go and deal only with the software part
Thanks in advance
|
|
|
|
|
11
|
Using Arduino / General Electronics / Re: error on power supply
|
on: February 04, 2013, 05:39:08 pm
|
i see now... errors aproved. i thought i couldnt proceed without fixing it  THANK YOU ALL!!! pin 1 from JP3 is the lamp i want to turn on. i didnt understand this... you do need to decide if you are using output 1 or ouput 2 output 1 is pin 6 0V pin 7 +V output 2 is pin 9 0v pin 10 +V thanks in advance
|
|
|
|
|
12
|
Using Arduino / General Electronics / Re: error on power supply
|
on: February 04, 2013, 11:25:59 am
|
i want to thanks to everyone that tried to help so far. crap i feel real dumb... i still cant solve my problem. i tried to rename but with no sucess... i've added the schematic on the first post, please help me 
|
|
|
|
|
13
|
Using Arduino / General Electronics / Re: error on power supply
|
on: February 04, 2013, 08:08:05 am
|
|
i still couldn't understand what im doing wrong... my problem started after i putted Myrra 47152 to convert (input) 220v to (Output) 5v, and then i connected those 5v to the rest of the board.
|
|
|
|
|
14
|
Using Arduino / General Electronics / error on power supply
|
on: February 01, 2013, 08:02:49 am
|
|
Hello,
I've made a schematic but it gives me and error: "OUTPUT and SUPPLY pins are mixed on net +5V (out) "OUTPUT and SUPPLY pins are mixed on net +5V (sup) and "OUTPUT and SUPPLY pins are mixed on net GND (out) "OUTPUT and SUPPLY pins are mixed on net GND (out)
i dont know how to correct it... can someone give an hand please?
Thanks in advance
|
|
|
|
|