Difference between revisions of "Microcontroller User Interfaces"

From OpenCircuits
Jump to navigation Jump to search
(fill in some details)
(mention e-ink displays, etc.)
 
(5 intermediate revisions by 2 users not shown)
Line 2: Line 2:
  
 
== Input ==
 
== Input ==
 +
 +
In principal any sensor can be used as an input so you may want to look at information on sensors as well.  These are the ones that are easy for people to manipulate.
  
  
Line 7: Line 9:
 
*Pro  Cheap, simple, uses only 1 bit port
 
*Pro  Cheap, simple, uses only 1 bit port
 
*Con  If you use a bunch uses a lot of port bits
 
*Con  If you use a bunch uses a lot of port bits
 +
*Find Code at:
  
 
=== Toggle switch ===
 
=== Toggle switch ===
 +
*Pro  Self indicating, not too expensive.
 +
*Con  Not very flexible unless used for binary input.
 +
*Find Code at:
  
 
=== Rotary Switch ===
 
=== Rotary Switch ===
 
*Pro
 
*Pro
 
*Con
 
*Con
 
+
*Find Code at:
  
 
Can be self decoding: position of switch indicates state of microcontroller.
 
Can be self decoding: position of switch indicates state of microcontroller.
  
 
=== Rotary Encoder ===
 
=== Rotary Encoder ===
*Pro
+
*Pro 2 wire interface.
*Con
+
*Con Code a bit complex, needs interrupt processing or fast polling.
 +
*Find Code at:
  
=== Potentiometer ===
+
=== Potentiometer Or Resistor Network and Switches ===
 
Use to feed a voltage to an analog to digitial converter.  You sould be able to get quite a few discrete values out of this while still having it easy to use.  Instead of a pot you can use a rotary switch with fixed resistors switched.   
 
Use to feed a voltage to an analog to digitial converter.  You sould be able to get quite a few discrete values out of this while still having it easy to use.  Instead of a pot you can use a rotary switch with fixed resistors switched.   
  
Line 58: Line 65:
  
 
=== 7 Segment Led ===
 
=== 7 Segment Led ===
 +
