micropython lcd display factory

The 5110 LCD is ideal for battery projects as it consumes little power. The resolution 84x48 is restrictive though. If you are buying a few of them, get them from the same provider. I have a few with slightly different shades of backlight. Just enough to be noticible and annoying.

You can get huge 7 segment displays, like 5x10cm per digit. A few of these would be ideal for an odometer. Low power, bright, no need for backlight, rugged. Controlled with either a max7219 or a ht16k33.

You can get 128x64 graphic LCDs, which are similar physical dimensions to a 20x4 character LCD. The yellow/black versions would give better readability in full sun than blue/white LCDs. This would give you a large area for custom graphics. The pixels are large enough to be readable from a distance. The pixel layout is similar to the OLED and the Nokia, so if you trial each display, you can share code.

The character LCDs based on hd44780 come in a few sizes. 8x8, 16x1, 16x2, 16x4, 20x2 and 20x4. That is character sizes. Each char is 5x8, and you can only have 8 custom chars in ram, so rather limited. Great for lots of ascii text.

The graphic LCDs, char LCDs and TFTs differ from the OLEDs as the pixels block light rather than emit. You need a backlight to be able to read them in most cases.

Which one is best for a bike HUD? Well... it depends on a few things. What information you want to display. How readable it needs to be. How rugged it needs to be. How fast it needs to refresh. How many MCU pins it needs. Your budget. Reliability - so you are safe if it crashes/reboots. Are there any laws / compliance you need to follow?

micropython lcd display factory

Consider use of Micropython"s framebuf Framebuffer library to see if it offers any acceleration, or just for conformance with other libraries - draw primitives look like they are the same.

micropython lcd display factory

In this tutorial Tony Goodhew explains how to use the basic graphics procedures which are included in the display driver, and for the ambitious makers out there he also provides examples for advanced shapes and graphics!

All the other graphical and text objects we would like to display can be built from this single pixel instruction; such as lines, circles, rectangles, triangles and text strings at different sizes.

This is all carried out with code. Display manufacturers usually supply some of these procedures/methods but leave the rest up to the end user to construct.

At the top of our driver program we will always import a minimal set of libraries using this block at the top of our MicroPython script (we add even more later when we want to do advanced programs):

The third line here imports the Framebuffer library which includes several very useful routines to draw objects on the display. The garbage collection library, gc, has also been imported so that we can check how much memory is available.

The following methods draw shapes (such as those above) onto the FrameBuffer. They only become visible to the user once the lcd.show() instruction is executed.

Each program contains the screen driver code, sets up the buttons/joystick (if applicable), sets the width and height variables, loads the essential libraries, defines the colour (R, G, B) and clear (c) procedures, then displays some colour checking text like this:

Using lcd.fill_rect, fill the whole screen green and then fill the middle of the screen black, leaving a 10 pixel border. Put red 10-pixel squares in each corner.

Draw a dark grey rectangle in the centre of the screen. Draw 500 white pixels inside the square, none touching the edge. (Random was explained in the previous display tutorial.)

This is routine is very complicated. It splits the original triangle into two with a horizontal line and then fills them in. If you uncomment all the # lcd.show() lines and sleep instructions it will slow right down and you can see it working (unfortunately, the 2” display needs such a large buffer that there is not enough memory for the filled triangles code):

For the imports we added the math library as this is needed for Sin and Cos in graph plotting. The random library has also been imported, for the randomly generated triangles. These are followed by the basic LCD board setup we covered earlier.

In the centre of the screen display a ‘bull’s eye’ circular target with a ‘gold’ centre, 4 other colours and scores 10, 8, 6, 4 and 2 written in the appropriate positions.

You may have noticed that on some screens the text is very small and difficult to read. In a following tutorial will add an extra font, with more characters, which we can display in different sizes.

This article was written by Tony Goodhew. Tony is a retired teacher of computing who starting writing code back in 1968 when it was called programming - he started with FORTRAN IV on an IBM 1130! An active Raspberry Pi community member, his main interests now are coding in MicroPython, travelling and photography.

micropython lcd display factory

