Wireless communication between Arduino Uno and Teensy 3.0?

Status
Not open for further replies.

jykm12

Member
I've been using nrf24l01+ modules to communicate between two arduino unos but I found that arduino was too slow to do the things I wanted on one end.

I tried the same code with Teensy 3.0 and the result was spectacular!

But I was wondering if it is possible to communicate between an Arduino Uno and a Teensy using the wireless module I specified. If that is not possible, how could I send commands from one Arduino Uno to Teensy? I know that if I use RX and TX, whenever arduino boots up, the board becomes unstable and cannot boot. I need an alternative.
 
You might be able to use SoftwareSerial on the Uno side and relocate the pins from 0/1. However, note it has no hardware assist, and does everything in the Uno (which might be ok if the Uno doesn't have anything to do but wait for serial commands).

It might be simpler in the end just to use two Teensy 3.0's, to use the hardware FIFO (or Teensy 3.1's which adds a second h/w FIFO on serial2, i.e. pins 9/10).
 
It now sounds like you have 2 Uno's and a Teensy 3.0. What is your application, and what does the whole setup look like?

What I'm suggesting is don't use any Uno's, just use Teensy 3.1's (or 3.0). With the Teensy you won't need the logic level converter, since the Teensy runs at 3.3v that the nf2401+ runs at.
 
I have a circuit with potentiometers and lcd screens and touch sensor buttons one side connected to an Uno. Uno sends commands to the other Uno via nrf24l01 modules. The 2nd Uno drives an LED strip. I'm using sin and cos to do the led brightness adjustments (because I can't think of other way to do 'aurora' looking effects), but Uno is waaaay too slow. I did it on Teensy and its insanely fast.
 
I suspect that it is 'insanely' fast on the Teensy due to it being a 32-bit chip that runs at 48Mhz or 96Mhz, compared to the Uno which is an 8-bit processor running at 16Mhz. Note sin/cos uses floating point. Neither the Teensy nor the Uno have hardware floating point, so they have to emulate it. Besides the 6x or 3x speed advantage that the processor speed gives you, a 32-bit processor will issue a lot fewer instructions to emulate floating point. So you are probably talking about an order of magnitude difference between the two.

Now, if you were to use a Raspberry Pi (700Mhz) or Beagle Bone Black (1Ghz) you might see 2 orders of magnitude difference in running sin/cos over the Teensy (1 from the higher clock speed, 1 from the chips having hardware floating point and not needing the emulator). Of course you pay for this in having a higher power budget and of course it is controlled in a different manner (Linux vs. Arduino libraries).

While the hardware FIFO's on the Teensy helps somewhat with the speed, I suspect it is in the noise level compared to the use of sin/cos.

<edit>
Sparkfun does have a floating point co-processor that looks like it was originally made for PIC processors that in addition to having the basic operations has direct support for sin, cos. Unfortunately the through hole version of the chip is sold out, and Sparkfun indicates they have no idea if they will ever get it again. If you are up for soldering SOIC, it looks like they have a few boards left (but I wouldn't count on them getting restocked if they sell out): https://www.sparkfun.com/products/8450
 
Last edited:
Yea I don't know exactly how much faster Teensy is but the LED sketch is running very fluidly on Teensy while on Uno it runs very choppy.
 
Probably the simplest way to communicate between Uno and Teensy 3.0, without the trouble of confusing Uno's bootloader, is I2C using the Wire library. On the Uno side, use Wire.begin(address) and set up the functions to run automatically when Teensy 3.0 reads or writes data. On the Teensy 3.0 side, use Wire.begin(), and then Wire.beginTransmission(address) to communicate with the Uno.

Even though Teensy 3.0 is not 5V tolerant, the I2C pullups on Uno are weak enough that they will not damage your Teensy 3.0. But for best communication, using real 4.7K pullup resistors on SDA and SCL, pulling up to 3.3V (not to 5V) is recommended.

Real wires are almost always more reliable than wireless, so if you can connect 2 signals and ground, I'd suggest using I2C.
 
Edited - it works perfect. teensy just needed some rest after a long day's work probably

Hi, I stumbled on this thread after not being able to communicate between UNO and teensy 3.0. Sorry for hijacking if I am. I am sending a lot of data from the teensy to UNO. UNO to UNO is absolutely no problem. But teensy 3.0 to teensy 3.0 does not work also.

I have modified the Serial buffer to 64 bytes and thats the only modification done.

I have tried a single direction logic level converter and it did not help, with and without pullup resistors on both the 5v and 3.3v sides. If I connect the teensy to the UNO directly as you suggested, do i connect the 5v of the UNO to the teensy Vin or Vout?


This is the code here. I am using it for 32 byes but shortened it so its easy to fit here
----------------Code on master
#include <Wire.h>
byte tosend1[] = {1,2,3,4};
byte tosend2[] = {8,9,10,11};
byte tosend3[] = {16,15,14,13};

void setup()
{
Wire.begin();
}

void loop()
{
Wire.beginTransmission(19);
Wire.write(tosend1,4);
Wire.endTransmission();
delay(22);
Wire.beginTransmission(19);
Wire.write(tosend2,4);
Wire.endTransmission();
delay(22);
Wire.beginTransmission(19);
Wire.write(tosend3,4);
Wire.endTransmission();
delay(22);
}



-------------Code on slave
#include <Wire.h>
int val1;
int val2;
int val3;
int val4;

void setup()
{
Wire.begin(19);
Wire.onReceive(receiveEvent);
Serial.begin(115200);

}

void loop()
{
Serial.print(val1);
Serial.print(val2);
Serial.print(val3);
Serial.println(val4);
}

void receiveEvent(int howMany)
{
val1 = Wire.read();
val2 = Wire.read();
val3 = Wire.read();
val4 = Wire.read();
}



For uno to uno, uno --> nano i get the numbers output.
for teensy --> teensy, teensy --> due, due --> nano all i get from the serial output is zeros because obviously something is wrong somewhere and I cannot figure it out yet :(. but I will be trying tomorrow again :cool:
 
Last edited:
Status
Not open for further replies.
Back
Top