[Logo] Anarduino and HopeRF Community Forum
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics     [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Messages posted by: bruster999
Forum Index » Profile for bruster999 » Messages posted by bruster999
Author Message
Hi all,

I'm working on a project I found in Instructables (http://www.instructables.com/id/Uber-Home-Automation-w-Arduino-Pi/step2/Parts-List-and-Initial-Prep/). Great project and everything was working fine using an Arduino, a generic Ethernet shield with an RFM69HW 915Mhz module piggybacked on it as the gateway. The various sensors are using RFM69W 915Mhz modules to communicate with the gateway.

After upgrading my router from a DLink to a Motorola SBG6580 the gatway will no longer get the DHCP address from the router as long as the RFM69W module is attached. If I remove it, the gateway will connect to the router just fine and returns the IP address.

Any thoughts as to why it worked ok with the DLink router but not the Motorola. Because it worked previously I'm doubtful that there is a conflict with the h/w. Below is the relevant code. It gets stuck at the while loop in the setup().

Any input would be appreciated.

Based on work from author: Eric Tsai
Gateway ncorporating both the RFM69 and the ethernet part
Revised by Alexandre Bouillot

License: CC-BY-SA, https://creativecommons.org/licenses/by-sa/2.0/
Date: 10-23-2014
File: Gateway.ino
This sketch receives RFM wireless data and forwards it to Mosquitto relay

Modifications Needed:
1) Update encryption string "ENCRYPTKEY"
2) Adjust SS - Chip Select - for RFM69
3) Adjust MQTT server address

RFM69 Pinout:
MOSI = 11
MISO = 12
SCK = 13
SS = 8

Ethernet Pinout:
MOSI = 11
MISO = 12
SCK = 13
SS = 10

//general --------------------------------
#define SERIAL_BAUD 115200
#if 0
#define DEBUG1(expression) Serial.print(expression)
#define DEBUG2(expression, arg) Serial.print(expression, arg)
#define DEBUGLN1(expression) Serial.println(expression)
#define DEBUG1(expression)
#define DEBUG2(expression, arg)
#define DEBUGLN1(expression)
//RFM69 ----------------------------------
#include <RFM69.h>
#include <SPI.h>
#define NODEID 1 //unique for each node on same network
#define NETWORKID 100 //the same on all nodes that talk to each other
//#define FREQUENCY RF69_433MHZ
//#define FREQUENCY RF69_868MHZ
#define FREQUENCY RF69_915MHZ
#define ENCRYPTKEY "sampleEncryptKey" //exactly the same 16 characters/bytes on all nodes!
#define IS_RFM69HW //uncomment only for RFM69HW! Leave out if you have RFM69W!
#define ACK_TIME 30 // max # of ms to wait for an ack
#define RFM69_SS 8
RFM69 radio(RFM69_SS);
bool promiscuousMode = true; //set to 'true' to sniff all packets on the same network

#include <Ethernet.h>
bool conn_ok;
bool mydebug = false;

byte mac[] = {
0x90, 0xA2, 0xDA, 0x0D, 0x11, 0x11
byte server[] = {192, 168, 0, 134 }; //Linux server address

IPAddress ip(192, 168, 0, 4); //address of gateway device
EthernetClient ethClient;
#define DHCP_RETRY 500

// Mosquitto---------------
#include <PubSubClient.h>
PubSubClient client(server, 1883, callback, ethClient);
#define MQTT_CLIENT_ID "arduinoClient"
#define MQTT_RETRY 500
int sendMQTT = 0;
unsigned long MQTT_reconnect = 0;

void MQTTSendInt(PubSubClient* _client, int node, int sensor, int var, int val);
void MQTTSendULong(PubSubClient* _client, int node, int sensor, int var, unsigned long val);
void MQTTSendFloat(PubSubClient* _client, int node, int sensor, int var, float val);

//use LED for indicating MQTT connection status.
int led = 13;

typedef struct {
int nodeID;
int sensorID;
unsigned long var1_usl;
float var2_float;
float var3_float;
Payload theData;

volatile struct
int nodeID;
int sensorID;
unsigned long var1_usl;
float var2_float;
float var3_float; //
int var4_int;

void setup()
Serial.println("Rebooting Ethernet_RFM_Gateways_Combinedv1.0");

//Ethernet -------------------------
//Ethernet.begin(mac, ip);

// //wait for IP address
while (Ethernet.begin(mac) != 1) { //<<<--- gets stuck here--->>>
Serial.println("Error getting IP address via DHCP, trying again...");

Serial.println("ethernet OK");
// print your local IP address:
Serial.println("My IP address: ");
for (byte thisByte = 0; thisByte < 4; thisByte++) {
// print the value of each byte of the IP address:
Serial.print(Ethernet.localIP()[thisByte], DEC);

// Mosquitto ------------------------------
while (client.connect(MQTT_CLIENT_ID) != 1) {
DEBUGLN1("Error connecting to MQTT");
Serial.println("Connected to MQTT: ");

//RFM69 ---------------------------
#ifdef IS_RFM69HW
radio.setHighPower(); //uncomment only for RFM69HW!
Serial.println("setHighPower ok ");
char buff[50];
sprintf(buff, "\nListening at %d Mhz...", FREQUENCY == RF69_433MHZ ? 433 : FREQUENCY == RF69_868MHZ ? 868 : 915);

Serial.println("setup complete");
} // end of setup

byte ackCount = 0;
long watchdogInterval = 2000;
long watchdog = 0;

void loop() {

Hi all,

I just recently purchased my first miniWireless RFM69HW 915MHz module (AW-40225) and am excited to incorporate it into a few ongoing projects. These projects are battery operated so low power consumption is critical. I have tried several low power solutions such as the Node sample code from lowpowerlabs (https://www.github.com/lowpowerlab/rfm69), etc. but I can't seem to get the power consumption below 5ma. I have been reading quite a few posts and see that several people have achieved much lower power consumption with similar boards and I was hoping those fine people would be willing to share their secrets.

My config is simple, I am using the above mentioned module with no other sensors. I am applying 3.3v power directly to VCC and measuring the current with an Amprobe multi-meter. I would post the code but it is stock, and long.

Is there a newer/better library? Do I need to modify the stock RFM69 code?

Any input would be appreciated.
Forum Index » Profile for bruster999 » Messages posted by bruster999
Go to:   
Powered by JForum 2.1.9 © JForum Team