Please find here my functions to print on a LCD text display (compatible Hitachi HD44780) up to 40 simultaneus bars , with different positions, lengths, linear progression or audio logarithmic, with/without peak memory display.
They can be used as progression bars, level meters, audio VUmeters, visually show any measurement or level you like to.
Types of bars can be mixed but all must only be horizontal OR vertical. This is due to display's customized characters limitation, so I was forced to write one function for horizontal bars/meters and another for vertical ones giving priority to the precision of the bars.
Main features:
- easy to embed in your projects, it doesn't use delays or delay loops in order to take the shortest CPU time possible and free CPU for your main application
- precise: it uses every dot of the display
- linear and audio logarithmic option, just with a parameter
- HORIZONTAL bars: peak indicator memory option in the same bar with expiration time adjustment
- VERTICAL bars: peak or standard bars: due to custom characters limitations it's not possible to have a cool bar like the horizontal ones :~
- it works with different display sizes (eg. 16x2 20x4)
- direct connection Arduino==display, no need of a serial converter in the middle
- I enclose also same scketches for serial LCD I2C versions interface (PCF8574T based) if you need to save I/O
- 4 wires parallel versions uses standard Arduino libraries
- serial I2C versions require to use libraries by F Malpartida and remove the Arduino libraries from program folder, instructions in the comments of sketches
Is your task obviously to check that position and maximum length of each bar stay inside the display...
Below images and codes, enjoy free, I will appreciate comments and see projects using them!
Example of several bars showing a typical stereo L-R audio logarithmic VUmeters, with peak memory, two different sizes: 3 in the top, 17 below.
In the middle one linear bar, length 17, without peak memory (but it can be activated).
Example using the VER version, showing 10 audio logarithmic bars, lengh 2 with sidebar peak memory. One linear peak bar, length 4. Two audio logarithmic L-R VUmeters, length 4, with peak memory bars in the centre.
Enclosed below the codes for HORIZONTAL BARS and the one for VERTICAL BARS.
*** Updated 13 april with v 1.2 :
- better circuit description
- better comments
*** Updated 15 april VER only with v 1.3 :
- you can print peak bar only if you wish
*** Added 17 may same two versions
- for I2C PCF8574T based interface serial controller
in this case remember to remove any LiquidCrystal library in the user library folder and in the Arduino program one
*** updated 17/06/2014 more comments, identical code
(if you like this post pls click my karma! XD )
NiceMetersHOR_1_2.ino (8.03 KB)
NiceMetersVER_1_3.ino (8.32 KB)
NiceMetersHOR_1_2_I2C.ino (8.08 KB)
NiceMetersVER_1_3_I2C.ino (8.32 KB)