RFM69 sensor problemen met ontvangen.

Voor mijn schoolproject doen we mee aan Cansat. Voor dit project hebben we 2 pro micro borden als bouwpakket gekregen. Hierin zit een temperatuur en luchtdrukmeter en ik heb zelf een accelerometer toegevoegd. De bedoeling is om met het ene bord metingen te doen, en deze metingen via de RFM69 radio sensor te versturen naar het grondstation (ook een RFM69 sensor). Ik heb hierbij alleen een probleem met de code: Het ene bord verzendt wel, maar het grondstation wil het signaal niet ontvangen. Ik heb als attachment de 2 codes toegevoegd. Ik kom er niet uit wat er nou fout is in de code. Zou iemand de code kunnen controleren en verbeteren, zodat het grondstation wel het signaal van het andere bord opvangt? Ik ben zelf een complete leek in het coderen/arduino, dus elke hulp is welkom.

  • Ik heb al gecontroleerd of de antennes goed zijn, hier is niks mis mee.

GroundStation.ino (2.1 KB)

T_en_P_en_Accelerometer_met_radio.ino (2.12 KB)

Dit leest wat eenvoudiger:

Meet node

//Include the required libraries
#include <qbcan.h>
#include <Wire.h>
#include <SPI.h>

#define NODEID        96    //unique for each node on same network
#define NETWORKID     60  //the same on all nodes that talk to each other
#define GATEWAYID     1    //Receiving node
#define FREQUENCY     433

//Pressure sensor object
BMP180 bmp;
char payload[50];
RFM69 radio;

const int xpin = 1;                  // x-axis of the accelerometer
const int ypin = 2;                  // y-axis
const int zpin = 3;                  // z-axis (only on 3-axis models)

void setup()
{
  //Initialize serial connection for debugging
  Serial.begin(9600);
  Serial.println("REBOOT");

  // Initialize pressure sensor.
  if (bmp.begin())
    Serial.println("BMP180 init success");
  else
  {
    //In case of error let user know of the problem
    Serial.println("BMP180 init fail (disconnected?)\n\n");
    while(1); // Pause forever.
  }
  //Initialize radio
  radio.initialize(FREQUENCY,NODEID,NETWORKID);
  Serial.println("Transmitting at 433 Mhz");
}

void loop()
{
  double T,P;
  
  // Get a new pressure reading:
  bmp.getData(T,P);

  //Display data
  Serial.print("Absolute pressure: ");
  Serial.print(P,2);
  Serial.println(" mb.");
  Serial.print("Temperature: ");
  Serial.print(T,2);
  Serial.println(" deg C.");

  int x = analogRead(xpin);  //read from xpin
 
  int y = analogRead(ypin);  //read from ypin
 
  int z = analogRead(zpin);  //read from zpin
 
  float zero_G = 512.0; //ADC is 0~1023  the zero g output equal to Vs/2
                      //ADXL335 power supply by Vs 3.3V
  float scale = 102.3;  //ADXL335330 Sensitivity is 330mv/g
                       //330 * 1024/3.3/1000 

  Serial.print(((float)x - 331.5)/65*9.8);  //print x value on serial monitor
  Serial.print("\t");
  Serial.print(((float)y - 329.5)/68.5*9.8);  //print y value on serial monitor
  Serial.print("\t");
  Serial.print(((float)z - 340)/68*9.8);  //print z value on serial monitor
  Serial.print("\n");

  sprintf(payload,"T: %d C, P: %d mb.",(int)T,(int)P);
  Serial.println(payload);
  radio.send(GATEWAYID, payload, 50);
  Serial.println("Send complete");
  
  delay(500);
}

ground station

/* 
    qbcan CanSat example.

    This sketch receives data from other qbcan that transmit messages.
*/

//Include the required libraries
#include <qbcan.h>
#include <Wire.h>
#include <SPI.h>


//Radio Parameters
#define NODEID        1    //unique for each node on same network
#define NETWORKID     60  //the same on all nodes that talk to each other
#define FREQUENCY     433


//Radio object
RFM69 radio;
bool promiscuousMode = true; //set to 'true' to sniff all packets on the same network

void setup()
{
  //Initialize serial connection for debugging
  Serial.begin(9600);
  Serial.println("REBOOT");

  //Delay to give time to the radio to power up (is it really needed?)
  delay(1000);

  //Initialize radio
  radio.initialize(FREQUENCY,NODEID,NETWORKID);
  radio.promiscuous(promiscuousMode);
  Serial.println("Listening at 433 Mhz");

}


byte ackCount=0;
uint32_t packetCount = 0;
void loop()
{

  if (radio.receiveDone())
  {
    Serial.print("#[");
    Serial.print(++packetCount);
    Serial.print(']');
    Serial.print('[');Serial.print(radio.SENDERID, DEC);Serial.print("] ");
    if (promiscuousMode)
    {
      Serial.print("to [");Serial.print(radio.TARGETID, DEC);Serial.print("] ");
    }
    for (byte i = 0; i < radio.DATALEN; i++)
      Serial.print((char)radio.DATA[i]);
    Serial.print("   [RX_RSSI:");Serial.print(radio.RSSI);Serial.print("]");
    
    if (radio.ACKRequested())
    {
      byte theNodeID = radio.SENDERID;
      radio.sendACK();
      Serial.print(" - ACK sent.");

      // When a node requests an ACK, respond to the ACK
      // and also send a packet requesting an ACK (every 3rd one only)
      // This way both TX/RX NODE functions are tested on 1 end at the GATEWAY
      if (ackCount++%3==0)
      {
        Serial.print(" Pinging node ");
        Serial.print(theNodeID);
        Serial.print(" - ACK...");
        delay(3); //need this when sending right after reception .. ?
        if (radio.sendWithRetry(theNodeID, "ACK TEST", 8, 0))  // 0 = only 1 attempt, no retries
          Serial.print("ok!");
        else Serial.print("nothing");
      }
    }
    Serial.println();
  }

}

Heb je al eens geprobeerd om gewoon een simpele "hello world" te versturen? Dus zonder de sensoren of iets anders eraan verbonden muv de RFM69?

Ja dit heb ik al geprobeerd, dit had echter geen resultaat. De meet node verzendt wel, maar de radio van de groundstation start niet op.

Hoe weet je dat dan ?
Klopt het dat je 2 keer dezelfde hardware hebt (op de sensoren na dan) ?
Heb je dan ook al geprobeerd de zender en de ontvanger te wisselen met elkaar, en de pro micro's ?