All Posts By

Kunal Gautam

How to Get M5Stack Battery Status with UIFlow 1.3.2 MicroPython

By | Coding Laboratory, Python Code

Recently I’ve got my hands on the M5Stack Core device. This device, not only brought possibilities of awesome ideas, but also bring me close to the world of MicroPython. For those who are unaware, MicroPython is software implementation of Programming language largely compatible with Python 3. In short, MicroPython is Python Compiler which can run on Microcontroller.

In this post, we will use MicroPython’s “machine” library for accessing i2c bus of the M5Stack Core. The battery circuit of M5Stack core is composed of IC IP5306, which provides i2c interface at 0x75 address with Battery Percentage of 0%, 25%, 50%, 75% and 100%.

To get started, UIFlow 1.3.2 firmware need to be flashed to the M5Stack Core device.

Flashing UIFlow 1.3.2 and connecting the M5Stack device in USB Mode

You can watch video till (2 Minutes 5 Sec) https://www.youtube.com/watch?v=Y9pOWgsNgKk for Flashing and connecting the M5Stack device in USB Mode.

Running Program

While device is connected with your Computer/Laptop in USB Mode, run UI Flow Desktop IDE. It will prompt for Connecting the IDE with device. Set the correct com port and you should be good to go for running the program. Select Python Mode and use the following code to access i2c bus and get the device’s battery status

Run the code and voila! you can now get battery statistics on the screen.

Turn your First Project to Hello World!

By | Django

As we seen in last post, the application shows default Django page and not the “Hello World!” string. Isn’t it sad?

In this post we will see how to create a “Hello World!” page inside Django application.

Step1: Create View

Create a new file named views.py inside HelloWorld directory and use this code :

 

Step2: Set the URL Pattern

Open the urls.py file and use this code :

 

Final Step: Run the server

python manage.py runserver 

 To terminate/stop the server, press CTRL+c key