nRF905 TX power and frequency

Since my other one seems to have mysteriously vanished, I will give the update on this brand new post. I was able to figure out how to use most of what I need but I still am stumped with setting the frequency.

 * Project: nRF905 AVR/Arduino Library/Driver
 * Author: Zak Kemble,
 * Copyright: (C) 2013 by Zak Kemble
 * License: GNU GPL v3 (see License.txt)
 * Web:

 * Time how long it takes to send some data and get a reply
 * Should be around 14-16ms with default settings.
 * 7 -> CE
 * 8 -> PWR
 * 9 -> TXE
 * 2 -> CD
 * 3 -> DR
 * 10 -> CSN
 * 12 -> SO
 * 11 -> SI
 * 13 -> SCK

#include <nRF905.h>
#include <SPI.h>

#define RXADDR {0xFE, 0x4C, 0xA6, 0xE5} // Address of this device (4 bytes)
#define TXADDR {0x58, 0x6F, 0x2E, 0x10} // Address of device to send to (4 bytes)

#define TIMEOUT 1000 // 1 second ping timeout

void setup()
	// Start up

//  Transmit level 10db

nRF905_setFrequency(nRF905_band_t band, uint32_t 915000000);

	// Set address of this device
	byte addr[] = RXADDR;

	// Put into receive mode

	Serial.println(F("Client started"));

void loop()
	static byte counter;

	// Make data
	char data[NRF905_MAX_PAYLOAD] = {0};
	sprintf(data, "test %hhu", counter);

	unsigned long startTime = millis();

	// Set address of device to send to
	byte addr[] = TXADDR;

	// Set payload data
	nRF905_setData(data, sizeof(data));

	// Send payload (send fails if other transmissions are going on, keep trying until success)

	// Put into receive mode

	// Make buffer for reply
	byte buffer[NRF905_MAX_PAYLOAD];
	bool success;

	// Wait for reply with timeout
	unsigned long sendStartTime = millis();
		success = nRF905_getData(buffer, sizeof(buffer));
		if(success)// Got data

		// Timeout
		if(millis() - sendStartTime > TIMEOUT)

		unsigned int totalTime = millis() - startTime;
		Serial.print(F("Ping time: "));

		// Printout ping contents
		Serial.print(F("Data from server: "));
		Serial.write(buffer, sizeof(buffer));
		Serial.println(F("Ping timed out"));


This is the line that has me stumped:

nRF905_setFrequency(nRF905_band_t band, uint32_t 915000000);

I was trying to figure it out from:


  • Set frequency, workout the channel from the frequency
  • 433MHz band: 422.4MHz - 473.5MHz, 100KHz steps
  • 868/915MHz band: 844.8MHz - 947MHz, 200KHz steps
  • @param [band] Frequency band
  • @param [freq] Frequency in Hz
  • @return (none)
    void nRF905_setFrequency(nRF905_band_t band, uint32_t freq);

All that is in the header nRF905.h

Library I got from github:

Thanks in advance!


Hi Bob

Looks like you need to change your function call to this:

nRF905_setFrequency(NRF905_BAND_915, 915000000UL);

In the library .h file, there are three options defined for the first argument:

NRF905_BAND_433 = 0x00,	/**< 433MHz band */
NRF905_BAND_868 = 0x02,	/**< 868MHz band */
NRF905_BAND_915 = 0x0



nRF905_setFrequency(NRF905_BAND_915, 915000000UL);

I see what I did wrong with the first part, I had lowercase letters because I wasn't paying close attention. I never did find the other half of it though (The 2nd argument), I'm not sure where that was pointing to. I also don't understand the "UL" after it. Thanks!

Thanks so much for that hackscribble, it compiled for me, now I just need to figure out why :slight_smile:


Edit: I read up on UL and found that it is for Unsigned Long. I assume this is just a default when nothing else really goes there?