diff --git a/README.md b/README.md index 8145abb..3481056 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,18 @@ # HannaBox +The HannaBox is a Wifi enabled music player for toddlers and small children. It features an sd card reader, three buttons, a speaker up to 3 watts and an RFID reader. It is powered by a ESP32 microcontroller module. + ## Microcontroller We are using an ESP-WROOM-32 module. For the mp3 decoding we need a multicore CPU, be careful, there are some ESP32 with only one core. -![](images/ESP32-wroom-32-pinout.png) - ## Pins The plain number refers to the GPIO pin. ### Amplifier -MAX98357A I2S 3W DAC Class D Amplifier Module - -![](images/amp.png) - - -SD / MODE - -This pin is used for shutdown mode but is also used for setting which channel is output. It's a little confusing but essentially: - - If SD is connected to ground directly (voltage is under 0.16V) then the amp is shut down - If the voltage on SD is between 0.16V and 0.77V then the output is (Left + Right)/2, that is the stereo average. - If the voltage on SD is between 0.77V and 1.4V then the output is just the Right channel - If the voltage on SD is higher than 1.4V then the output is the Left channel. - -This is compounded by an internal 100K pulldown resistor on SD so you need to use a pullup resistor on SD to balance out the 100K internal pulldown. - -For the breakout board, there's a 1Mohm resistor from SD to Vin which, when powering from 5V will give you the 'stereo average' output. If you want left or right channel only, or if you are powering from non-5V power, you may need to experiment with different resistors to get the desired voltage on SD +We use a MAX98357A I2S 3W DAC Class D Amplifier Module ``` 26 -> DIN @@ -49,14 +33,15 @@ CLK -> 18 (D5) MISO -> 19 (D6) ``` -Or if a plain reader is used: - -![Alt text](images/sd-card.png) +The pinout of a micro sd card is like this: +![Alt text](images/sd-card-pinout.png) ### RFID Reader -NFC RFID module RC522 +For RFID, we use a standard module: NFC RFID module RC522 + +These are the connections: ``` SOA -> 32 @@ -70,22 +55,16 @@ RST -> 33 ``` -#### RFID Chip Registers - -Interrupt method was not working because it seems reading a card does not trigger one. - -See https://arduino.stackexchange.com/a/76285 and https://github.com/miguelbalboa/rfid/blob/master/examples/MinimalInterrupt/MinimalInterrupt.ino - - ### Buttons +We use three buttons, preferably big and robust. They are grounded if closed, so normally high and pressed low. + ``` Start / Stop -> 17 and GND Wake up / Next -> 04 and GND Previous -> 16 and GND ``` - ## Battery Voltage The battery voltage is measured by the ADC of pin 35. A voltage divider halves the voltage so that the pin can not be overloaded (max 3.3V). @@ -106,17 +85,49 @@ Place these sounds in the folder `system` on the SD card: sleep.mp3 will be played just before the timed shutdown, start.mp3 will be played if the box started and initialized successfully. -## TODOs - ## Schematic without modules +This schematic uses the amplifier and sd card reader as discrete components instead of modules: + +![alt text](images/schematic.png) + + +## Notes + +ESP32-Wroom Pinout: + +![esp32-wroom-32 pinout](images/ESP32-wroom-32-pinout.png) + +### RFID Chip Registers + +The interrupt method was not working because it seems reading a card does not trigger one. + +See https://arduino.stackexchange.com/a/76285 and https://github.com/miguelbalboa/rfid/blob/master/examples/MinimalInterrupt/MinimalInterrupt.ino + ### Charging circuit -https://ww1.microchip.com/downloads/en/AppNotes/01149c.pdf -MCP73837 ? +[Possible circuit](https://ww1.microchip.com/downloads/en/AppNotes/01149c.pdf) +Chip to use: MCP73837? + +### Amplifier + +#### SD / MODE + +This pin is used for shutdown mode but is also used for setting which channel is output. It's a little confusing but essentially: + +* If SD is connected to ground directly (voltage is under 0.16V) then the amp is shut down +* If the voltage on SD is between 0.16V and 0.77V then the output is (Left + Right)/2, that is the stereo average. +* If the voltage on SD is between 0.77V and 1.4V then the output is just the Right channel +* If the voltage on SD is higher than 1.4V then the output is the Left channel. +This is compounded by an internal 100K pulldown resistor on SD so you need to use a pullup resistor on SD to balance out the 100K internal pulldown. + +For the breakout board, there's a 1Mohm resistor from SD to Vin which, when powering from 5V will give you the 'stereo average' output. If you want left or right channel only, or if you are powering from non-5V power, you may need to experiment with different resistors to get the desired voltage on SD + +![](images/amp.png) ## Links -https://github.com/earlephilhower/ESP8266Audio +[Audio Library](https://github.com/earlephilhower/ESP8266Audio) [Running two SPI devices at once](https://randomnerdtutorials.com/esp32-spi-communication-arduino/) + diff --git a/images/schematic.png b/images/schematic.png new file mode 100644 index 0000000..865340b Binary files /dev/null and b/images/schematic.png differ diff --git a/images/sd-card-pinout.png b/images/sd-card-pinout.png new file mode 100644 index 0000000..b04a3cb Binary files /dev/null and b/images/sd-card-pinout.png differ diff --git a/images/sd-card-reader.png b/images/sd-card-reader.png deleted file mode 100644 index 32e541e..0000000 Binary files a/images/sd-card-reader.png and /dev/null differ diff --git a/images/sd-card.png b/images/sd-card.png deleted file mode 100644 index 05f711a..0000000 Binary files a/images/sd-card.png and /dev/null differ diff --git a/images/wemos-d1-mini-esp32.png b/images/wemos-d1-mini-esp32.png deleted file mode 100644 index 7502c88..0000000 Binary files a/images/wemos-d1-mini-esp32.png and /dev/null differ diff --git a/schema/hannabox/hannabox.kicad_sch b/schema/hannabox/hannabox.kicad_sch index 3803442..6cbfbac 100644 --- a/schema/hannabox/hannabox.kicad_sch +++ b/schema/hannabox/hannabox.kicad_sch @@ -4,6 +4,14 @@ (paper "A4") + (title_block + (title "Hannabox") + (date "15.01.2024") + (rev "1") + (company "Stefan Ostermann") + (comment 1 "Für Hanna") + ) + (lib_symbols (symbol "Amplifier_Audio_modified:MAX98357" (pin_names (offset 1.016)) (in_bom yes) (on_board yes) (property "Reference" "U" (at 1.27 13.97 0)