hannabox/README.md

96 lines
1.9 KiB
Markdown

# HannaBox
## Microcontroller
D1 Mini ESP32
Due to mp3 playback it needs a multicore esp 32:
This library only works on multi-core ESP32 chips like the ESP32-S3. It does not work on the ESP32-S2 or the ESP32-C3 warning
## Pins
### Amplifier
```
26 -> DIN
27 -> BCLK
25 -> LRC
5V -> Vin
GND -> GND
```
### SD Card
```
CS -> 22 (D1)
MOSI -> 23 (D7)
CLK -> 18 (D5)
MISO -> 19 (D6)
```
### RFID Reader
```
SOA -> 32
SCK -> 18
MOSI -> 23
MISO -> 19
IRQ -> NC
GND -> GND
RST -> 33
3.3V -> 3.3V
```
#### 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
```
Start / Stop -> 17 and GND
Wake up / Next -> 04 and GND
Previous -> 16 and GND
```
## System sounds
Place these sounds in the folder `system` on the SD card:
* sleep.mp3
* start.mp3
sleep.mp3 will be played just before the timed shutdown, start.mp3 will be played if the box started and initialized successfully.
## Battery Voltage
The battery voltage is measured by the ADC of pin 13. A voltage divider halves the voltage so that the pin can not be overloaded (max 3.3V).
The voltage divider consists of two 100kOHM resistors, the voltage is measured between them. One side is connected to the battery and the other to ground.
Pin 13s ADC (ADC2) can not be used while WIFI is on... damn.
## TODOs
* Card Reader with SPI. Configure hspi, second SPI channel? Or does SD Card + RFID run at the same channel?
![](images/wemos-d1-mini-esp32.png)
## Schematic without modules
### Charging circuit
https://ww1.microchip.com/downloads/en/AppNotes/01149c.pdf
MCP73837 ?
## Links
https://github.com/earlephilhower/ESP8266Audio
[Running two SPI devices at once](https://randomnerdtutorials.com/esp32-spi-communication-arduino/)