I am new to coding. I have this project that I want to get done, so this is daunting. I had someone else write this, but my LCD was DOA, so I want to switch to an OLED. Can anyone help me transcribe this code from LCD display to OLED? I made some progress, I think, but I"m not entirely sure what to do next. I"ve setup the header to import the SSD1306 python file for the OLED and changed the options for the I2C to the settings for the OLED display. I"ve set the pins and I"ve changed what happens when I2C runs to what I think is appropriate for this OLED display, but I"m not sure. And later on there are some codes that control what is written to the display, but this is where I am out of my depth. I don"t know what to change at the lcd_print stuff to make it do the same thing, but on an OLED...

micropython lcd display factory

This tutorial will show you how to plug things in, how to get to grips with the built in demo programs and how to start programming your Tufty with MicroPython.

Some sort of battery if you want to disconnect Tufty from your computer and update the display on the go - we"ll discuss a few options and their pros and cons!

Your Tufty will come preloaded with MicroPython and a suite of examples, but for the all the latest features, tweaks and fixes, download yourself the newest version. You"ll need to be running version 1.19.0 or later to have access to all the new Tufty/PicoGraphics stuff.

If you"re brand new to Raspberry Pi Pico/RP2040s, you might find the step by step instructions in our Getting Started with Raspberry Pi Pico tutorial useful - it will show you how to install our custom MicroPython build and goes into more detail about how to use Thonny . Here"s a quick TLDR!

Download the most recent MicroPython .uf2 from the Releases page of our pimoroni-pico Github repository. You"ll want to download the special version for Tufty 2040, to give you access to all that lovely extra flash storage.

We"ve preloaded Tufty with a little menu program and some examples to show you what"s possible. Navigate the menu with the arrow up and down buttons, and press A to open up the example. If you save additional MicroPython programs to your Tufty, they"ll show up automatically in the menu. You"ll need to turn Tufty off and on with the power button to return to the menu once you"re done with an example.

Once MicroPython is installed, Tufty won"t show up as a drive on your computer any more. To program it, you"ll need to talk to it through an interpreter - we"re using Thonny, which is available for Windows, Mac or Linux.

After you press stop, you should get something like this a MicroPython prompt that looks something like this. The flashing cursor next to the >>> in the "Shell" box tells you that Tufty 2040 is talking to your computer and is ready to accept instructions.

Thonny didn"t manage to detect our board automatically - probably because the Tufty image is based on brand new v1.19 MicroPython . We had to specify the port our device was using, you can do this by clicking on MicroPython (Raspberry Pi Pico) at the bottom right, and selecting Configure Interpreter. Select your device under "Port" - our Tufty was showing up as "COM20".

The built in example button_test.py shows a simple way to read the buttons on Tufty using one of our helper functions. Fancier, interrupt methods are available! (Get Started with MicroPython on Raspberry Pi Pico covers a few different methods).

display.text writes text to the screen buffer. When using a bitmap font, the "0, 0" is the x/y co-ordinates of the top left of the text. "320" is when text will start wrapping onto the next line (so needs to be the width of the screen in most cases). The final number "4" is the scale of the text, reduce or increase it to shrink or embiggen!

Once you"ve got to grips with Thonny and our examples, why not add one of our breakouts into the mix to give your Tufty some sensor smarts. If your breakout has a Qw/ST connector, you can plug it straight into Tufty with a Qw/ST cable (if not, you can use one of these adaptors). There"s a list of which of our breakouts are currently supported in our MicroPython build here.

If you need to delete all your programs from Tufty"s flash memory and start again from scratch, you can do that by downloading this special .uf2 file and copying it to Tufty whilst it"s in bootloader mode. Once you"ve done that, you"ll need to copy the Tufty MicroPython image across again.

You may also find clearing the flash to be useful if you encounter problems after upgrading to the newest version of MicroPython - just make sure you save any code you"ve been working on to your computer first!

micropython lcd display factory

M5StickC with a bigger screen .It is a portable, easy-to-use, open source, IoT development board. This tiny device will enable you to realize your ideas, enrich your creativity, and speed up your IoT prototyping. Developing with M5StickC PLUS takes away a lot of the pains from the development process. M5StickC Plus is one of the core devices in M5Stacks product series. The compact body is integrated with rich hardware resources, such as infrared, RTC, Microphone, LED, IMU, Buttons, PMU,etc. Improvements from the regular StickC are a buzzer, bigger screen (1.14-inch, 135 * 240 resolution LCD Screen) and more stable hardware design. This revision increases the display area by 18.7%, and the battery capacity from 95mAh to 120mAh. It also supports the HAT and Unit family of products.