WiPy is a nifty little Wi-Fi enabled module that is great for creating IoT applications using MicroPython. I have been experimenting with WiPy and want to show you how quickly this device can be setup for sending an e-mail using Gmail as well as synchronising its internal RTC using NTP.

In this article I will cover the following tasks:

  • WiPy Hardware Setup
  • WiPy Default Passwords
  • Debugging
  • WiFi & E-mail Setup
  • Safe Boot

So let’s get started…

WiPy Hardware Setup

This one is easy. Set up the WiPy as shown below and plug the USB cable to your computer.

WiPy

I am using a Mac, however most of this information also applies to Windows PCs.

You can buy the WiPy module and development board from Amazon:

WiPy Module @ AmazonWiPy Universal Expansion Board @ Amazon

WiPy Default Passwords

So the first thing we need to do is to connect to our WiPy – to do this you need to search for it in your WiFi settings. My WiPy was the last one in the list 🙂

Wifi settings list

You will then be prompted for the WiFi password. This default password is:

www.wipy.io

Once connected, using FileZilla you can easily update the WiPy and make changes to test your code. The default IP address of the WiPy is:

192.168.1.1

This IP address is used in setting up the FTP connection to the the WiPy. Here is how my FileZilla setup looks:

Filezilla WiPy Setup

User: micro
Password: python

After clicking Connect, you should be able to see the WiPy filesystem shown in the remote site section of FileZilla:

Filezilla remote site

Now let’s setup debugging.

WiPy Debugging

Open a terminal window and type the following command to find the serial port name for your WiPy:

ls /dev/tty*.*

Then simply enter the following command:

screen tty.<your device> 115200

In my case…

Terminal Connection

This will allow you to communicate with the WiPy via USB instead of WiFi and provides a terminal output of events as your program executes. Handy to see what your code is doing.

You will see a blank screen with a flashing cursor. This is expected as the output will be shown once the micro python code starts.

Time to code, MicroPython code… 🙂

WiFi & E-mail Setup

In a new terminal window clone the following wipy-starter project from github:

git clone https://github.com/gbhogal/wipy-starter.git

In your local wipy-starter folder update settings.py with your WiFi SSID and password:

Wifi Settings

Update main.py with your e-mail address and the credentials for your e-mail:

E-mail Settings

Using Filezilla, copy the contents from the wipy-starter lib to the lib folder on your WiPy. Copy your boot.py, main.py and settings.py to your WiPy flash directory.

wipy-file-system

After the files have been transferred successfully, press the RESET button on the WiPy.

The WiPy will reboot and attempt to run the boot.py code first and then the main.py code. In the boot.py file I have the code to connect to the WiFi network. The main.py file contains MicroPython code to update the internal RTC using NTP from the internet and send you an e-mail.

You should see an output similar to the this in your debug terminal:

Debug Terminal Output

And of course you should get an e-mail with the time from the WiPy 🙂

You should note the IP address being displayed in the terminal of your WiPy as you will need to reconnect to this IP address in Filezilla to update the code files as you will no longer be connected directly to the WiPy.

If you have any problem in connecting to the WiPy, you can always safe boot it as follows:

Safe Boot

Safe booting bypasses your boot.py and main.py files. To do this you override the boot sequence by pulling GP28 up (connect it to the 3v3 output pin) during reset as follows:

WiPy Safe Boot Mode

Press RESET and wait 7 seconds (until the LED blinks very quickly) and then remove the cable from the 3v3 line. You will then be able to connect to the WiPy from your WiFi settings as described above.

See Safe Boot Details for further information.

References

WiPy Official Documentation.

Thank you Daniel for the SMTP library.

Thank you Andrew for the NTP library.


 

Gurpal Bhogal

Gurpal Bhogal

Technical Director