DTMF decoder for handy with arduino, control over several kilometers
In this tutorial we will see how to make a circuit to connect to our handy, in this case a Baofeng UV-5R (although it also works for other brands and models) for long distance control of motors, lights, water pumps without the need to use a cellular network, or in places where it does not exist. We will see the assembly of the electronic circuit, we will study the source code and finally we will test the entire device to verify its operation.
Electronic components
3.58 Mhz crystal
Two 100K Ohm resistors
Two 100 nF ceramic disc capacitors
A 300K Ohm resistor
An arduino mini pro
Two handy baofeng or similar
hc-05 module (optional)
Only if you want to see the data received on your cell phone you can connect this module, that is why it is optional and not mandatory.
Works as a bluetooth master and slave device
Configurable via AT commands
Bluetooth V2.0+EDR
Operating frequency: 2.4 GHz ISM band
Modulación: GFSK (Gaussian Frequency Shift Keying)
Transmit power: <=4dBm, Class 2
Sensitivity: <=-84dBm @ 0.1% BER
Security: Authentication and encryption
Perfiles Bluetooth: Puerto serie bluetooth.
Distance of up to 10 meters in optimal conditions
Operating Voltage: 3.6 VDC to 6 VDC
Current Consumption: 30 mA to 50 mA
Chip: BC417143
Version or firmware: 3.0-20170609
Default Baud: 38400
Supported baud rates: 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200.
Interface: Serial TTL
Antenna: Integrated into the PCB
Security: Authentication and encryption (Default password: 0000 or 1234)
Working temperature (Max): 75°C
Working temperature (Min): -20°C
Dimensions: 4.4 x 1.6 x 0.7 cm
Female pins
2.5mm male jack plug
Integrated circuit MT8870de
Pinout del MT8870DE
Data sheet
mt8870d-datasheet
Display oled con driver SSD1306
The display performance is better than traditional LCD screen, also lower consumption.
Specification:
Driver IC: SSD1306
Size: 0.91 inch OLED
Resolution: 128 x 32
Size: 38 * 12mm
Number of pins: 4 pins
Interface type:
IIC interface
Screen color: White / Blue
Pin description:
GND: Power Ground
VCC: Power + (DC 3.3 ~ 5v)
Working temperature: -40 ~ 85 ℃
SCL: Clock line
SDA: Data line
OLED display, no need backlight, self-illumination, Screen color: blue.
The display performance is better than traditional LCD, also lower consumption; IIC (I2C communications) simplifies connections.
Use with Arduino, ESP8266, ESP32, STM32, etc. 3.3 to 5v voltage
Pines macho
Socket for the arduino mini pro
Socket for the MT8870 integrated circuit
Circuit
PCB
Download pcb –> dtmf duino
#include <Arduino.h>
#include <U8g2lib.h>
#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif
U8G2_SSD1306_128X32_UNIVISION_1_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE); //Display SSD1306 de 128x32
int codigo;
const int Pin12 = 12;
const int Pin11 = 11;
const int Pin10 = 10;
const int Pin9 = 9;
const int Pin8 = 8;
const int Pin7 = 7;
const int Pin6 = 6;
const int Pin5 = 5;
const int Pin4 = 4;
const int Pin3 = 3;
const int Pin2 = 2;
int EstadoPin2 = 0;
int EstadoPin3 = 0;
int EstadoPin4 = 0;
int EstadoPin5 = 0;
int EstadoPin6 = 0;
void setup() {
Serial.begin(9600);//Velocidad del puerto serial
u8g2.begin();//Inicializamos el display
// Ponemos los pines 2 al 6 como entradas para el circuto integrado MT8870DE
pinMode(Pin2, INPUT);
pinMode(Pin3, INPUT);
pinMode(Pin4, INPUT);
pinMode(Pin5, INPUT);
pinMode(Pin6, INPUT);
//Salidas control de luces, motores, relay, triac, etc
pinMode(Pin7, OUTPUT);
pinMode(Pin8, OUTPUT);
pinMode(Pin9, OUTPUT);
pinMode(Pin10, OUTPUT);
pinMode(Pin11, OUTPUT);
pinMode(Pin12, OUTPUT);
//Inicializamos el display con la leyenda "Preparado"
codigo = 17;
displayOled();
}
void loop() {
// Leemos el estado de los pines 2 al 6
EstadoPin2 = digitalRead(Pin2);
EstadoPin3 = digitalRead(Pin3);
EstadoPin4 = digitalRead(Pin4);
EstadoPin5 = digitalRead(Pin5);
EstadoPin6 = digitalRead(Pin6);
delay(110);
//Boton 1 10001
if (EstadoPin6 == HIGH && EstadoPin5 == LOW && EstadoPin4 == LOW && EstadoPin3 == LOW && EstadoPin2 == HIGH ) {
Serial.print("1");
while(EstadoPin6 == HIGH && EstadoPin5 == LOW && EstadoPin4 == LOW && EstadoPin3 == LOW && EstadoPin2 == HIGH){
EstadoPin2 = digitalRead(Pin2);
EstadoPin3 = digitalRead(Pin3);
EstadoPin4 = digitalRead(Pin4);
EstadoPin5 = digitalRead(Pin5);
EstadoPin6 = digitalRead(Pin6);
codigo = 1;
digitalWrite(Pin7, HIGH);
displayOled();
}
}
//Boton 2 01001
if (EstadoPin6 == LOW && EstadoPin5 == HIGH && EstadoPin4 == LOW && EstadoPin3 == LOW && EstadoPin2 == HIGH ) {
Serial.print("2");
while(EstadoPin6 == LOW && EstadoPin5 == HIGH && EstadoPin4 == LOW && EstadoPin3 == LOW && EstadoPin2 == HIGH ){
EstadoPin2 = digitalRead(Pin2);
EstadoPin3 = digitalRead(Pin3);
EstadoPin4 = digitalRead(Pin4);
EstadoPin5 = digitalRead(Pin5);
EstadoPin6 = digitalRead(Pin6);
digitalWrite(Pin7, LOW);
codigo = 2;
displayOled();
}
}
//Boton 3 11001
if (EstadoPin6 == HIGH && EstadoPin5 == HIGH && EstadoPin4 == LOW && EstadoPin3 == LOW && EstadoPin2 == HIGH ) {
Serial.print("3");
while(EstadoPin6 == HIGH && EstadoPin5 == HIGH && EstadoPin4 == LOW && EstadoPin3 == LOW && EstadoPin2 == HIGH ){
EstadoPin2 = digitalRead(Pin2);
EstadoPin3 = digitalRead(Pin3);
EstadoPin4 = digitalRead(Pin4);
EstadoPin5 = digitalRead(Pin5);
EstadoPin6 = digitalRead(Pin6);
digitalWrite(Pin8, HIGH);
codigo = 3;
displayOled();
}
}
//Boton 4 00101
if (EstadoPin6 == LOW && EstadoPin5 == LOW && EstadoPin4 == HIGH && EstadoPin3 == LOW && EstadoPin2 == HIGH ) {
Serial.print("4");
while(EstadoPin6 == LOW && EstadoPin5 == LOW && EstadoPin4 == HIGH && EstadoPin3 == LOW && EstadoPin2 == HIGH ){
EstadoPin2 = digitalRead(Pin2);
EstadoPin3 = digitalRead(Pin3);
EstadoPin4 = digitalRead(Pin4);
EstadoPin5 = digitalRead(Pin5);
EstadoPin6 = digitalRead(Pin6);
digitalWrite(Pin8, LOW);
codigo = 4;
displayOled();
}
}
//Boton 5 10101
if (EstadoPin6 == HIGH && EstadoPin5 == LOW && EstadoPin4 == HIGH && EstadoPin3 == LOW && EstadoPin2 == HIGH ) {
Serial.print("5");
while(EstadoPin6 == HIGH && EstadoPin5 == LOW && EstadoPin4 == HIGH && EstadoPin3 == LOW && EstadoPin2 == HIGH ){
EstadoPin2 = digitalRead(Pin2);
EstadoPin3 = digitalRead(Pin3);
EstadoPin4 = digitalRead(Pin4);
EstadoPin5 = digitalRead(Pin5);
EstadoPin6 = digitalRead(Pin6);
digitalWrite(Pin9, HIGH);
codigo = 5;
displayOled();
}
}
//Boton 6 01101
if (EstadoPin6 == LOW && EstadoPin5 == HIGH && EstadoPin4 == HIGH && EstadoPin3 == LOW && EstadoPin2 == HIGH ) {
Serial.print("6");
while(EstadoPin6 == LOW && EstadoPin5 == HIGH && EstadoPin4 == HIGH && EstadoPin3 == LOW && EstadoPin2 == HIGH ){
EstadoPin2 = digitalRead(Pin2);
EstadoPin3 = digitalRead(Pin3);
EstadoPin4 = digitalRead(Pin4);
EstadoPin5 = digitalRead(Pin5);
EstadoPin6 = digitalRead(Pin6);
digitalWrite(Pin9, LOW);
codigo = 6;
displayOled();
}
}
//Boton 7 11101
if (EstadoPin6 == HIGH && EstadoPin5 == HIGH && EstadoPin4 == HIGH && EstadoPin3 == LOW && EstadoPin2 == HIGH ) {
Serial.print("7");
while(EstadoPin6 == HIGH && EstadoPin5 == HIGH && EstadoPin4 == HIGH && EstadoPin3 == LOW && EstadoPin2 == HIGH ){
EstadoPin2 = digitalRead(Pin2);
EstadoPin3 = digitalRead(Pin3);
EstadoPin4 = digitalRead(Pin4);
EstadoPin5 = digitalRead(Pin5);
EstadoPin6 = digitalRead(Pin6);
digitalWrite(Pin10, HIGH);
codigo = 7;
displayOled();
}
}
//Boton 8 00011
if (EstadoPin6 == LOW && EstadoPin5 == LOW && EstadoPin4 == LOW && EstadoPin3 == HIGH && EstadoPin2 == HIGH ) {
Serial.print("8");
while(EstadoPin6 == LOW && EstadoPin5 == LOW && EstadoPin4 == LOW && EstadoPin3 == HIGH && EstadoPin2 == HIGH ){
EstadoPin2 = digitalRead(Pin2);
EstadoPin3 = digitalRead(Pin3);
EstadoPin4 = digitalRead(Pin4);
EstadoPin5 = digitalRead(Pin5);
EstadoPin6 = digitalRead(Pin6);
digitalWrite(Pin10, LOW);
codigo = 8;
displayOled();
}
}
//Boton 9 10011
if (EstadoPin6 == HIGH && EstadoPin5 == LOW && EstadoPin4 == LOW && EstadoPin3 == HIGH && EstadoPin2 == HIGH ) {
Serial.print("9");
while(EstadoPin6 == HIGH && EstadoPin5 == LOW && EstadoPin4 == LOW && EstadoPin3 == HIGH && EstadoPin2 == HIGH ){
EstadoPin2 = digitalRead(Pin2);
EstadoPin3 = digitalRead(Pin3);
EstadoPin4 = digitalRead(Pin4);
EstadoPin5 = digitalRead(Pin5);
EstadoPin6 = digitalRead(Pin6);
digitalWrite(Pin11, HIGH);
codigo = 9;
displayOled();
}
}
//Boton 0 01011
if (EstadoPin6 == LOW && EstadoPin5 == HIGH && EstadoPin4 == LOW && EstadoPin3 == HIGH && EstadoPin2 == HIGH ) {
Serial.print("0");
while(EstadoPin6 == LOW && EstadoPin5 == HIGH && EstadoPin4 == LOW && EstadoPin3 == HIGH && EstadoPin2 == HIGH ){
EstadoPin2 = digitalRead(Pin2);
EstadoPin3 = digitalRead(Pin3);
EstadoPin4 = digitalRead(Pin4);
EstadoPin5 = digitalRead(Pin5);
EstadoPin6 = digitalRead(Pin6);
digitalWrite(Pin11, LOW);
codigo = 0;
displayOled();
}
}
//Boton * 11011
if (EstadoPin6 == HIGH && EstadoPin5 == HIGH && EstadoPin4 == LOW && EstadoPin3 == HIGH && EstadoPin2 == HIGH ) {
Serial.print("*");
while(EstadoPin6 == HIGH && EstadoPin5 == HIGH && EstadoPin4 == LOW && EstadoPin3 == HIGH && EstadoPin2 == HIGH ){
EstadoPin2 = digitalRead(Pin2);
EstadoPin3 = digitalRead(Pin3);
EstadoPin4 = digitalRead(Pin4);
EstadoPin5 = digitalRead(Pin5);
EstadoPin6 = digitalRead(Pin6);
digitalWrite(Pin12, HIGH);
codigo = 11;
displayOled();
}
}
//Boton # 00111
if (EstadoPin6 == LOW && EstadoPin5 == LOW && EstadoPin4 == HIGH && EstadoPin3 == HIGH && EstadoPin2 == HIGH ) {
Serial.print("#");
while(EstadoPin6 == LOW && EstadoPin5 == LOW && EstadoPin4 == HIGH && EstadoPin3 == HIGH && EstadoPin2 == HIGH ){
EstadoPin2 = digitalRead(Pin2);
EstadoPin3 = digitalRead(Pin3);
EstadoPin4 = digitalRead(Pin4);
EstadoPin5 = digitalRead(Pin5);
EstadoPin6 = digitalRead(Pin6);
digitalWrite(Pin12, LOW);
codigo = 12;
displayOled();
}
}
//Boton MENU 10111
if (EstadoPin6 == HIGH && EstadoPin5 == LOW && EstadoPin4 == HIGH && EstadoPin3 == HIGH && EstadoPin2 == HIGH ) {
Serial.print("MENU");
while(EstadoPin6 == HIGH && EstadoPin5 == LOW && EstadoPin4 == HIGH && EstadoPin3 == HIGH && EstadoPin2 == HIGH ){
EstadoPin2 = digitalRead(Pin2);
EstadoPin3 = digitalRead(Pin3);
EstadoPin4 = digitalRead(Pin4);
EstadoPin5 = digitalRead(Pin5);
EstadoPin6 = digitalRead(Pin6);
codigo = 13;
displayOled();
}
}
//Boton ALTO 01111
if (EstadoPin6 == LOW && EstadoPin5 == HIGH && EstadoPin4 == HIGH && EstadoPin3 == HIGH && EstadoPin2 == HIGH ) {
Serial.print("UP");
while(EstadoPin6 == LOW && EstadoPin5 == HIGH && EstadoPin4 == HIGH && EstadoPin3 == HIGH && EstadoPin2 == HIGH ){
EstadoPin2 = digitalRead(Pin2);
EstadoPin3 = digitalRead(Pin3);
EstadoPin4 = digitalRead(Pin4);
EstadoPin5 = digitalRead(Pin5);
EstadoPin6 = digitalRead(Pin6);
codigo = 14;
displayOled();
}
}
//Boton BAJO 11111
if (EstadoPin6 == HIGH && EstadoPin5 == HIGH && EstadoPin4 == HIGH && EstadoPin3 == HIGH && EstadoPin2 == HIGH ) {
Serial.print("DOWN");
while(EstadoPin6 == HIGH && EstadoPin5 == HIGH && EstadoPin4 == HIGH && EstadoPin3 == HIGH && EstadoPin2 == HIGH ){
EstadoPin2 = digitalRead(Pin2);
EstadoPin3 = digitalRead(Pin3);
EstadoPin4 = digitalRead(Pin4);
EstadoPin5 = digitalRead(Pin5);
EstadoPin6 = digitalRead(Pin6);
codigo = 15;
displayOled();
}
}
//Boton EXIT 00001
if (EstadoPin6 == LOW && EstadoPin5 == LOW && EstadoPin4 == LOW && EstadoPin3 == LOW && EstadoPin2 == HIGH ) {
Serial.print("EXIT");
while(EstadoPin6 == LOW && EstadoPin5 == LOW && EstadoPin4 == LOW && EstadoPin3 == LOW && EstadoPin2 == HIGH ){
EstadoPin2 = digitalRead(Pin2);
EstadoPin3 = digitalRead(Pin3);
EstadoPin4 = digitalRead(Pin4);
EstadoPin5 = digitalRead(Pin5);
EstadoPin6 = digitalRead(Pin6);
codigo = 16;
displayOled();
}
}
}
//Visualización el display
void displayOled(){
u8g2.firstPage();
do {
u8g2.setFont(u8g2_font_ncenB10_tr);
if(codigo == 1){
u8g2.drawStr(0,24,"Codigo: 1");
}
if(codigo == 2){
u8g2.drawStr(0,24,"Codigo: 2");
}
if(codigo == 3){
u8g2.drawStr(0,24,"Codigo: 3");
}
if(codigo == 4){
u8g2.drawStr(0,24,"Codigo: 4");
}
if(codigo == 5){
u8g2.drawStr(0,24,"Codigo: 5");
}
if(codigo == 6){
u8g2.drawStr(0,24,"Codigo: 6");
}
if(codigo == 7){
u8g2.drawStr(0,24,"Codigo: 7");
}
if(codigo == 8){
u8g2.drawStr(0,24,"Codigo: 8");
}
if(codigo == 9){
u8g2.drawStr(0,24,"Codigo: 9");
}
if(codigo == 0){
u8g2.drawStr(0,24,"Codigo: 0");
}
if(codigo == 11){
u8g2.drawStr(0,24,"Codigo: *");
}
if(codigo == 12){
u8g2.drawStr(0,24,"Codigo: #");
}
if(codigo == 13){
u8g2.drawStr(0,24,"Codigo: MENU");
}
if(codigo == 14){
u8g2.drawStr(0,24,"Codigo: UP");
}
if(codigo == 15){
u8g2.drawStr(0,24,"Codigo: DOWN");
}
if(codigo == 16){
u8g2.drawStr(0,24,"Codigo: EXIT");
}
if(codigo == 17){
u8g2.drawStr(0,24,"Preparado");
}
} while ( u8g2.nextPage() );
}
DTMF decoder for handy with arduino, control over several kilometers
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.
- Comments(0)
- Likes(2)
- Dominik Wodzick Dec 12,2024
- Engineer Oct 01,2024
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by CarlosVolt Tutoriales
- Infrared stepper motor control with speed control More info and updates https://rogerbit.com/wprb/2024/09/motor-paso-a-paso-x-infrarrojo/In this proje...
- Uploading BME280 Sensor Data to ThingSpeak Using ESP32 In this tutorial, we will show you how to connect a BME280 sensor to an ESP32 to read temperature, h...
- Water pump control for irrigation via telegram and esp32 Water Pump Control by Telegram and ESP32 is an automated system that allows you to remotely control ...
- Air conditioning on/off control via telegram and esp32 In this tutorial we will see how to control an air conditioner, with an esp32 and the telegram appli...
- 35 watt stereo amplifier In this video we will see how to build an audio amplifier, with the TDA7377 integrated circuit, and ...
- Laser alarm with RFID module More info and updates in https://rogerbit.com/wprb/2024/08/alarma-laser-rfid/In this project, we bui...
- Control lights by voice commands and keys In this tutorial we will see how to create a device to control lights by voice commands, with a modu...
- Stepper motor control x bluetooth and app In this tutorial we will see a circuit, which controls a stepper motor, with an application made in ...
- DFplayermini x bluetooth mp3 player control More info and updates in https://rogerbit.com/wprb/2022/12/dfplayermini-x-bluetooth/In this tutorial...
- Robot with WiFi control and servos driven by ESP32 More info and updates in https://rogerbit.com/wprb/2023/07/robot-wifi/A robot controlled by Wi-Fi, s...
- How to make a water level meter with uln2803 In this tutorial we will see how to make a water level meter circuit with the built-in uln2803.The p...
- Color Detector with Arduino and OLED display In this tutorial we will show you how to build a color detector using the TCS3200 sensor and an SH11...
- DTMF decoder for handy with arduino, control over several kilometers In this tutorial we will see how to make a circuit to connect to our handy, in this case a Baofeng U...
- Turn on light from thindspeak with esp32 In this tutorial, we will show you how to control lights over the Internet using an ESP32 and the Th...
- MP3 player control with webserver using ESP32 WIFI In this tutorial, you will learn how to build a web server using the ESP32 to control the YX5300 mod...
- Time clock with fingerprint IoT module, uploading data to thingspeak More info in and updates in https://rogerbit.com/wprb/2022/07/reloj-de-control-fingerprint/In this t...
- Make your own logic tip (includes printed circuit board) In this video tutorial we will see how to make a logic tip, on a printed circuit, with the integrate...
- Coil or inductor meter with Arduino and OLED display More info and updates in https://rogerbit.com/wprb/2022/06/medidor-inductores/In this tutorial we wi...
-
-
-
kmMiniSchield MIDI I/O - IN/OUT/THROUGH MIDI extension for kmMidiMini
119 0 0 -
DIY Laser Power Meter with Arduino
170 0 2 -
-
-
Box & Bolt, 3D Printed Cardboard Crafting Tools
157 0 2 -