Close
0%
0%

Mini WAV Recorder

Mini WAV recorder based on STM32G030F6P6 and I2S microphone

Similar projects worth following
Mini WAV recorder made on very small STM32 microcontroller. At first I was testing animated menu and eventually it has transformed into this project. It features 16 KHz recording quality and low power consumption in sleep (~10 uA). Build in RTC on STM32 is utilized to give recordings names with start time. Currently, it can only record and that probably won't change as the program uses ~90% of memory (no HAL)

As I said in description first thing I done in this project was simple animated menu. You can see it working at this video:

I didn't have idea for icons so I randomly draw microphone at first and thought to make simple recorder. It utilize almost all pins of the MCU and it's memory. I don't know if this will be possible to be made with HAL. I assumed it will take lot of memory and from beginning made it on registers. However there is some repeated code to optimize. But I will rather use this gained memory to add playback than port it to HAL.

Almost all memory used(inspect in PlatformIO)

Controls

Buttons for control are software debounced and they are triggering interrupt. However I don't think it's necessery. Maybe function called in main when there is nothing else to do will be sufficiant to smooth working of navigation. At first i used four buttons (ok, back, up, down) but later I added "back" as long press of ok. Long press of two other buttons shows battery level. 

Recording

Recording screen has simple animation that shows average  level of sound in last buffor. It also shows recording time at has 3 options. Settings where only setting is gain. But really it not adding any gain but gets more right 16 bits from microphone. (Microphone is giving 24 bit sample but recorder saves only 16 bits so I can ignore some bits from right or left to get different sound level). Other option is play/pause i don't think it's need explanation. And the last option is to end recording. It's only way to do this to avoid accidental stop. I've tested 3 diffrent microSD cards and noticed some things. One from Samsung doesn't want to work at SPI at all. One from "NoName" is working but it's too slow. Recording screen is visable lagging and final recording is also doing it. Best results I had with card form Netac that i have from Ender 3. For communication with SD Card I used FatFs from CUBEIDE with SPI driver from here : https://github.com/kiwih/cubeide-sd-card

Recording screen

Current consumption

It's will be powered from li-ion battery so current consumption is important thing.  When turned on it consumes around 12 mA depending on how many pixels on OLED are on. At recording this value is increased to 16-17 mA, but when saving to memory card there are current spikes up to 60 mA what can be seen on oscilloscope. When turned off, MCU consuption drops to ~2uA. Other things are disconnected from power by MOSFET. However in final form this value will increase due to consuption of LDO and battery protection circuit. I've achive that low current consuption of microcontroller by using standby sleep mode with RTC. Wake up by press of button is possible becouse pin of ok button is same as of one of system wake up pins.

Other

Main settings menu contains options to set time & date, initialize SD card and check free space on card. Icon "i" on main screen contains some informations like microphone type and firmware version however it's kind of random because i wanted icons to be squere and needed four options. Maybe in future it will be replaced with playback option.

Code: https://github.com/max7d3/STM32G030F6P6-Mini_WAV_Recorder

Showcase on YT: 

  • PCBs

    Maksym04/16/2022 at 17:45 0 comments

    I recently received PCBs for my project from JLCPCB (not sponsored :( but it's cheap anyway ). They were designed in KiCad and in my opinion turn out well, but it's just 2nd my PCB design for production so there is room improvment for sure.

    I'm soldered it using cheap soldering station and fine tip. A bit hard to solder was only the MCU and I damaged one PCB trace during this process, but the rest was really easy. I added display and microphone module after I programmed MCU.

    Then I checked if everything is working and mounted li-po battery and tp4056 charging module by double-sided tape on back.

    I choose battery with capacity of 550 mAh what should result in about 27 hours record time and 4 years of standby time (teoreticly).

    Driving "big" quartz with STM32

    I used not SMD version of crystal oscillator because at the time available SMD version prices in local shops were a joke. Its have high capacitance of probably 12.5pF (common value for this size I don't have datasheet) so according to documents from ST it require to change something called drive capability. But I don't getting it because, setting anything else than low cause RTC to not work. At low setting it's working but touching crystal with oscilloscope probe (or hand) cause it to stop working (RTC stops counting) and I'm not seeing anything on oscilloscope so signal must be really weak. If someone knows something more about this subject I will be grateful for comment.

    Anyway I set time and let it running. After one day I noticed that it's hurry by one second. Then another day and another second. STM32 RTC have calibration register so after some math by eye I set it to 34 and now it's one second late after 3 weeks so I hit good spot. 

    3D printed case and fail

    I designed case in Fusion 360 and print it on Ender 3 however I thought that it's looking too much like a brick and decided to design something less "bricky". Microphone breakout board was a big obstacle to this goal so I decided to desolder it, cut goldpins, and solder it on wires as flat as possible. I didn't wanted to move battery now so I done it from front. It was hard and irritating job to remove it and after that I noticed that goldpins were soldered from other side to microphone board too because I destroyed two traces. I tried to fix it but there was only very small point of copper just basiclly on microphone itself. I'm succesfully soldered thin wire to it and put evrything together but microphone was damaged. I'm don't know if it was too much heat but it's theoretically working but at max gain I must shout to be able to hear something on recording that is very deformed. Now I have to order new modules from China. So probably next and final update in 2 mounths at least. I could order it locally but I'm not really need that project (just for hobby and learning) so I don't want to pay over 400%.

View project log

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates