Transceiver issues [resolved]

Started by microblades, December 12, 2016, 04:50:56 PM

microblades

I ordered a Moteino and weathershield and it arrived saturday. I soldered everything together directly using a single header. I uploaded a sketch I have been using on another weathershield for a few weeks. The new moteino seems to be working, as is the weathershield. But it will not transmit data. I can see data in the serial port monitor in the Arduino IDE.

Initially the moteino would do a single loop and then hang. I commented out the sleep command for the radio, and now it continues to loop, but transmits no data.

I used a loupe to verify my solder connections and found what appears to some sort of filament laying across the transceiver board. It looked like maybe a strand from steel wool or something similar. I wasn't able to verify that it was a conductive material, but it was definitely stuck in the solder on the transceiver board. I was able to remove it with tweezers, but the transceiver still seems to not work.

Do you have any ideas or some direction I can take? I don't have much in the way of testing equipment to go beyond "it's attempting to send, but is not sending". Is there some "status" checking code I can use to see if the transceiver is working at all?

Thanks!

Felix

Assuming you have the same hardware/sketch as your previous setup - but if not I'd check in this order:

- radio settings match that of the hardware and the rest of your network (isHW most importantly)
- check what the strand was conductive if possible?
- any cold solder joints? I know you mentioned you checked but .... cold joints can be real elusive

- Can the radio receive? - ie use the Node+Gateway sketches to test this: use another moteino as Gateway and load the Node sketch on this questionable Moteino, (again being careful with IS_RFM69HW setting) let's see the results.

microblades

The only difference between the moteinos is that the newest one has the memory chip.

-Radio settings appear to be good
-The strand was extremely small, I'd personally have no way to test it. But it's long gone now.
-The solder joints look good. Everything is working except for the radio, and I didn't solder anything on it except for the antenna. That's the first place I checked, and it looks good to me...?

I will have to test the gateway-node sketches later tonight and report back.

Here is the code I'm using...gleaned from https://github.com/johnsdiyplayground/home-automation-examples/tree/master/weather-shield-R2 and modified slightly for the gateway. It has been working well. (encryption key removed)

// IMPORTANT: adjust the settings in the configuration section below !!!
// **********************************************************************************
// Copyright Felix Rusu of LowPowerLab.com, 2016
// RFM69 library and sample code by Felix Rusu - lowpowerlab.com/contact
//
// Code modified by John Wills, November 2016 
// This code should only be used with Weather Shield R2 from lowpowerlab.com
// **********************************************************************************
// License
// **********************************************************************************
// This program is free software; you can redistribute it 
// and/or modify it under the terms of the GNU General    
// Public License as published by the Free Software       
// Foundation; either version 3 of the License, or        
// (at your option) any later version.                    
//                                                        
// This program is distributed in the hope that it will   
// be useful, but WITHOUT ANY WARRANTY; without even the  
// implied warranty of MERCHANTABILITY or FITNESS FOR A   
// PARTICULAR PURPOSE. See the GNU General Public        
// License for more details.                              
//                                                        
// You should have received a copy of the GNU General    
// Public License along with this program.
// If not, see <http://www.gnu.org/licenses/>.
//                                                        
// Licence can be viewed at                               
// http://www.gnu.org/licenses/gpl-3.0.txt
//
// Please maintain this license information along with authorship
// and copyright notices in any redistribution of this code
// **********************************************************************************
#include <RFM69.h>    //get it here: https://www.github.com/lowpowerlab/rfm69
#include <RFM69_ATC.h>//get it here: https://www.github.com/lowpowerlab/rfm69
#include <SPI.h>      //comes with Arduino IDE (www.arduino.cc)
#include <LowPower.h> //get library from: https://github.com/lowpowerlab/lowpower
                      //writeup here: http://www.rocketscream.com/blog/2011/07/04/lightweight-low-power-arduino-library/
#include <SPIFlash.h> //get it here: https://www.github.com/lowpowerlab/spiflash
#include <SparkFunBME280.h> //get it here: https://github.com/sparkfun/SparkFun_BME280_Breakout_Board/tree/master/Libraries/Arduino/src
#include <Wire.h>     //comes with Arduino

//*********************************************************************************************
//************ IMPORTANT SETTINGS - YOU MUST CHANGE/CONFIGURE TO FIT YOUR HARDWARE *************
//*********************************************************************************************
#define NODEID        13    //unique for each node on same network
#define NETWORKID     69  //the same on all nodes that talk to each other
#define GATEWAYID     1
//Match frequency to the hardware version of the radio on your Moteino (uncomment one of the three):
//#define FREQUENCY     RF69_433MHZ
//#define FREQUENCY     RF69_868MHZ
#define FREQUENCY     RF69_915MHZ
//#define IS_RFM69HW    //uncomment only for RFM69HW! Remove/comment if you have RFM69W!
#define ENCRYPTKEY    "****************" //exactly the same 16 characters/bytes on all nodes!
#define ENABLE_ATC    //comment out this line to disable AUTO TRANSMISSION CONTROL
#define ATC_RSSI      -75
//*********************************************************************************************
#define ACK_TIME      30  // max # of ms to wait for an ack
#define BATT_MONITOR  A7  // Sense VBAT_COND signal (when powered externally should read ~3.25v/3.3v (1000-1023), when external power is cutoff it should start reading around 2.85v/3.3v * 1023 ~= 883 (ratio given by 10k+4.7K divider from VBAT_COND = 1.47 multiplier)
#define BATT_FORMULA(reading) reading * 0.00322 * 1.49 // >>> fine tune this parameter to match your voltage when fully charged
                                                       // details on how this works: https://lowpowerlab.com/forum/index.php/topic,1206.0.html

#define SERIAL_EN             //comment this out when deploying to an installed Mote to save a few KB of sketch size
#define SERIAL_BAUD    19200
#ifdef SERIAL_EN
  #define DEBUG(input)   {Serial.print(input); delay(1);}
  #define DEBUGln(input) {Serial.println(input); delay(1);}
  #define DEBUGFlush() { Serial.flush(); }
#else
  #define DEBUG(input);
  #define DEBUGln(input);
  #define DEBUGFlush();
#endif

#ifdef ENABLE_ATC
  RFM69_ATC radio;
#else
  RFM69 radio;
#endif

#define FLASH_SS      8 // and FLASH SS on D8 on regular Moteinos (D23 on MoteinoMEGA)
SPIFlash flash(FLASH_SS, 0xEF30); //EF30 for 4mbit  Windbond chip (W25X40CL)

BME280 bme280;  

float batteryVolts = 4.5;
char BATstr[10]; //longest battery voltage reading message = 9chars

char sendBuf[32];
byte sendLen;

float temperature=0;
char Fstr[10];
float humidity=0;
char Hstr[10];
float pressure=0;
char Pstr[10];

uint16_t batteryReportCycles=25;

void setup() {
  Serial.begin(SERIAL_BAUD);
  radio.initialize(FREQUENCY,NODEID,NETWORKID);
  #ifdef IS_RFM69HW
    radio.setHighPower(); //uncomment only for RFM69HW!
  #endif
  radio.encrypt(ENCRYPTKEY);

  //Auto Transmission Control - dials down transmit power to save battery (-100 is the noise floor, -90 is still pretty good)
  //For indoor nodes that are pretty static and at pretty stable temperatures (like a MotionMote) -90dBm is quite safe
  //For more variable nodes that can expect to move or experience larger temp drifts a lower margin like -70 to -80 would probably be better
  //Always test your ATC mote in the edge cases in your own environment to ensure ATC will perform as you expect
  #ifdef ENABLE_ATC
    radio.enableAutoPower(ATC_RSSI);
  #endif
  
  char buff[50];
  sprintf(buff, "\nTransmitting at %d Mhz...", FREQUENCY==RF69_433MHZ ? 433 : FREQUENCY==RF69_868MHZ ? 868 : 915);
  DEBUGln(buff);
  radio.sendWithRetry(GATEWAYID, "START", 5);
  
  #ifdef ENABLE_ATC
    DEBUGln("RFM69_ATC Enabled (Auto Transmission Control)\n");
  #endif

  if (flash.initialize()) flash.sleep(); //if Moteino has FLASH-MEM, make sure it sleeps

  bme280.settings.commInterface = I2C_MODE;
  bme280.settings.I2CAddress = 0x77;
  bme280.settings.runMode = 3; //Normal mode
  bme280.settings.tStandby = 0;
  bme280.settings.filter = 0;
  bme280.settings.tempOverSample = 1;
  bme280.settings.pressOverSample = 1;
  bme280.settings.humidOverSample = 1;

  radio.sendWithRetry(GATEWAYID, "START", 6);

}  // END OF THE SETUP SECTION OF CODE
// *****************************************************

void loop() {
    bme280.begin();
    dtostrf(bme280.readTempF(), 3,1, Fstr);
    dtostrf(bme280.readFloatHumidity(), 2,0, Hstr);
    float p = bme280.readFloatPressure();
    p = p / 3311.8352;  // this is conversion from Pascals to inches of mercury, adjusted for my location above sea level 
    dtostrf(p, 2,2, Pstr);  
    bme280.writeRegister(BME280_CTRL_MEAS_REG, 0x00); //sleep the BME280

    // we only will report battery voltage every "x" cycles, set the number of cycles in the line below 
    if (batteryReportCycles > 10)  // change this number to a higher number to save even more battery life  
    {
      DEBUGln("Inside the checkBattery routine to report battery voltage");
      int readings = 0; 
      for (byte i=0; i<10; i++) //take 10 samples, and average
        readings+=analogRead(BATT_MONITOR);
      batteryVolts = BATT_FORMULA(readings / 10.0);
      dtostrf(batteryVolts, 3,2, BATstr); //update the BATStr which gets sent every batteryReportCycles
      batteryReportCycles=0;
    }

    sprintf(sendBuf, "BAT:%sv F:%s H:%s P:%s", BATstr, Fstr, Hstr, Pstr);
    sendLen = strlen(sendBuf);
    radio.sendWithRetry(GATEWAYID, sendBuf, sendLen); 
    DEBUGln(sendBuf);
 
    DEBUGFlush();
    radio.sleep();

    // the value of this loop will set a sleep delay an power the unit down
    // the lengh of the delay is 8 seconds * the number of cycles
    // so for example a value of 100 means 100 * 8 = 800 seconds sleeping, 
    // or about 13.33 minutes between read and transmitting weather data
    // NOTE:  The maximum value for the loop size is 255
    for (int i = 0; i < 1; i++)  
       LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
    DEBUGln("SLEEP_8S for loop completed");

    batteryReportCycles++;
    DEBUG("Battery Report cycles is ");DEBUGln(batteryReportCycles);

} // ****END OF THE LOOP SECTION OF CODE ****

Felix

Ok without the hardware it's impossible to tell, so the verdict will be the gateway-node test.

microblades

I installed the node sketch on a USB moteino to check the settings...my mightyhat lit up, so I know it was receiving.

I installed it on the new moteino and the mighty hat didn't receive anything. Output from Arduino IDE serial monitor is below:

Transmitting at 915 Mhz...
SPI Flash Init OK ... UniqueID (MAC): D7 65 A4 5 83 7E 70 27 
RFM69_ATC Enabled (Auto Transmission Control)

 nothing...
Sending[1]: 1 nothing...
Sending[2]: 12 nothing...
Sending[3]: 123 nothing...
Sending[4]: 123  nothing...
Sending[5]: 123 A nothing...
Sending[6]: 123 AB nothing...
Sending[7]: 123 ABC nothing...
Sending[8]: 123 ABCD nothing...
Sending[9]: 123 ABCDE nothing...
Sending[10]: 123 ABCDEF nothing...
Sending[11]: 123 ABCDEFG nothing...
Sending[12]: 123 ABCDEFGH nothing...
Sending[13]: 123 ABCDEFGHI nothing...
Sending[14]: 123 ABCDEFGHIJ nothing...
Sending[15]: 123 ABCDEFGHIJK nothing...
Sending[16]: 123 ABCDEFGHIJKL nothing...
Sending[17]: 123 ABCDEFGHIJKLM nothing...
Sending[18]: 123 ABCDEFGHIJKLMN nothing...
Sending[19]: 123 ABCDEFGHIJKLMNO nothing...
Sending[20]: 123 ABCDEFGHIJKLMNOP nothing...
Sending[21]: 123 ABCDEFGHIJKLMNOPQ nothing...
Sending[22]: 123 ABCDEFGHIJKLMNOPQR nothing...
Sending[23]: 123 ABCDEFGHIJKLMNOPQRS nothing...
Sending[24]: 123 ABCDEFGHIJKLMNOPQRST nothing...
Sending[25]: 123 ABCDEFGHIJKLMNOPQRSTU nothing...
Sending[26]: 123 ABCDEFGHIJKLMNOPQRSTUV nothing...
Sending[27]: 123 ABCDEFGHIJKLMNOPQRSTUVW nothing...
Sending[28]: 123 ABCDEFGHIJKLMNOPQRSTUVWX nothing...
Sending[29]: 123 ABCDEFGHIJKLMNOPQRSTUVWXY nothing...
Sending[30]: 123 ABCDEFGHIJKLMNOPQRSTUVWXYZ nothing...

Felix

Ok so assuming this was DOA - you want to return it for debugging/repair/replacement?

microblades

Considering I'm pretty much dead in the water and wouldn't have the slightest idea what to do, aside from purchasing a new one...yes! :-)

Thank you. Your help is much appreciated. I have no problem paying for your trouble shooting and even the cost of replacement of the transceiver  (if that's possible).

Felix

No problem, please email me for more details.

microblades

A big thank you to Felix for taking a look at this for me, and replacing the transceiver. Works perfectly.

MPParsley

@Felix, any idea what went wrong there?

I ordered 3 Moteino USB's and 3 regular Moteino's and they all work fine except for one regular which always outputs the following:

Transmitting at 433 Mhz...
SPI Flash Init OK ... UniqueID (MAC): D7 65 A4 5 83 6C CD 27
RFM69_ATC Enabled (Auto Transmission Control)

nothing...
Sending[1]: 1 nothing...
Sending[2]: 12 nothing...
Sending[3]: 123 nothing...
Sending[4]: 123  nothing...
Sending[5]: 123 A nothing...
Sending[6]: 123 AB nothing...
Sending[7]: 123 ABC nothing...
Sending[8]: 123 ABCD nothing...
Sending[9]: 123 ABCDE nothing...
Sending[10]: 123 ABCDEF nothing...
Sending[11]: 123 ABCDEFG nothing...
Sending[12]: 123 ABCDEFGH nothing...
Sending[13]: 123 ABCDEFGHI nothing...
Sending[14]: 123 ABCDEFGHIJ nothing...
Sending[15]: 123 ABCDEFGHIJK nothing...
Sending[16]: 123 ABCDEFGHIJKL nothing...
Sending[17]: 123 ABCDEFGHIJKLM nothing...
Sending[18]: 123 ABCDEFGHIJKLMN nothing...
Sending[19]: 123 ABCDEFGHIJKLMNO nothing...
Sending[20]: 123 ABCDEFGHIJKLMNOP nothing...
Sending[21]: 123 ABCDEFGHIJKLMNOPQ nothing...
Sending[22]: 123 ABCDEFGHIJKLMNOPQR nothing...
Sending[23]: 123 ABCDEFGHIJKLMNOPQRS nothing...
Sending[24]: 123 ABCDEFGHIJKLMNOPQRST nothing...
Sending[25]: 123 ABCDEFGHIJKLMNOPQRSTU nothing...
Sending[26]: 123 ABCDEFGHIJKLMNOPQRSTUV nothing...
Sending[27]: 123 ABCDEFGHIJKLMNOPQRSTUVW nothing...
Sending[28]: 123 ABCDEFGHIJKLMNOPQRSTUVWX nothing...
Sending[29]: 123 ABCDEFGHIJKLMNOPQRSTUVWXY nothing...
Sending[30]: 123 ABCDEFGHIJKLMNOPQRSTUVWXYZ nothing...
nothing...
Sending[1]: 1 nothing...
Sending[2]: 12 nothing...
Sending[3]: 123 nothing...
Sending[4]: 123  nothing...
Sending[5]: 123 A nothing...
Sending[6]: 123 AB nothing...
Sending[7]: 123 ABC nothing...
Sending[8]: 123 ABCD nothing...
Sending[9]: 123 ABCDE nothing...
Sending[10]: 123 ABCDEF nothing...
Sending[11]: 123 ABCDEFG nothing...
Sending[12]: 123 ABCDEFGH nothing...
Sending[13]: 123 ABCDEFGHI nothing...
Sending[14]: 123 ABCDEFGHIJ nothing...
Sending[15]: 123 ABCDEFGHIJK nothing...
Sending[16]: 123 ABCDEFGHIJKL nothing...
Sending[17]: 123 ABCDEFGHIJKLM nothing...
Sending[18]: 123 ABCDEFGHIJKLMN nothing...
Sending[19]: 123 ABCDEFGHIJKLMNO nothing...
Sending[20]: 123 ABCDEFGHIJKLMNOP nothing...
Sending[21]: 123 ABCDEFGHIJKLMNOPQ nothing...
Sending[22]: 123 ABCDEFGHIJKLMNOPQR nothing...
Sending[23]: 123 ABCDEFGHIJKLMNOPQRS nothing...
Sending[24]: 123 ABCDEFGHIJKLMNOPQRST nothing...
Sending[25]: 123 ABCDEFGHIJKLMNOPQRSTU nothing...
Sending[26]: 123 ABCDEFGHIJKLMNOPQRSTUV nothing...
Sending[27]: 123 ABCDEFGHIJKLMNOPQRSTUVW nothing...
Sending[28]: 123 ABCDEFGHIJKLMNOPQRSTUVWX nothing...
Sending[29]: 123 ABCDEFGHIJKLMNOPQRSTUVWXY nothing...
Sending[30]: 123 ABCDEFGHIJKLMNOPQRSTUVWXYZ nothing...
nothing...

Felix

@MPParsley - can you give more details just to be sure?
What radio W/HW?
Did you solder antenna?
Did you set the HW setting in the sketch?

MPParsley

Hi Felix,

- It's the W radio
- I soldered the antenna, yes
- No, I didn't set the HW setting (since it's a W, not a HW)

To make things a bit more bizarre, it appears that I can receive data: the PiGateway script receives data from my other nodes BUT when I transmit data (using the same Node script as my other nodes) the data is not received.

Felix

Well make sure the node ID is UNIQUE.
Also when you receive but can't transmit that's an indication the HW setting is mismatched. I know you said it's a W but are you 100% sure? Check the transceivers guide.

MPParsley

#13
Really sorry about this but I checked the order again and it appears we did (accidentally) order the one HW chip...
Setting to HW did the trick.

Thanks for your support!