spirilis

[Energia Library] Nordic nRF24L01+ library

352 posts in this topic

The main thing I'd offer is that 2.4GHz is a warzone of noise, and some channels are likely to be noisier than others so you may find some nodes don't work so well.  I'd recommend using the 5-byte RF addresses and stick with one channel--my example channel scanner (in the library) could help you find one that's very quiet.

 

Also with long distances, I recommend using 250Kbps data rate as it's substantially more reliable over distance.  Only downside is under the hood it won't perform auto-ACK.

Share this post


Link to post
Share on other sites

I a super green noob and i can do a lot of the basics but I am stuck on how to the following.  I want to have a wireless motion trigger the following code is what I use for taking pics with a wired motion trigger but I am not sure how or what would be the next step to making it wireless.  Any help would be appreciated I have a set of the 

nRF24L01 to use for this.  I ultimately want use the wireless msp430s but I thought I would try first with this.  
/**********************
 * Motion Activated Camera
 * Dan Bridges 2009
 * 
 * For schematics and more documentation see:
 * http://www.dayofthenewdan.com/projects/motion-camera
 **********************/


boolean focus = false;

int shutterPin = 2;
int focusPin = 3;
int PIRPin = 4;

int shutterPressDelay = 200;
int focusPressDelay = 200;
int interPictureDelay = 500;


void setup(){
  pinMode(shutterPin, OUTPUT);
  pinMode(focusPin, OUTPUT);
}

void loop(){
  if (digitalRead(PIRPin)) {
    takePicture();
    delay(interPictureDelay);
  }
}

void takePicture() {
  //If you want the camera to focus first set
  //the focus variable to true.
  if (focus) {
    digitalWrite(focusPin, HIGH);
    delay(focusPressDelay);
    digitalWrite(focusPin, LOW);
    delay(250);
  }
  digitalWrite(shutterPin, HIGH);
  delay(shutterPressDelay);
  digitalWrite(shutterPin, LOW);
}

Share this post


Link to post
Share on other sites

Ok, hello again...

So after rereading this topic, I patched Energia and got the correct resulst in the TX, RX and scan examples

 

[...]

 

So this is really related to the Energia problem, I have to improve my github skills...

I will go on and try receive/transmit examples on 2 launchpad soon.

Sorry for disturbing you with this.

 

Hi!

I'm having the same issues with the TX and RX examples... what i've to do to patch Energia?

 

Thank you,

V.

 

EDIT: After few hours of sleep i've successfully patched Energia and now the TX/RX demo is working! :D Thanks again!

Share this post


Link to post
Share on other sites

good day guys,

 

I'm totally new to Energia. This is my requirement.

 

I have a stellaris launchpad LM4F120 and a MSP430 launchpad for 2553. I need to establish a simple communication link between these two using NRF24L01 transceivers.

 

I downloaded energia. Then I downloaded the files "spirilis" linked in this post. I copied Enrf24.h, Enrf24.cpp and nRF24L01.h to Enrf24_RXdemo folder. Then I opened the .ino file through energia. But when I verify it through energia I got the following error messages. Please help me through.

 

 

Enrf24.cpp: In member function 'void Enrf24::begin(uint32_t, uint8_t)':
Enrf24.cpp:65:27: error: 'BIT2' was not declared in this scope
Enrf24.cpp: In member function 'void Enrf24::_maintenanceHook()':
Enrf24.cpp:239:41: error: 'BIT1' was not declared in this scope
Enrf24.cpp: In member function 'boolean Enrf24::available(boolean)':
Enrf24.cpp:277:39: error: 'BIT0' was not declared in this scope
Enrf24.cpp: In member function 'size_t Enrf24::read(void*, uint8_t)':
Enrf24.cpp:293:37: error: 'BIT0' was not declared in this scope
Enrf24.cpp: In member function 'void Enrf24::flush()':
Enrf24.cpp:316:13: error: 'BIT5' was not declared in this scope
Enrf24.cpp:322:13: error: 'BIT6' was not declared in this scope
Enrf24.cpp:337:16: error: 'BIT1' was not declared in this scope
Enrf24.cpp:338:49: error: 'BIT3' was not declared in this scope
Enrf24.cpp:338:49: error: 'BIT2' was not declared in this scope
Enrf24.cpp:341:13: error: 'BIT0' was not declared in this scope
Enrf24.cpp:344:49: error: 'BIT3' was not declared in this scope
Enrf24.cpp:344:49: error: 'BIT2' was not declared in this scope
Enrf24.cpp:344:75: error: 'BIT1' was not declared in this scope
Enrf24.cpp: In member function 'uint8_t Enrf24::radioState()':
Enrf24.cpp:396:16: error: 'BIT1' was not declared in this scope
Enrf24.cpp:400:13: error: 'BIT0' was not declared in this scope
Enrf24.cpp:407:36: error: 'BIT4' was not declared in this scope
Enrf24.cpp: In member function 'void Enrf24::deepsleep()':
Enrf24.cpp:417:14: error: 'BIT1' was not declared in this scope
Enrf24.cpp:417:28: error: 'BIT0' was not declared in this scope
Enrf24.cpp:418:49: error: 'BIT3' was not declared in this scope
Enrf24.cpp:418:49: error: 'BIT2' was not declared in this scope
Enrf24.cpp: In member function 'void Enrf24::enableRX()':
Enrf24.cpp:428:47: error: 'BIT3' was not declared in this scope
Enrf24.cpp:428:47: error: 'BIT2' was not declared in this scope
Enrf24.cpp:428:73: error: 'BIT1' was not declared in this scope
Enrf24.cpp:428:87: error: 'BIT0' was not declared in this scope
Enrf24.cpp: In member function 'void Enrf24::disableRX()':
Enrf24.cpp:443:13: error: 'BIT1' was not declared in this scope
Enrf24.cpp:446:49: error: 'BIT3' was not declared in this scope
Enrf24.cpp:446:49: error: 'BIT2' was not declared in this scope
Enrf24.cpp:448:49: error: 'BIT3' was not declared in this scope
Enrf24.cpp:448:49: error: 'BIT2' was not declared in this scope
Enrf24.cpp: In member function 'void Enrf24::setCRC(boolean, boolean)':
Enrf24.cpp:509:16: error: 'BIT3' was not declared in this scope
Enrf24.cpp:511:16: error: 'BIT2' was not declared in this scope

 

Thank you in advance.

 

 

EDIT::: Sorry for the dumb question. I figured it out. :D

Edited by Pradeepa

Share this post


Link to post
Share on other sites

Hi. Just red the whole 3 pages but it is not really clear how to patch energia... Can someone explain it as simply as it can be? Another question: What is the range approximetly on the modules (without the amp) on 1Mbps and 250Kbps?

Share this post


Link to post
Share on other sites

Good day,


 


I want to connect my Stellaris launchpad and the MSP430 2553 using NRF24L01 transceivers. I found following energia libraries,


 


For MSP430


 


http://forum.43oh.co...f24l01-library/


 


For Stelaris launchpad


 


http://forum.stellar...f24l01-library/


 


 


After that I connected the pins of the modules like below,


 


MSP430


 


CE >> P2.0


CSN >> P2.1


SCK >> P1.5


MOSI >> P1.7


MISO >> P1.6


 


Stellaris launchpad


 


 


CE >> PA6


CSN >> PA7


SCK >> PB4


MOSI >> PB7


MISO >> PB6


 


Then i used putty to check whether the transmission is happening. But I think it is not. 


 


MSP430 serial interface gives my this result,


 


 


Enrf24 radio transceiver status: Receive Mode

Received packet:

Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT

Received packet:

Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT

Received packet:

Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT

Received packet:

Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT

Received packet:

Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT

Received packet:

Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT

Received packet:

Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT

Received packet:

Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT

Received packet:

Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT

Received packet:

Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT

Received packet:

Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT

Received packet:

Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT

Received packet:

Enrf24 radio transceiver status: Receive Mode

Received packet:

 

Stellaris launchpad gives me following result


 


 


Timeout on response from server!

Finished sending

 

I'm not sure whether I am doing this correctly. Can someone please help me through. 

Share this post


Link to post
Share on other sites

 

Good day,

 

I want to connect my Stellaris launchpad and the MSP430 2553 using NRF24L01 transceivers. I found following energia libraries,

 

For MSP430

 

http://forum.43oh.co...f24l01-library/

 

For Stelaris launchpad

 

http://forum.stellar...f24l01-library/

 

 

After that I connected the pins of the modules like below,

 

MSP430

 

CE >> P2.0

CSN >> P2.1

SCK >> P1.5

MOSI >> P1.7

MISO >> P1.6

 

Stellaris launchpad

 

 

