|
Post by johno123 on Feb 18, 2015 16:27:05 GMT
Eric, that is an awesome idea. I already purchased a copy from OSH. Thanks again
|
|
|
Post by thinkpeace on Feb 19, 2015 17:54:31 GMT
Thanks for sharing Eric. OSH park is a great deal and I'm planning to do some sensor nodes. Do you have any sensor nodes designed yet? I'm working on a garden sensor node and output nodes for controlling 24V solenoids and 110/220 devices. The RFM69/RTC module is actually the first PCB that I've designed. Before that, my experience was with creating some schematics, and hand-prototyping. Eric
|
|
|
Post by joshuarobot on Feb 23, 2015 17:48:59 GMT
Try github.com/abouillot/HomeAutomation/tree/master/piGateway. I've had good luck getting my Pi <-> RFM69HW gateway working with his code. I'm using Eric's excellent Instructable for the nodes. Does this work on duplex mode? Did you had any problem until now? I have gotten this code working in duplex mode. I can trigger my garage door to open or close from openHAB. You have to set up openHAB to send an MQTT message and subscribe to that message topic in the piGateway.c program. Then in the "on_message" callback function in piGateway.c you can add handling to forward the information via RFM to the correct node. At the node, just add code to receive the RFM signal the same way the gateway was set up to do. I definitely want to thank everyone who has contributed to this project. I currently have 3 nodes set up (2 door monitors and now the garage door monitor/controller). I plan on adding a lot more now that i have the bi-directional pi gateway working. I would not have been able to do any of this myself and that's why i want to add my 2 cents here in case it can help someone get one step further. I know there is some great work being contributed to the duplex problem but i have only seen that code for the arduino gateway. I think ultimately the pi gateway is a better solution.
|
|
|
Post by joshuarobot on Feb 23, 2015 18:25:47 GMT
Greetings, I am requesting assistance with debugging the Raspberry Pi <-> RFM69 Sensor Node Gateway. I already have a mosquitto publisher working on a Raspberry Pi publishing Temperature/Humidity data from Pi Sensor Nodes already on my local network to OpenHab on my Mac. I would like to expand to include Arduino Sensor Nodes. I have a prototype Ardunio Node with a DMT22 and PIR. It seems to be working and broadcasting (according to serial monitor), but I can’t see anything happening on my piGatway (the same Pi already publishing to Openhab). I have followed Alexandre Bouillot’s GitHub instruction for the piGateway. I seems to startup ok, but I can’t tell whether is is working correctly. I did include the “-DDEBUG” option when compiling, but I don’t know where debug logs are located or whether they might hold any clues. Occasionally, I will see lines in the mosquitto.log (i.e., /var/log/mosquitto) that shows like this: “New client connected from 127.0.0.1 as arduinoClient (c1, k120). “Client arduinoClient has exceeded timeout, disconnecting. Nothing else there that I can identify from the Arduino Node. Most of what is there is from the mosquitto publisher already working on the Pi - looks like this: “New client connected from 10.0.1.221 as mosqpub/2280-OfficePi (c1, k60).” When I subscribe to all topics being published, I see only the Temperature/Humidity from the Pi Nodes, nothing is published from the Arduino Node. Any assistance - advice - insight - clues would be appreciated. That line "New Client .... arduinoClient" means that the connection does take place. Maybe try changing the "#define KEEPALIVE_SECONDS" line in piGateway.c. you should see pings back and forth between the gateway and the mosquitto server. As for comms between the node and the pi, make sure all of the info in the RFM configuration is correct. in the gateway code, it defaults to 433mhz but the node code i believe defaults to 868 or 915. make sure only one line is not commented out. also check that the encrypt keys match. when the gateway receives a transmission, you should see four lines of output in the terminal that say "mosquitto_publish......" with info from the node. hope this helps! i definitely had that issue at one point when i was trying to set this all up.
|
|
|
Post by graffiti on Feb 23, 2015 23:51:07 GMT
Does this work on duplex mode? Did you had any problem until now? I have gotten this code working in duplex mode. I can trigger my garage door to open or close from openHAB. You have to set up openHAB to send an MQTT message and subscribe to that message topic in the piGateway.c program. Then in the "on_message" callback function in piGateway.c you can add handling to forward the information via RFM to the correct node. At the node, just add code to receive the RFM signal the same way the gateway was set up to do. I definitely want to thank everyone who has contributed to this project. I currently have 3 nodes set up (2 door monitors and now the garage door monitor/controller). I plan on adding a lot more now that i have the bi-directional pi gateway working. I would not have been able to do any of this myself and that's why i want to add my 2 cents here in case it can help someone get one step further. I know there is some great work being contributed to the duplex problem but i have only seen that code for the arduino gateway. I think ultimately the pi gateway is a better solution. Please can you post your relay code example
|
|
|
Post by joshuarobot on Feb 24, 2015 15:25:37 GMT
I have gotten this code working in duplex mode. I can trigger my garage door to open or close from openHAB. You have to set up openHAB to send an MQTT message and subscribe to that message topic in the piGateway.c program. Then in the "on_message" callback function in piGateway.c you can add handling to forward the information via RFM to the correct node. At the node, just add code to receive the RFM signal the same way the gateway was set up to do. I definitely want to thank everyone who has contributed to this project. I currently have 3 nodes set up (2 door monitors and now the garage door monitor/controller). I plan on adding a lot more now that i have the bi-directional pi gateway working. I would not have been able to do any of this myself and that's why i want to add my 2 cents here in case it can help someone get one step further. I know there is some great work being contributed to the duplex problem but i have only seen that code for the arduino gateway. I think ultimately the pi gateway is a better solution. Please can you post your relay code example here is the modified gateway code (in order to avoid having to read through the entire program, i am just posting the relevant sections that need modification: . . .
//RFM69 --------------------------- rfm69 = new RFM69(); rfm69->initialize(FREQUENCY,NODEID,NETWORKID); #ifdef IS_RFM69HW rfm69->setHighPower(); //uncomment only for RFM69HW! #endif rfm69->encrypt(ENCRYPTKEY); rfm69->promiscuous(promiscuousMode); LOG("\nListening at %d Mhz...", FREQUENCY==RF69_433MHZ ? 433 : FREQUENCY==RF69_868MHZ ? 868 : 915); LOG("setup complete\n");
// subscribe to mosquitto topics (must subscribe to all new outgoing commands) const char* topic1 = "5022"; mosquitto_subscribe(m, 0, topic1, 0);
return run_loop(m); } // end of setup . . . . /* Handle a message that just arrived via one of the subscriptions. */ static void on_message(struct mosquitto *m, void *udata, const struct mosquitto_message *msg) { if (msg == NULL) { return; } LOG("-- got message @ %s: (%d, QoS %d, %s) '%s'\n", msg->topic, msg->payloadlen, msg->qos, msg->retain ? "R" : "!r", msg->payload);
// this code parses out the node and sensor ID from the payload char* tpc = msg->topic; unsigned long pld = *((int *)msg->payload); char tpcN[2]; char tpcS[1];
strncpy(tpcN, tpc, 2); strncpy(tpcS, &tpc[2], 1);
// create message structure sensorNode.nodeID = strtol(tpcN, NULL, 10); sensorNode.sensorID = strtol(tpcS, NULL, 10); sensorNode.var1_usl = pld-48; sensorNode.var2_float = 0; sensorNode.var3_float = 0;
//LOG(" %d \n", sensorNode.nodeID); //LOG(" %d \n", sensorNode.sensorID); //LOG(" %d \n", sensorNode.var1_usl);
// send the message rfm69->send(sensorNode.nodeID, &sensorNode, sizeof(sensorNode)); LOG("-- sent message to node %d \n", sensorNode.nodeID);
} . . . In order for this to work, you need to have an openHAB item that writes the MQTT message. in order to do this, it should be the same setup as the incoming message but switch the "<" with ">". check out the openHAB documentation for this: openHAB MQTT documentation. The way i have it working, i will have to subscribe to every output i want to set. The one thing I am not 100% sure about is that when i was programming it i figured out that the switch state was being set at the 48th character in the payload. i'm not sure why. if you want to send more than just a switch state this will have to be investigated further. Another issue i ran into was that i couldnt find a momentary switch in openHAB. As a result, i had to create a rule that toggles the switch "off" once it sees the state change. This works for my garage door but a "high" signal for too long in a different application could have a very different result.
|
|
|
Post by selcouth on Feb 24, 2015 22:52:57 GMT
Thanks Joshuarobot, I all sounds so easy, but it just don’t work when I do it. I have checked the encrypt keys, the frequency settings - they appear correct. There are no pings that I can see, nor four lines of output you mention. I don’t see anything on the Raspberry Pi once I give the command “sudo ./Gateway” It just runs, but near as I can tell doesn’t do anything but produce that line in the mosquito log. Can you say where I can find the Gateway debug log or look at the debug messages? Anyone? Your mosquitto config file is probably /etc/mosquitto/mosquitto.conf - may be somewhere different. Normally with mosquitto you would set a line in your config like: log_dest file /var/log/mosquitto/mosquitto.log But there is a bug (feature?) with mosquitto where it doesn't write to the log until the process ends. So an alternative that I'm using is to log to syslog and then view it there live. Set this line your mosquitto.conf: log_type debug log_dest syslog
and then you can use tail -f to view the end of the log file as it is changed: sudo tail -f /var/log/syslog You should see information like this as it happens:
|
|
|
Post by joshuarobot on Feb 24, 2015 23:56:12 GMT
Thanks Joshuarobot, I all sounds so easy, but it just don’t work when I do it. I have checked the encrypt keys, the frequency settings - they appear correct. There are no pings that I can see, nor four lines of output you mention. I don’t see anything on the Raspberry Pi once I give the command “sudo ./Gateway” It just runs, but near as I can tell doesn’t do anything but produce that line in the mosquito log. Can you say where I can find the Gateway debug log or look at the debug messages? Anyone? If you run the gateway in a terminal window you should see those messages appear in the same window, not in the mosquito log. If you see the output you have verified that your radio communication is working, then you can try to troubleshoot the mosquitto stuff.
|
|
|
Post by lucidbuddha on Feb 25, 2015 3:57:21 GMT
I think I've got the same issue.
1424751451: Warning: Address family not supported by protocol
1424751724: New connection from 127.0.0.1 on port 1883.
1424751724: New client connected from 127.0.0.1 as arduinoClient (c1, k60).
1424751724: Socket error on client arduinoClient, disconnecting.
1424751836: New connection from 127.0.0.1 on port 1883.
1424751836: New client connected from 127.0.0.1 as arduinoClient (c1, k60).
1424751836: Socket error on client arduinoClient, disconnecting.
1424752004: mosquitto version 1.3.5 terminating
1424752004: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1424752024: mosquitto version 1.3.5 (build date 2014-10-18
21:06:44+0100) starting
1424752024: Config loaded from /etc/mosquitto/mosquitto.conf.
1424752024: Opening ipv4 listen socket on port 1883.
1424752024: Opening ipv6 listen socket on port 1883.
1424752024: Warning: Address family not supported by protocol
1424752287: New connection from 127.0.0.1 on port 1883.
1424752287: New client connected from 127.0.0.1 as arduinoClient (c1, k60).
1424752414: New connection from 192.168.0.4 on port 1883.
1424752414: New client connected from 192.168.0.4 as
root.1424752413675 (c1, k60).
1424752775: mosquitto version 1.3.5 terminating
1424752775: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
I'm very much a noob and simply working through the instructable and this forum. It seems I have my gateway working fine - did a simple subscribe/publish test using Android's MYMQTT. I haven't replaced code as joshuarobot suggests...yet and I still need to understand how MQTT works with all of this. Any advice is appreciated.
|
|
|
Post by mothpaul on Feb 25, 2015 16:50:10 GMT
Thanks again joshuarobot,
Therein lies my problem - I am not getting any feedback from the terminal window in which the Gateway is running: no status, no errors, nothing. I can see the Gateway processes is running with ps, but the Gateway itself provides nothing (but that line in the mosquitto log). I don’t think this is a mosquitto issue. So if you have any suggestions for how to verify the radio communications are running, they would be appreciated. I have swapped the radios between the Raspberry Pi Gateway and Arduino Sensor Node. I am not getting any errors from the Node on the Serial Monitor, everything seems good there with either radio. Nothing on the RPi with either radio.
Thanks,
UPDATE - I beleive my error was related to the set-up step "Ensure you properly setup the SPI interface, using raspi-config"
Nevertheless - it works now.
|
|
|
Post by Couth on Feb 25, 2015 19:23:32 GMT
Thanks again joshuarobot, Therein lies my problem - I am not getting any feedback from the terminal window in which the Gateway is running: no status, no errors, nothing. I can see the Gateway processes is running with ps, but the Gateway itself provides nothing (but that line in the mosquitto log). I don’t think this is a mosquitto issue. So if you have any suggestions for how to verify the radio communications are running, they would be appreciated. I have swapped the radios between the Raspberry Pi Gateway and Arduino Sensor Node. I am not getting any errors from the Node on the Serial Monitor, everything seems good there with either radio. Nothing on the RPi with either radio. Thanks, MothPaul Could power level be a problem? I don't believe the Raspberry Pi can put out the 130mA required for full power transmit, so if you're using an RFM69HW you might try dropping the power level. I don't know if that would stop you from receiving anything, though. The power level is set in rfm69.h: _powerLevel = 31;
|
|
|
Post by selcouth on Feb 26, 2015 1:57:45 GMT
In order for this to work, you need to have an openHAB item that writes the MQTT message. in order to do this, it should be the same setup as the incoming message but switch the "<" with ">". check out the openHAB documentation for this: openHAB MQTT documentation. The way i have it working, i will have to subscribe to every output i want to set. The one thing I am not 100% sure about is that when i was programming it i figured out that the switch state was being set at the 48th character in the payload. i'm not sure why. if you want to send more than just a switch state this will have to be investigated further. Another issue i ran into was that i couldnt find a momentary switch in openHAB. As a result, i had to create a rule that toggles the switch "off" once it sees the state change. This works for my garage door but a "high" signal for too long in a different application could have a very different result. What does your sensor node radio receiving look like? I have piGateway subscribing to the topic and publishing on an openHAB switch item (0 for off, 1 for on): Feb 25 19:43:59 raspberrypi mosquitto[2104]: Received PUBLISH from selcouth.1424735054948 (d0, q0, r1, m0, '1022', ... (1 bytes))
Feb 25 19:53:36 raspberrypi mosquitto[2104]: Sending PUBLISH to arduinoClient (d0, q0, r0, m0, '1022', ... (1 bytes))
But my Arduino node (node 10) never gets anything. Arduino loop code (not coded to do anything with the received data yet other than print to console): //Receiving signal
if (radio.receiveDone())
Serial.println("We get signal");
{
if (promiscuousMode)
{
Serial.print("to [");Serial.print(radio.TARGETID, DEC);Serial.print("] ");
}
if (radio.DATALEN != sizeof(Payload))
{
//Serial.println("Invalid payload received, not matching Payload struct!");
}
else
{
Serial.println("Main screen turn on");
theData = *(Payload*)radio.DATA;
Serial.print(theData.deviceID);
Serial.print(", ");
Serial.print(theData.var1_usl);
Serial.print(", ");
Serial.print(theData.var2_float);
Serial.print(", ");
Serial.print(theData.var3_float);
Serial.print(", RSSI=");
Serial.println(radio.RSSI);
}
if (radio.ACK_REQUESTED)
{
//byte theNodeID = radio.SENDERID;
radio.sendACK();
Serial.print(" - ACK sent.");
}
}
//end receiving signal section
|
|
|
Post by jtk on Feb 26, 2015 2:33:03 GMT
I have a similar issue to mothpaul. But only recently. My piGateway was working with the slight issue of freezing up everyday or so. Then a brief power event at the house and now the radio never seems to init. Meaning I never see the startup message from piGateway. I don't get the SPI failed message from the RFM library but it seems to be stuck in the radio initialization.
My next step is the try either a second pi or second radio. Probably the radio since there is a spare just waiting for leads...
As for the freezing I first suspected an issue with buffer sizing in the transmit routine. The numbers don't quite add up. Never a problem for the arduino code since there isn't a receive buffer in the same sense.
|
|
|
Post by etrombly on Feb 26, 2015 6:07:29 GMT
If anyone still wanted to use python for the gateway side of the code, I finally got the port finished here github.com/etrombly/RFM69 .Seems to be working well now. I'm going to start working on a power strip first, so I'll keep everyone updated.
|
|
|
Post by Couth on Feb 26, 2015 17:11:42 GMT
Thanks Couth I tried your suggestion about droping the power level, nothing different happened with Gateway startup - I am not using the RFM69FW, so I don't think it is a power problem. Anyone - could you publish the standard Gateway terminal startup messages that are received with a working system. Perhaps that would provide me some clue to where to look next. I have installed the gateway on one of my other Raspberry Pis resulting in the same behavior as before. Whatever I am doing, I seem to be doing consistently, so I think there must be only some small error leading to my failure. Thanks, MothPaul When you start the Gateway program on the Pi the only message you'll initially see is "Connect succeed" This is what I see immediately after a radio message comes in: Connect succeed [10] a.0.4.0.bb.35.0.0.0.e0.8a.44.0.0.8b.44. Received Node ID = 10 Device ID = 4 Time = 13755 RSSI = -19 var2 = 1111.000000 var3 = 1112.000000 -- published successfully -- published successfully -- published successfully -- published successfully I used the following on the Arduino to see if/where my radio code was bad. Maybe it can help you or you can adapt it a bit with more console output. The idea is you should see the loop count increase, and you should see the radio fired message. When the radio fires, you should see some data show on the Raspberry Pi terminal running the gateway code. Keep in mind I'm using a 915 mHz RFM69HW so you'll need to comment out some code. (my code indents didn't copy over well through remote connection) #include <RFM69.h>
#include <RFM69registers.h>
#include <SPI.h>
#define NODEID 10
#define NETWORKID 101 //make sure this matches your Gateway.c network ID #define GATEWAYID 1 //your gateway should be node 1
//#define FREQUENCY RF69_433MHZ
//#define FREQUENCY RF69_868MHZ
#define FREQUENCY RF69_915MHZ //change this for your radio's frequency
#define ENCRYPTKEY "abcdefghijklmnop" //make sure it's the same 16 chars on both gateway and node
#define IS_RFM69HW //comment this out if you're not using HW
#define ACK_TIME 30
#define SERIAL_BAUD 9600
RFM69 radio;
int loopCount = 0;
typedef struct {
short nodeID;
short sensorID;
unsigned long var1_usl;
float var2_float;
float var3_float;
} Payload;
Payload theData;
void setup()
{
Serial.begin(SERIAL_BAUD);
radio.initialize(FREQUENCY,NODEID,NETWORKID);
#ifdef IS_RFM69HW
radio.setHighPower(); //this will be false if above is not defined as HW
#endif
radio.encrypt(ENCRYPTKEY);
char buff[50];
sprintf(buff, "\nTransmitting at %d Mhz...", FREQUENCY==RF69_433MHZ ? 433 : FREQUENCY==RF69_868MHZ ? 868 : 915);
Serial.println(buff);
}
void loop()
{
Serial.println("\nWaiting 5 seconds...");
delay(5000);
Serial.println("\nLooping");
Serial.print(loopCount);
loopCount = loopCount + 1;
delay(200);
//define some data to send
theData.sensorID = 2;
theData.var1_usl = 12345;
theData.var2_float = 1.2;
theData.var3_float = 3.4;
Serial.println("\nAbout to radio...");
delay(100);
if (radio.sendWithRetry(GATEWAYID, (const void*) (&theData), sizeof(theData)))
{
Serial.println("\nRadio fired...");
}
else
{
Serial.print ("\nNothing...");
}
Serial.println("\nAbout to loop again...");
delay(100);
}//end loop
|
|
|
Post by joshuarobot on Feb 26, 2015 20:45:18 GMT
In order for this to work, you need to have an openHAB item that writes the MQTT message. in order to do this, it should be the same setup as the incoming message but switch the "<" with ">". check out the openHAB documentation for this: openHAB MQTT documentation. The way i have it working, i will have to subscribe to every output i want to set. The one thing I am not 100% sure about is that when i was programming it i figured out that the switch state was being set at the 48th character in the payload. i'm not sure why. if you want to send more than just a switch state this will have to be investigated further. Another issue i ran into was that i couldnt find a momentary switch in openHAB. As a result, i had to create a rule that toggles the switch "off" once it sees the state change. This works for my garage door but a "high" signal for too long in a different application could have a very different result. What does your sensor node radio receiving look like? I have piGateway subscribing to the topic and publishing on an openHAB switch item (0 for off, 1 for on): Feb 25 19:43:59 raspberrypi mosquitto[2104]: Received PUBLISH from selcouth.1424735054948 (d0, q0, r1, m0, '1022', ... (1 bytes))
Feb 25 19:53:36 raspberrypi mosquitto[2104]: Sending PUBLISH to arduinoClient (d0, q0, r0, m0, '1022', ... (1 bytes))
But my Arduino node (node 10) never gets anything. Arduino loop code (not coded to do anything with the received data yet other than print to console): . . . that mosquitto output won't guarantee that your piGateway is reading it properly and sending it on to the node. You have only guaranteed that the openHAB mosquitto write is working. At this point, you need to make sure that you are subscribing to topic 1022 in the piGateway code within the setup function (in my code it was 5022 because i was writing to node 50). Did you see my post with the code i added to piGateway?
|
|
|
Post by selcouth on Feb 26, 2015 21:00:41 GMT
that mosquitto output won't guarantee that your piGateway is reading it properly and sending it on to the node. You have only guaranteed that the openHAB mosquitto write is working. At this point, you need to make sure that you are subscribing to topic 1022 in the piGateway code within the setup function (in my code it was 5022 because i was writing to node 50). Did you see my post with the code i added to piGateway? Yes, I have your code in my piGateway. Obviously changed the node, but for the most part it's the same. The Pi is reporting messages when I trigger the switch. The mosquitto log I linked earlier shows mosquitto is receiving the publish from openHAB and sending the publish to arduinoClient. If the piGateway isn't running I don't see the publish to Arduino in mosquitto logs so I'm 90% sure the piGateway is fine. I think my trouble is on the Arduino receiving end not picking up the payload. Did you see any problems with my code on that end?
|
|
|
Post by joshuarobot on Feb 26, 2015 21:14:22 GMT
I have a couple general comments and suggestions based on my experience so far with this project. I have been working on this for a couple of months now and every single step has been excruciating yet gratifying. I am not a great programmer but thanks to everyone's work I have been able to figure this stuff out.
thing 1: at first, i bought the arduino clone with the 3.3/5v switch and the network shield. it never worked, which is why i put all of my effort into doing it directly on the pi. one thing i found out after about a week is that my board was outputting 5V from the 3.3V pin when the switch was set to 3.3V. That likely fried the first RFM chip i was using. this brings me to...
thing 2: just use moteinos from lowpowerlabs. they are an arduino and rfm chip in one package. once i got my first node working with this, i havent looked back. they eliminate the questions you might have about whether your chip is soldered and wired properly to your arduino or the power is set properly. also they are tiny. i have 6 of them now and i dont plan on using anything else. one important thing to note if you plan on buying these is that you will also need to buy a USB-FTDI adapter to program them.
thing 3: don't give up! the more issues you run into and the more things you try to do with this project, the more you will learn.
|
|
|
Post by joshuarobot on Feb 26, 2015 21:26:02 GMT
that mosquitto output won't guarantee that your piGateway is reading it properly and sending it on to the node. You have only guaranteed that the openHAB mosquitto write is working. At this point, you need to make sure that you are subscribing to topic 1022 in the piGateway code within the setup function (in my code it was 5022 because i was writing to node 50). Did you see my post with the code i added to piGateway? Yes, I have your code in my piGateway. Obviously changed the node, but for the most part it's the same. The Pi is reporting messages when I trigger the switch. The mosquitto log I linked earlier shows mosquitto is receiving the publish from openHAB and sending the publish to arduinoClient. If the piGateway isn't running I don't see the publish to Arduino in mosquitto logs so I'm 90% sure the piGateway is fine. I think my trouble is on the Arduino receiving end not picking up the payload. Did you see any problems with my code on that end? haha yeah i figured you changed the code but you never know. there are so many steps to get info from one side to the other that its easy to forget things. just to be sure, do you see a message output in the piGateway terminal that says it is writing to the node? Also to answer your question, i didnt see anything wrong with your code. I always use a { directly after my if statement in the same line and it looks like you do it underneath your serial write. i think your syntax is still good though. could someone please verify that?
|
|
|
Post by selcouth on Feb 26, 2015 21:44:41 GMT
Yea, piGateway shows it's sending node messages: -- got message @ 1022: (1, QoS 0, !r) '1' -- sent message to node 10 -- got message @ 1022: (1, QoS 0, !r) '0' -- sent message to node 10
|
|
|
Post by joshuarobot on Feb 26, 2015 21:50:32 GMT
Yea, piGateway shows it's sending node messages: -- got message @ 1022: (1, QoS 0, !r) '1' -- sent message to node 10 -- got message @ 1022: (1, QoS 0, !r) '0' -- sent message to node 10 ok great. one thing i did during debug was to comment out the code in the node that checks the length of the payload. i always write the payload to "theData" no matter what the message is. i realize i was so excited that it was working that i never verified that the payload was actually the correct size. it seems like you should still get a message "invalid payload..." if this is the case but it could be worth a shot.
|
|
|
Post by selcouth on Feb 27, 2015 3:00:04 GMT
Yea, piGateway shows it's sending node messages: -- got message @ 1022: (1, QoS 0, !r) '1' -- sent message to node 10 -- got message @ 1022: (1, QoS 0, !r) '0' -- sent message to node 10 ok great. one thing i did during debug was to comment out the code in the node that checks the length of the payload. i always write the payload to "theData" no matter what the message is. i realize i was so excited that it was working that i never verified that the payload was actually the correct size. it seems like you should still get a message "invalid payload..." if this is the case but it could be worth a shot. I am now pretty certain that my issue receiving the data on the node end is related to my problem with the interrupt pin mentioned here. I'm continuing to explore other options but I'm pretty sure that's where I'm stuck.
|
|
|
Post by joshuarobot on Feb 27, 2015 3:11:07 GMT
i found a bug in my piGateway code that will cause issues being read into the nodes. I was using the "SensorNode" structure which includes an extra element for the RSSI. What i should have been using is the payload structure. I didnt notice because i had disabled the length check in my node program. i was reading in whatever the gateway was writing. Since the beginning of the structure is the same, i didn't notice.
|
|
|
Post by Sutan on Mar 4, 2015 19:52:43 GMT
I have installed the piGateway on my rapsberrry pi using the github.com/abouillot/HomeAutomation/tree/master/piGateway library. I am running debian v7.6. It is a perfect combo when it works. However the problem is the Gateway cannot connect to mosquitto before after 7-8 hours after I have rebooted the machine. If I try I get the message, Listening at 868 Mhz -Startup Complete connection refused. When I start it the next morning I will get: connection suceed, and it will start receiving from my nodes. I have checked this several times -installed and reistalled to no avail. If I updated to a newer version of debian it didn't work at all. If I am lucky the Gateway will work for a few hours before it freeze and stops receiving. Has anyone had similar problems and solved it? Can it be related to the fact that I have password protection set in mosquitto? I am also using TSL encryption on WAN clients, but not on localhost which uses port 1883. I am also running Openhab and razberry card (z-wave) but it uses different GPIO pins.
|
|
|
Post by Gandalph on Mar 11, 2015 20:23:27 GMT
I finally have mosquitto and the Gateway script of abouillot running on my Pi with a RF69HW sensor attached. Just 1 RF sensor for now, anyone any ideas how I can check if it works ok on the Pi sideo only?
|
|
sean
New Member
Posts: 4
|
Post by sean on Mar 14, 2015 5:54:11 GMT
I have a couple general comments and suggestions based on my experience so far with this project. I have been working on this for a couple of months now and every single step has been excruciating yet gratifying. I am not a great programmer but thanks to everyone's work I have been able to figure this stuff out. thing 1: at first, i bought the arduino clone with the 3.3/5v switch and the network shield. it never worked, which is why i put all of my effort into doing it directly on the pi. one thing i found out after about a week is that my board was outputting 5V from the 3.3V pin when the switch was set to 3.3V. That likely fried the first RFM chip i was using. this brings me to... thing 2: just use moteinos from lowpowerlabs. they are an arduino and rfm chip in one package. once i got my first node working with this, i havent looked back. they eliminate the questions you might have about whether your chip is soldered and wired properly to your arduino or the power is set properly. also they are tiny. i have 6 of them now and i dont plan on using anything else. one important thing to note if you plan on buying these is that you will also need to buy a USB-FTDI adapter to program them. thing 3: don't give up! the more issues you run into and the more things you try to do with this project, the more you will learn. Excellent points! I found myself nodding at a few of them, especially: "every single step has been excruciating yet gratifying." Also, Anarduino is a similar product to Moteino (RFM connected to the backside of a tiny PCB) that also eliminates the questions of connections, etc. and keeps things very compact. But to add to that, I'm cheap, so instead of buying a separate FTDI adapter for them, I learned how to program the Anarduino from the Pi. If you want another excruciating project, take that on ! A series of posts by Dean Mao here: www.deanmao.com/2012/08/06/arduino-and-the-raspberry-pi/ will give you the bits you need.
|
|
sean
New Member
Posts: 4
|
Post by sean on Mar 14, 2015 6:02:45 GMT
I finally have mosquitto and the Gateway script of abouillot running on my Pi with a RF69HW sensor attached. Just 1 RF sensor for now, anyone any ideas how I can check if it works ok on the Pi sideo only? If you're running it from the terminal it should be giving you printouts on the status (look for 'LOG' lines in the code for the parts it will update you about). If you're running it as a service, you can look at /var/log/syslog. That's where the LOG messages get directed when it's built as a service.
|
|
|
Post by Gandalph on Mar 30, 2015 9:57:37 GMT
Hi, I now have the Pi and arduino with RFM69HW talking to each other, added in some sensor data (temp) for good measure, so I was good to go, or so I thought... Readouts from the mosquitto terminal output indicate very low RSSI (-90). Also serial output on my arduinos (uno clone and pro mini) give me this low level. So now I'm stuck with 2 wireless sensors which I can only place 3m from my central node....
I have changed the antenna from a single dupont cable to a solid core one, no relief. I am officially out of ideas now... Anyone?
|
|
|
Post by joshuarobot on Apr 5, 2015 6:45:12 GMT
im not sure -90 rssi is all that bad. if your mosquitto can give you an rssi reading, doesn't that indicate that it is receiving data from the node? it should be able to see anything else you send it as well. are you having issues with the temperature information getting to the server?
|
|
|
Post by joshuarobot on Apr 5, 2015 18:46:40 GMT
I'm not sure if anyone has been able to get my bi-directional code working from my descriptions. I forked the original repository a few weeks ago and added my changes. abouillot has since made changes to his gateway code and libraries, so my code is no longer based on the current version, but it does work in my system. because my code is no longer based on the latest revision, i doubt it will be pulled back into the main repo. If anyone is interested in downloading my version, or using it to add modifications to the new gateway code, you can grab it from here: github.com/joshuarobot1/HomeAutomation/tree/joshuarobot1-patch-1
|
|