Introduction: Flashing MicroPython on Kano Pixel Kit
Kano's Pixel Kit is a great piece of hardware! It features 128 super bright RGB LEDs, a joystick, 2 buttons, a dial, battery and a powerful microprocessor as its brains (ESP32).
It comes from factory with a firmware that talks with Kano Code App, an app where you have coding challenges, can browse creations made by the community, stream the creations made on the block based interface to the LEDs and save animations.
It's a great way to give the first steps learning how to code or to have a fun animation display at home. But if you want to unlock the full potential of your Pixel Kit there is a simple and powerful solution: Replace the factory firmware with MicroPython!
This tutorial will show multiple ways you can replace the factory firmware with MicroPython as well as restore the original firmware.
Step 1: Two Versions of Pixel Kit
There are 2 versions of Pixel Kit: The Kickstarter version has a Banana Pi brain and the retail version has the ESP32.
If your Pixel Kit has an SD card you have a Kickstarter Pixel Kit (KPK), otherwise you have a Retail Pixel Kit (RPK).
This tutorial is only for the Retail Pixel Kit.
Step 2: OSX High Sierra, Ubuntu 18.04 and Windows
This is the easiest way to flash your Pixel Kit. Go to https://github.com/murilopolese/kano-pixel-kit-flash-tool/releases and download the latest version of Pixel Kit Flash Tool.
Once downloaded, make sure your Pixel Kit is on and connected to your computer via USB (it comes with a red cable) and run the application.
Click on "Select serial port..." to pick your Pixel Kit serial port. If nothing shows up here, make sure again that your Pixel Kit is on and connected to the computer and click "Refresh ports". If that doesn't work, try changing the USB port on your computer.
On some OS (like Windows 7) you will need a driver to be able to make your computer to talk with Pixel Kit. The easiest way to get the driver is by installing Kano Code App. Alternatively you can manually install the FTDI drivers here or here.
Once the serial port is selected, just pick what you want to flash: Kano Code firmware will reset the factory firmware and MicroPython firmware will install MicroPython (Pixel32 to be more specific).
This can take a a few seconds to a minute to complete.
Step 3: Any OS With Python 3
If you have any operational system with Python 3 and pip, you can easily run Pixel Kit Flash Tool from the source super easy.
You can check if you have Python and pip installed by typing `python -V` and `pip -V` on your terminal/command line. If you don't have Python or pip, download and install it from https://www.python.org/.
Then follow the steps:
- Download the latest source code on the github page or using this link.
- Unzip the source code and navigate to it using your terminal
- Run "pip install -r --user requirements.txt"
- Run "python run.py"
After that you should see the Pixel Kit Flash Tool window.
- Make sure your Pixel Kit is on and connected to your computer via USB.
- Click on "Select serial port..." to pick your Pixel Kit serial port.
- If nothing shows up here, make sure again that your Pixel Kit is on and connected to the computer and click "Refresh ports".
Once the serial port is selected, just pick what you want to flash: Kano Code firmware will reset the factory firmware and MicroPython firmware will install MicroPython (Pixel32 to be more specific).
This can take a a few seconds to a minute to complete.
Step 4: Use MicroPython!
You can find all the documentation for what you can do with the MicroPython firmware (Pixel32) you just installed on your Pixel Kit here: https://murilopolese.github.io/kano-pixel-kit-pixel32-docs/
I made other Instructable just for the first steps with Pixel32:
https://www.instructables.com/id/Pixel-Kit-Running...
You might also find many other MicroPython and CircuitPython tutorials online and they are most likely to be compatible with the Pixel Kit! Let me know if you find any problem or if you have a better solution!
7 Comments
4 years ago
I came across this instructable while I was looking on how to use the Pixel Kit with Arduino IDE - and after reading this, and the github repository I decided, I didn't need to do anything special. I already has the ESP32 board core installed in the IDE, I selected the "node32s" board (why? just a guess), and compiled one of the WiFi examples - it worked with out doing anything special. I spent a little time, mostly trail and error to find the button pins, and The neopixels were easy to find.
For those interested -
A0 is the knob - you get values from 4095 to 0.
The buttons look like they are active low...(I just used the Arduino example, to test this)
PIN 18 is the "B" button - red button on the right edge
PIN 23 is the "A" button - inner red button
PIN 25 is joystick right
PIN 26 is joystick left
PIN 27 is joystick button
PIN 34 is joystick down
PIN 35 is joystick up
The neopixels are on PIN 4, it appears that they work better when PIN 2 is set to output and set to HIGH. (I'm not sure if this is true or not, it just appears that way)
Adafruits neopixel library works, but has some timing issues, so doesn't work well.
NeoPixelBus and FastLED libraries appear to work the best.
NeoPixelBus had issues if I lowered the colorSaturation but seemed to work fine if I left it at 128.
But I have a question, that I'm hoping you or someone might be able to answer....even if it's not really related to micropython. :-)
While I was doing the trail and error for the knob, I found that A3, A4, A13, A14, and A15 all appear to be showing some analog value for something, most of these were pretty stable, so that makes me think they are connected to something. Most were greater than 100 with the highest I saw was just under 800.
A5 also has something, but its value was pretty low, never more than about 20 maybe 30 - but did seem to jump around quite a bit.
Does any one know what might be connected to these analog pins?
My other question is on how to use the USB ports, I don't have a clue here. I tried to do a I2C scanner but it didn't find anything, I just assumed the I2C were the defaults.
Are there any sensors on board, or is it just neopixels and buttons.
Reply 1 year ago
Thanks!, I'm playing again with the Pixel Kit and the Arduino IDE. I have also been able to compile the microBlocks (https://microblocks.fun/get-started) virtual machine and it works very well. I can confirm that the microphone (which is an analog MEMS microphone) is attached to A3, but it is not very useful because it lacks a corresponding amplifier.
Question 2 years ago on Introduction
Great post on Pixel Kit, Kano now officially don't support them any more so this is even more important! The Kano App software that can be used to upload programs and animations no longer works so decided to look around for more direct access. So first hurdle is flashing the PK, I run up the flashing tool, pick port, and pick Pixel 32 to flash , after a few minutes I get this :-
Flashing MicroPython (version 20180511-v1.9.4) and Pixel32 (version v0.2.3)
Preparing to flash memory. This can take a while.
ERROR: Could not write to flash memory.
Flash finished
Any ideas ?
Thanks
Neil
4 years ago
Wonderful just started with my pixel kit so this is something to try in the future!
The main thing I see missing in the docs is microphone access, any roadmap to having this in future?
Thank you for the effort of building and sharing :)
Reply 4 years ago
Hey, @mexitalian! That is true. I haven't tried to use the microphone because I had real bad experiences with it using the "standard" Kano firmware... But it's wired so it's a matter of finding which pin it's connected to and tune the sample rate you read from it? I'd be pleased to get any news if you get it working and I'll merge your findings straight away to the PixelKit library I'm shiping on Pixel32. :)
Question 4 years ago on Step 4
Great work! We have the Kickstarter version with a Banana Pi and we will love to unlock the kit and program it by ourselves in python, javascript or whatever without the KanoApp. We have experience with RPi and arduino but not with banana Pi and we have no idea on how the leds are connected or interact with the banana. Any suggestions/comments? or at least how to start?
Answer 4 years ago
Hey, @jfaraudo! I'm glad you liked this article :D I have also written something else called the Community SDK for Kano while I worked there: https://github.com/KanoComputing/community-sdk
There is an ongoing discussion about making it work on the Kickstarter Pixel Kit here: https://github.com/KanoComputing/community-sdk/is...
But unfortunately, that is all... Kano does not provide much more than that. You can try opening a topic on their forum: https://community.kano.me/c/developers-corner
What I can tell you is that the Banana Pi has ssh enabled but I don't know the password. Also, there is a tiny micro controller (arduino compatible) that drives the actual LEDs.
If you want to do some serious hacking, you can take the SD card out from the Pixel Kit, mount on your computer and change the ssh password for it. It is tricky but once you have it you have have a look on all the source code, including how the banana pi interacts with the micro controller.
I hope that helps, it's all I have/know...
Let me know if you have any success!!!!