Giter Site home page Giter Site logo

biologist79 / espuino Goto Github PK

View Code? Open in Web Editor NEW
258.0 21.0 113.0 30.86 MB

RFID-controlled musicplayer powered by ESP32

Home Page: https://forum.espuino.de

License: GNU General Public License v3.0

C 4.77% C++ 77.95% HTML 15.84% Python 1.32% JavaScript 0.06% CMake 0.05%
esp32 i2s i2s-audio mqtt mqtt-smarthome neopixel-ring mp3-player arduino openhab pcb

espuino's Introduction

ESPuino - RFID-controlled Audio Player based on ESP32 with I2S-DAC Support

build workflow

Forum

  • EN: I've set up a primarily German-speaking community with much documentation. Also an international corner for non-German-speakers is available at https://forum.espuino.de. GitHub login can be used for signing in there (optional).
  • DE: Ich habe ein primär deutschsprachiges Forum aufgesetzt, welches ich mit reichlich Doku versehen habe. Würde mich freuen, euch dort zu sehen: https://forum.espuino.de. Ihr könnt euch dort mit eurem Github-Login einloggen, jedoch auch "normal" anmelden. Dokumentation findet ihr insbesondere hier: https://forum.espuino.de/c/dokumentation/anleitungen/10.

News

⚠️ By the end of october 2023, ESPuino switched framework from ESP32-Arduino1 to ESP32-Arduino2. This brought lots of improvements but as it turned out, due to memory restrictions this version no longer runs safely on ESP32 without PSRAM. So please make sure to use an ESP32-WROVER!

Current development

There is a development branch (dev) that contains new features, that will be introduced and tested there first until they become part of the master branch. Feel free to try but be advised this could be unstable.

ESPuino - what's that?

The basic idea of ESPuino is to use RFID tags to control an audio player. Even for kids this concept is simple: place a RFID-tagged object (card, toy character, etc.) on top of a box and the music starts to play stuff from SD card or webradio. Place a different RFID tag on it and something else is played. Simple as that.

This project is based on the popular microcontroller ESP32 by Espressif. Why? It's powerful and having WiFi support out-of-the-box enables further features like an integrated webserver, smarthome-integration via MQTT, webradio and FTP server. And even Bluetooth, too! However, my primary focus was to port the project to a modular base: MP3-decoding is done in software and the digital music output is done via the popular I2S protocol. So we need a DAC to make an analog signal of it: I did all my tests with MAX98357A, UDA1334, MS6324 and PCM5102a. General advice: ESPuino makes use of library ESP32-audioI2S; so everything that's supposed to work with this library should work with ESPuino, too (but maybe not right out-of-the-box). Especially this is true for ES8388.

Hardware setup

You could start on a breadboard with jumper wires but I strongly recommend to start right away with a PCB that was especially developed for ESPuino. There are several available, but ESPuino-mini 4L (SMD) can be considered as being the latest generation. Furthermore you need a ESP32-develboard like (or another one that's pin compatible):

⚠️ Due to memory restrictions meanwhile it's mandatory to use ESP32 with PSRAM. This being said you need to make sure that your develboard carries an ESP32-WROVER. And you should make sure that 16 MB flash memory is available (both is true for all develboards named above).

Optionally a headphone-pcb can be attached to ESPuino-mini 4L (SMD).

However, feel free to develop PCBs yourself. But again, be advised your ESP32 needs PSRAM in order to run ESPuino properly.

Getting started

  • Much more documentation in german language.
  • You need to install Microsoft's Visual Studio Code.
  • Install PlatformIO Plugin into Visual Studio Code and make sure to have a look at the documentation. Step-by-step-manual is available here
  • Install Git and make a copy ("clone") of my repository to your local computer using git clone https://github.com/biologist79/ESPuino.git. Using Git you can keep your local repository easily up to date without doing copy'n'paste. To keep it up to date run git pull origin master. Further infos here and here.
  • (Optional) Install GitLens as plugin (to have advanced Git features in VSCode).
  • Now, that the Git repository is saved locally, import this folder into Platformio as a project.
  • Select the desired environment (e.g. lolin_d32_pro_sdmmc_pe).
  • Edit src/settings.h according your needs.
  • Edit board-specific (HAL) config-file (e.g. settings-lolin_d32_pro_sdmmc_pe.h for Lolin D32/D32 pro). If you're running a board that is not listed there: start with settings-custom.h and change it according your needs.
  • Connect your develboard via USB, click the alien-head icon in the left sidebar, choose the project task that matches your desired HAL and run Upload and Monitor. All libraries necessary are fetched automatically and compilation of the code gets started. After that, your ESP32 is flashed with the firmware. Depending on your develboard it might be necessary to push a button in order to allow ESP32 to enter flash mode (not necessary für Lolin32, D32 und D32 pro).
  • Now have a look at the serial output at the bottom of Visual Studio Code's window. At the first run there might appear a few error messages (related to missing entries in NVS). Don't worry, this is just normal. However, make sure the SD card is detected as this is mandatory!
  • If everything ran fine, at the first run, ESPuino should open an access-point and ESPuino offers a captive portal that is shown on your computer. If that's not the case, join a WiFi called "ESPuino" and enter http://192.168.4.1 to your webbrowser. Enter WiFi credentials and the hostname there (or in the captive portal). After saving the configuration, restart ESPuino.
  • After reboot ESPuino tries to join your WiFi (with the credentials previously entered). If that was successful, an IP is shown in the serial console. You can access ESPuino's GUI using a webbrowser via this IP; make sure to allow Javascript. If the mDNS feature is active in src/settings.h, you can use the hostname configured extended by .local instead the IP. So if you configured espuino as hostname, you can use http://espuino.local for web GUI and FTP.
  • Via FTP and web GUI you can upload data (expect a throughput like 320 kB/s up to 700 kB/s).
  • FTP needs to be activated after boot if you need it! Don't forget to assign action ENABLE_FTP_SERVER in settings.h to be able to activate it. Neopixel flashes green (1x) if enabling was successful. It'll be disabled automatically after next reboot. Means: you have to enable it every time you need it (if reboot was in between). Sounds annoying and maybe it is, but's running this way in order to have more heap-memory available (for webstream) if FTP isn't needed.
  • Via webbrowser you can configure various settings and pair RFID tags with actions. If MQTT/FTP-support was not compiled, their config tabs won't appear.

SD-card: SPI or SD-MMC (1 bit)-mode?

Having the SD card working is mandatory, ESPuino doesn't start without working SD card (at least unless NO_SDCARD hasn't been enabled previously). However, there are two modes available to interface SD cards: SPI and SDMMC (1 bit). Be advised that SDMMC is twice as fast as SPI and needs one GPIO less. So basically it's a no-brainer.

Which RFID-reader: RC522 or PN5180?

RC522 is so to say the ESPuino standard. It's cheap and works, but RFID tags have to be placed close to the reader. PN5180 instead has better RFID range/sensitivity and can read ISO-15693 / iCode SLIX2-tags aka 'Tonies' (you need a password to read Tonies), too. You can also wake up ESPuino with the a ISO-14443 card (after flashing PN5180 with a new firmware). This feature is called LPCD. Disadvantages PN5180: it's more expensive and needs more GPIOs (6/7 instead of 4). In my opinion it's worth it! Refer to PN5180's wiring section below for further information. Hint: if using 3.3 V only make sure to connect these 3.3 V to PN5180's 5 V AND 3.3 V. Sounds weird but it's necessary.

3.3 V or 5 V?

ESP32 runs at 3.3 V only. But what about the periphery?

  • 3.3 V! Because: if you plan to use battery mode with LiPo/LiFePO4, there's no 5 V available (unless USB is connected or you make use of a boost converter). That's why my focus is on 3.3 V only. If you want to use 5 V instead - do so, but be advised it might not be compatible with battery mode.
  • MAX98357A: provides more power at 5 V but also runs at 3.3 V. Anyway: it's still loud enough (in my opinion).
  • Neopixel: specification says it needs 5 V but runs at 3.3 V as well.
  • RC522: needs 3.3 V (don't ever power with 5 V!)
  • PN5180: at 3.3 V make sure to connect both 5 V and 3.3 V pins to 3.3 V. If 5 V is available all the time: connect 5 V to 5 V and 3.3 V to 3.3 V.
  • SD card: needs 3.3 V but if voltage regulator is onboard, it can be connected to 5 V as well
  • Rotary encoder: 3.3 V (don't power with 5 V! Encoder doesn't care if connected to 3.3 or 5 V, but GPIOs of ESP32 do!)

WiFi

WiFi is mandatory for web GUI, FTP, MQTT and webradio. However, WiFi can be temporarily or permanently disabled (and ESPuino remembers this state after the next restart). There are two ways to (re-)enable/disable WiFi:

  • Use a special modification card that can be configured via web GUI.
  • Assign action CMD_TOGGLE_WIFI_STATUS to a button (or multi-button). This toggles the current WiFi status.

Bluetooth

⚠️ Due to memory restrictions it's not possible to run Bluetooth in parallel with WiFi. This means that you cannot stream webradio via Bluetooth or access the web GUI while this mode is enabled.

ESPuino as A2DP sink (stream to ESPuino)

ESPuino can be used as Bluetooth sink (A2DP sink). In this mode you can stream audio (e.g. from a mobile device) via Bluetooth to your ESPuino. This mode can be enabled/disabled via a RFID modification card or by assigning action CMD_TOGGLE_BLUETOOTH_MODE to a button (or multi-button). Applying this will restart ESPuino immediately. Activated Bluetooth is indicated by four slow rotating blue-violet LEDs. After the Bluetooth device is paired the LEDs turn to blue.

ESPuino as A2DP source (stream from ESPuino)

ESPuino can also be used to stream audio (A2DP source) to a Bluetooth headset or external Bluetooth speakers. This mode can be enabled/disabled via a RFID modification card or by assigning action CMD_TOGGLE_BLUETOOTH_SOURCE_MODE to a button (or multi-button). Applying this will restart ESPuino immediately. Activated Bluetooth is indicated by four slow rotating blue-violet LEDs. After the Bluetooth headset is connected LEDs turn to blue.

Port expander

There might be situations where you run out of GPIOs. To address this, a port expander PCA9555 can be used to extend the number of input channels (output mode is only supported in special cases). PCA9555 provides 2 ports with 8 channels each - so 16 channels in total. To activate PCA9555 you need to enable PORT_EXPANDER_ENABLE. Like GPIOs in your develboard-specific settings-file, you can assign numbers. Range is 100 (port 0 channel 0) -> 115 (port 1 channel 7). Via expanderI2cAddress the port expander's I2C-address can be changed. It's 0x20 if pins A0, A1, A2 are wired to GND.

After ESPuino is connected to your WiFi

After making ESPuino part of your LAN/WiFi, the 'regular' web GUI is available at the IP assigned by your router (or the configured hostname). Using this GUI you can:

  • configure WiFi
  • make bindings between RFID tag, file/directory/URL and playback mode
  • make bindings between RFID tag and a modification type
  • configure MQTT (if enabled)
  • configure FTP (if enabled)
  • configure initial volume, maximum volume (speaker / headphone), brightness of Neopixel (night mode / default) and inactivity time
  • configure voltage levels for battery mode
  • view logs / status / current track
  • control player
  • run modifications (like modification card)
  • upload audiofiles (called web transfer)
  • do OTA updates (ESP32 with 16 MB of flash memory only)
  • import + delete NVS-RFID-assigments
  • restart + shutdown ESPuino

ℹ️ As you apply a RFID tag to the RFID reader, the corresponding ID is pushed to the GUI automatically. So there's no need to enter such IDs manually (unless you want to). The file path is filled out automatically by selecting a file/directory in the file browser.

Interacting with ESPuino

Playback modes

It's not just simply playing music; different playback modes are supported:

  • Single track => plays one track one time
  • Single track (loop) => plays one track forever
  • Single track of a directory (random). Followed by sleep => picks and plays one single track out of a directory and falls asleep subsequently. Neopixel gets dimmed.
  • Audiobook=> single file or playlist/folder; last play position (file and playlist) is saved (when pushing pause or moving to another track) and reused next time
  • Audiobook (loop) => same as audiobook but loops forever
  • Folder/playlist (alph. sorted) => plays all tracks in alph. order from a folder one time
  • Folder/playlist (random order) => plays all tracks in random order from a folder one time
  • Folder/playlist (alph. sorted) => plays all tracks in alph. order from a folder forever
  • Folder/playlist (random order) => plays all tracks in random order from a folder forever
  • All tracks of a random subdirectory (sorted alph.) => plays of tracks in alph. order of a randomly picked subdirectory of a given directory
  • All tracks of a random subdirectory (random order) => plays all tracks in random order of a randomly picked subdirectory of a given directory
  • Webradio => always only one "track": plays a webstream
  • List (files from SD and/or webstreams) from local .m3u-File => can be one or more files / webradio stations with local .m3u as sourcefile

Modification RFID tags

There are special RFID tags, that don't start music by themselves but can modify things. If applied a second time, it's previous action/modification will be reversed.

So first make sure to start the music then use a modification card in order to apply your desired modification:

  • Lock/unlock all buttons
  • Sleep after 5/30/60/120 minutes
  • Sleep after end of current track
  • Sleep after end of playlist
  • Sleep after five tracks
  • Dim Neopixel
  • Loop track
  • Loop playlist
  • Toggle WiFi (enable/disable) => disabling WiFi while webstream is active will stop a running webstream instantly!
  • Toggle Bluetooth sink (enable/disable) => restarts ESPuino immediately. In this mode you can stream to your ESPuino via BT.
  • Toggle Bluetooth source (enable/disable) => restarts ESPuino immediately. In this mode your ESPuino can stream via BT to an external device.
  • Toggle through the different modes (Normal => BT-Sink => BT-Source => Normal)
  • Speech output of IP-address or current time

ℹ️ All sleep modes do dimming (Neopixel) automatically because it's supposed to be used in the evening when going to bed. Well, at least that's my children's indication :-)

ℹ️ Track and playlist loop mode can both be activated at the same time, but unless track loop isn't deactivated, playlist loop won't be effective

Neopixel LEDs (optional)

Indicates different things. Don't forget configuration of number of LEDs via #define NUM_LEDS. Most designs use a Neopixel ring, but a linear strip is also possible.

ℹ️ Some Neopixels use a reversed addressing which leads to the 'problem', that all effects are shown counter clockwise. If you want to change that behaviour, just enable NEOPIXEL_REVERSE_ROTATION.

Boot

  • While booting: every second LED (rotating orange)
  • Unable to mount SD: LEDs flashing red (will remain forever unless SD card is available or SHUTDOWN_IF_SD_BOOT_FAILS is active)

Status

  • Idle: four LEDs slowly rotating (white if WiFi connected; green if WiFi disabled or ESPuino is about to connect to WiFi)
  • Bluetooth: four LEDs slow rotating coloured blue
  • Error: all LEDs flashing red (1x) if an action was not accepted
  • OK: all LEDs flashing green (1x) if an action was accepted
  • Power Off: red-circle that grows until long-press-time is reached
  • Buttons Locked: track-progress-LEDs coloured red

Playback

  • Busy: violet; four fast rotating LEDs when generating a playlist. Duration depends on the number of files in your playlist.
  • Track Progress: rainbow; number of LEDs relative to play-progress
  • Playlist Progress: blue; appears only shortly in playlist-mode with the beginning every new track; number of LEDs relative to progress
  • Webstream: two slow rotating LEDs that change their colours rainbow-wise as the stream proceeds
  • Volume: green => red-gradient; number of LEDs relative from current to max volume
  • Paused: track-progress-LEDs coloured orange
  • Rewind: if single-track-loop is activated a LED-rewind is performed when restarting the given track

Battery Status (optional)

  • Undervoltage: flashes three times red if battery-voltage is too low. This voltage-level can be configured via GUI.
  • Short press of rotary encoder's button provides battery-voltage visualisation via Neopixel. Upper und lower voltage cut-offs can be adjusted via GUI. So for example if lower voltage is set to 3.2 V and upper voltage to 4.2 V, 50% of the LEDs indicate a voltage of 3.7 V.

Buttons

⚠️ This section describes my default-design: 3 buttons + rotary-encoder. Feel free to change number of buttons (up to 5) and button-actions according your needs in settings.h and your develboard-specific config-file (e.g. settings-lolin32.h). At maximum you can activate five buttons + rotary-encoder. Minimum duration for long press (to distinguish vom short press) in ms is defined by intervalToLongPress. All actions available are listed in src/values.h. If using GPIO >= 34 make sure to add a external pullup-resistor (10 k).

  • Previous (short): previous track / beginning of the first track if pressed while first track is playing
  • Previous (long): first track of playlist
  • Next (short): next track of playlist
  • Next (long): last track of playlist
  • Pause/Play (short/long): pause/play
  • Rotary Encoder (turning): vol +/-
  • Rotary Encoder (button long): switch off (only when on)
  • Rotary Encoder (button short): switch on (when switched off)
  • Rotary Encoder (button short): show battery-voltage via Neopixel (when switched on and MEASURE_BATTERY_VOLTAGE is active)
  • Previous (long; keep pressed) + Next (short) + release (both): toggle WiFi enabled/disabled

Music playback

  • Music starts to play right away after a valid RFID tag was applied (if it's known to ESPuino).
  • If PLAY_LAST_RFID_AFTER_REBOOT is active, ESPuino will remember the last RFID applied => music-autoplay.
  • If a folder should be played that contains many MP3s, the playlist generation can take a few seconds.
  • A file's name including path isn't allowed to exceed 255 characters.
  • While the playlist is generated Neopixel indicates BUSY-mode.
  • After the last track was played, Neopixel indicates IDLE-mode.

Audiobook mode

This mode is different from the others because the last playback position is saved, when...

  • next track starts.
  • first/previous/last track requested by button.
  • pause was pressed.
  • track is over.
  • playlist is over (position is reset to the first track and file position 0).
  • As per default last playback position is not saved when applying a new RFID tag. You can enable this using SAVE_PLAYPOS_WHEN_RFID_CHANGE.
  • As per default last playback position is not saved when doing shutdown. You can enable this using SAVE_PLAYPOS_BEFORE_SHUTDOWN.

FTP (optional)

  • FTP needs to be activated after boot! Don't forget to assign action ENABLE_FTP_SERVER in settings.h or use a modification card to activate it! Neopixel flashes green (1x) if enabling was successful. It'll be disabled automatically after next reboot. Means: you have to enable it every time you need it (if reboot was in between). Sounds annoying and maybe it is, but it's running this way in order to save heap memory when FTP isn't needed.
  • Why FTP? Well: in order to avoid exposing the SD card or disassembling ESPuino all the time for adding new music, it's possible to transfer music to the SD card using FTP. Another possibility is to do via web GUI (webtransfer).
  • Default user and password are set to esp32 / esp32 but can be changed via GUI.
  • Secured FTP is not available. So make sure to disable SSL/TLS.
  • Software: my recommendation is Filezilla as it's free and available for multiple platforms.
  • Please note: if music is played in parallel, this rate decreases dramatically! So better stop playback when doing file transfers.

Energy saving

As already described in the modifications section, there are different sleep modes available. Additionally the ESP32 controller will be put to deep sleep after 10 minutes of inactivity (configurable via maxInactivityTime) unless ESPuino doesn't play music, has a FTP client connected and any input via buttons. Every button interaction resets the counter.

Backups

As all assignments between RFID IDs and actions (playback mode, file to play, ...) is saved in ESP's NVS, the problem is that it's all gone when the ESP is broken. So that's where a backup comes in handy. Every time you change or add a new assignment between a RFID tag and an action via GUI, a backup file is saved on the SD card. The file's name can be changed via backupFile. So better don't delete it! Using the web GUI you can use the upload form to import such a file.

Smarthome/MQTT (optional)

Everything that can be controlled via RFID tags and buttons, can also be controlled via MQTT (excepting toggling WiFi status as this doesn't make sense). All manual interactions (buttons, RFID tags) are also sent to MQTT in parallel, so everything is always in sync (unless Wifi/MQTT-connection is broken).

In order to use it it's necessary to run a MQTT broker; Mosquitto for instance. After connecting to it, ESPuino subscribes to all command-topics. State-topics are used to push states to the broker in order to inform others if anything changed (change of volume, new playlist, new track, you name it).

In my home setup I'm using openHAB to "encapsulate" MQTT into a nice GUI, that's accessible via app + web. For further information (and pictures) refer to the openHAB directory.

ℹ️ I described a sample config for openHAB2. However, meanwhile openHAB3 is available and all the stuff described can also be configured via GUI. Be advised that openHAB is pretty complex and you have to spend some time to get familiar with it.

MQTT topics

Feel free to use your own smarthome environments (instead of openHAB). The MQTT topics available are described as follows.

ℹ️ If you want to send a command to ESPuino, you have to use a cmnd-topic whereas ESPuino pushes its states back via state-topics. So guess you want to change the volume to 8 you have to send this number via topic-variable topicLoudnessCmnd. Immediately after doing so, ESPuino sends a conformation of this command using topicLoudnessState. To get hands on MQTT I recommend this one as introduction (covers more than you need for ESPuino).

topic-variable range meaning
topicSleepCmnd 0 or OFF Power off ESPuino immediately
topicSleepState ON or OFF Sends ESPuino's last state
topicRfidCmnd 12 digits Set number of RFID tag which 'emulates' an RFID tag (e.g. 123789456089)
topicRfidState 12 digits ID of current RFID tag (if not a modification card)
topicTrackState String Sends current track number, total number of tracks and full path of curren track. E.g. "(2/10) /mp3/kinderlieder/Ri ra rutsch.mp3"
topicTrackControlCmnd 1 -> 7 1=stop; 2=unused!; 3=play/pause; 4=next; 5=prev; 6=first; 7=last
topicCoverChangedState Indicated that the cover image has potentially changed. For performance reasons the application should load the image only if it's visible to the user
topicLoudnessCmnd 0 -> 21 Set loudness (depends on minVolume / maxVolume)
topicLoudnessState 0 -> 21 Sends loudness (depends on minVolume / maxVolume
topicSleepTimerCmnd EOP Power off after end to playlist
EOT Power off after end of track
EO5T Power off after end of five tracks
1 -> 2^32 Duration in minutes to power off
0 Deactivate timer (if active)
topicSleepTimerState various Sends active timer (EOP, EOT, EO5T, 0, ...)
topicState Online, Offline Online when powering on, Offline when powering off
topicCurrentIPv4IP IPv4-string Sends ESPuino's IP-address (e.g. 192.168.2.78)
topicLockControlsCmnd ON, OFF Set if controls (buttons, rotary encoder) should be locked
topicLockControlsState ON, OFF Sends if controls (buttons, rotary encoder) are locked
topicPlaymodeState 0 - 10 Sends current playback mode (single track, audiobook...; see playback modes)
topicRepeatModeCmnd 0 - 3 Set repeat-mode: 0=no; 1=track; 2=playlist; 3=both
topicRepeatModeState 0 - 3 Sends repeat-mode
topicLedBrightnessCmnd 0 - 255 Set brightness of Neopixel
topicLedBrightnessState 0 - 255 Sends brightness of Neopixel
topicBatteryVoltage float Voltage (e.g. 3.81)
topicBatterySOC float Current battery charge in percent (e.g. 83.0)
topicWiFiRssiState int Numeric WiFi signal-strength (dBm)
topicSRevisionState String Software-revision

Development and Contributions

Code Formatting

Automatic code formatting via clang-format is used. The configuration/rules can be found in .clang-format. If you use Visual Studio Code as IDE, the support for this is automatically available through the C++ extension.

When editing source code, use Ctrl+Shift+I to run the auto-formatting on the file or Ctrl+K Ctrl+F for the selected code.

See the documentation for more options like run auto-formatting on saving or editing the file.

The CI (via "GitHub Actions") checks changes when they are pushed in order to keep the source code clean and provide feedback to the developers and maintainers.

To keep the output of git blame clean despite the massive changes when introducing new formatting rules, we have a .git-blame-ignore-revs that lists the commits to ignore. In VSCode this should be used automatically if you use the "GitLens" extension. Otherwise make sure you apply the config fragment for git by running git config --local include.path ../.gitconfig once in your local clone.

espuino's People

Contributors

anoff avatar biologist79 avatar bliepp avatar ceear avatar cturmann avatar dependabot[bot] avatar fetzerch avatar fschrempf avatar grch87 avatar h4kun4m4t4t4 avatar herm avatar ingomeyer441 avatar joe91 avatar kkloesener avatar lukx avatar mzanetti avatar niko-at avatar orempel avatar r-schmidt avatar rolinbert avatar sonovice avatar splash005 avatar strguntbr avatar szenglein avatar thebino avatar tml89 avatar tueddy avatar tuniii avatar tyllmoritz avatar unhold avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

espuino's Issues

Build errors

Hi, I am getting these errors while compiling the code for the AZ Dev Kit v4: It used to work flawlessly before the integration of different boards :/

EDIT: After fiddling around a bit it changed to these error messages:

Processing az-delivery-devkit-v4 (platform: espressif32; board: az-delivery-devkit-v4; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/az-delivery-devkit-v4.html
PLATFORM: Espressif 32 (3.0.0) > AZ-Delivery ESP-32 Dev Kit C V4
HARDWARE: ESP32 240MHz, 520KB RAM, 16MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 0.0.0+sha.7ecbb48
 - tool-esptoolpy 1.30000.201119 (3.0.0)
 - toolchain-xtensa32 2.50200.80 (5.2.0)
KeyError: 'PIOBUILDFILES':
  File "C:\Users\hauki\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 177:
    env.SConscript("$BUILD_SCRIPT")
  File "C:\Users\hauki\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Script\SConscript.py", line 591:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\hauki\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Script\SConscript.py", line 280:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\hauki\.platformio\platforms\espressif32\builder\main.py", line 225:
    target_elf = env.BuildProgram()
  File "C:\Users\hauki\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Util.py", line 658:
    return self.method(*nargs, **kwargs)
  File "C:\Users\hauki\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 77:
    os.path.join("$BUILD_DIR", env.subst("$PROGNAME")), env["PIOBUILDFILES"]
  File "C:\Users\hauki\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Environment.py", line 388:
    return self._dict[key]
==================================================================================== [FAILED] Took 0.90 seconds ====================================================================================
Environment            Status    Duration
---------------------  --------  ------------
az-delivery-devkit-v4  FAILED    00:00:00.904
============================================================================== 1 failed, 0 succeeded in 00:00:00.904 ============================================================================== 
The terminal process "C:\Users\hauki\.platformio\penv\Scripts\pio.exe 'run', '--environment', 'az-delivery-devkit-v4'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

I already reinstalled everything and downloaded the project again but still the same errors

regards

Rotary Encoder - no INPUT_PULLDOWN possible

I am not sure if this really matters.
The GPIO34 and GPIO35 where the rotary encoder is connected has no sw enable pullup or pulldown.
The used library ESP32Encoder default enables a pulldown on these GPIOs but this is not working.

Problems with old MP3 Tags (ID3v2.2)

With the newest version I experienced problems with MP3 files with older MP3 Tags (ID3v2.2). All the songs with old tags did not play, and on the console the following messages appeared multiple times:

...
info        : ID3 framesSize=2337
info        : ID3 version=2
info        : ID3 version must be 3, skip all metadata
info        : ID3 framesSize=2337
info        : ID3 version=2
info        : ID3 version must be 3, skip all metadata
...

After writing the tag info with some MP3 Tag software, it was updated (as a side effect) to version ID3v2.3 and the files played again. Maybe a change in the underlying MP3 lib caused this new behavior. (It was working before with the older version of ESPuino / ESP TonUINO from December 2020.)

Give hint how to change the repo URL

Since the repo was moved, it might be a good idea to give a hint how to change the URL (using git remote set-url; see https://docs.github.com/en/github/using-git/changing-a-remotes-url)

% git remote -v
origin	https://github.com/biologist79/Tonuino-ESP32-I2S.git (fetch)
origin	https://github.com/biologist79/Tonuino-ESP32-I2S.git (push)
% git remote set-url origin https://github.com/biologist79/ESPuino.git
% git remote -v                                                       
origin	https://github.com/biologist79/ESPuino.git (fetch)
origin	https://github.com/biologist79/ESPuino.git (push)

License

Hi,
what license is this code? I would suggest GPL v3 (same as Tonuino project).

RC522 very slow / unresponsive with this code

Hi! First of all - great job! I was looking for adding FTP support to the Tonuino project when I found your repo, thanks for the great documentation.
I really like the way of handling audio on the esp rather than using the dfplayer.

When trying out your image, I noticed that the RFID reader is quit slow / doesn't pick up cards as easy as with sample code from the repo.

I changed cables etc, but when I use a basic sketch to try out the chip, it works as supposed.

I had a quick look at your code and couldn't find a delay other than the 300ms in line 1467.

Since I am not too much into the library for the RC522, my fist guess is, that line https://github.com/biologist79/Tonuino-ESP32-I2S/blob/bfb8d81af2914f16de721057272625c5ad056082/src/main.cpp#L1471 will check for a new card. If I hold the same card, it will not trigger. However, if I try three different tags, all not known to the device, it will only pick up 1 of them instantly. Sometimes it helps to hold the card above or underneath the device, however it picks them up rather slow..

I will investigate further, maybe others have the same issue and we can exchange ideas here. Thanks!

Geht das auch auf einen M5 Core ?

Hi,

ich nutze ein M5 Core (Geniales Teil!).
Meinst du es ist möglich, den Code darauf laufen zu lassen, und den internen Speakter + SDCard Slot + Display anzusteuern ? Quasi -> All in one Lösung ?!

Viele Grüße...

i18n Support for the user interface.

I think it would be nice if there is a more elegant way for handling i18n. In my opinion the serial debug (backend) translations are not so important. More important is the user interface stuff. A more elegant way for handling translations would be using a JavaScript i18n Library. I know more JavaScript stuff :) But let the heavy stuff happen in the frontend where the Browser can handle the mighty heavy String handling stuff.

My idea is:

  1. writing the HTML in a default language (maybe german or english)
  2. using a i18n library which is able to load dynamically json language files from the SD-Card.
  3. when no file is found (initial state) the default language is used
  4. choosing the right language can be done by using the browser language or by selecting it manually in the user interface.

However this will bring the benefit that even people without programming skills can commit something to the project, furthermore there is less static code in header files and only one html file needed to edit.

SPI configuration on ttgo t8 v1.7 (SD card reader onboard)

I am trying to use the ttgo t8 v1.7 in my project. It has an onboard card reader. Unfortunately I can't get the RFID reader (RC522) to work. I saw that you @biologist79 have played around with different SPI configurations on different boards and was wondering if you have an idea what I do wrong or what I could try to get the RFID reader work. Previous to this project I had no experience with SPI.

Here is my configuration:

//#define SINGLE_SPI_ENABLE         // If only one SPI-instance should be used instead of two (not yet working!)
// uSD-card-reader (via SPI)
#define SPISD_CS                        13 // <- changed from 15          // GPIO for chip select (SD)
#ifndef SINGLE_SPI_ENABLE
    #define SPISD_MOSI                  15 // <- changed from 13            // GPIO for master out slave in (SD) => not necessary for single-SPI
    #define SPISD_MISO                 2 // <- changed from 16             // GPIO for master in slave ou (SD) => not necessary for single-SPI
    #define SPISD_SCK                   14          // GPIO for clock-signal (SD) => not necessary for single-SPI
#endif

// RFID (via SPI)
#define RST_PIN                         99          // Not necessary but has to be set anyway; so let's use a dummy-number
#define RFID_CS                         21          // GPIO for chip select (RFID)
#define RFID_MOSI                       23          // GPIO for master out slave in (RFID)
#define RFID_MISO                       19          // GPIO for master in slave out (RFID)
#define RFID_SCK                        18          // GPIO for clock-signal (RFID)

The ttgo t8 board:
T81 7

SD Karte wird nicht erkannt

Hallo,

Danke erstmal für das tolle Projekt.
Ich habe bereits die vorherige Version mit einer nodemcu am laufen gehabt, und will mir jetzt die neue Version auf Basis des Lolin32 aufbauen. Habe mir hierzu deine PCBs und die anderen Komponenten bestellt. Das einzige das ich nicht habe ist die Batterie, da ich den Tonuino nicht portable benötige.
Allerdings wird hier die SD Karte nicht erkannt und somit startet der Tonuino nicht in den AP mode.
Kann es sein das ich die Batterie benötige auch wenn ich sie nicht brauche?
Die CHG LED des Lolin32 flackert auch immer wie wild.
Und mein neopixel blinkt rot. Was darauf schließt das die SD Karte nicht erkannt wird.

Woran könnte es denn noch liegen?

esp32-audio-kit can't mount SD while MFRC is connected and MFRC is not working

Hi,

thanks for your work getting tonuino running on ESP32-Audio-kit. I followed your instructions but it won't work with the ESP32-Audio-Kit.
The strange thing is, if I put all together with a normal ESP32-dev board everything works fine.

The Problem:
If I start the ESP-Audio-kit while everything is connected, the mount of the SD-Card fails and keeps trying in the loop. If I disconnect the SDA Wire from of the MFRC while the moutloop is running the loop is ending with a mounted SD-Card but RFID doesn't work. The interessting thing is that I don't get a message for the missing MFRC on boot.

If I'm booting the esp32-audio-kit with disconnected SDA wire of the MFRC the SD-Card can be monted on the first try and I get the message "WARNING: Communication failure, is the MFRC522 properly connected?".

In both cases RFID won't work.

What have I done:
I copied the whole content of the Folder "Hardware-Plaforms/ESP32-A1S-Audiokit" to the root folder of the Project and replaced all existing files. In the platformio.ini I removed the rfid lib "https://github.com/biologist79/rfid.git" and added "yveaux/AC101@^0.0.1".

All the rest is done like you discribed, I removed all the resistor for the Keys and solderd miso of the MFRC522 to Pin 7 of the SD-Card reader gpio 2.

Jumpers are set to off/on/on/off/on

Have you done anything else ? because its running fine with a normal esp32 dev board. Or maybe my board is broken!?

thanks

Button 3 without rotary

Hi,

if rotary is disabled, there is no chance to use button_3 aka ROTARYENCODER_BUTTON.

I suggest, to exclude ROTARYENCODER_BUTTON from the USEROTARY_ENABLE section and change the other code parts allowing ROTARYENCODER_BUTTON to be used as a normal button without having a rotary.

// Rotary encoder
    #ifdef USEROTARY_ENABLE
        #define ROTARYENCODER_CLK           34          // If you want to reverse encoder's direction, just switch GPIOs of CLK with DT (in software or hardware)
        #define ROTARYENCODER_DT            39          // 39 = 'VN'; rotary's encoder 
    #endif

    // Amp enable (optional)
    #define GPIO_PA_EN                      108         // To enable/disable amp for loudspeaker; connected to port-expander

    // Control-buttons
    #define NEXT_BUTTON                     102         // Next-Button: connected to port-expander
    #define PREVIOUS_BUTTON                 100         // Prev-Button: connected to port-expander
    #define PAUSEPLAY_BUTTON                101         // Pplay-Button: connected to port-expander
----------new---------
    #define ROTARYENCODER_BUTTON        103         // Set to 99 to disable the button; connected to port-expander
-------------------------
    #define BUTTON_4                        104         // Button 4: connected to port-expander
    #define BUTTON_5                        105         // Button 5: connected to port-expander

Thanks for consideration.

Best regrads,
GL

MQTT Port

Hallo,

es wäre super wenn du bei MQTT noch den Port in der WebGui anpassbar machen könntest.

Feature: Add Audio Feedback

Hi again.
I am currently trying to implement audio feedback. So e.g. when the box starts, next track etc. there is also a voice output.

Currently I see two options:

  1. Working with the Queue system in place (drawback: When interrupting a queue (=playlist) we loose the state of where we where.
  2. Have an independet implementation that handles audio feedback.

I like option 2, I tried option 1 and it breaks the playlist, when being used within a queue being played. For option 1 I am currently missing more information on how the MAX device and the I2S protocol is designed. Can we have a parallel connection ? Or how can we enable sound output while keeping te queue structure in place?

Any ideas welcome.

Thanks a lot.

Rotary Encoder Button Press with a followed RFID read causes a Reboot

Hi,
just saw that there is a strange interference between the Rotary Encoder and the RC522. When I do a short press on the Rotary Encoder Button (for voltage measurements) and put then a card onto the RFID reader, the application crashes.
The error is LoadProhibited and the EXCVADDR Register is 0. According to the documentation this an indication for dereferencing a Null Pointer.
The Backtrace is as follows:
0x401d76d1: MFRC522::PICC_ReadCardSerial() at E:\workspace\Tonuino-ESP32-I2S/.pio\libdeps\lolin_d32_pro\MFRC522\src/MFRC522.cpp:1928
0x400daf26: rfidScanner(void*) at E:\workspace\Tonuino-ESP32-I2S/src/main.cpp:1797

Is someone else able to reproduce it?
I can have a closer look into it after Christmas.

Cheers

Wifi AP reset functionality

Is it possible to implement a mode, where I can create an RDID mapping + content on the SD card but reset my local Wifi configuration?

i.e. I want to prepare this Box as a present but I don't know the SSID/PW of the person who gets the present.

Is this maybe already somehow implemented?
How would you suggest to tackle this problem?

  • push and hold 3 buttons for 10 seconds to reset wifi?
  • have a special RFID card to reset wifi?

Board

Hi!

Ist geplant ein Board (PCB) für das Projekt zu machen? Ich habe gerade die Bauteile vor mir aber ich bin erst bei der Hälfte und es sieht schon wüst aus.

Ich könnte ein Board entwerfen und es zur Verfügung stellen.

Könntest du dann den Entwurf checken?

Uploaded files via FTP are always empty

I have tries to upload files via the Linux ftp command or via filezilla with a single connection and passive disabled.
But the files are just touched on the SD-card, but no content is written to the file.

Do you have any tips, what I am doing wrong?

MQTT doesn't work

I enabled MQTT with IP, user and password.
On serial I see the correct credentials from NVS.
In the mosquitto log I don't see anything from the client, no connection trials.

gerber files for D32 missing outline

I tried to order your PCBs form jlcpcb as you suggested but after review they sent me an email:

Audit Failed
Failure Reason:
1.Hi Sir/ Madam, there is no board outline in your file, please kindly check it!

Can your recheck the board?

Wifi problem: Esp doesn't get proper IP assigned

Hello,
first I want to thank you for your great work!

Unfortunately I am struggling to get everything to work. So far I only have the sd card module and the rfid reader connected. I had some issues to get the sd card reader to work with my Lolin32 Lite (no 5V pin) but managed to solve the issue by using a external 5V source to power the sd card module. This is not a nice solution but it works for the moment.

After connecting to the access point, changing the wifi settings and restarting the esp is not properly connected to the network. I can see the device in the fritz!box settings but it has no IP assigned. DHCP is aktivated.

The output also looks really weird:

[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 2 - STA_START
Hostname aus NVS geladen: jettebox
Firmware Version: 0xEF = (unknown)
RFID-Tags koennen jetzt gescannt werden...
[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 7 - STA_GOT_IP
[D][WiFiGeneric.cpp:418] _eventCallback(): STA IP: 255.255.255.255, MASK: 255.255.255.255, GW: 255.255.255.255
[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 7 - STA_GOT_IP
[D][WiFiGeneric.cpp:418] _eventCallback(): STA IP: 255.255.255.255, MASK: 255.255.255.255, GW: 255.255.255.255
.Aktuelle IP: 255.255.255.255
SD Card Type: SDHC
Free heap: 153464
Versuche Verbindung zu MQTT-Broker aufzubauen 192.168.2.43
Verbinde zu MQTT-Server mit User und Passwort
Neue Lautstärke empfangen via Queue: 3

Have you experienced similar problems or do you have any idea what might cause the problem?

Dateinamen

In settings.h sollten die Dateinamen für die Includedateien so geschrieben sein wie die Dateien heißen, da z.B. Linux hier Fehler meldet.

In settings.h the filenames for the include files should be written as the files are named, because e.g. Linux reports errors here.

Sleep Mode: Deactivating EOP, EOT, and EO5T not possible

Hey,

MQTT-Nachricht empfangen: [Topic: Cmnd/ESPuino/SleepTimer] [Command: EOT]
Sleep-Timer: Nach dem Ende des laufenden Tracks.
MQTT-Nachricht empfangen: [Topic: Cmnd/ESPuino/SleepTimer] [Command: 0]
Sleep-Timer ist bereits deaktiviert.

After EOP, EOT, and EO5T is set, it cannot be deactivated by mqtt command. The device device goes to deep sleep mode although the log says the timer is deactivated.

Thanks and best regards

GL

Headphone PCB BOM Issue

Hello there,

some weeks ago, you have provided the new and detailed BOM for the PCB's. Now we have the problem, that in the BOM for the Headphone PCB is a IC1 (ME6211C33m5g) written but we cant find the IC1 in the Schematic / on the ordered PCB. Do you have a solution fot that?

LED Rainbow hue does not seem to work?

Edit:

I think I need to understand: lockControls better.

I have hooked up an LED ring and it mostly works, i.e.

  • white if bootd with wifi (animated)
  • blue if started without wifi (animated)
  • orange during boot (animated()

But I can't get the rainbow hue working whilst playing a single MP3 file.
When playing a single file the LEDs turn off.

When playing a webstream I get 2 opposite red LEDs (not animated)

My question is:

Is this intended behaviour? (to safe battery)

If I were to implement it, do I need to create another LED state like ledStatusOk, ledStatusError?

RC522 via second I2C instance

Hey!
I want to thank you for the great project so far.

I have the ESP32-A1S Audio-Development-Kit here and i want to ask if its not possible to define a second I2C instance to use for the RC522. Personally i dont want to use the neopixel and rotary encoder. There would be enough GPIO for this and some keys to connect (ex: pause/play, next, stop)
Via this I2C there would also be an optional display possible.

This would be a good solution for everyone not willing to solder.

Deletion of a folder via FTP / WebUI

Hi all,

UseCase (SW-Revision: 20211113-2):

  1. Create Folder via FTP - folder name: "üäö" (without "") (remark: I used utf-8 encoding during my ftp session - don't know if this was the issue)
  2. Try to delete via FTP: deletion was not successful
  3. Try to delete via WebUI: deletion was not successful

Thanks and regards,
GL

Forst sentence in News section

The first sentence in the news section makes no sense:
"As the creator of ESPuino claims it's trademarkt right, my project has been renamed to ESPuino."
Here the global search/replace also changed the name of the original project (TonUINO).

No RFID tag via MQTT

Thank you very much for this great project!

The days I came up with another idea, what I would like to implement with the box:
To help our daughter learn colors, I painted her RFDI cards with colors (red, green, blue, etc.).
When she puts the card on, a track is played to her that explains what the color is called.

Now I have the idea that I could link the whole thing via MQTT with the light chain on the Christmas tree.
Speak:
I put on a card, get the ID via MQTT, which I use in HomeAssistant or NodeRed to change the color of the lights on the Christmas tree.

Yesterday I noticed a little something:
According to the documentation on the home page "topicTrackState" should send the following: "Sends number of last RFID-tag applied".
That would be great and would work perfectly, since the ID is always unique for each card.
Instead, however, the current track is published via MQTT, which is not always unique due to random modes, etc.
Would it be possible to publish two different topics for the title and the rfid tag?

Minor documentation request: MQTT topic changed

Just a minor doc request (because it took me a while to figure out why my MQTT connection was not working any more): It might be worth to mention that the MQTT topic also changed to "ESPuino" and that the settings on the MQTT clients have to be updated.

WebGUI: stopped track / playlist - current title is set

Hi,

Use case:

  1. play song
  2. stop song via MQTT: Cmnd/ESPuino/TrackControl --> 1
    Issue here: ws[/ws][1] text-message[24]: ping --> every 15 seconds
  3. go on website to Controll (Steuerung)
    Issue here: current title (Aktuelller titel) is set --> should be blank IMHO
  4. trying to resume does not start the song --> console: Playmode kann nicht verändert werden, wenn keine Playlist aktiv ist. --> IMHO correct behaviour

FTP Problems

Hallo,
es gelingt mir nicht, mehrere Files oder ganze Verzeichnisse per ftp zu übertragen. Einzelne Files nacheinander klappt.
Ich nutze FileZilla auf Ubuntu, nur damit ist es mir gelungen überhaupt eine ftp-Verbindung vernünftig aufzubauen, da man TLS gezielt ausschalten/verhindern muss.
LG Reinhard

Enabled HEADPHONE_ADJUST_ENABLE: RFID not working

Hi,

having only three modules activated:

  • LANGUAGE DE
  • HEADPHONE_ADJUST_ENABLE
  • SHUTDOWN_IF_SD_BOOT_FAILS

Issues:

  1. RFID (PN5180) is not working
  2. log console every second: ws[/ws][1] text-message[24]: ping

Deactivating HEADPHONE_ADJUST_ENABLE --> RFID is working + no strange log console

Thanks and best regards,
GL

Support of Bluetooth headphones

Instead of using the Headphone Jack, the ESP32 could also stream the sound to Bluetooth headphones. Unfortunately according to this ticket, it's not integrated into the ESP32 Arduino library but maybe someone has an idea. If I find the time, maybe I will work on it myself.

Feedback welcome!

MQTT: new brightness values not published

Hi,

while setting a new value for the loudness is working fine, brightness does not work properly IMHO.

Use Case for loudness:

  1. ESPUINO_MQTT publishes on start e.g. 10.
  2. PRIVATE_MQTT_CLIENT receives 10
  3. PRIVATE_MQTT_CLIENT publishes 11
  4. ESPUINO_MQTT receives 11 and espuino sets loudness to 11
  5. ESPUINO_MQTT publishes 11
  6. PRIVATE_MQTT_CLIENT receives 11

Use Case for brightness:

  1. ESPUINO_MQTT publishes on start e.g. 10.
  2. PRIVATE_MQTT_CLIENT receives 10
  3. PRIVATE_MQTT_CLIENT publishes 11
  4. ESPUINO_MQTT receives 11 and espuino sets brightness to 11
    -- NOT WORKING BELOW THIS LINE --
  5. ESPUINO_MQTT publishes 11
  6. PRIVATE_MQTT_CLIENT receives 11

Thanks and regards,
GL

File Browser for RFID-assignments

Just want to let you know that i am working on a File Browser for making RFID-assignments more convenient.

There will be a json file on the SD-Card which contains the current file tree of the SD-Card. The file is created by a function in the backend code. This function can be called by a websocket request.The request can be sent by clicking the link below the file Browser box.

The file is loaded by an ajax call. I am using jsTree for creating the dom.

I made it this way, because i wanted to prevent long blocking times for example in the setup() routine. The refresh link can be called after new files were copied to the SD-Card.

filebrowser

I will do a pull request when it's done. I am still struggling with the json formating.

FTP Upload Probleme

Hallo,
es gelingt mir nicht, mehrere Files oder ganze Verzeichnisse per ftp zu übertragen. Einzelne Files nacheinander klappt.
Ich nutze FileZilla auf Ubuntu, nur damit ist es mir gelungen überhaupt eine ftp-Verbindung vernünftig aufzubauen, da man TLS gezielt ausschalten/verhindern muss.
LG Reinhard

Reboot after cleaned sd card

Hi,

scenario:

  1. save music on SD card and bind it to an RFID card
  2. erase SD card --> I guess that a deletion of a single file instead of the whole SD card is also within this scenario
  3. try to play music (non-existing) via RFID Card

Behavior:

  • LEDs flashing wild and blue
  • esp32 reboots

Desired behaviour:

  • unbind connection playlist and RFID ID, if RFID ID is bind and file is not found
  • No reboot

Logs:

RFID-Karte empfangen: 000023146130
[E][vfs_api.cpp:64] open(): /sdcard/musicfox_its_not_easy.mp3 does not exist
Datei oder Verzeichnis existiert nicht 
Fehler aufgetreten!
Kontroll-Kommando empfangen via Queue: 1
Playmode kann nicht verändert werden, wenn keine Playlist aktiv ist.
ws[/ws][1] connect

Version:

ESP-IDF-version (major): 3
ESP-IDF-version (minor): 3
Software-revision: 20211222-1

Thanks for reply.

Regards,
GL

What stereo DAC should I use?

Are there any recommendations for stereo DACs? I need to drive two of these: https://www.ebay.de/itm/150510938590

Currently I'am experimenting with this DAC on my own breakout board: TI TLV320DAC3101. But I'am struggling heavily with all the BCLK/MCLK stuff. Do I need a dedicated Bit clock for this DAC or is it generated from the MCLK? I'am really confused :D

Files (mp3) are not playing from the beginning.

After a couple of weeks playing with the device i figured out that files don't play from the beginning. Mostly the file starts a couple of seconds after the regular beginning of the file. Sometimes it seems to start somewhere in the middle of the file. The file is ok so far. When i play it on another device it works. This behaviour does not match all my mp3 files. I tried all of the play (audiobook, single track etc.) modes but it occurs in all play modes.

Anybody who can confirm a similar issue?

I am coming to the conclusion that this might be a mp3 encoding issue, cause it works with some of my older files. I am using the suggested hardware components.
Can some people please share some encoding information about the used mp3 files like sample rate etc. That might help debugging the issue.

Esp32 Reboots sometimes when NVS Data is written

Hi,
first of all thank you for the great work you did!

I face a problem, that the Esp32 is rebooting from time to time. I narrowed it down, that it happens when NVS data is written.
The reason is that a core panic'ed:

Titel wurde bei Position 483427 pausiert. Schreibe '#/ManaMana#483427#3#0' in NVS für RFID-Card-ID 164177162177 mit playmode 3 und letzter Track 0 #/ManaMana#483427#3#0 Guru Meditation Error: Core 0 panic'ed (Cache disabled but cached memory region accessed) Core 0 register dump: PC : 0x401826cc PS : 0x00060034 A0 : 0x800813dd A1 : 0x3ffbe180 A2 : 0x00000000 A3 : 0x3ffc1530 A4 : 0xc86f19be A5 : 0x00001004 A6 : 0x3ffc5ad0 A7 : 0xffffeffb A8 : 0x80081332 A9 : 0x3ffbe160 A10 : 0x00000000 A11 : 0x00000000 A12 : 0x0ffd114c A13 : 0x00000000 A14 : 0x000f8023 A15 : 0x00000002 SAR : 0x00000014 EXCCAUSE: 0x00000007 EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000 Core 0 was running in ISR context: EPC1 : 0x4008ad89 EPC2 : 0x00000000 EPC3 : 0x40088e44 EPC4 : 0x401826cc

To reproduce it I use the Audiobook mode and toggle Play/Pause Button as long as the problem occurs.

It seems that I found with the help of google the reason:
https://esp32.com/viewtopic.php?t=7684

However, I'm not able to solve it so far and created therefore this issue.
Is this a known issue?

D32 pro: build in sd card reader in coflict with PN5180

Hi,

it seems, that the build in sd card reader of the D32 pro is not compatible with PN5180-NFC. Let us see if it is a layer 8 issue... ;)

Unneeded pins are set to 99.

The following scenarios are tested:

  1. MFRC522_SPI activted, PN5180 deactivated, RFID PINS to 99 --> OK
  2. MFRC522_SPI deactivted, PN5180 activated, RFID PINS to 99 --> NOK
  3. MFRC522_SPI deactivted, PN5180 activated + PINs set to default, but PN5180 not connected --> NOK
  4. MFRC522_SPI deactivted, PN5180 activated + PINs set to default, PN5180 connected --> NOK

(Not tested: MFRC522_SPI activted, PN5180 deactivated, RFID PINS to default --> I do not have a MFRC522)

Definition of OK: web server is accessible and music can be played.

Why NOK: Output is constant:

Maximale Inaktivitätszeit wurde aus NVS geladen: 10
Firmware version=0.0
RFID-Tags koennen jetzt gescannt werden...
[E][sd_diskio.cpp:194] sdCommand(): Card Failed! cmd: 0x37
[E][sd_diskio.cpp:194] sdCommand(): Card Failed! cmd: 0x29
[E][sd_diskio.cpp:775] sdcard_mount(): f_mount failed: (3) The physical drive cannot work
[E][sd_diskio.cpp:194] sdCommand(): Card Failed! cmd: 0x00
SD-Karte konnte nicht gemountet werden.
[E][sd_diskio.cpp:194] sdCommand(): Card Failed! cmd: 0x00
[E][sd_diskio.cpp:775] sdcard_mount(): f_mount failed: (3) The physical drive cannot work
[E][sd_diskio.cpp:194] sdCommand(): Card Failed! cmd: 0x00
SD-Karte konnte nicht gemountet werden.

SW-Version:

ESP-IDF-version (major): 3
ESP-IDF-version (minor): 3
Software-revision: 20211123-1

settings.h:


    //########################## MODULES #################################
    //#define PORT_EXPANDER_ENABLE          // When enabled, buttons can be connected via port-expander PCA9555 (https://forum.espuino.de/t/einsatz-des-port-expanders-pca9555/306)
    //#define I2S_COMM_FMT_LSB_ENABLE       // Enables FMT instead of MSB for I2S-communication-format. Used e.g. by PT2811. Don't enable for MAX98357a, AC101 or PCM5102A)
    #define MDNS_ENABLE                     // When enabled, you don't have to handle with ESPuino's IP-address. If hostname is set to "ESPuino", you can reach it via ESPuino.local
    //#define MQTT_ENABLE                     // Make sure to configure mqtt-server and (optionally) username+pwd
    //#define FTP_ENABLE                      // Enables FTP-server; DON'T FORGET TO ACTIVATE AFTER BOOT BY PRESSING PAUSE + NEXT-BUTTONS (IN PARALLEL)!
    //#define NEOPIXEL_ENABLE                 // Don't forget configuration of NUM_LEDS if enabled
    //#define NEOPIXEL_REVERSE_ROTATION     // Some Neopixels are adressed/soldered counter-clockwise. This can be configured here.
    #define LANGUAGE DE                     // DE = deutsch; EN = english
    //#define STATIC_IP_ENABLE              // Enables static IP-configuration (change static ip-section accordingly)
    //#define HEADPHONE_ADJUST_ENABLE       // Used to adjust (lower) volume for optional headphone-pcb (refer maxVolumeSpeaker / maxVolumeHeadphone) and to enable stereo (if PLAY_MONO_SPEAKER is set)
    //#define PLAY_MONO_SPEAKER               // If only one speaker is used enabling mono should make sense. Please note: headphones is always stereo (if HEADPHONE_ADJUST_ENABLE is active)
    #define SHUTDOWN_IF_SD_BOOT_FAILS       // Will put ESP to deepsleep if boot fails due to SD. Really recommend this if there's in battery-mode no other way to restart ESP! Interval adjustable via deepsleepTimeAfterBootFails.
    //#define MEASURE_BATTERY_VOLTAGE         // Enables battery-measurement via GPIO (ADC) and voltage-divider
    //#define PLAY_LAST_RFID_AFTER_REBOOT   // When restarting ESPuino, the last RFID that was active before, is recalled and played
    //#define USE_LAST_VOLUME_AFTER_REBOOT  // Remembers the volume used at last shutdown after reboot
    //#define USEROTARY_ENABLE                // If rotary-encoder is used (don't forget to review WAKEUP_BUTTON if you disable this feature!)
    //#define BLUETOOTH_ENABLE                // If enabled and bluetooth-mode is active, you can stream to your ESPuino via bluetooth (a2dp-sink).
    //#define IR_CONTROL_ENABLE             // Enables remote control (https://forum.espuino.de/t/neues-feature-fernsteuerung-per-infrarot-fernbedienung/265)
    //#define CACHED_PLAYLIST_ENABLE          // Enables playlist-caching (infos: https://forum.espuino.de/t/neues-feature-cached-playlist/515)
    //#define PAUSE_WHEN_RFID_REMOVED       // Playback starts when card is applied and pauses automatically, when card is removed (https://forum.espuino.de/t/neues-feature-pausieren-wenn-rfid-karte-entfernt-wurde/541)
    //#define SAVE_PLAYPOS_BEFORE_SHUTDOWN  // When playback is active and mode audiobook was selected, last play-position is saved automatically when shutdown is initiated
    //#define SAVE_PLAYPOS_WHEN_RFID_CHANGE // When playback is active and mode audiobook was selected, last play-position is saved automatically for old playlist when new RFID-tag is applied


    //################## select SD card mode #############################
    //#define SD_MMC_1BIT_MODE              // run SD card in SD-MMC 1Bit mode (using GPIOs 15 + 14 + 2 is mandatory!)
    //#define SINGLE_SPI_ENABLE             // If only one SPI-instance should be used instead of two (not yet working!)


    //################## select RFID reader ##############################
    //#define RFID_READER_TYPE_MFRC522_SPI    // use MFRC522 via SPI
    //#define RFID_READER_TYPE_MFRC522_I2C  // use MFRC522 via I2C
    #define RFID_READER_TYPE_PN5180       // use PN5180 via SPI

    #ifdef RFID_READER_TYPE_MFRC522_I2C
        #define MFRC522_ADDR 0x28           // default I2C-address of MFRC522
    #endif

    #ifdef RFID_READER_TYPE_PN5180
        //#define PN5180_ENABLE_LPCD        // Wakes up ESPuino if RFID-tag was applied while deepsleep is active. Only ISO-14443-tags are supported for wakeup!
    #endif

settings-lolin_d32_pro.h:

#ifndef __ESPUINO_SETTINGS_LOLIN_D32_PRO_H__
#define __ESPUINO_SETTINGS_LOLIN_D32_PRO_H__
    #include "Arduino.h"

    //######################### INFOS ####################################
    /* This is a develboard-specific config-file for *Wemos Lolin32*. Specific doesn't mean it's only working with this board.
    Lolin32 is the predecessor of Lolin D32.
    PCB: None so far
    Infos: https://www.wemos.cc/en/latest/d32/d32_pro.html
    Schematics: https://www.wemos.cc/en/latest/_static/files/sch_d32_pro_v2.0.0.pdf
    Caveats: GPIO35 (battery monitoring) + SD can't be changed, it's built in (and because of the SD-pinout used, it is not compatible with MMC-mode)
    Status:
        tested with 2xSPI: RC522 & SD (by biologist79)
    */

    //################## GPIO-configuration ##############################
    // Please note: GPIOs 34, 35, 36, 39 are input-only and don't have pullup-resistors.
    // So if connecting a button to these, make sure to add a 10k-pullup-resistor for each button.
    // Further infos: https://randomnerdtutorials.com/esp32-pinout-reference-gpios/
    // GPIOs 16+17 are not available for D32 pro as they're used to internal purposes (PSRAM).
    #ifdef SD_MMC_1BIT_MODE
        // NOT SUPPORTED BY D32 pro as 15 / 14 / 2 doesn't match D32 pro's SD-pinout
    #else
        // uSD-card-reader (via SPI) => Cannot be changed, it's built in!
        #define SPISD_CS                     4          // GPIO for chip select (SD)
        #ifndef SINGLE_SPI_ENABLE
            #define SPISD_MOSI              23          // GPIO for master out slave in (SD) => not necessary for single-SPI
            #define SPISD_MISO              19          // GPIO for master in slave ou (SD) => not necessary for single-SPI
            #define SPISD_SCK               18          // GPIO for clock-signal (SD) => not necessary for single-SPI
        #endif
    #endif

    // RFID (via SPI)
    #define RST_PIN                         99          // Not necessary but has to be set anyway; so let's use a dummy-number
    #define RFID_CS                         99//21          // GPIO for chip select (RFID)
    #define RFID_MOSI                       99//13          // GPIO for master out slave in (RFID)
    #define RFID_MISO                       99//15          // GPIO for master in slave out (RFID)
    #define RFID_SCK                        99//14          // GPIO for clock-signal (RFID)

    #ifdef RFID_READER_TYPE_PN5180
        #define RFID_BUSY                   99//33          // PN5180 BUSY PIN
        #define RFID_RST                    99//22          // PN5180 RESET PIN
        #define RFID_IRQ                    99//39          // PN5180 IRQ PIN (only needed for low power card detection)
    #endif
    // I2S (DAC)
    #define I2S_DOUT                        25          // Digital out (I2S)
    #define I2S_BCLK                        27          // BCLK (I2S)
    #define I2S_LRC                         26          // LRC (I2S)

    // Rotary encoder
    #ifdef USEROTARY_ENABLE
        #define ROTARYENCODER_CLK           99//34          // If you want to reverse encoder's direction, just switch GPIOs of CLK with DT (in software or hardware)
        #define ROTARYENCODER_DT            99//39          // 39 = 'VN'; Info: Lolin D32 pro is using 35 for battery-voltage-monitoring!
        #define ROTARYENCODER_BUTTON        99//32          // (set to 99 to disable; 0->39 for GPIO; 100->115 for port-expander)
    #endif

    // Amp enable (optional)
    //#define GPIO_PA_EN                      112         // To enable amp for loudspeaker (GPIO or port-channel)
    //#define GPIO_HP_EN                      113         // To enable amp for headphones (GPIO or port-channel)

    // Control-buttons (set to 99 to DISABLE; 0->39 for GPIO; 100->115 for port-expander)
    #define NEXT_BUTTON                     99          // Button 0: GPIO to detect next
    #define PREVIOUS_BUTTON                 99          // Button 1: GPIO to detect previous
    #define PAUSEPLAY_BUTTON                99          // Button 2: GPIO to detect pause/play
    #define BUTTON_4                        99          // Button 4: unnamed optional button
    #define BUTTON_5                        99          // Button 5: unnamed optional button

    // Channels of port-expander can be read cyclic or interrupt-driven. It's strongly recommended to use the interrupt-way!
    // Infos: https://forum.espuino.de/t/einsatz-des-port-expanders-pca9555/306
    #ifdef PORT_EXPANDER_ENABLE
        #define PE_INTERRUPT_PIN            99          // GPIO that is used to receive interrupts from port-expander
    #endif

    // I2C-configuration (necessary for RC522 [only via i2c - not spi!] or port-expander)
    #if defined(RFID_READER_TYPE_MFRC522_I2C) || defined(PORT_EXPANDER_ENABLE)
        #define ext_IIC_CLK                 99//5           // i2c-SCL (clock)
        #define ext_IIC_DATA                99//2           // i2c-SDA (data)
    #endif

    // Wake-up button => this also is the interrupt-pin if port-expander is enabled!
    // Please note: only RTC-GPIOs (0, 4, 12, 13, 14, 15, 25, 26, 27, 32, 33, 34, 35, 36, 39, 99) can be used! Set to 99 to DISABLE.
    // Please note #2: this button can be used as interrupt-pin for port-expander. If so, all pins connected to port-expander can wake up ESPuino.
    #define WAKEUP_BUTTON                   PREVIOUS_BUTTON // Defines the button that is used to wake up ESPuino from deepsleep.

    // (optional) Power-control
    #define POWER                           99//5           // GPIO used to drive transistor-circuit, that switches off peripheral devices while ESP32-deepsleep

    // (optional) Neopixel
    #define LED_PIN                         99//12          // GPIO for Neopixel-signaling

    // (optinal) Headphone-detection
    #ifdef HEADPHONE_ADJUST_ENABLE
        //#define DETECT_HP_ON_HIGH                       // Per default headphones are supposed to be connected if HT_DETECT is LOW. DETECT_HP_ON_HIGH will change this behaviour to HIGH.
        #define HP_DETECT                   99/22          // GPIO that detects, if there's a plug in the headphone jack or not
    #endif

    // (optional) Monitoring of battery-voltage via ADC
    #ifdef MEASURE_BATTERY_VOLTAGE
        #define VOLTAGE_READ_PIN            99//35          // GPIO used to monitor battery-voltage. Cannot be changed, it's built in
        constexpr float referenceVoltage = 3.30;                  // Voltage between 3.3V and GND-pin at the develboard in battery-mode (disconnect USB!)
        constexpr float offsetVoltage = 0.1;                      // If voltage measured by ESP isn't 100% accurate, you can add an correction-value here
    #endif

    // (optional) For measuring battery-voltage a voltage-divider is already onboard. Connect a LiPo and use it!
    #ifdef MEASURE_BATTERY_VOLTAGE
        constexpr uint16_t rdiv1 = 100;                           // Cannot be changed, it's built in
        constexpr uint16_t rdiv2 = 100;                           // Cannot be changed, it's built in
    #endif

    // (Optional) remote control via infrared
    #ifdef IR_CONTROL_ENABLE
        #define IRLED_PIN                   99//22              // GPIO where IR-receiver is connected (only tested with VS1838B)
        #define IR_DEBOUNCE                 200             // Interval in ms to wait at least for next signal (not used for actions volume up/down)

        // Actions available. Use your own remote control and have a look at the console for "Command=0x??". E.g. "Protocol=NEC Address=0x17F Command=0x68 Repeat gap=39750us"
        // Make sure to define a hex-code not more than once as this will lead to a compile-error
        // https://forum.espuino.de/t/neues-feature-fernsteuerung-per-infrarot-fernbedienung/265
        #define RC_PLAY                     0x68            // command for play
        #define RC_PAUSE                    0x67            // command for pause
        #define RC_NEXT                     0x6b            // command for next track of playlist
        #define RC_PREVIOUS                 0x6a            // command for previous track of playlist
        #define RC_FIRST                    0x6c            // command for first track of playlist
        #define RC_LAST                     0x6d            // command for last track of playlist
        #define RC_VOL_UP                   0x1a            // Command for volume up (one step)
        #define RC_VOL_DOWN                 0x1b            // Command for volume down (one step)
        #define RC_MUTE                     0x1c            // Command to mute ESPuino
        #define RC_SHUTDOWN                 0x2a            // Command for deepsleep
        #define RC_BLUETOOTH                0x72            // Command to enable/disable bluetooth
        #define RC_FTP                      0x65            // Command to enable FTP-server
    #endif
#endif

Kein Issue, einfach danke!

Ich wollte mich auf dem Weg kurz für die Arbeit bedanken die du hier reingesteckt hast. Ich konnte bisher eine von zwei Tonuinos auf deine ESP32 Lösung problemlos umbauen.

Um den Verkabelungs-Overhead so gering wie möglich zu halten habe ich mir auch ein Board in KiCad entworfen, nichts besonderes es entspricht so ca. dem Board was auch in #4 vorgestellt wurde. Falls interesse besteht kann ich es bei GitHub hochladen.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.