|
| 1 | +# DFR0534 |
| 2 | +Arduino Uno/Nano library for a [DFR0534](https://wiki.dfrobot.com/Voice_Module_SKU__DFR0534) audio module. The library works with SoftwareSerial and is very similar to https://github.com/sleemanj/JQ8400_Serial, but is no fork. |
| 3 | + |
| 4 | +To create a DFR0534 object pass the existing SoftwareSerial object as parameter to the DFR0534 constructor, for example |
| 5 | + |
| 6 | +``` |
| 7 | +#include <SoftwareSerial.h> |
| 8 | +#include <DFR0534.h> |
| 9 | +
|
| 10 | +#define TX_PIN A0 |
| 11 | +#define RX_PIN A1 |
| 12 | +SoftwareSerial g_serial(RX_PIN, TX_PIN); |
| 13 | +DFR0534 g_audio(g_serial); |
| 14 | +... |
| 15 | +``` |
| 16 | + |
| 17 | +Examples how to use the library |
| 18 | +- [playFileByName](/examples/playFileByName/playFileByName.ino) |
| 19 | +- [playFileByNumber](/examples/playFileByNumber/playFileByNumber.ino) |
| 20 | +- [playCombined](/examples/playCombined/playCombined.ino) |
| 21 | + |
| 22 | +## License and copyright |
| 23 | +This library is licensed under the terms of the 2-Clause BSD License [Copyright (c) 2024 codingABI](LICENSE.txt). |
| 24 | + |
| 25 | +## Appendix |
| 26 | + |
| 27 | +### Supported functions |
| 28 | + |
| 29 | + |
| 30 | +| Function | Notes | |
| 31 | +| ------------- | ------------- | |
| 32 | +| decreaseVolume | | |
| 33 | +| fastBackwardDuration | | |
| 34 | +| fastForwardDuration | | |
| 35 | +| getDrive | Returns DFR0534::DRIVEUSB, DFR0534::DRIVESD, DFR0534::DRIVEFLASH or DFR0534::DRIVEUNKNOWN, Example [playFileByNumber](/examples/playFileByNumber/playFileByNumber.ino) | |
| 36 | +| getDrivesStates | Returns bitmask for DFR0534::DRIVEUSB, DFR0534::DRIVESD, DFR0534::DRIVEFLASH, Example [playFileByNumber](/examples/playFileByNumber/playFileByNumber.ino) | |
| 37 | +| getDuration | | |
| 38 | +| getFileName | Example [playFileByNumber](/examples/playFileByNumber/playFileByNumber.ino) | |
| 39 | +| getFileNumber | Example [playFileByNumber](/examples/playFileByNumber/playFileByNumber.ino) | |
| 40 | +| getFirstFileNumberInCurrentDirectory | Example [playFileByNumber](/examples/playFileByNumber/playFileByNumber.ino) | |
| 41 | +| getRuntime | | |
| 42 | +| getStatus | Returns DFR0534::STOPPED, DFR0534::PLAYING, DFR0534::PAUSED or DFR0534::STATUSUNKNOWN, Example [playFileByNumber](/examples/playFileByNumber/playFileByNumber.ino)| |
| 43 | +| getTotalFiles | Example [playFileByNumber](/examples/playFileByNumber/playFileByNumber.ino) | |
| 44 | +| getTotalFilesInCurrentDirectory | Example [playFileByNumber](/examples/playFileByNumber/playFileByNumber.ino) | |
| 45 | +| increaseVolume | | |
| 46 | +| insertFileByNumber | | |
| 47 | +| pause | | |
| 48 | +| play | | |
| 49 | +| playCombined | The DFR0534 uses a special two char file name format and fixed folder /ZH for this function. Look a the a the example [playCombined](/examples/playCombined/playCombined.ino) or comments to this function in [DFR0534.cpp](src/DFR0534.cpp) for details | |
| 50 | +| playFileByName | The DFR0534 uses a special 8+3 file name format. Before using this function take a look a the example [playFileByName](/examples/playFileByName/playFileByName.ino) or the comments to this function in [DFR0534.cpp](src/DFR0534.cpp) for details | |
| 51 | +| playFileByNumber | Example [playFileByNumber](/examples/playFileByNumber/playFileByNumber.ino) | |
| 52 | +| playLastInDirectory | | |
| 53 | +| playNext | | |
| 54 | +| playNextDirectory | | |
| 55 | +| playPrevious | | |
| 56 | +| prepareFileByNumber | | |
| 57 | +| repeatPart | | |
| 58 | +| setChannel | Supports DFR0534::CHANNELMP3, DFR0534::CHANNELDAC and DFR0534::CHANNELMP3AUX | |
| 59 | +| setDrive | Supports DFR0534::DRIVEUSB, DFR0534::DRIVESD and DFR0534::DRIVEFLASH | |
| 60 | +| setDirectory | Seems not to work | |
| 61 | +| setEqualizer | Supports DFR0534::NORMAL, DFR0534::POP, DFR0534::ROCK, DFR0534::JAZZ and DFR0534::CLASSIC | |
| 62 | +| setLoopMode | Supports DFR0534::LOOPBACKALL, DFR0534::SINGLEAUDIOLOOP, DFR0534::SINGLEAUDIOSTOP, DFR0534::PLAYRANDOM, DFR0534::DIRECTORYLOOP, DFR0534::RANDOMINDIRECTORY, DFR0534::SEQUENTIALINDIRECTORY and DFR0534::SEQUENTIAL | |
| 63 | +| setRepeatLoops | | |
| 64 | +| setVolume | Volume level (0 = mute, 30 = max), Example [playFileByNumber](/examples/playFileByNumber/playFileByNumber.ino) | |
| 65 | +| startSendingRuntime | | |
| 66 | +| stop | | |
| 67 | +| stopCombined | | |
| 68 | +| stopInsertedFile | | |
| 69 | +| stopRepeatPart | | |
| 70 | +| stopSendingRuntime | | |
| 71 | + |
| 72 | +For function details see comments in [DFR0534.cpp](src/DFR0534.cpp) |
| 73 | + |
| 74 | + |
| 75 | +### DF0534 pinout |
| 76 | + |
| 77 | + |
| 78 | +Minimal schematic to use this library |
| 79 | +| Pin | Connteced to | |
| 80 | +| ------------- | ------------- | |
| 81 | +| TX | Used SoftwareSerial RX | |
| 82 | +| RX | Used SoftwareSerial TX* | |
| 83 | +| GND | Ground | |
| 84 | +| VCC | 3.3-5V | |
| 85 | +| SP+ | Speaker + connector | |
| 86 | +| SP- | Speaker - connector | |
| 87 | + |
| 88 | +*If your microcontroller runs at 5V use a 1k resistor between RX and SoftwareSerial TX. |
| 89 | + |
| 90 | + |
0 commit comments