would Spi to I2C slow down?

Hello i been told a few times in the past if you have a Spi and you want a to use it on i2c you need some kind of converter but from also what I'm wondering wouldn't converting it from Spi to I2c slow down things i have a Spi nrf24l01 module and I'm running out of arduino uno pins i found a Spi to i2c module for the nrf24l01 module http://www.ebay.com/itm/141291806464?_trksid=p2060778.m1438.l2649&ssPageName=STRK%3AMEBIDX%3AIT what I'm trying to ask is that wouldn't converting it from Spi which is faster to I2c slow it down?

"slow it down" is a bit vague. Are you talking about latency (the delay between sending and the signal arriving at the other end) or bandwidth (the rate at which data can be sent). On both scores, the most important question is whether the I2C bus is fast enough for your application.

From what I gather, the I2C bus has a greater bandwidth than the nrf24l01 so that's never going to be an issue, unless you have many other VERY busy devices also on the I2C bus.

Hello KenF thank you for that information it help me a lot the problem I'm having is that I'm running out of analog and digital pins on my project and i came across this spi 2 i2c converter for the nrf24 modules I'm only using it for sending text message from one node to another node on the network. one thing was to do is add this module for the i2c or some kind of digital pin extender to give more digital pins but looking into that i would lose a few pins but only gain about 3 to 4 more pins so i wouldn't sure what i should do that i guess i cross that path when i get there but again thank you for that information.

Sounds like an interesting project. Would you care to share more details to see if we can come up with any other ideas to optimise your pin usage.

This is what I'm trying to do or trying now and failed. because I'm limited on programing coding i have a hard time programing I'm great at building hardware but not coding what I'm trying to do is setup 6 people me and my 2 brothers and 3 of our friends on the nrf24 modules as i guess like a network they call it a mesh network. i can do a 1 on 1 2way text like a old 2way pager i found a sketch online http://shantamraj.wordpress.com/2014/07/20/a-better-chat-program/ but rlogiacco help me to add a third person with some success it worked but a little buggie meaning everyone ended up the same user id number and if i send a text message all 3 people can see it. but what i would like to do is setup 6 people and say I'm number one node and i want to send it to number 5 node one of my friends without sending it to the whole network of everyone at once. and if say number 3 node my younger brother wants to send a text to node 6 our other friend without everyone seeing it at once. problem is sense the lack of coding or knowing how to program i can't do it i have all the hardware but that's all.

This is why i need help.

aha! OK. This sounds doable. Could you post a copy of the "buggy" software you have so far. It sounds like you also need to have a method to set each stations ID independently. The EEProm would be an ideal place for this. Then the devices could even be turned off and back on without loosing track of their own identity.

If you're this close, I'm sure it's not going to be too hard to get that final step sorted.

This is the code for the 3 users but its not using the mesh network so if one person is 2 far it won’t relay through the third person. this is just using the normal nrf24 library. this is the sketch where the users each one shows the same id number well kind of i had one setup on my desktop second one on my new laptop well used but new to me and the third one on a very old p4 laptop when i send a message from the desktop as number one the new laptop says it came from id2 but on my old laptop the message show as number 3 and if i send a message from my new laptop the desktop says its number 3 and old laptop says its number 1 it came from the funny thing is if i send from my old laptop desktop says its come from number 1 and new laptop says it come from number 3 i never seen this before kind of strange to me snese I’m not a coder. but this is the sketch below.

#include<SPI.h>
#include"nRf24L01.h"
#include"RF24.h"
#include"printf.h"

#define DEVICES 3 // set this to the number of devices
#define DEVICE_ID 1 // set this to a value between 1 to 3 for each of the 3 devices
RF24 radio(9, 10);
const uint64_t pipes[DEVICES] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL , 0xF0F0F0F0D3LL }; // 0xCAFEBABED3LL, 0xCAFEBABEF4LL, 0xCAFEBABEE5LL // provide an address for each device
bool go_to_tx_mode = false;
char input[32] = "";
void setup() {
  Serial.begin(57600);
  printf_begin();
  radio.begin();
  radio.setRetries(15, 15);
  printf("sending messages as %i", DEVICE_ID % DEVICES);
  radio.openWritingPipe(pipes[DEVICE_ID % DEVICES]);
  for (int i = 1; i < DEVICES; i++) {
    printf("listening for messages from %i on pipe %i", (DEVICE_ID + i) % DEVICES, i);
    radio.openReadingPipe(i, pipes[(DEVICE_ID + i) % DEVICES]);
  }
  radio.startListening();
  radio.printDetails();
  // put your setup code here, to run once:

}

