Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 3 1 2 3 LastLast
Results 1 to 25 of 59

Thread: Adding WiFi to Teensy 3.x

  1. #1
    Senior Member
    Join Date
    Feb 2017
    Posts
    321

    Adding WiFi to Teensy 3.x

    Hi all. Very new to the Teensy World and still feeling my way around. Wondering if there's a preferred way (or at least chosen by a majority of users) to add WiFi capability to Teensy 3.x boards. From past experience and all other things being equal, I'd go with the ATWINC1500 and the WiFi library. But, since I have next to zero experience with Teensy boards, I'd like to hear from folks who have reliable WiFi up and running.

    Thanks.
    Last edited by gfvalvo; 02-18-2017 at 04:34 AM.

  2. #2
    Senior Member
    Join Date
    Jan 2014
    Posts
    157
    I was successfull running atwinc1500 on teensy through spi using adafruit libraise including tcp and up client and server.

  3. #3
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,101
    ESP8266 worked for me. I never stressed it much - other than casual reads where it stayed up for days presenting a web page. It is cheap - not low power (when radio is active) - but has it's very own 80 MHz processor that can be programmed with Arduino to support the web server code and WiFi by itself offloading the Teensy - and have cycles left over to talk to the Teensy and provide a co-processor and FLASH storage if you get a 4 MB model it can be split it to hold 3 MB of SPIFFS file system data - for the web pages or log/feed Teensy data. That leaves 1 MB for code - enough to allow 500KB of OTA programming space on the ESP from Arduino IDE. The Teensy can reset it if needed - and it handles all the radio WiFi traffic so the Teensy never blocks/stalls on that. I've posted about it with link to github to my use and with nailbuster's MyWebServer.

  4. #4
    Senior Member
    Join Date
    Feb 2017
    Posts
    321
    Quote Originally Posted by defragster View Post
    ESP8266 worked for me.
    Hi, thanks. Yes I've used Adafruit's ESP8266 Huzzah as the main (and only) application processor on several WiFi-enabled projects. Using it as a slave WiFi processor is an intriguing idea. How'd you connect it to Teensy? SPI? Did you roll your own inter-processor communication protocol based on your application? Since I don't yet know my way around here, I'd really appreciate it if you'd provide some links to your relevant posts and github.

    Quote Originally Posted by RichardFerraro View Post
    I was successfull running atwinc1500 on teensy through spi using adafruit libraise including tcp and up client and server.
    Thanks.

  5. #5
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,101
    To connect Teensy to ESP I only went as far as using Serial# transfers for minimal debug spew. The same serial lines can be used to program the ESP through the Teensy when OTA gets wiped. Someone posted they were doing 2-4+ Mbps transfer rates - perhaps they needed hardware flow control. Will depend on how much data you want to send which way and if both side can keep up as needed.

    You can also just put on the AT command set firmware and use the ESP as just a gateway - this seems to be what FrankB posted with his projects.

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,821
    I keep hoping someone who's used ESP8266 with Teensy at high baud rates and with RTS/CTS flow control will write up a guide with photos and step-by-step instructions.

    Or maybe someone already has? If it's out there, please let me know? I want to make a link from the serial page.

  7. #7
    Junior Member
    Join Date
    Aug 2016
    Posts
    8
    Quote Originally Posted by PaulStoffregen View Post
    I keep hoping someone who's used ESP8266 with Teensy at high baud rates and with RTS/CTS flow control will write up a guide with photos and step-by-step instructions.

    Or maybe someone already has? If it's out there, please let me know? I want to make a link from the serial page.
    That would be great! A complete project using ESP8266 would be great! Bits and pieces everywhere with a dozen different approaches...

  8. #8
    Junior Member
    Join Date
    May 2017
    Posts
    3
    Quote Originally Posted by RichardFerraro View Post
    I was successfull running atwinc1500 on teensy through spi using adafruit libraise including tcp and up client and server.
    I am trying to do the same thing with the Teensy 3.6 and the Adafruit ATWINC1500 WiFi Breakout. Any advice? What specifically do you have to change so that it works with the Teensy (as oopsed to just using the Ardiuno Uno, which there are plenty of tutorials for)? Thanks!!

  9. #9
    Senior Member
    Join Date
    Feb 2017
    Posts
    321
    I think Adafruit now recommends WIFI101 library with their boards that use ATWINC1500.

  10. #10
    Junior Member
    Join Date
    May 2017
    Posts
    3
    Quote Originally Posted by gfvalvo View Post
    I think Adafruit now recommends WIFI101 library with their boards that use ATWINC1500.
    That's the library I am attempting to use with no success.

  11. #11
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,135
    i use adafruits huzzah esp8266 on i2c 64byte buffered fifo with rts/cts with teensy3.5,

    i know this sounds weird, but its true
    115,200baud as well.

    i created a library to support i2c uart device using the stream class, so it works with libraries that use "Stream &uart" type of class initializers, or use it as a regular serial port:

    if ( huzzah.available() > 0 ) Serial.print((char)huzzah.read());

    took me about a day to make this library

    i also setup a 2nd i2c uart with rts/cts with BT, you can have up to 16 of these uarts PER i2c bus, both huzzah and bt were working simultaneously over i2c without data loss.

    also, rts/cts on the i2cuart i program the register for auto rts/cts, whether its used or not, this makes devices hookup easier, by default they were disabled

    i even had it working with a 4dsystems display @115200 and the display doesnt even use rts/cts
    Last edited by tonton81; 05-12-2017 at 09:13 AM.

  12. #12
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,135
    i successfully implemented rts/cts on adafruits huzzah, you need to use gpio 13 and 15 for rts/cts and v2 AT firmware,

    i havnt checked if teensy has rts/cts im running mine off i2c with 64byte fifo hardware at 115,200

    i could give instructions and the firmware for the AT command set thats working on the huzzah and the pins needed if you want

  13. #13
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,135
    you also need to set at uart cur/dev with last value as 3 to enable esp8266 rts/cts
    be aware though if you enable it and your rts/cts lines are floating/not connected properly, yiu will not send/receive data and may think its broke, but its not, remember to use CUR until it works, then DEF once it works to make rts/cts persist accross restarts

    using:
    Code:
      while ( Serial.available() > 0 ) huzzah.write(Serial.read());
      if ( huzzah.available() > 0 ) Serial.print((char)huzzah.read());
    *** without RTS/CTS *** Output:



    Code:
    AT+CWLAP
    
    +CWLAP:(3,"BELL453",-87,"40:f2:01:fa:bb:f7",1,-31,0)
    +CWLAP:(3,"B

    *** with RTS/CTS *** Output:

    Code:
    AT+UART_CUR=115200,8,1,0,3 <-- the 3 enables esp8266 cts/rts flow control
    
    
    OK
    AT+CWLAP
    
    +CWLAP:(3,"Ma Connexion",-78,"b0:48:7a:ce:47:d4",1,18,0)
    +CWLAP:(3,"BELL678",-90,"88:a6:c6:7b:fc:a6",1,-11,0)
    +CWLAP:(3,"BELL430",-91,"44:e9:dd:49:a9:12",11,-22,0)
    +CWLAP:(3,"BELL649",-87,"68:15:90:39:28:6e",11,-26,0)
    +CWLAP:(3,"BELL171",-90,"18:1e:78:07:41:1e",11,-26,0)
    +CWLAP:(3,"RĂ©seau Wi-Fi ",-89,"24:a0:74:76:1e:0a",11,-36,0)
    +CWLAP:(3,"BELL351",-88,"f0:82:61:46:cd:b1",6,-36,0)
    +CWLAP:(4,"Tony",-49,"18:1e:78:01:02:6e",11,-16,0)
    +CWLAP:(3,"4D Systems",-51,"0a:1e:78:01:02:6e",11,-16,0)
    +CWLAP:(4,"Gemstelecom08945",-93,"10:fe:ed:d6:0e:22",11,-14,0)
    +CWLAP:(3,"BELL025",-91,"44:e9:dd:46:95:fa",11,-19,0)
    
    OK
    for anyone interested, on the adafruit huzzah, pin 15 is RTS, and pin 13 is CTS, you need to run AT+UART_CUR=115200,8,1,0,3 to activate flow control, if you always want it enabled after every restart of the huzzah, you need to type this command so it writes it to its flash: AT+UART_DEF=115200,8,1,0,3
    im not sure if im allowed to post the v2 AT command firmware that works on the huzzah, but i do have it
    Last edited by tonton81; 05-12-2017 at 01:50 PM.

  14. #14
    Senior Member
    Join Date
    Jan 2014
    Posts
    157
    I use the following libraries :
    #include <Adafruit_WINC1500.h>
    #include <Adafruit_WINC1500Udp.h> // i use udp and tcp, but in my ap, I use udp.

    #define WINC_CS 10
    #define WINC_IRQ 9
    #define WINC_RST 8
    Adafruit_WINC1500 WiFi(WINC_CS, WINC_IRQ, WINC_RST);

    I connect the WINC1500 through spi as seen in the attached Click image for larger version. 

Name:	atwinc1500-teensy.jpg 
Views:	680 
Size:	96.8 KB 
ID:	10560

  15. #15
    Junior Member
    Join Date
    May 2017
    Posts
    3
    Quote Originally Posted by RichardFerraro View Post
    I use the following libraries :
    #include <Adafruit_WINC1500.h>
    #include <Adafruit_WINC1500Udp.h> // i use udp and tcp, but in my ap, I use udp.

    #define WINC_CS 10
    #define WINC_IRQ 9
    #define WINC_RST 8
    Adafruit_WINC1500 WiFi(WINC_CS, WINC_IRQ, WINC_RST);

    I connect the WINC1500 through spi as seen in the attached Click image for larger version. 

Name:	atwinc1500-teensy.jpg 
Views:	680 
Size:	96.8 KB 
ID:	10560
    Okay, that is helpful. Thank you! I can at least now check the firmware for the WINC1500, however, heres what I get:

    WINC1500 firmware check.

    WINC1500: NOT PRESENT

    How do I load the correct firmware on. I only can find examples of updating the firmware with the WiFi 101 library but I have had no success with that either (I think that is how I messed things up in the first place).

  16. #16
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,135
    the 3.7 lipo goes to the 3.3v pin of T3.2? heh

  17. #17
    Senior Member
    Join Date
    Jan 2014
    Posts
    157
    Yes I connect Lipo to 3.3pin. Is that bad?
    I have done that on many teensy with no problems,
    I had no need to change code on winc1500.

  18. #18
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,374
    Quote Originally Posted by tonton81 View Post
    the 3.7 lipo goes to the 3.3v pin of T3.2? heh
    Quote Originally Posted by RichardFerraro View Post
    Yes I connect Lipo to 3.3pin. Is that bad?
    I have done that on many teensy with no problems,
    I had no need to change code on winc1500.
    No, you want to connect the lipo to the VIN pin. The normal lipo battery will deliver 4.2v when freshly charged, and nominally 3.7v for most of the discharge cycle. The VIN pin has a voltage regulator to provide 3.3v.

    If you are supplying power to the 3.3v, in must be regulated to 3.3v.

  19. #19
    Senior Member
    Join Date
    Jan 2014
    Posts
    157
    Why can't the LIPO voltage be provided on the 3.3v pin?
    No 5 volts is provided on USB so the output of the 3.3v regulator floats to the provided voltage.

    I haven't had any problems doing it this way.

    My reasoning is that by providing the Lipo on 5v pin, the 3.3v regulator will drop out even through the Lipo is good down to 3.0 volts.
    Thus, providing the lipo to 3.3v gives me more life out of my lipo cycle.

    thanks,

    Richard

  20. #20
    Member
    Join Date
    Sep 2015
    Location
    Mechelen, Belgium
    Posts
    21
    Hi,

    look at it this way, with a lipo @4.2V connected to the 3.3V of your Teensy means that you apply an ~27% higher voltage than you should apply.
    Even when the lipo is at 3.7V the voltage is still ~12% too high.

    In normal electronics a couple of % voltage difference is no problem (<5%) but in this case you are way above that.

    I would be very surprised if the Teensy can survive this setup for some time.

    Regards, Otto

  21. #21
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,135
    unless paul added some sanity protection i doubt itll last long running constantly

  22. #22
    Senior Member
    Join Date
    Jan 2014
    Posts
    157
    Good points. I guess I will change over.
    I have purchased about 50 teensy 3's and have not had a single failure.

    Perhaps Paul's sanity protection would be not selling any more to me. ha.

    thanks for the help.

    Richard

  23. #23
    From my reading of the Kinetis spec, the on-chip 5V regulator is a low-dropout one with a pass-through mode at low voltages, so you should be able to run a LiPo on the Vin line down to about 3.6V without any problems. It will probably work a bit below that, but the core voltage will start dropping below 3.3V, and you are getting into voltages that can damage the LiPo as well, so you'd probably want to shut down at that point anyway. Don't forget to cut the VUSB trace or you might over-charge your LiPo when the USB is plugged in, which can lead to unwanted excitement.

  24. #24
    Junior Member
    Join Date
    Jun 2017
    Posts
    8
    Hello,
    I also attempted to hook up an Adafruit WINC1500 to Teensy 3.6 using the following pins:
    CS0= 10
    MOSI0 = 11
    MISO0 = 12
    SCK0 = 13
    IRQ = 34
    RST = 33
    Vin set to the 3.3 V on the Teensy board, with EN tied to Vin.
    I'm using SPI and WiFi 101 with the WiFi.setPins (10, 34, 33);
    I know WINC1500 board works as I have used it with the Arduino Mega with no issues.
    I have attempted to check firmware and run simple example sketches to no avail.
    Any help would be appreciated. Thanks.

  25. #25
    Senior Member
    Join Date
    Mar 2013
    Posts
    651
    Dont see much in the way of code examples or wiring. You are setting the SPI to 12MHz or less correct?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •