Mist AP SSID on/off with MicroController
THE INITIAL THOUGHTS
The idea behind this device is to provide a portable tool that allows you to stop the radios of a Mist Access Point.
To make it more relatable, let’s consider a scenario: Imagine a school with Wi-Fi access for students. However, teachers are unhappy to see students scrolling through their phones during class time. It’s time to take action. With this designed box, you can easily disable the access point with a single push of a button (instead of unplugging it or accessing the Mist portal).
And with another push of the same button, things will return to normal.
REQUIREMENTS
MICROCONTROLLER
The ESP32 and ESP8266 are both developed by the company Espressif and are widely used in IoT projects. Both have built-in Wi-Fi and Bluetooth capabilities, but the ESP32 has more processing power and more GPIO pins compared to the ESP8266. On the other hand, the Raspberry Pi Pico is a microcontroller developed by the Raspberry Pi Foundation. It has a dual-core ARM Cortex-M0+ processor and is designed to be more power-efficient than the Raspberry Pi. While the ESP32 and ESP8266 are more commonly used in IoT projects, the Raspberry Pi Pico is a great choice for low-power embedded projects that require more processing power than an Arduino but less than a Raspberry Pi.
For this project, we have chosen to use the Raspberry Pi Pico W, although any of the above options could have been used as well.
PASSIVE ELEMENTS
This job requires some passive elements to monitor the state and execute on/off commands:
- LCD: to check connection and display previous and current states.
- LEDs: to colour-code each state.
- Push-button: to execute on/off commands.
- Buzzer: to sound every time we use the push-button.
- Resistors: to limit current and prevent any damages to the microcontroller.
PROGRAMMING LANGUAGE
Regardless of the language you choose, it is important to keep in mind and follow the SOLID principles.
SOLID is a set of programming principles that help developers design maintainable, scalable, and efficient software.
The principles in SOLID stand for:
- The Single Responsibility principle encourages developers to write classes that have only one reason to change, which makes it easier to maintain and test them.
- The Open/Closed principle encourages developers to design software modules that are open for extension but closed for modification, making it possible to add new functionality to the system without changing existing code.
- The Liskov Substitution principle encourages developers to design classes that can be used interchangeably with their base classes, which makes it easier to write code that is easy to understand and maintain.
- The Interface Segregation principle encourages developers to define smaller, more focused interfaces that are tailored to the specific needs of each client, which leads to more modular and reusable code.
- The Dependency Inversion principle encourages developers to depend on abstractions rather than concrete implementations, which makes it easier to write code that is flexible and adaptable to changing requirements.
SOLID principles provide a clear set of guidelines that allow developers to write code that is easy to extend and modify, while also reducing the risk of introducing bugs.
The programming language used in this project is MicroPython. To learn more about MicroPython and how to interact with Thonny, please click on the link below:
Source: https://semfionetworks.com/blog/an-introduction-to-micropython/
NETWORK DIAGRAM
The diagram above is an attempt to visually illustrate the set-up. The MicroPython script has been written based on these pins.
SHOW TIME
The above Video/Gif is the process of what our box does
RESOURCES
- The following link contains the source code of this post:https://github.com/semfionetworks/MistAPssid-on-off/tree/main (Do not forget to replace your Mist token, SSID, and password inside the script)