void loop() {
  if (go_to_tx_mode)
  {
    radio.stopListening();
    bool ok = radio.write(input, 32);
    if (ok)
    {
      printf("ME : %s\n", input);
      go_to_tx_mode = false;
      radio.startListening();
    }
    else
      printf("could not write....\n");
  }
  uint8_t sender;
  if (radio.available(&sender))
  {
    char payload[32] = "";
    bool done = false;
    while (!done)
    {
      done = radio.read( payload , 32 );
      printf("Sender %u: %s\n", sender, payload);
    }
  }

  if (Serial.available())
  {
    int len = Serial.readBytesUntil('\n', input, 31);
    input[len] = '\0';
    go_to_tx_mode = true;
  }
}

Interesting. Having a quick look it seems pretty readable and far less bloated than I was expecting. (Jolly helpful chap that rlogiacco, eh)

So here's are my first thoughts. You MUST give every station it's own unique ID. As I say, I think this should be stored in eprom. This could be read within your setup function. You could perhaps make this updateable through the Serial port. For example, if the string entered by the user starts with "_SID" it could then take the following characters as a new ID. Save this in eprom and use it as it's new id.

To relay messages, the messages themselves should be identifiable, otherwise you could end up with a situation where messages are endlessly repeated throughout the network. So the strategy I suggest is that every station keeps a variable msgID. It will increment this for every message it sends.

Any station recieving a message that is not addressed to itself should resend the message, but only if it hasn't already relayed it before. To keep track of which messages have been relayed already it will have an array that stores the last message id that it has relayed for every other station. Before relaying, it would just need to check that the new message ID is different to the last one that it relayed for that station.

I'll see if I can come up with some code to implement these ideas but unfortunately I don't even have access to an arduino at the moment so it may take a bit of debugging. Watch this space.

thank you for the help Ken. but what happens if I'm to far from my friends out of range then i couldn't send to them before it's not setup as a mesh network to relay the message through the other nodes?

josephchrzempiec:
thank you for the help Ken. but what happens if I’m to far from my friends out of range then i couldn’t send to them before it’s not setup as a mesh network to relay the message through the other nodes?

It’s the functionality of a mesh network that I’m thinking of creating. I’ve just finished locating and downloading all the library files that you have referenced in your source so I’m busy working through them now to get to grips with what is already available. I’m not convinced that we need to do all the work within our sketch. Even if we do, I don’t think it’s particularly complicated.

Understandable Ken the idea you have to store the id for each node in the eeprom would be a great thing that way if i get a text from that id it will tell me who it's from would be cool. or maybe something like a cellphone you know how you can add a name to contact list might be nice. doesn't have to store the messages i know the eeprom not much memory to store it but storing the id numbers for each one or having some kind of contact list say i put peter for the first contact and he is on id number 2 and matt can be on contact for id 3 and so forth.

in my source code it's not setup for the mesh network. This is the mesh network library https://github.com/maniacbug/RF24Network you also need the https://github.com/maniacbug/RF24 as part of it from what i have seen.

So is that the way you want to go?

What do you mean? What I’m trying to do is setup for 6 people using the mesh network that i can send a text to 1 instead of the whole network receiving the text. for now just trying to get this up and running would be awesome and later on can always add the contact list or id or whatever it is. would be a great starter there i think.

josephchrzempiec: What do you mean? What I'm trying to do is setup for 6 people using the mesh network that i can send a text to 1 instead of the whole network receiving the text. for now just trying to get this up and running would be awesome and later on can always add the contact list or id or whatever it is. would be a great starter there i think.

But the whole idea of the mesh network is that ALL stations recieve every message (even those out of range of the original sender) but only the one that is addressed as the recipient would actually shows the message.

The individual IDs are required so that a receiving station knows what to do with a message when it receives it. If the message is addressed TO it's own ID it will show the message to the user. Otherwise, it simply passes the message on.

Ken this setup yes for all the modules stations to receive the text message at once yes you are correct with that sketch there. kind of like a chat text message. but the setup I'm trying to do is something like a cellphone text message like a 1 on 1 so it doesn't go to the whole group at once. but problem is with this setup of that sketch i posted if someone is out of range they won't get the text. unless it's setup as a mesh network because within the mesh network haves the capability to relay from one node to another into it gets to where it should go.

hey Ken what i found out is the 24rf network uses node addresses but the nrf24 uses pipeline addresses what is the difference?