: ''main: [[Basic Circuit Building Blocks#Seven segment LEDs]]''
 +
 
* Pro: All segments matched brightness and packaged nicely.
 
* Pro: All segments matched brightness and packaged nicely.
 
* Con: difficult to display letters
 
* Con: difficult to display letters
Line 66: Line 75:
 
* Pro: Can have lots of characters, small displays are often 2 x 16.  Cost is about 10 bucks. Perhaps the simplest and lowest-power way to display text.
 
* Pro: Can have lots of characters, small displays are often 2 x 16.  Cost is about 10 bucks. Perhaps the simplest and lowest-power way to display text.
 
*Con  Cost is about 10 bucks.  You may not have the 7 port bits available.
 
*Con  Cost is about 10 bucks.  You may not have the 7 port bits available.
 +
 +
The Hitachi HD44780 parallel interface is extremely common on character LCDs.
 +
In addition to displaying letters and digits,
 +
the Hitachi HD44780 supports a few "user-defined characters" that support simple graphics,
 +
such as the [http://wilsonminesco.com/multitask/ battery-life icon documented by Garth Wilson].
 +
 +
* ''(Many [[watch display]] are character LCDs)''
 +
* [https://en.wikipedia.org/wiki/Hitachi_HD44780_LCD_controller Wikipedia: Hitachi HD44780 LCD controller]
  
 
=== graphical LCD or OLED ===
 
=== graphical LCD or OLED ===
 
* Pro:
 
* Pro:
 
* Con:  graphics often fill up and overflow whatever memory you have available. The person programming the system often spends huge amounts of time tweaking the graphics.
 
* Con:  graphics often fill up and overflow whatever memory you have available. The person programming the system often spends huge amounts of time tweaking the graphics.
 +
 +
: ''(Many [[watch display]] are graphical LCDs or OLEDs)''
 +
* The 2"x2" [[Arm7OledClock]]
 +
 +
=== e-ink display ===
 +
 +
Many people find e-ink displays much easier on the eyes than other kinds of displays.
 +
The e-ink displays use far less power (between updates) than nearly all other kinds of displays.
 +
Theoretically that should make them useful for [[watch display]]s.
 +
 +
Adafruit has a bunch of eInk / ePaper displays and tutorials on how to use them:
 +
* https://learn.adafruit.com/category/eink-slash-epaper
 +
* "QT Py CH32V203 eInk / ePaper Daily Calendar and Clock" https://learn.adafruit.com/ch32v203-eink-epaper-calendar-and-clock
 +
 +
Sparkfun has a few e-ink / e-paper displays:
 +
* https://www.sparkfun.com/mikroe-e-paper-display-1-54-200x200-dots.html
 +
 +
Pimoroni has a few e-ink / e-paper displays:
 +
* Badger 2040 W (Raspberry Pico W Aboard) https://shop.pimoroni.com/products/badger-2040-w?variant=40514062221395
 +
* https://shop.pimoroni.com/search?q=e-ink&product_type=Display
 +
 +
TRMNL:
 +
* [https://www.reddit.com/r/eink/comments/1iqnj31/trmnl_an_eink_feed_on_your_wall_easy_to_set_up/ Reddit: "TRMNL - An E-Ink Feed on your Wall - Easy to Set Up and Still Open Source!"]
 +
* [https://news.ycombinator.com/item?id=42137513 Hacker News: "Trmnl, a hackable e-ink dashboard that helps you stay focused"].
 +
* [https://tildes.net/~tech/1lzf/trmnl_open_source_e_ink_companion_device Tildes: "TRMNL - Open source e-ink 'companion' device"] also has some discussion on various alternative e-ink display
 +
* TRMNL firmware is open source at: https://github.com/usetrmnl
 +
* TRMNL remote server is open source at: https://usetrmnl.com/developers
 +
* Combining Home Assistant and TRMNL https://community.home-assistant.io/t/trmnl-e-ink-display/898822
 +
 +
"The Invisible Display: E-Paper Calendar and Smart Screen"
 +
* https://www.invisible-computers.com/
 +
 +
"Make yourself your own TRMNL"
 +
* using a ESP32C3 and a Waveshare eInk display https://medium.com/@datacompboy/make-yourself-your-own-trmnl-146486fbf13e
  
 
=== PC on Serial Port ===
 
=== PC on Serial Port ===
 
Control with a terminal program or a custom application.  PC provides both input and output.
 
Control with a terminal program or a custom application.  PC provides both input and output.
 
 
*Pro 2 bit only.  Can have very fancy smart interface.  Can be very useful for debugging.
 
*Pro 2 bit only.  Can have very fancy smart interface.  Can be very useful for debugging.
 
*Con Needs PC.  May need custom application. For good flexibility needs a uart on the chip.
 
*Con Needs PC.  May need custom application. For good flexibility needs a uart on the chip.
 +
 +
 +
== Combination input and output ==
 +
 +
== touch-screen ==
 +
 +
Various technologies -- see [[Multi-touch display]]
 +
 +
 +
 +
 +
[[category:Microcontroller]][[category:Serial Communications]]

Latest revision as of 23:11, 12 June 2025

The intent of this page is to document different styles of user interfaces for microcontrollers together with code ( any language ) to drive them. We could use some contributions, can you help?

Input

In principal any sensor can be used as an input so you may want to look at information on sensors as well. These are the ones that are easy for people to manipulate.


Momentary Button

  • Pro Cheap, simple, uses only 1 bit port
  • Con If you use a bunch uses a lot of port bits
  • Find Code at:

Toggle switch

  • Pro Self indicating, not too expensive.
  • Con Not very flexible unless used for binary input.
  • Find Code at:

Rotary Switch

  • Pro
  • Con
  • Find Code at:

Can be self decoding: position of switch indicates state of microcontroller.

Rotary Encoder

  • Pro 2 wire interface.
  • Con Code a bit complex, needs interrupt processing or fast polling.
  • Find Code at:

Potentiometer Or Resistor Network and Switches

Use to feed a voltage to an analog to digitial converter. You sould be able to get quite a few discrete values out of this while still having it easy to use. Instead of a pot you can use a rotary switch with fixed resistors switched.

  • Pro Uses only 1 pin if using an AtoD converter.
  • Con Readint takes a AtoD converter ( or standard io port(s) with software. Takes a bit of time.

Keypad

  • Pro
  • Con

TV remote control and IR remote receiver

  • Pro: lots of pretty buttons, relatively low-cost -- under $2 for the IR remote receiver module, then use TV remote control you already have or a $10 remote; uses only 1 port pin
  • Con: may be difficult to program and debug; you never know when the batteries will die.

Output

Single Led

In its simplest form either on or off, slightly harder to read are various patterns of blinks.

  • Pro: easiest to program and lowest-cost user interface: from under $.10 for a tiny LED to a few dollars for a high-intensity LED. Can "read" from all the way across the room.
  • Con: only shows 1 bit of information at a time

Multiple Led

  • Pro Cheap, simple, easy to drive. One port bit per led ( untill you get to large numbers where ticks kick in ) Match with a pushbutton and state of the microcontroller and means to change it is simple.
  • Con: Can use more port bits than you have. Some LEDs may be dimmer than others. Uses more power than most other user interfaces.

A shift register can make driving a large number of LEDs easier.

POV display

POV display

  • Pro: learning experience; easy to make large displays
  • Con: uses more power than most other user interfaces; complicated and difficult to debug; can hurt you.

7 Segment Led

main: Basic Circuit Building Blocks#Seven segment LEDs
  • Pro: All segments matched brightness and packaged nicely.
  • Con: difficult to display letters

character LCD

In the nibble mode mode needs a total of 7 port bits. Some displays are backlit, others are not.

  • Pro: Can have lots of characters, small displays are often 2 x 16. Cost is about 10 bucks. Perhaps the simplest and lowest-power way to display text.
  • Con Cost is about 10 bucks. You may not have the 7 port bits available.

The Hitachi HD44780 parallel interface is extremely common on character LCDs. In addition to displaying letters and digits, the Hitachi HD44780 supports a few "user-defined characters" that support simple graphics, such as the battery-life icon documented by Garth Wilson.

graphical LCD or OLED

  • Pro:
  • Con: graphics often fill up and overflow whatever memory you have available. The person programming the system often spends huge amounts of time tweaking the graphics.
(Many watch display are graphical LCDs or OLEDs)

e-ink display

Many people find e-ink displays much easier on the eyes than other kinds of displays. The e-ink displays use far less power (between updates) than nearly all other kinds of displays. Theoretically that should make them useful for watch displays.

Adafruit has a bunch of eInk / ePaper displays and tutorials on how to use them:

Sparkfun has a few e-ink / e-paper displays:

Pimoroni has a few e-ink / e-paper displays:

TRMNL:

"The Invisible Display: E-Paper Calendar and Smart Screen"

"Make yourself your own TRMNL"

PC on Serial Port

Control with a terminal program or a custom application. PC provides both input and output.

  • Pro 2 bit only. Can have very fancy smart interface. Can be very useful for debugging.
  • Con Needs PC. May need custom application. For good flexibility needs a uart on the chip.


Combination input and output

touch-screen

Various technologies -- see Multi-touch display