Giter Club home page Giter Club logo

illuminos's Introduction

illuminOS

An open-source MicroPython based SDK for ESP8266 WiFi-enabled microcontrollers. It enables you to focus on your actual project by providing ready-made functionality for tedious stuff

Main Features

  • Handles connections with known Wi-Fi networks according to user-defined priority
  • Detects single or any number of taps on microcontroller buttons and allows execution of any code after that
  • Allows the user to take control of the on-board LEDs and blink them with any pattern and delay
  • Automated installation on the mirocontroller (see installation section using mpfshell)
  • Filesystem formatter cleans up your microcontroller - no need to reflash it
  • Can be configured for any microcontroller (currently supported NodeMCU)
  • Simple logging functionality
  • Ability to read .properties files for configuration
  • Intended for use in both commercial and open-source projects.

Resources

Github issues list/bugtracker: https://github.com/idimitrakopoulos/illuminOS/issues

Quick Install

Clone the git repository in any local directory by typing the following:

$ git clone https://github.com/idimitrakopoulos/illuminOS
$ cd illuminOS

Now you need to upload it to your microcontroller. To do this you can use the excellent mpfshell see installation instructions here.

After installing mpfshell you should connect your PC and microntroller via USB and type:

$ sudo mpfshell -s mpf_cmd.mpf

Of course you can also upload illuminOS manually or using one of your favorite IDEs (e.g. ESPlorer)

Project Structure

A quick folder/file walkthrough of the project

conf (all configuration files go here)
  network.properties (define your wifi networks here)
util (utilities folder)
  nodemcu.py (hardware mapping of NodeMCU board)
  <yourboard.py> (you can write your own board mapping!)
  toolkit.py (a generic toolkit library that contains board agnostic functions)
boot.py (gets executed first during boot-up)
main.py (gets executed second)

The user is free to utilize the functionalitu offered by illuminOS freely and at any point. It certainly makes sense however to play with some of the examples below by adding code inside main.py or boot.py.

Microcontroller Support

illuminOS is open enough to allow the configuration and control of any ESP based microcontroller. At this point only nodeMCU has been configured by the author but other controllers can be contributed by users.

To do this a new module must be created.

e.g. util/nodemcu.py

In this file board related configuration can be mapped and toolkit functions invoked. The concept is to abstract hardware mapping as much as possible from functionality.

Examples

Connect to preferred Wi-Fi network

Simply edit conf/network.properties with WiFi SSID and password as shown below

[wifi]
mynetwork = "abcdef"
worknet = "2334d"

Then in main.py the following code must be copied. This will scan for known SSIDs as per the configuration above and connect to the first preferred network

from util.toolkit import log, load_properties, scan_wifi, determine_preferred_wifi, connect_to_wifi

configured_wifis = load_properties("conf/network.properties")
found_wifis = scan_wifi()
preferred_wifi = determine_preferred_wifi(configured_wifis, found_wifis)
ip = connect_to_wifi(preferred_wifi["ssid"], preferred_wifi["password"])

log("Connected with IP: " + ip)

Listen for button clicks

To listen for clicks on the Flash button of your board, place the following snippet in your main.py. This places a polling timer which anticipates button clicks. Upon first click it very briefly waits for another click and then registers either a single or a double click.

Following this event you could execute any code required by your project.

For the Flash button use

import util.nodemcu as board
board.get_flash_button_interrupts()

And for the User button use

import util.nodemcu as board
board.get_user_button_interrupts()

Control LEDs

You can make the on-board LEDs flash as per requirement by using the following command.

import util.nodemcu as board
board.blink_blue_led(15, 0.06)

Format "Filesystem"

You can recursively wipe files and folders from your microcontroller using this function.

from util.toolkit import format_fs
format_fs()

Read .properties files

In case you want to provide configuration using .properties files you can use the illuminOS method load_properties

from util.toolkit import load_properties
load_properties("conf/my.properties")

Logging

A simple logging functionality exists

from util.toolkit import log
log("hello world!")

License

The content of this project itself is licensed under the Creative Commons Attribution 3.0 license, and the underlying source code used to format and display that content is licensed under the MIT license.

Enjoy!

Iason D.

illuminos's People

Contributors

idimitrakopoulos avatar

Watchers

Manu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.