Hardware

Mini serial console for MM8D

Hardware

It is a simple serial console that can be used for data display and data input. It can handle three (different) serial interfaces at the same time: 3.3V TTL for single-board computers and microcontrollers, via traditional RS-232 and serial over USB.

supply voltage:5 V
current consumption:approx. 30 mA
mechanical dimensions:100x60x50 mm
insulation class:Class 0
IP protection:IP 00
device housing material:thermoplastic (PC), cover only
display size:20x4 characters
character set:ASCII 32-127
connection:3.3V TTL, RS-232 and USB serial
receive buffer size:255 byte
This is a Raspberry Pi Pico-based device. The display is 20x4 character-sized liquid crystal display, which displays 20x4 size area of the larger size virtual screen. This area is a can be moved with buttons. The default size of the virtual screen is 80x25 characters, this value can be set in the program.

The circuit has three serial ports, depending on the setting, all three can be used for data and system message transmission, or both at the same time. The #0 serial port is via USB port, #1 is a 3.3V TTL port, #2 is a conventional RS-232 serial port. Serial #1 can be connected to a 5V TTL serial port with an external level shifter circuit. Default port speeds: 115200, 9600 and 9600 bit/s, these values can be set in the program.

The console has four operation modes, the first three for display only can be used, these are pre-programmed, the fourth is reserved for unique solutions. With jumpers between modes we can choose. Only MODE #3 is used in this application. See original page for detailed information about modes.

Modes of operation:
MODE #3/0read only mode, no cursor, 20x4 size displayed area, the displayed page can be change with pushbuttons, switch to other submode with PB4 button.
MODE #3/1 read only mode, mode, no cursor, 20x4 size displayed area, the displayed page can be change with pushbuttons, switch to other submode with PB4 button.
MODE #3/2read only mode, no cursor, 20x4 size displayed area on 80x25* size virtual screen, automatically scrolling lines, the displayed area can be moved horizontally and vertically with pushbuttons, switch to other submode with PB4 button, lock scroll with PB5 button.
*: The size of the virtual screen can be set in the program.

Function of buttons:
button MODE #3/0 MODE #3/1 MODE #3/2
PB0    
PB1    
PB2 Pg Up Pg Up
PB3 Pg Dn Pg Dn
PB4 change submode change submode change submode
PB5     lock scroll
Pages

Software

The program that operates this device was created on the Arduino IDE development system. This application must first be prepared to work with the Raspberry Pi Pico, for which instructions can be found online (for example here).

Setup
Before installing the program, you need to set these prepocessor macros:

#define LCD_8BIT               // enable 8 bit mode of the LCD
#define COM_USB                // enable Serial #0 port
#define COM_TTL                // enable Serial #1 port
#define COM_RS232C             // enable Serial #2 port
// #define COM_USB_MESSAGES    // enable console messages on Serial #0 port
// #define COM_TTL_MESSAGES    // enable console messages on Serial #1 port
// #define COM_RS232C_MESSAGES // enable console messages on Serial #2 port
and constants:

const int     lcd_bloffinterval = 60000;                // LCD backlight off time
const byte    lcd_xsize         = 20;                   // horizontal size of display
const byte    lcd_ysize         = 4;                    //vertical size of display
const byte    virtscreenxsize   = 80;                   // horizontal size of virtual screen
const byte    virtscreenysize   = 25;                   // vertical size of virtual screen
const int     com_speed[3]      = {115200, 9600, 9600}; // speed of the USB serial port

How it works?
At start-up, the program initializes serial ports and if consol messages is enabled sends status message. After that, it sets the GPIO ports, clears the virtual screen and initializes the display. Sets its own operating mode according to the jumpers (JP2-3). The display shows brief information about the device.

The program then continuously monitors all serial ports, the state of the buttons, and the state of the mode selection jumpers. If data is received on one of the ports, the software decides on the type of incoming data. If it is a plain text log file record, it stores it on the virtual screen. If it is a binary channel data, it is stored in the state and override buffer.

In MODE #3/0, the software creates the current page from the stored status data, in MODE #3/1 from the stored override data. In MODE #3/2 the LCD display shows a part of the virtual screen as a window. This 'window' can be moved with the buttons. The size of the virtual screen and the ability to move the 'window' depend on the selected mode.

The program turns off the backlight after 60 s of inactivity, then turns it back on when a button is pressed.

Incoming data from controllers
Incoming (binary) data in MODE #3 (CH #0 of the MM8D)
byte function values
0: 'C' 0x43      
1: 'H' 0x48      
2: number of channel 0x00      
3: overcurrent breaker error 0x00: closed 0x01: opened    
4: water pump pressure error (no water) 0x00: good 0x01: bad      
5: water pump pressure error (clogging) 0x00: good 0x01: bad      
6: external temperature in °C 0x00-0x80      
7: status of water pump and tube #1 0x00: off 0x01: on 0x02: always off 0x03: always on
8: status of water pump and tube #2 0x00: off 0x01: on 0x02: always off 0x03: always on
9: status of water pump and tube #3 0x00: off 0x01: on 0x02: always off 0x03: always on
A: unused 0x00      
B: unused 0x00      
C: unused 0x00      

Incoming (binary) data in MODE #3 (CH #1-8 of the MM8D)
byte function values
0: 'C' 0x43      
1: 'H' 0x48      
2: number of channel 0x01-0x08      
3: temperature in °C 0x00-0x80      
4: relative humidity 0x00-0x80      
5: relative unwanted gas concentrate 0x00-0x80      
6: operation moder 0x00: hyphae 0x01: mushroom 0x7F: disabled channel  
7: manual mode 0x00: auto 0x01: manual    
8: overcurrent breaker error 0x00: closed 0x01: opened    
9: status of door (alarm) 0x00: closed 0x01: opened    
A: status of lamp output 0x00: off 0x01: on 0x02: always off 0x03: always on
B: status of ventilator output 0x00: off 0x01: on 0x02: always off 0x03: always on
C: status of heater output 0x00: off 0x01: on 0x02: always off 0x03: always on

Incoming (text) log line in MODE #3
Example lines:
    "221213 114421 I Configuration is loaded."
    "221213 114427 W CH2: MM6D is not accessible."
    "221213 114427 E ERROR #18: There is not enabled channel!"
date (yymmdd) time (hhmmss) level short description
221213 114421 I Configuration is loaded.
221213 114427 W CH2: MM6D is not accessible.
221213 114427 E ERROR #18: There is not enabled channel!

Manuals and connectors

1:Fuse F1 - power supply
2:J1 connector - power input
3:J2 connector - TTL serial port
4:J3 connector - RS-232 serial port
5:J4 connector - push buttons
6:JP1 jumper - RESET
7:JP2-3 jumpers - mode selector
8:USB connector

Schematic

Polycarbonate cover

Download

name version format comment
hardware documentation v220726 tar.gz  
only Gerber files v0.1 zip Order here: PCBWay

Operation program

name version OS arch. format note
source package v0.1     tar.gz C++
binary package v0.1   arm tar.gz  
Github git clone https://github.com/pozsarzs/mini_serial_console_mm8d-sw.git

 Hackster Project page on Hackster.io

Stand with Ukraine!