Das sprechende Multimeter - Teil 3

So far (To part 1, To part 2) The TDMM has not yet spoken, but today the big day came: it will now speak to them. Tension, electricity and resistance are announced if you want. You can choose which values ​​are displayed and which are also spoken.

Material list

Mini MP3 Player DFPlayer Master modules

Loudspeaker

Elko 22µF

Resistance 1 kΩ

Button

2 x slide switch

The DFPlayer DFR0299 module

Let's start with the central module that enables us to speech the voice Dfplayer.

There is a lot of information about this module, including a detailed eBook from AZ. Various circuit variants are presented there. The manufacturer wiki is even more detailed at wiki.dfrobot.com. On this page you can see that there are two different DFPlayers. We are interested in the DFR0299 alone.  If you look around even more intensely, see that there are some suppliers for this player and - probably - also different firmware. More on that later.

The module was originally intended to play MP3 files from an inserted SD card. All you need to do is connect a few buttons and you have an MP3 player. The module brings an integrated amplifier. Connect speakers and buttons - done. And all for a few € uro.

In addition, there are a DAC output for both output channels, so you can amplifier and can connect two speakers. This makes the sound quality even better. A headphones or earphones can also be used. This "stereo system" is truly compact.

At some point there was probably the requirement to control the DFPlayer via a serial interface and so there was a 9,600 baud interface. Via this channel we will later control the player with the "Software Real" library.

The player also makes it easier for us to be used in 5 V and 3.3 V environments without using a level converter. In the blog series for the "Speaking color detector“Andreas Wolter showed how to use a 1 K resistance to the level adjustment.

Practical experience

Thanks to the library "Talking_Display“By Gerald Lechner, the DFPlayer can be easily integrated into any application that should speak. There are a few points on the hardware side that not only noticed when I develop the device:

   Fault -free power supply: It is important that the power supply is stable and sufficiently powerful. In any case, a tantalic capacitor of 10 µF… 22 µF should be as close as possible to the power supply of the DFPlayer (pay attention to polarity!).

   The dfplayer's rest flow is approximately 25 mA because the integrated amplifier of the "class AB" type is. When the device speaks, depending on the set volume, up to 75 mA flows. If the power supply comes from a USB connection that has a lot to do, dropouts are possible. Words are left out. I had good experiences with a power bank 2,600 mAh.

   The access speed of the SD card on which the MP3 files lie is critical. First I used an older card. Sometimes individual words were missing, which I couldn't explain. In fact, the problem could only be fixed with a sufficiently fast SD card.

   The MP3 files cannot be arranged and sorted as desired because the player is looking for them in the order in which they were installed. If you later load the SD card with the MP3 files, please do not name the files or sort them up again. The Fileformat is FAT32.

   If you want to create such MP3 files yourself (e.g. in other languages), you can like the website like me voicebooking.com visit.

We expand the hardware

In practical use, it has been shown that the TDMM should not always speak, but only on request. So we have three switches with which we set the language specifications:

1. Tension announcements - switch for mass on D3

2. ENTERATIONS - switch for mass on D4

3. Resistance announcements - switch on A0 with voltage divider (see TDMM Part 2)

I do not let the calculated value of the performance announce. If you want this, you can easily expand the sketch accordingly.

There is also a button with a pull-up resistor 1kΩ on D0, which you press to call up the announcement. This button is best on the test tip, so that you can concentrate on the measurement in peace. You press the button and get the measured value.

With this part of the logic we prove a total of 3 + 1 inputs. We have in Part 2 Already seen how the resistance measurement is switched on. When it is activated, the resistance is always announced when pressing the speaking button.

Let's take a look at how the Breadboard looks now:

Set up voice output

We use the Library for the voice output “Talking_Display“By Gerald Lechner. This library was originally built for the announcement of date, time and measured values. The MP3 files in German and English go well with the GithubPage of the library are offered. We need a few additional MP3 files for our project. You can do the overall package of the language files here download.

The extended code shows how the voice output is integrated into the sketch, here the setup part:

// TDMM - The Talking Digital Multimeter - German Speaking DMM

// Michael Klein & Bernd Schaedler 2024

//  

// Thanks to rob.tillaart for: ads1x15.h

// Thanks to Gerald Lechner for: Talking_Display.H

// Based on Wemos D1 Mini V3 - Use Board Manager Lolin (Wemos) D1 Mini Pro

 

//#include

#include <Ads1x15.h>

#include <U8G2Lib.h>

#include <Software.h>

#include <Talking_Display.h>

#define Dfplayer_rx 12 // RX connection for communication with the DFPlayer

#define Dfplayer_tx 13 // TX connection for communication with the DFPlayer

#define Busy 14 // D5 Busy Head of the DFPlayer

 

Software ss (dfplayer_rx,Dfplayer_tx); // rx, tx

Talking_Display<Software> TD (SS,Busy);

 

U8g2_sh1106_128x64_noname_f_hw_i2c U8G2 (U8G2_R0, /* reset =*/U8x8_pin_none); u8g2_uint_t Offset;

u8g2_uint_t Width;

