Arduino Touch

 

This is a BV4242 with an Arduino nano attached and libraries.

The library uses pins 11,12 and optionally 13 to drive a software 1 wire interface to the display and keypad so that only 2 or three pins are used leaving the others free for the application.

The LCD and touch pads are driven by a separate processor. The Arduino is connected to the keypad with 4 pins GND, +V, D11 and D12. The keypad has an 8 way connector and only 4 are used.

Library

The library includes an example which is installed by default. It uses a soft I2C which uses pins 11 and 12 instead of the normal pins.

Keypad Section

void clrBuf(); Clears / resets the keypad buffer, the buffer is 79 bytes big
uint8_t keysBuf(); Returns the number of keys in the buffer
uint8_t key(); removes and returns the key in the buffer, if no key, returns a 0
uint8_t keyIn(uint8_t k); See if 'k' is in the buffer, 0 if not or a number representing its position in the buffer
uint8_t scan(); Returns the scan code if a pad is being touched, if no pad being touched then returns 0
void avg(uint16_t *b); Supply a buffer 8 integers big and this will return the 8 averages from each channel
void delta(uint16_t *b); Supply a buffer 8 integers big and this will return the delta value for each channel. The delta value is the difference between an average value and the touched value, if no pad is thouched the delaa value will therefore be 0
void EEreset(); Resets all EEPROM values back to their defaults
void sleep(); Shuts down device to save power, can only be awakened with a reset or I2C activity. NOTE the keypad will not respond when in sleep mode.

EEPROM Section

NOTE: Values written to the EEPROM will not take effect until the device is reset. For what the values mean consult the data sheet in the Device Parameters section.

void trigger(uint16_t value); Write a new trigger value to the EEPROM
void hyst(uint8_t value); Writes a new hysteresis value to EEPROM
void keyPtr(uint8_t value); Writes a new key pointer value to EEPROM
void keySize(uint8_t value); Writes a new key table size value to EEPROM
void debounce(uint8_t value); Writes a new debounce value to EEPROM
void repeat(uint16_t value); Writes a new repeat key value to EEPROM
void timebase(uint8_t value);  Writes a new timebase value to EEPROM
void defaultBL(uint8_t value);  Writes a new default back light value to EEPROM

System Section

void EEwrite(uint8_t adr, uint8_t value); Writes a value to the specified EEPROM address
uint8_t EEread(uint8_t adr); Reads an EEPROM value at the specified address
uint16_t ID(); Gets the device id number as an integer, in this case 4242
void Version(uint8_t *b); Gets the firmware version as two bytes

LCD Section

The LCD secion uses exactly the same function names as used in the LiquidCrystal library and so will not be repeated here. There are however a few extra functions listed

void lcd_mode(uint8_t mode); The default is 0 which is a 16 x 2 line display, set this to 1 and the display will be 16 x 1 line with double height characters.void bl(uint8_t v);
void lcd_reset(); Sends a reset to the LCD display
void lcd_contrast(uint8_t m); The contrast is a value between 0 and 63 and will require changing depending on the voltage used. The default value is held in EEPROM and is set to about 45 which is right for 3.3V. 5V requires about 25.
void lcd_startMsg(); This simply displays the message stored in EEPROM

USB Driver

The nano uses the CH340G for the USB communication, if your operating system does not have this installed there are plenty or resources on line.

Box

The device fits exactly in an E76 box, supplied by m-r-s and there is still some room for batteries and other components.

Beeper

This does not take up any Adruino resources as it is a function of the touch panel. The negative end of the beeper is connected to the pin marked KEY on the LCD panel.

Overlay

The keypad is designed as a front panel and comes with just a bare PCB, the front of which has the touch pads on. The idea is to create your own design to suit a particular project.

The layouts file contains an svg file. This can be opened and edited in inkscape which is free and rather good.

The layout can be printed on sticky back paper, photo glossy or vinyl.

Recommended:

Because of the thickness, sticky back vinyl is best, on top of this sticky back clear vinyl can be applied which will protect the printing.

Tips:

Produce the layouts a bit oversized. When printed the rectangle hole for the LCD display was cut out so as to position the overlay.

This covered the PCB. The excess was cut off from the back.

Dimensions