Go Down

Topic: NRF24L01 + I2C Shield DESPERATE need of help. (Read 437 times) previous topic - next topic

daniel__gl

I have a set of arduino UNOs and a set of NRF24L01 extended range modules which I have been able to program for one way communication by just connecting all eight pins directly to the MC. Now, I recently purchased the I2C shields that supposedly "simplifies the communication alot" but I find that to be ridiculous. The only thing that has worked is this example: [YouTube Link, Code in description.] which I have just copied and pasted. When I try to modify anything, it stops working.

I am in desperate need of a tutorial, a data sheet or instructions or anything regarding this module. I have looked everywhere on the internet and have found nothing. The only thing I have found is how to communicate between two arduinos via i2c, but the examples presented don't work either.

I am on the verge of tossing these to the trash. This is my last resort. Please help, thanks.

PaulS

Quote
I am in desperate need of a tutorial, a data sheet or instructions or anything regarding this module.
Without telling us what module you are referring to, you are going to remain that way.

Robin2

As well as what @PaulS has said, I don't understand what you plan to do with the I2C shield. The nRF24 modules use SPI rather than I2C

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

daniel__gl

Im sorry guys for rambling like that yesterday I had spent the whole day working on it with no avail until this morning at 3 AM and I was already frustrated. My hardware consists of two UNOs, two NRF24L01 modules, and two NRF24L01 Wireless Shield SPI to IIC I2C TWI Interfaces which don't really have a part number either, but I know they they are made by icstation. The I2C shields are these: [SPI to I2C by icStation] and there is a data sheet with a bit of basic information.

The idea of this shield is to simplify the communication process between two or more NRF24L01 modules. Now instead of using the SPI.h, nRF24L01.h etc, we will only use wire.h which is used for I2C communication. The address for both of these modules is 35, and when there is no data being transmitted by the user, the default conversation is simply (0x47).

I have now made the modules work and I am able to send a three digit numbers from one NRF to the other using "unsigned char", or a single letter using "char", like this:

[Snippet of code only]

unsigned char DataRX = 125;

Wire.write(DataTX);

This prints out 125 on the other module's serial. I have also tried sending a float number (12.6), but on the other end I only get 12 without the .6. I believe this is just standard I2C communication, the same as wired, I just haven't ever worked with I2C before.

How do you send a four digit number via I2C? how about a string "Hello"? or a (12.6) float?

Thank you all, if you can point me in the right direction I would truly appreciate it. If you all need more information let me know and Ill post it.




Robin2

Im sorry guys for rambling like that yesterday I had spent the whole day working on it with no avail until this morning at 3 AM and I was already frustrated. My hardware consists of two UNOs, two NRF24L01 modules, and two NRF24L01 Wireless Shield SPI to IIC I2C TWI Interfaces which don't really have a part number either, but I know they they are made by icstation. The I2C shields are these: [SPI to I2C by icStation] and there is a data sheet with a bit of basic information.
That sounds like using a train to get a Boeing 737 from Manchester to London.

I got my nRF24s to work by following this tutorial

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

daniel__gl

hahah I know right?  :smiley-confuse: I did see that tutorial before and I have read it completely. Its the one I used initially to set up my program before the shields arrived. Furthermore my program was already running and communicating partially the way I wanted it, I just needed to figure out how to open up a second pipe to receive data and have two way communication. The only problem I had with this set up was, when I used the NRF in MAX power mode, the range almost vanished completely unless I wrapped my hand around the antenna, so I set up power to LOW. Im assuming that the range is reduced by setting power to this level, and by using the shields I haven't had any problems with range. Also it has an onboard 3.3v regulator.

Once the I2C Shields arrived I had to start all over again, this time programming everything in I2C. Here is where all hell broke loose because I don't know how to even make sense of how I2C works and the tutorials don't make sense either because they don't explain how data is transmitted. All I know is that I2C begins communication by asking for a byte then reading data. But how do I know what the incoming data is? Is everything sent at once? If I want to send a value of 100, then a value of 200 in an array, how does it work?

I wish it was as easy as "radio.write(array, sizeof(array));" but I2C does not work like that. Am i making sense?

Robin2

#6
Jan 13, 2016, 11:44 am Last Edit: Jan 13, 2016, 11:46 am by Robin2
I wish it was as easy as "radio.write(array, sizeof(array));" but I2C does not work like that. Am i making sense?
I will only say that if it was my project I would dump the I2C shield.

Quote
out how to open up a second pipe to receive data and have two way communication
You don't need a second pipe to get 2-way communication. I just use the writeAckPayload() function on the slave and it sends data back without even needing to change between listening and writing.

As a general comment, it is seldom practical to solve a complex problem by adding further complexity that you are just as unfamiliar with. In this case, if you were just asking a question about nRF24 code I may be able to help. But I know nothing about I2C or your shield and I have no idea whether your problem is in the I2C system or in the nRF24 system.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

daniel__gl

I am starting to think the same thing, maybe these shields are not a good idea after all, they save room because it uses less wires but waste a whole bunch more time for somebody with no experience; i2c is more complex to make it communicate more than one variable. The thing I liked about these is the onboard regulator and the status leds but I think ill just order some hardware and make my own pcb shield that consists of just a regulator, status leds and thats it, no I2C.

By the way I had no clue you could use the same pipe for return communication! I was thinking since at the beginning I set the open.readingpipe(pipe) for the rx and open.writingpipe(pipe) for the tx, it was strictly one way communication. So with writeAckPayload() I can write as much information back to the rx? or does it have any kind of limitation? The idea for my project, for now is to send two, three digit numbers to the rx, and then have the rx send back a different three digit float value.

Also, have you ever had any range problems when you set the power level on the NRF to HIGH or MAX? I have read forums where people say that it could be a noisy 3.3v power input but I'm still not sure what the problem really is. At this point I have already installed the recommended capacitor across the power pins like everybody recommends. The communication works great on power level LOW but I want to switch to MAX because I need as much range as possible.

Thanks for your valuable responses!

Robin2

Have a look at the pair of demo programs in this link

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

daniel__gl

BINGO!!!! I will be definitely be using the payload function. Thank you so much for your help Robin2 that was the missing piece, now whats left is the MAX power issue which I think or hope will be resolved with the use of a 3.3v regulator.

I will definitely run back to this thread if I have any questions!

Thank you :)  :)  :)

daniel__gl

#10
Jan 14, 2016, 01:54 am Last Edit: Jan 14, 2016, 08:09 am by daniel__gl
[POST DELETED]

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy