NRF24L01+ & Max6675

All am scratching my head down to the bare bone trying to figure out how to get these two devices to play nice with each other.

The radio seems to take over the SPI bus and will not free it up. If I do not initialize the radio I am able to read the temperature probes without any issues but as soon as I initialize/start the radio I loose my temperature readings.

I am using the maniacbug library with he radio setup in a network mode. Bellow one of the sketches that I have been tinkering with.

I have even went as far as modifying the library to add a function to set the CSN pin to HIGH/LOW and I could see pin 10 going high and low but I still couldn’t read my temperature sensor.

If anyone has any recommendations it would be greatly appreciated.

#include <SPI.h>
#include <RF24Network.h>
#include <RF24.h>
#include "max6675.h"


MAX6675 tempProbe(13,7,12);




//nRF24 set the pin 9 to CE and 10 to CSN/SS
// Cables are:
//     SS       -> 10
//     MOSI     -> 11
//     MISO     -> 12
//     SCK      -> 13

RF24 radio(9,10);
RF24Network network(radio);
const uint16_t this_node=1;
const uint16_t master_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;

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() 
{
 // 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 = { getTemp(), packets_sent++ };
   RF24NetworkHeader header(/*to node*/ master_node);
   bool ok = network.write(header,&payload,sizeof(payload));
   if (ok)
     Serial.println("ok.");
   else
     Serial.println("failed.");
 }
}
float getTemp()
{
 return tempProbe.readCelsius();
}

Please modify your post and use the code button </>

so your code looks like this

and is easy to copy to a text editor. See How to use the Forum

Is it essential to use the network? I have not used it myself.

If the network is not essential the transmitter (master) in the pair of programs in this link only sends data once every 100 millisecs - leaving plenty of time for other stuff.

…R

My initial program wasn't using the network and I was still getting the same result. If I remove the getTemp() call and put 100.0 in it's place it transmits that data properly and on the receiver side I am able to get the 100.0. However if I put the getTemp() call back in the everything still works as far as rx/tx only thing is that I get 0.0 for temperature.

If I comment the radio/network stuff out and Serial.println(getTemp()) I get a good temperature reading.

jcainslie: If I comment the radio/network stuff out and Serial.println(getTemp()) I get a good temperature reading.

Have you tried the code in my link?

...R

I am currently at work and haven't tried your code yet.

I am not sure it will show me much different as I am currently able to send and receive data without any issue. Even when I try and read the temperature probe I get a 0.0 from the temp probe and I am able to transmit and receive 0.0.

I will give your code a try this evening just to be sure though.

jcainslie: I am not sure it will show me much different as I am currently able to send and receive data without any issue.

It will at least be different because it is not creating a network. I imagine that a network requires constant action.

Also, as I said earlier, my code only uses the wireless about 10% of the time (maybe a lot less) so there should be 90% of time available for other stuff.

...R