int32_t VAL_00 =0; int32_t VAL_01 =0; int32_t VAL_02=0; int32_t VAL_03=0;

float dcurrent = 0; float dcurrenty=0;

int32_t VRES_00 =0; int32_t VRES_01 =0; float resval=0; float Resvolts_01 =0;

 

Bool Stated0 = digital read(16); Bool Stated3 = digital read(0);

Bool Stated4 = digital read(2);

 

Ads1115 Ads (0x48);

 

void set up() {

Serial.Begin(19200);

 

TD.Begin();

  SS.set(2000);

  TD.Setvolume (27);

  Serial.print("Speech output ready");

  TD.setlish (false);

  TD.SetwordTimeout (2);

  TD.Registerone terror (Tderror);

 

pin mode(16,Input); // D0 for "Speak" key

pin mode(2, Input_pullup); // D3 for "Say-Ampere" Switch

pin mode(0, Input_pullup); // D4 for "Say-Volt" Switch

pin mode(15, OUTPUT); // D8 for relay

 

Serial.print(__File__);

Serial.print("Ads1x15_lib_version:"); Serial.print(Ads1x15_lib_version);

 

Wire.Begin(); // D1 Mini V3 Connect SDA> D2 (PIN 4) SCL> D1 (pin 5)

Ads.Begin();

 

  IF (!Ads.Begin()) {

      Serial.print("Address ads1115 or 0x48 not found");

    }

    IF (!Ads.Isconnected ()) {

      Serial.print("Address 0x48 not found");  

    }

  Serial.print("AD1115 is Properly Connected.");

  

  U8G2.Begin();

  U8G2.enableutf8print ();

  Start screen (); // call for initial screen  

} // end of setup

We only look at the first part to the end of the set up(). Because of the average formation, we have all the integrariables that play a role in the measurement int32_t converted.

It starts with the #include and #define Agreements for , And the definition of the pins rx = 12 and tx = 13, as well as busy = 14 for the player. With Busy, the player indicates that he ended the last called MP3.

The instances for both objects are formed. We also define the BOOL variables for D0, D3 and D4, to which our switches and the button are connected.

It If the timeout for the player is determined first and the volume is set at 27. In the value range 0 - 30 you choose a pleasant setting. This is followed by the language setting in German, the timeout for a single word and we register the DFPlayer for its error messages at the Library. There are also on the Manufacturer's side A suitable test routine with all fault types.

After the pinmodes of the digital i/OS are defined, the ADS1115 library is initiated and the connection is tested, the display attached and the start screen called. The first MP3 file is already accessed there. It has number 362 and produces the Marimba start sound:

void Start screen () {
  U8G2.Clear buffer (); 
  U8G2.set font(u8g2_font_ncenb08_tr); // set fontsize
  U8G2.Setfontpostop (); // set position
  const char* title = "-TDMM-";
  const char* subtitle = "Art-of-Electronics.Blog";
  intimately Xtitle = (128 - U8G2.Dutf8width(title)) / 2; // Title position + center
  intimately ytitle = 10; // vertical position of title
  intimately Xsubitle = (128 - U8G2.Dutf8width(subtitle)) / 2; // Subtitle + center
  intimately Ysubitle = 40; // subtitle vertical position
  U8G2.Setdrawcolor (1); // TextColor (1 = white)
  U8G2.Drawstr (Xtitle, ytitle, title);
  U8G2.Drawstr (Xsubtitle, Ysubitle, subtitle);
  U8G2.Send buffer (); // Send display data
  TD.Say (362); // start tune
  delay(3500);
}

A special feature is important: The sketch demands that in the Loop () A call from td.loop () takes place with every grinding run.

We have in Part 2 already discussed the part of the resistance measurement in detail. We still know the voltage and current measurement Part 1 this series of contributions. In fact, the sketch has not become much more extensive, because the Library takes away a significant part of the work. We use the following functions for the voice output:

td.say (int)                          Speak the file with this integer number

td.sayint (int X)                  Say the number of integers X

Resistance values ​​are issued without decimal places.

So it remains Loop () Quite clear:

void loop() {
  Ads.Setgain (0);
  VAL_01=0;
  for (intimately X=0; X<10; X++){ // Measure Voltage
    VAL_00 = Ads.readadc_ differential_0_1 ();  
    VAL_01=VAL_01+VAL_00;
    delay(2); // Delay 2ms
  }
  VAL_01=VAL_01/10; // Mean Value of Voltage
  float volts_01 = Ads.Tovoltage (VAL_01)*22.87; // multiplier 
  String voltsstring = String(volts_01);
  Serial.print("U:"); Serial.print(Voltsstring); Serial.print("Volt");
  
  VAL_02=0; dcurrent=0; dcurrenty=0; // Measure Current
  for (intimately y=0; y<10; y++){
    VAL_02 = Ads.readadc (2); 
    float volts_02 = Ads.Tovoltage (VAL_02);  
    dcurrenty = (volts_02 - 2.396)*5.405; // Multiplier for 0.185 MV/A
    dcurrent=ABS(Dcurrent+dcurrenty*1.045); // Factor 1.045: Empirical Correction
  }
  dcurrent=dcurrent/10; // Mean Value of Current
  String dcurrentx = String(dcurrent);
  Serial.print("\ t"); Serial.print("I:"); Serial.print(dcurrentx); Serial.print("A");
  
  U8G2.Clear buffer (); // Show value on oled 
  U8G2.set font(U8G2_FONT_NCENB12_TF);
  U8G2.setcursor(0, 20);
  U8G2.print("U:"); U8G2.print(Voltstring); U8G2.print("V");
  U8G2.setcursor(3, 35);
  U8G2.print("I:"); U8G2.print(dcurrent); U8G2.print("A");
  U8G2.setcursor(2, 50);
  U8G2.print("P:"); U8G2.print(ABS(Dcurrent*volts_01)); U8G2.print("W");
  U8G2.Send buffer ();
  Serial.print("\ t"); Serial.print("P:"); Serial.print(Dcurrent*volts_01);Serial.print("W");
  
  Stated0=digital read(16); Stated3=digital read(2); Stated4=digital read(0); 
  IF (Stated0 == Low && Stated3 == Low) { 
    Serial.print("Volts Speaking Activated");// volt- & speak-key pressed?
    TD.Sayfloat (volts_01,2);
    delay(1500);
    TD.Say (363);
  } 
  IF (Stated0 == Low && Stated4 == Low) {  // amp- & speak-key pressed?
    Serial.print("Ampere Speaking Activated");
    delay(1000);
    TD.Sayfloat (dcurrent,2);
    delay(1500);
    TD.Say (364);
  }
  Stated0 = HIGH; // set state back to high
  
  IF (analogead(0)>400){ // "Resistor-Switch set?"
    Resistor ();
    }
  TD.loop();
  delay(1500);
  
} // end of loop

Practical implementation

As soon as you have completely set up the hardware and set up the sketch, I recommend another examination. Our breakboard is densely populated, all connections on the D1 mini are used. The RX/TX cabling on the DFPlayer has to be right, otherwise he will not touch.

When uploading the sketch, all switches of the voice output should be switched off.

Then please load the MP3 files on a FAT32, empty SD card. After that it can start. When you start, hear the Marimba sound and see the "TDMM" display on the display. If you have come that far, not much should go wrong.

For my prototype, I trained the "speech button" as a reed contact with magnetic control. It only serves to test. I use classic test pipes for daily operation. I mounted a small button on the plus test tip to trigger the language announcement.

The attached videos show the timing of the language announcement with the selected settings. Most listeners found the announcement clear and suitable. A few impatient people didn't want to wait so long for the spoken result. This is a matter of taste. The announcement can set up everyone as they want from the timing.

Sometimes it happens that the TDMM "swallows" a comma. Even then, the announcement remains clear. For example, he does not say "twenty comma five one volt" but "twenty pause - five one volt. Most of the time it works well. Sometimes it also happens to me that a dropout happens. I don't want to hide this because I had some trouble to achieve an acceptable result. The videos show examples.

Thankfully, Gerald Lechner has prepared an alternative library, which, however, needs an ESP32 processor.  The MP3s are saved in the ESP32 mini files system. This no longer needs communication with the DFPlayer and there are no waiting times.

I will accept the challenge as soon as the new library for the ESP32 is online. The entire TDMM is revised a little. Maybe I will still meet weaknesses in practical operation. In the past few months, the prototype has been “dear to my heart” because it covers my requirements uncomplicated and extremely reliably. The "new model" is coming this year.

If you do not see the videos at this point, please check the cookie settings of your browser

Improvements 

The TDMM has received two extensions to simplify practical operation. For the resistance measurement, I soldered two banana plugs with crocodile terminals to create simple measurement aid.

If you trigger the language announcement, all selected values ​​are announced, finally the resistance value (without decimal places). 

The blue measurement resistance in the photo was measured with a 4-leader precision DVM. The result was 3.32 Ω. As you can see on the display, the TDMM shows 3.31 Ω. Several attempts with other, low -resistance values ​​showed similarly accurate values.

One second improvement concerns the test peaks for voltage measurement. You can see the black socket at the TDMM where the switch was previously. This socket is 4-pin and picks up a jack plug. It is connected there to the speaker (on the red test tip). The test peaks were connected to the sockets for voltage measurement.

outlook

The next post is about measuring AC voltages, which will turn out to be a trivial task. In addition, it is about the most perfect power supply for the TDMM, stable, low -fault and sufficiently powerful - as always created with standard components.

Until then,
Your
Michael Klein

DisplaysEsp-8266Projekte für anfängerSensoren

Laisser un commentaire

Tous les commentaires sont modérés avant d'être publiés

Articles de blog recommandés

  1. ESP32 jetzt über den Boardverwalter installieren - AZ-Delivery
  2. Internet-Radio mit dem ESP32 - UPDATE - AZ-Delivery
  3. Arduino IDE - Programmieren für Einsteiger - Teil 1 - AZ-Delivery
  4. ESP32 - das Multitalent - AZ-Delivery