The W600 is a low cost WiFi SOC from Winner Micro. It is similar in capabilities to the ESP32 from Espressif Systems.
I created a small WiFi connected display widget using the W600 running MicroPython and an OLED display to demonstrate its capabilities.
Here is a summary of the W600 capabilities (datasheet here):
- ARM Cortex-M3 running at 80Mhz
- Integrated 1MB flash
- SPI, UART, GPIO, I²C, PWM, I²S, RTC peripherals
One advantage the W600 has over the ESP32/ESP32 is using a ARM Cortex-M3 instead of a Tensilica Xtensa. This means a wide variety of ARM development and debugging tools can be used with the W600.
Documentation for the W600 is available on the official site here.
Several boards available, I have tried the Air602 (from SeedStudio) and the and TB-01 (from ThingsTurn). I recommend getting the TB-01 board from ThingsTurn has most of the PIOSs accessible on the header. I bought mine from here.
[table id=1 /]
Installing the driver
Both the Air602 and ThingsTurn board use the CH330N USB-to-Serial chip. This chip works with the same drivers as the CH430 chip that a lot of ESP8266/ESP32 and Arduino clone boards use.
You can find an CH430 driver is here: https://wiki.wemos.cc/downloads
You can use any terminal emulator to talk to the the boards but need a terminal emulator that supports Xmodem file transfer to download firmware. For Windows I recommend extraputty(http://www.extraputty.com/download.php)For Mac SecureCRT works, it is commercial software but a 30 day trial is avialable.
A python script is also available that can be used to download firmware but I havent tried it.
Firmware can be loaded over the W600s serial ports using either a bootloader running from ROM or using a secondary bootloader running form flash.
Most boards come with the AT command based firmware already installed. We are going to replace that firwmare with the Python firmware image. The firmware images also include the secondary bootloader called “secboot”.
Connect the board to your PC and then check what serial port has been assigned. Open the port with baud rate 115200bps and the standard serial settings (databits 8, parity: none, stop bits: 1) in the terminal emulator.
Note that for the TB-01 board the reset line is also connected to the RTS output form the CH330N USB-to-Serial chip. You need to correctly set/reset the CTS line in your terminal emulator to ensure the board is not continuously held in reset.
Now to put the board in bootlooader mode you need to press “Esc” in the terminal window (which sends the escape character ASCII 27) soon after pressing pressing the reset button. You should see the following on the terminal window if the secondary bootloader has started:
secboot running... CCCCCCCCCCCCCCCCCC
To use the ROM bootloader you need to hold the pin PA0 to GND and then assert the reset line. On the TB-01 board you can press and hold the USR key (connected to PA0) and then press the RST key to start the ROM boot loader. In this case this is what you will see on the terminal emulator:
The MicroPython firmware image for W600 is avilable here. Use the GZ.img image file with the secondary bootloader and the FLS file with the ROM bootloader.
__ __ \ \ /\ / / \ \ / \ / / \ \/ /\ \/ / \ / \ / / /\ / /\ / /\ \/ /\ \ / / \ / \ \ /_/ \/ \_\ WinnerMicro W600 MicroPython v1.9.4 on 2018-12-22; WinnerMicro module with W600 Type "help()" for more information. >>
Most of the W600 micropython APIs is same as for the ESP8266 / ESP32 documented here. There are some subtle differences, the following examples have been tested, other functionality might work but hasnt been tested.
Pins and GPIO
my_pin1 = machine.Pin(33, machine.Pin.OUT, machine.Pin.PULL_FLOATING) my_pin1(0) #drive pin low my_pin1(1) #drive pin high my_pin1.value(0) #drive pin low my_pin1.value(1) # drive pin high
The GPIO pin numbering can be found in this file in the W600 SDK. As an example you would use the following pin numbers for the default UART on the boards.
WM_IO_PB_09 = 25 # UART1_CTS WM_IO_PB_10 = 26 # UART1_RTS WM_IO_PB_11 = 27 # UART1_RX WM_IO_PB_12 = 28 # UART1_TX
spi_mosi = machine.Pin(28) spi_miso = machine.Pin(27) spi_sck = machine.Pin(26) spi = machine.SPI(sck=spi_sck,mosi=spi_mosi,miso=spi_miso) spi.init()
The micropython firmware image includes a file called easyw600.py. This contains routines to connect to WiFi and to start a ftpserver that can be used to upload/download files to/from the filesytem.
from easyw600 import * sta_if = connect("<SSID>","<PASSWORD>")
The connect functions blocks till a connection is completed.
Below is the code for the connect routine which can be found in easyw600.py
import network def connect(ssid=None, password=None): sta_if = network.WLAN(network.STA_IF) sta_if.active(True) sta_if.connect(ssid, password) print("connecting...") while (1): if (sta_if.isconnected()): break; else: utime.sleep(1) print("connected, ip is " + sta_if.ifconfig()) return sta_if
Once the WiFi is connected, you can use the FTP server to upload/download files to the micropython filesystem.
from easyw600 import * ftpserver()
Use a FTP client like filezilla to connect to the server (user: root, password: root). Make sure the login encryption is set to plain / no encryption.
Running a py script at boot
To run a python script at boot, add it to main.py
# main.py -- put your code here! execfile("aio_demo.py")
Making the display widget
Interfacing the SSD1306 OLED module
I used the Air602 board and a SSD1306 SPI OLED module to make the display widget. A python script running on the W600 fetches an Adafruit AIO feed from the interface, parses and displays the information on the OLED module.
[table id=2 /]
Python script for the widget
All the python code for the display widget is available on github.
Micropython SSD1306 library is used to drive the OLED module over SPI interface.
urequests module is being used to fetch the Adafruit AIO feed. The feed text is in JSON format and is parsed using the json module