Skip to content

RobTillaart/MT8870

Repository files navigation

Arduino CI Arduino-lint JSON check GitHub issues

License: MIT GitHub release PlatformIO Registry

MT8870

Arduino library for MT8870 DTMF decoder (breakout).

Description

This library reads the signals of the MT8870 chip. If data is available one can read it raw or as text.

DTMF = Dual Tones Multiple Frequency. These are the tones you hear when you press buttons on your phone.

DTMF tones, uses one frequency from A..D and one frequency from E..H.

Name Frequency
A 697 Hz
B 770 Hz
C 852 Hz
D 941 Hz
E 1209 Hz
F 1336 Hz
G 1477 Hz
H 1633 Hz

Character table

char low freq high freq
1 697 Hz 1209 Hz
2 697 Hz 1336 Hz
3 697 Hz 1477 Hz
A 697 Hz 1633 Hz
4 770 Hz 1209 Hz
5 770 Hz 1336 Hz
6 770 Hz 1477 Hz
B 770 Hz 1633 Hz
7 852 Hz 1209 Hz
8 852 Hz 1336 Hz
9 852 Hz 1477 Hz
C 852 Hz 1633 Hz
* 941 Hz 1209 Hz
0 941 Hz 1336 Hz
# 941 Hz 1477 Hz
D 941 Hz 1633 Hz

Feedback as always is welcome.

Interface

#include "MT8870.h"

Constructor

  • MT8870() constructor
  • void begin(uint8_t STQ, uint8_t Q1, uint8_t Q2, uint8_t Q3, uint8_t Q4) defines which pins to use. Technically it is possible to have readout multiple decoders with one MT8870 object by calling begin() with other pins.
    • STQ = data available signal
    • Q1..Q4 = data pins.
    • Calling begin resets the lastRead char

Communication

  • bool available() returns true if there is a DMTF signal
  • char read() reads the character available. Returns MT8870_NOKEY == 255 if no signal available.
  • uint8_t readRaw() returns 0 .. 15 or MT8870_NOKEY == 255 if no signal is available.
  • uint8_t lastRaw() returns the last code read 0 .. 15 or MT8870_NOKEY == 255 if no signal available. Note this is a cached value from a readRaw / read call.
  • uint32_t lastTimeRead() returns the timestamp of last read() or readRaw().

Future

Must

  • improve documentation
    • keypad matrix, which key generates which tones.

Should

  • test setup
  • add examples
    • DMTF with a PCF8574
    • DMTF as secret key
    • DMTF with less keys (less pins)
    • DMTF over interrupt triggered by STQ line

Could

  • buffer like Serial? (how to fill? interrupt? example sketch?)
    • read part of stream interface?
  • DMTF tone generation?
    • MCP_DAC
    • PWM + HW?

Wont

Support

If you appreciate my libraries, you can support the development and maintenance. Improve the quality of the libraries by providing issues and Pull Requests, or donate through PayPal or GitHub sponsors.

Thank you,

About

Arduino library for MT8870 DTMF decoder (breakout)

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

 
 
 

Languages