CE >> PA6

CSN >> PA7

SCK >> PB4

MOSI >> PB7

MISO >> PB6

 

Then i used putty to check whether the transmission is happening. But I think it is not. 

 

MSP430 serial interface gives my this result,

 

 

Enrf24 radio transceiver status: Receive Mode
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: Receive Mode
Received packet:
 

Stellaris launchpad gives me following result

 

 

Timeout on response from server!
Finished sending
 

I'm not sure whether I am doing this correctly. Can someone please help me through. 

 

Something sounds awful flaky on the MSP430 side.  It shouldn't shift from "Receive Mode" to "NO TRANSCEIVER PRESENT".  Maybe check the wires and make sure they're not intermittently disconnecting or frayed?

Share this post


Link to post
Share on other sites

Hi. Just red the whole 3 pages but it is not really clear how to patch energia... Can someone explain it as simply as it can be? Another question: What is the range approximetly on the modules (without the amp) on 1Mbps and 250Kbps?

Geodave in another post mentioned about 40-50ft through 3 walls and I'm pretty sure that's with 250Kbps.  1Mbps is a lot less than that.  I get about ~40ft through 3 or 4 walls with possibly some room to work with.  That same setup does not work at all with 1Mbps.

Share this post


Link to post
Share on other sites

Then it is worth buying the amlpified modules. They say it goes up to 1Km. It should be a couple of hundred meters anyways. What do you think? http://www.ebay.com/itm/310651702557?ssPageName=STRK:MEWAX:IT&_trksid=p3984.m1423.l2649

 

So could you help me out with the patching? BTW when we can expect the next ernergia release?

Good find!

Share this post


Link to post
Share on other sites

Then it is worth buying the amlpified modules. They say it goes up to 1Km. It should be a couple of hundred meters anyways. What do you think? http://www.ebay.com/itm/310651702557?ssPageName=STRK:MEWAX:IT&_trksid=p3984.m1423.l2649

 

So could you help me out with the patching? BTW when we can expect the next ernergia release?

Man those things are dropping in price free-fall!  I paid $22 for mine less than a year ago...

I don't have 2 of them to validate the range bidirectional, but I can say they supposedly draw upwards of 120mA in a burst when you transmit and ~40-50mA continuously when you have them in receive mode.  They definitely improve the range when there's a non-amplified unit on the other end but it's still quite susceptible to water and/or metal interference.

 

As for the patching, the thread I created has the info ... I don't really know what else to put, this really needs to be fixed in the next Energia release and I have no idea when that's happening.

 

edit: Here they are even cheaper: http://www.aliexpress.com/item/1100-meter-long-distance-NRF24L01-PA-LNA-with-antenna-NRF24L01-Wireless-Module-2-4G-Wireless-Communication/727064493.html

Share this post


Link to post
Share on other sites

Thank you all. I could get them to work. theese are definitely better than the 433Mhz modules. when i tried the virtual wire it didnt work and killed one LP meanwhile :/ Lucky i got 3 of them :D When did the LP's price became 10 dollars? I should have bought more when the 1.5 came out :/

Share this post


Link to post
Share on other sites

Something sounds awful flaky on the MSP430 side.  It shouldn't shift from "Receive Mode" to "NO TRANSCEIVER PRESENT".  Maybe check the wires and make sure they're not intermittently disconnecting or frayed?

 

The wires are connected as i mentioned above. They are not disconnecting. Do I need to interchange MOSI and MISO? I haven't patched energia, can that cause issues? 

Share this post


Link to post
Share on other sites

 

Good day,

 

I want to connect my Stellaris launchpad and the MSP430 2553 using NRF24L01 transceivers. I found following energia libraries,

 

For MSP430

 

http://forum.43oh.co...f24l01-library/

 

For Stelaris launchpad

 

http://forum.stellar...f24l01-library/

 

 

After that I connected the pins of the modules like below,

 

MSP430

 

CE >> P2.0

CSN >> P2.1

SCK >> P1.5

MOSI >> P1.7

MISO >> P1.6

 

Stellaris launchpad

 

 

CE >> PA6

CSN >> PA7

SCK >> PB4

MOSI >> PB7

MISO >> PB6

 

Then i used putty to check whether the transmission is happening. But I think it is not. 

 

MSP430 serial interface gives my this result,

 

 

Enrf24 radio transceiver status: Receive Mode
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT
Received packet:
Enrf24 radio transceiver status: Receive Mode
Received packet:
 

Stellaris launchpad gives me following result

 

 

Timeout on response from server!
Finished sending
 

I'm not sure whether I am doing this correctly. Can someone please help me through. 

 

 

I patched Energia and now I can get the following output from MSP430

 

 

Enrf24 radio transceiver status: DEEP SLEEP <1uA power consumption
Enrf24 radio transceiver status: Receive Mode
 

I think the Receiver Module is working. But i still cannot receive any data. Can someone help me with configuring the transmitter module on stellaris launchpad. If someone can help me it would be highly appreciated.

Share this post


Link to post
Share on other sites

This library is great.  I use it between MSP430's all the time.  I know that there is a library already for the Stellar Pad, however, I like this one a LOT more.  Has anyone thought about getting this one to work with the Stellaris?  Again, I know the Mirf library is out there...it just doesn't even begin to compare to this one as far as simplicity and ease of use.

 

Just a thought...I see people asking about trying to use the Mirf with this library, and honestly...I haven't gotten it to work either...they just don't seem to want to talk to eachother.

 

I have been trying to get this library to work with the StellarPad for the past day or two and have not had any luck.  It just does not seem to talk to the module correctly.  If anybody has any ideas about how to port this thing, I am sure I am not the only one who would appreciate it.

 

Jerod

Share this post


Link to post
Share on other sites

G'Day,

Seems I've joined the tribe that can't get comms between Mirk and 430 libs. Only think I can see is the Mirk Lib does not allow you to set the TX & RX address. Will have another look at Mirk and see if there is a default address, that has to be used by the 430 sketch.

Share this post


Link to post
Share on other sites

Mirf sets Tx address to "serv1" and Rx address to "clie1" in ping_client, and opposite way around in ping server.

 

But with 430 lib Enrf24 we set both TX and RX to (0xDE, 0xAD, 0xBE, 0xEF, 0x01)

 

So maybe problem is with address., will have another go at changing address (didn't solve it the first time I played with them)

 

Grant

Share this post


Link to post
Share on other sites

Mirf sets Tx address to "serv1" and Rx address to "clie1" in ping_client, and opposite way around in ping server.

 

But with 430 lib Enrf24 we set both TX and RX to (0xDE, 0xAD, 0xBE, 0xEF, 0x01)

 

So maybe problem is with address., will have another go at changing address (didn't solve it the first time I played with them)

 

Grant

I tried to change the address. But still didn't work. I also did a channel scanning using the Enrf24 channel scanner that can be found in this thread. It did not output ***** near any frequency.  Any luck?

Share this post


Link to post
Share on other sites

Noup or is it nup,  anyway next idea has to be, have we got the same channel number,its default to 0 on the 430, but have changed that in the Mirf to 0 but still no comms. We might have to wait for a clever  member to solve this.

Grant

Share this post


Link to post
Share on other sites

Nrf24l Mirf(PA_7, PA_6, 0, 16); //CSN Pin Chip Select, CE Pin, Channel, Payload width, SPImodule(default 2)

radio.begin();  // Defaults 1Mbps, channel 0, max TX power

i think both tx and rx is tuned to same channel. Should try to port Enrf for stellaris.

Share this post


Link to post
Share on other sites

Ok, so I ported the Enrf library over so that it works with both MSP430 and Stellaris.  Seems to work great.  I am watching the tx rx demo between msp430g2553 (on the RX side), and the StellarPad doing the TX.  I have included an example in the usual examples folder so you can see how the SPI is setup on the StellarPad. 
 
Was not much at all to change.  Just added the BIT defs, messed around with the SPI settings and it was up and running.

 

I am off to bed.

 

JerodEnrf24ST.zip

OzGrant, Pradeepa, reaper7 and 1 other like this

Share this post


Link to post
Share on other sites

Ok, so I ported the Enrf library over so that it works with both MSP430 and Stellaris.  Seems to work great.  I am watching the tx rx demo between msp430g2553 (on the RX side), and the StellarPad doing the TX.  I have included an example in the usual examples folder so you can see how the SPI is setup on the StellarPad. 

 

Was not much at all to change.  Just added the BIT defs, messed around with the SPI settings and it was up and running.

 

I am off to bed.

 

Jerodattachicon.gifEnrf24ST.zip

Thank you much for the port!  I'll take a look at your changes and incorporate them into the git repo.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now