Pixel Kit Running MicroPython: First Steps

About: Hello! My name is Murilo, I am a Brazilian technologist (or a full stack developer if you prefer). I am profoundly interested in education and technology. More specifically when technology is used to build ...

Intro: Pixel Kit Running MicroPython: First Steps

The journey to unlock the full potential of Kano's Pixel starts with replacing the factory firmware with MicroPython but that is only the beginning.

In order to code on the Pixel Kit we must connect our computers to it.

This tutorial will explain what the boot screens mean, how to access the terminal page and how to connect to Pixel Kit.

Step 1: Boot Screens

When your Pixel Kit boots up it shows a few screens to let you know what it's doing and its state. Here is what they mean:

  • Orange: Trying to connect.
  • Blue: Created its own wifi network.
  • Green: Connected to a wifi network.
  • Red: Tried to connect to a wifi network and failed.

When Pixel Kit creates its own wifi network, It should be named something like PIXEL_KIT_XXXX but with a number instead of the XXXX.

The first time your Pixel Kit boots it will always display the blue screen.

In cases your Pixel Kit is connected to (green screen) or created a wifi network (blue screen), it will display its ip address in binary format: Red dots mean 1, no dots mean 0.

Step 2: Accessing the Terminal Page

Blue screen

If your Pixel Kit boots to the blue screen, you will find an open wifi network named PIXEL_KIT_*NUMBERS*.

A few seconds after we connect to this network, a pop up (just like in airports) will show up with the terminal page. You can use the terminal in this pop up window but it's strongly recommend using it on your browser. To open the terminal in your browser, make sure you are connected to the Pixel Kit wifi network and navigate to http://192.168.4.1. You will see then the same page.

The Pixel Kit ip address while displaying the blue screen will never change: it will always be 192.168.4.1.

Green screen

If your Pixel kit boots to the green screen, it will display its ip address on the network it's connected. We'll assume it's connected to the same network as your computer but if it's not, check the last step on how to recover/reconnect your Pixel Kit.

Once you make sure your computer and Pixel Kit are connected to the same network, navigate to its ip address to access the terminal page.

Step 3: Saving the Terminal Page on Your Computer

When you access the terminal browser from your Pixel Kit ip, your Pixel Kit is behaving like a web server: It hosts a web page that you can access on your browser. Every time you request or refresh this page, the Pixel Kit must stop everything it's doing and answer this request.

While it's awesome Pixel Kit can behave like a web server, it was not meant to be a web server and sometimes it can be very slow. The good news is once you have loaded the terminal page, you can save it offline!

To save the terminal page offline, type "CTRL + S", "CMD + S" or search on your browser the option to "save as" or "save page as". There are many ways to do it, I really like the keyboard shortcuts "CTRL + S" or "CMD + S".

You will be asked where you want to save a file named "Kano Pixel Kit - Code with light.html". Pick a place that is easily accessible so anytime you want to open the terminal you can double click the html file.

Step 4: Connecting to Pixel Kit

With your terminal page opened and after you made sure your Pixel Kit and computer are on the same network (either the one Pixel Kit created itself or the one you connected it to) and type the ip address in binary or decimal format. It will look something like this:

> 11000000101010000000010000000001

or

> 192.168.4.1

If you want to know how to convert binary numbers in decimal, check this link: https://www.instructables.com/howto/how+to+convert+binary+to+decimal/

Once connected the headers will turn green and you will be presented to a Python REPL: Read, Evaluate, Print and Loop. Yay!

Step 5: Connecting to a Wifi Network

While connected on the network created by the Pixel Kit you won't have access to internet.

If you want to code and have access to internet at the same time you must connect the Pixel Kit to a wifi network that has internet. The computer you will use to code must also be connected to the same network.

The easiest way to connect is to run "saveWifiConf(ssid, passord)" on the REPL where ssid is the name of the network you want your Pixel Kit to connect and password is the network password:

saveWifiConf('KanoGuest', 'everyonecanmake')

After running "saveWifiConf(ssid, password)", you must turn your Pixel Kit off and on again to apply the changes.

Also, remember to switch back from the Pixel Kit network, refresh the terminal page and reconnect to your pixel kit!

Pro tip: You can reset your Pixel Kit from the terminal page by typing the following commands:

import machine
machine.reset()

Your terminal will lose connection after that so, remember to refresh the page and reconnect!

Step 6: Recovery/Offline Mode

At any time, turn your Pixel Kit off and on again while holding both red buttons to gently force it to show the blue screen.

This is very useful in a few cases:

- You have connected to the wrong wifi network, wrong password, typo, etc... In this cases Pixel Kit will boot to the red screen and forcing the blue screen is the only way to connect again to the Pixel Kit.

- The wifi network you connected is not available anymore. This can be due to technical problems but it also can be because you connected to your home wifi and now you are at school or a friend's place. Entering the blue screen will allow you to connect to a new wifi network.

- We seem to live in a connected world but I believe we should not rely on network availability to be able to learn, make things and be creative! If you want to code your Pixel Kit 100% offline or if there is no wifi available, make your Pixel Kit enter in the blue screen and happy coding!

Step 7: Code With Lights!

Documentation

You can find all the documentation of a few things you can do with your Pixel Kit running Pixel32 at Github.

But Pixel Kit also have all the documentation offline! You can access it by typing "docs()" on a connected terminal or by navigating to http://192.168.4.1/docs.html if your Pixel Kit is showing the blue screen. If your Pixel Kit is showing the green screen it will be http://192.168.4.1/docs.html ADDRESS*/docs.html.

The docs can (and should) be saved on your computer the same way you would do with the terminal page.

Drawing!

There are basically two ways to draw on Pixel Kit leds: PixelTurtle and PixelKit libraries.

The first one is the simplest way to get started and you can find all it can do on the following links:

https://github.com/murilopolese/kano-pixel-kit-pix...

https://murilopolese.github.io/pixel-turtle/pixel-...

The second one is a more advanced library (PixelTurtle is written using it) and you will find how to use it on the following links:

https://github.com/murilopolese/kano-pixel-kit-pix...

https://murilopolese.github.io/pixel-turtle/pixel-...

If you are having trouble with Python, there is also a quick introduction included on the offline documentation and on the following links:

https://github.com/murilopolese/kano-pixel-kit-pix...

https://murilopolese.github.io/pixel-turtle/progra...

Watch out for more Instructables showing how to make animations, games and interactive displays with Pixel Kit + MicroPython!!!!!

Share

    Recommendations

    • Electronics Tips & Tricks Challenge

      Electronics Tips & Tricks Challenge
    • Audio Contest 2018

      Audio Contest 2018
    • Optics Contest

      Optics Contest

    Discussions