8266 AND tEENSY 3.1

Status
Not open for further replies.

jpatrick62

Well-known member
I just got 2 of the 8266 Wifi modules from ElectroDragon to test out. However, for whatever reason I have been unable to get the serial communications to
work. I have wired


Code:
#define*UART1*Serial1

void setup() 
{

****// Setup computer to Arduino serial
****Serial.begin(9600);

****// Setup Arduino to ESP8266 serial
****// Use baud rate 115200 during firmware update
****UART1.begin(9600);
}

void loop() 
{

****// Send bytes from ESP8266 to computer
****if ( UART1.available() ) 
****{
********Serial.write( UART1.read() );
****}

****// Send bytes from computer back to ESP8266
****if ( Serial.available() ) 
****{
********UART1.write( UART1.read() );
****}

}

and here's my hardware setup:

TeensyTo8266.jpg

But I cannot get to the TTY commands. I've tried using 9600, 57600, and 115200 to no avail. I get nothing unless I
type in a char, and then I'll get endless chars back (the blue led on the 8266 stays on while this is happening as well).
Am I doing something wrong - I am using the Serial Port interface in the Arduino Tools menu.
 
What is the current demands for the module?

Teensy can only provide 100ma, and would expect most RF modules to need more than that in transmit. As a separate thing I don't think this line is right
Code:
UART1.write( UART1.read() );

I'm guessing that should be
UART1.write( Serial.read() );
 
Yes, an external 3.3V voltage regulator is required. Max current consumption is up to 215 mA.
 
Wow - so tired I didn't even see that - you are right, it should be UART1.write( Serial.read() );
I have an external 3.3 volt regulator on this, should be enough current.
Thanks for pointing that out to me!
 
You might also look at File > Examples > Teensy > USB_Serial > USBtoSerial.

If your data rates are not very fast, or if the data is mostly flowing only in 1 direction at a time, the simple 1-byte-at-a-time approach works pretty well.

For more demanding data flow, the approach of using both available() and availableForWrite() to move larger chunks, but never more than either port is ready to actually accept, gives much higher performance.
 
I have this bookmarked for when I get round to using ESP8266 and Teensy together.
http://www.cse.dmu.ac.uk/~sexton/ESP8266/
I believe the author of this is also active on this forum.

Your modules should have some version of the AT software running although there have been some reports on the ESP8266 forums of blank modules from some vendors (Should this be the case the electrodragon site has some of the better tutorials on how to flash them).
NB - Also make sure that Your serial terminal is set to send both CR and NL.
 
Last edited:
Status
Not open for further replies.
Back
Top