-How to get started with Raspberry Pi?
-Fill the image on the SD-card, connect to the power supply and go to the store to buy everything that is missing.
Raspberry Pi in the standard package - not a gift. At least, if you are going to give Pi to someone for this New Year, make sure that the keyboard-monitor-mouse set, or at least a USB-UART adapter, will be available for the lucky recipient.
What to do if you want to do your project, but there is only a fee and it is problematic to connect at least something to it? I suffered with this kind of problems for 3 years until I developed pyLCI. About how to start using pyLCI and what it gives, I will tell you today.
Let's start with connecting to Pi. There are many ways, and each has its drawbacks.
USB-UART USB-UART ( 3.3V) (FTDI, ) (composite/HDMI)++ ( HDMI), 220 , - , IP? Ethernet DHCP- Pi IP, ( !) Ethernet- () WiFi wpa_supplicant.conf boot IP (!) (, WiFi wlan2 ...)
How to make an interface for your smart home / media center / robot?
GUI VNC VNC GUI (Shutdown/Reboot/WiFi/IP/shell commands) SSH+CLI WEB Webmin/Ajenti/whatever
In the three years that I have been working with Raspberry Pi, I learned Linux, programming in Python and using all of this to create various interesting devices. All this time I ran across the same problems, the root of which is that the Raspberry Pi does not have simple built-in methods for interacting with the OS - for example, the built-in monitor / keyboard. As a result, it is easy to connect a laptop with Linux to WiFi, and for the Raspberry Pi you need to use additional hardware, dig with commands or carry monitors. This, as for me, has not yet been avoided, but it can be solved with a minimal amount of effort.
The more I developed different projects, the more different solutions I tried. During this time I used:
It's not that. The resulting solutions at some point clearly showed their limitations, and with all the iron that I used, one could achieve much more. What did my requirements ultimately form?
As a result, last year (2015), I started a project that uses cheap displays and buttons and gives me the opportunity to use the basic functions of the Raspberry Pi. It would seem that the idea is very simple - such interfaces have been popular for a long time in various devices - but when searching for ready-made solutions for Linux, only the LCDProc was visible, which is more of a status monitor. Most of the people who wanted to use such an interface, collective farms or something on Python with ready libs for displays and somehow working navigation code, sometimes not even rendered into classes for reuse.
In April of this year, a bunch of projects and a lot of mistakes later, I finished the project to version 1.0, called pyLCI and put it on GT for everyone to see. Since then, much has changed - pyLCI was used in each of my Raspberry Pi-projects, features were added, bugs disappeared, and occasionally I received letters with questions about some of the nuances of pyLCI. Now my goal is to tell about this project to all those who might find it useful.
pyLCI is a simple interface for configuring and managing Raspberry Pi functions using 2x16 screens, buttons and Python. It is simple, cheap and easy to use.
Installing pyLCI is easy - you install shield for $ 5 on Pi, download pyLCI on Pi and put it into autoload with the included script.
Under the spoilers - beautiful pyLCI gifs in work.
The simple answer is to take such a shield from China:
It costs about 5 dollars, and it works flawlessly.
Then you can take a shield from Adafruit:
More expensive, but better made and wait for the delivery will not have to (shild from China - almost a complete copy of this).
You need a simple display compatible with HD44780 commands, the minimum size is 16x2, displays of different sizes are supported. This type:
The display can be connected via GPIO (it takes 6 contacts on the Raspberry Pi) or I2C. Such displays often come across all sorts of Starter Kits, are available in every little bit respecting electronics store and market and cost $ 2 with free shipping from China.
You need at least 5 buttons. They can be connected via GPIO, I2C-GPIO expanders, or use USB HID devices - such as such numpads:
pyLCI is a UI framework that provides various UI elements to speed development and even allows you to fully integrate your application into pyLCI. For complex applications that need to be run separately, there is a proven approach - to implement some kind of RPC interface into it and write a pyLCI application that provides a UI and jerks RPC functions.
menu_name = "Hello world" from ui import Printer #Callback global for pyLCI callback = None #Some globals for us i = None o = None def init_app(input, output): global callback, i, o i = input; o = output callback = lambda: Printer("Hello world!", i, o)
What for what:
menu_name
- the name of the application in the main menui
- input device , catches button presses and calls callbacks set on them.o
- output device , operates the display.Printer
is a simple display function . Uses i and o, has various useful parameters and ways to call.init_app
is an application function called when pyLCI starts. It transfers i and o to the application, it usually creates the main UI elements of the application.callback
is a function called when an application is activated. Usually activates the main menu of the application, in our case simply calls Printer with our message.Documentation for various available UI elements is on ReadTheDocs , besides many examples of use can be seen in already written applications .
Recently, I often add various features and fix bugs. A document with plans for the future is available here , but if you badly lack any function or application, please email me (crimier yandex ru) or issues on Github , I can help.
Developing a phone project on Pi Zero using pyLCI to change system settings without connecting via SSH
Source: https://habr.com/ru/post/400159/