The WiPy: Python on a WiFi enabled microcontroller

While playing around with the ESP8266 i noticed the “highly experimental” MicroPython port for this board. How cool would that be: Running Python straight on a WiFi enabled microcontroller? Exploring this idea further i ended into a kickstarter project called: The WiPy. The project was well underway and had already reached its goal but was not shipping yet. Now this state is not uncommon at Kickstarter and sometimes lasts forever so i decided to wait some more.
Then i found out that the development and production of the WiPy is carried out less than 5 miles from my home so i bravely wired €29. While the backers were enjoying their boards it took just a few weeks more for mine to arrive.

During this time i learned that there is a growing interest in MicroPython. The European Space Agency (ESA) funds further development to investigate the use of MicroPython in payloads  and the BBC will launch the micro:bit, an initiative comparable to the Rasberry Pi, aimed at young tech pioneers. The micro:bit will run… yes: MicroPython. This amusing story tells how the pieces for the micro:bit came together

Meet The WiPy

Meet The WiPy

Finally i have some time to start playing with the WiPy. First thing is to get 3.3V to supply the thing. An easy task for the newly aquired breadboard power supply. Although the input voltage is rated between 6V and 12V DC the supply dies with a loud *bang* rocketing the capacitor when 12V from a wall plug supply is connected…

Exploded capacitor

The second attempt uses the FTDI USB interface i also used for the ESP8266 modules. The 3V3 output can just supply those units when a large 100uF capacitor is used to buffer the supply to cope with peak currents. However the WiPy is not satisfied with that. The red led flashes rapidly and no WiFi AP can be detected.

The final attempt requires me to go upstairs and get the adjustable power supply. At 6 volts (drawing 100mA) the spare breadboard supply does much better and the LED on the WiPy now flashes once every 4 seconds.

On the laptop a network with SSID “wipy-wlan–7ef8” pops up and password “www.wipy.io” works to connect to it. Finally a telnet with Putty  prompts the login for the WiPy. User “micro” and password “python” gets me to the >>> python prompt. Yeah!

The WiPy ont the breadboard

The WiPy on the breadboard

Now it shows that the unit uses V1.0 firmware which can be upgraded OTA (over the air). This requires a FTP client like FileZilla or alike. Before trying to connect make sure to configure FileZilla as the general docs tell and use the same credentials as used for telnet access.

Do not use the quick connect button, instead, open the site manager and create a new configuration. In the General tab make sure that encryption is set to: Only use plain FTP (insecure). In the Transfer Settings tab limit the max number of connections to one, otherwise FileZilla will try to open a second command connection when retrieving and saving files, and for simplicity and to reduce code size, only one command and one data connections are possible. Other FTP clients might behave in a similar way.

Download version 1.5 from micropython.org (scroll to “Firmware for the WiPy”) and extract the “mcuimg.bin” from the zipfile and ftp it into the /flash/sys folder on the WiPy. After a reset the unit now runs version 1.5.

MicroPython v1.5-1-ge954604 on 2015-10-21; WiPy with CC3200
Type "help()" for more information.
>>>

and the examples run smooth:

>>> from machine import Pin
>>> import wipy
>>> wipy.heartbeat(False) # disable the heartbeat
>>> led = Pin('GP25', mode=Pin.OUT)
>>> led(1)
>>> led(0)
>>> led.toggle()

It’s about 23:00 now and my wife fell asleep on the couch so why not try to get the console working over the UART interface?  The FTDI equipped USB interface should do the job. First some magic commands need to be entered on the telnet prompt:

>>> from machine import UART
>>> import os
>>> uart = UART(0, 115200)
>>> os.dupterm(uart)

The pinout of the WiPy is not really clear to me at this stage. Pins can be used for different purposes but what the numbers in brackets mean?

WiPy pinout

WiPy pinout

At first i try to use GP30 (UART0_TX(9)) and GP31 (UART0_RX(9)) as TX and RX without luck. However after investigating the schematics of the Expansion Board it looks like UART0_TX(3) en  UART0_RX(3) or pin GP2 and GP1 should be used instead.  So after connecting  GP2–>FTDI TX  en GP1 –> FTDI RX i can use putty through the serial port to get the prompt too. Connecting RTX/CTS for flow control is not needed. To have this feature enabled at startup the 4 lines have been added to the boot.py file which is run at startup. My wife slowly wakes up from my jumps for joy so time to finish for tonight.

Next to try is getting the WiPy to connect to my home WiFi as client. Can’t wait!

 

Advertisements
This entry was posted in WiPy. Bookmark the permalink.

3 Responses to The WiPy: Python on a WiFi enabled microcontroller

  1. “It’s about 23:00 now and my wife fell asleep on the couch so why not try to get the console working over the UART interface?” : D

    It’s a pleasure to read your posts. First, I’ve found your ADS-B related messages, and can not stop reading the entire blog.

    Liked by 1 person

  2. Pingback: Mapping The Things Network with a LoPy (1) | Projects by Keptenkurk

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s