Walkie Talkie using STM32F103 and NRF24L01 - Page 1
Forum section: electronics / projects

author: Georgy.Moshkin
author_rank: Frequent Contributor
timestamp: November 15, 2024, 06:23:19 am
content: I have an idea for creating a walkie-talkie with some special features. I chose the STM32F103 and NRF24L01 mainly because I already have some experience with them. However, for the second version, I’d like to try something newer, like the NRF52832, or another chip that someone might recommend. Alternatively, I might downgrade to a cheaper STM32F030 and a lower-bitrate transceiver.The most important features are:1. Audio compression. I will stick to the lowest available bitrate for NRF24L01 (250kbps) and use my small compression algorithm2. Micro-SD card buffer to retry unsent audio messages when present. Replaying of received messages is not planned, need opinions3. Low noise audio without buzzing and hissing that is often present in Arduino walkie talkie-videos4. Rotary encoder and custom 0805 LED screen to select the channelAudio compression: I plan to use the lowest available bitrate for the NRF24L01 (250kbps) along with a custom compression algorithm.Micro-SD card buffer: This would allow for retrying unsent audio messages when a connection is available.Low-noise audio: I aim to eliminate the buzzing and hissing often found in Arduino-based walkie-talkie projects.Channel selection: A rotary encoder and a custom 0805 LED screen for selecting the channel.The main focus is on high audio quality and reliable message delivery, with no focus on security. I’m also considering using a stereo microphone and stereo audio when earphones are connected. My thought is that the human brain may be able to separate speech from environmental noise better with stereo signals. Stereo transmission could be an interesting feature, but I’m still unsure if it would provide a significant benefit.I plan to use the cheapest components available in stock at JLCPCB and will make the project files available so anyone can order it. I will also include a battery holder for an 18650 Li-ion cell and a USB-C port for charging. Do you think this project could be interesting and a good addition to an engineer’s portfolio?

author: brucehoult
author_rank: Super Contributor
timestamp: November 15, 2024, 06:58:26 am
content: Quote from: Georgy.Moshkin on November 15, 2024, 06:23:19 amUhh ... you do realise that 1980s uncompressed POTS voice channels were 64 kbps? Today, 5G networks commonly use between 12 kbps and 24 kbps for voice, but it can be as los as 5 kbps.Actually, typical bit rates really haven't changed from 2G to 3G to 4G to 5G, but the quality of codecs have improved a lot from the original GSM in the late 90s where you couldn't recognise people's voices. Early 2G GSM mostly used 13 kbps but could drop to 6.5 kbps on a congested network.250 kbps of compressed audio is HUGE. It's around DVD-quality audio.

author: Georgy.Moshkin
author_rank: Frequent Contributor
timestamp: November 15, 2024, 07:25:07 am
content: Quote from: brucehoult on November 15, 2024, 06:58:26 amThanks for these numbers! Not sure how low I can go on bitrate with my own algorithm, but these numbers are actually encouraging as I aim for LoRa or some extremely cheap/low bitrate transceiver chips. For now, I can skip NRF24L01 packets to simulate a lower bitrate radio channel or maybe implement some redundancy.

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 15, 2024, 07:52:56 am
content: I don't think a chip like the NRF52832 is a good fit for a walkie talkie. Why because it is Bluetooth and the distance it works on won't be very far. Original Bluetooth is specified for 10 meters, if I'm not mistaken.bruceholt has a very good point. Just for voice, which a walkie talkie is mainly about all you need is a frequency range up to 4kHz. So no need for high bitrates.Is it a good project for ones portfolio, sure if you get it working properly. I'm not familiar with the nRF24L01, but keep in mind that the 2.4GHz band is very occupied and that there may be a lot of interference lowering the quality of your transmission/reception. To avoid problems things like channel hopping comes to mind. Another issue is line of sight. If the remote walkie talkie is on the other side of a forest reception might be very poor.To find out more about this you might want to look into how RC transmitters and receivers deal with this. The 2.4GHz band is also used in this field and they keep planes and helicopters in the air.

author: brucehoult
author_rank: Super Contributor
timestamp: November 15, 2024, 09:05:08 am
content: Quote from: pcprogrammer on November 15, 2024, 07:52:56 amI was using them back in 2014 or so, as the most cost-effective wireless option at the time for adding to a microcontroller.They implement a UDP-like or I guess ethernet-like or Localtalk-like thing with a 3-5 byte ID of the receiving node, 9 bits of config (including 6 bit packet length, 2 bit rolling packet ID), up to 32 bytes of data, and a 2 byte CRC. You need to implement any higher level data format, flow control, retries etc yourself.Experience long ago showed that for live audio it is better to simply drop any corrupted data than to retransmit it. So it might be better to keep the compression independent in each packet.

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 15, 2024, 12:50:51 pm
content: Sounds similar to the way the nRF905 works. I'm using these in a RC project. Data rate is not as high though. Only 50kbps.

author: SiliconWizard
author_rank: Super Contributor
timestamp: November 15, 2024, 08:56:51 pm
content: Quote from: Georgy.Moshkin on November 15, 2024, 07:25:07 amForget about LoRa, it's not even about the bitrate, LoRa is not made for constantly hogging a channel, and thus is certainly not adapted to streaming audio in real-time. It's not a problem of data throughput, but that of allowed duty cycle.Even with a custom protocol on the same frequency bands, those bands (400/800/900) are heavily regulated (contrary to the 2.4GHz band that you can use any way you see fit, it just has power limits depending on context and country) and allow only a pretty small duty cycle.The nRF24L01(p) was a great chip, but it's now kind of obsolete. If this is a personal project with only a few prototypes made, that should be fine. Otherwise, yes, I'd suggest going for something else, and these days, standalone 2.4GHz RF chips like this have become a rarity. So most of what you can get is a SoC, a MCU with a RF frontend. Nordic has chips for that, you'll just need to invest time learning that.In terms of range, you'll likely need to add an RF amplifier if you want a decent range. There were nRF24L01p modules available with an onboard amplifier. A "naked" nRF24L01p with just an antenna will not get you very far. Probably just a couple tens of meters at the lowest bitrate.One can still find such modules from EBYTE :https://www.cdebyte.com/products/E01-ML01DP5(available on Amazon and others).

author: Georgy.Moshkin
author_rank: Frequent Contributor
timestamp: November 16, 2024, 09:18:39 am
content: I was looking into analog-output microphones. I found some with internal amplification, but it seems that the output still should be amplified. For example, WMM7037AT2"consists of an acoustic sensor, a low noise input buffer, and an output amplifier."https://www.lcsc.com/datasheet/lcsc_datasheet_1809191925_WILLSEMI-Will-Semicon-WMM7037AT2-4-TR_C140705.pdfBut after doing some calculations I am puzzled what output amplifier gain is.From the datasheet, sensitivity S = -42 dBV/Pa. If sound pressure level from the speech is SPL = 60dB, then1. Converting sensitivity to mV peak-to-peak per pascal (Pa):S_RMS = 10^(S/20)*10^3 = 7.9 mV RMS/PaConverting to mV p-p/PaS_PP=S_RMS*Sqrt(2)*2 = 22.5 mVpp/Pa2. Converting SPL to pascal (Pa):P = (20*10^-6)*10^(SPL/20) = 0.02 Pa3. Calculating peak-to-peak voltage of sinusoidal signal at microphone outputVpp = S_PP*P = 0.5 mVppIt's too low. For a 12-bit ADC with 3.3v reference voltage, single step is3.3v * 10^3 / 4096 = 0.8 mVIt needs additional 1000x to be properly digitized, which means need additional 20*Log10(1000) = 60dB gain?I've found some schematic where WMM7037AT2 is directly connected to a ES7210 audio codec ADC input. ES7210 datasheet says:"in mic application, PGA gain must be set at or above 21 dB". Therefore, this mic output indeed around 0.5 mVpp.I am not sure if adding an opamp between WMM7037AT2 and STM32F103 is a good choice, because it's +$3 extended part fee on JLCPCB.Update:No, all good - I found few opamps in basic parts!PDM microphones are not very suitable for STM32F103, considering I planned a downgrade. I2S are great if something like STM32F411 is used, with plenty of SAI/I2S ports. To minimize extended parts count I'll probably need to investigate transistor-based amplification.Quote from: SiliconWizard on November 15, 2024, 08:56:51 pmoops.. I've got it! ThanksIn such case, LoRa usage may be problematic even for a frequent text-only messaging?!

author: SiliconWizard
author_rank: Super Contributor
timestamp: November 16, 2024, 09:48:26 pm
content: Quote from: Georgy.Moshkin on November 16, 2024, 09:18:39 amIt would depend on how "frequent" it is and the duration of typical transactions. It's hard to tell without more details, but typical peer-to-peer text messaging should be plenty fine.Meshtastic uses LoRa.

author: Zipdox
author_rank: Regular Contributor
timestamp: November 19, 2024, 11:20:44 am
content: The STM32F030 series doesn't have I2S and it's absolutely anemic in terms of memory and processing power. Good luck pushing 250kbps though it also. The NRF52832 already is an SoC, you don't need another micro. I don't think Bluetooth is a good choice for a walkie-talkie though. I suggest just sticking with an ESP32, here's why:Two powerful 32-bit ARM cores with FPUWiFi (can be connectionless) and BluetoothTwo I2S peripheralsOpus encoding is possible4MB flashSPI, I2C, etcCheap (modules with crystal, flash, and antenna for $3)

author: ftg
author_rank: Frequent Contributor
timestamp: November 19, 2024, 11:28:21 am
content: Quote from: Georgy.Moshkin on November 16, 2024, 09:18:39 amPDM can just be low pass filtered to get analog audio, if that is desired.Quote from: Zipdox on November 19, 2024, 11:20:44 amThe STM32F030 does not need to sustain 250kbps, just that the audio needs to fit that. It will likely do 64kbps A-law or µ-law PCM fine as well as 32kbps ADPCM.ST even has an appnote about ADPCM on cheaper STM32's.I think NRF52832 still supports the classic ShockBurst stuff that NRF24L01 does.So the air interface is very simple and connectionless, so it could work for audio streams.

author: tszaboo
author_rank: Super Contributor
timestamp: November 19, 2024, 02:38:08 pm
content: Quote from: ftg on November 19, 2024, 11:28:21 amNot to mention those chips have I2S interface.I don't know how much it's supported, but maybe you don't even need to route the audio through the STM.

author: Georgy.Moshkin
author_rank: Frequent Contributor
timestamp: November 20, 2024, 10:31:33 am
content: Thanks for these insightful comments. A lot to think about. I've found an 8-pin chip that is compatible with nrf24l01 - Ci24R1. There is also a pin-to-pin compatible version starting with "Si", but I like the 8-pin more for having single-ended antenna output.

author: ftg
author_rank: Frequent Contributor
timestamp: November 20, 2024, 12:05:13 pm
content: That Ci24R1 chip looks delightfully cheap.Only 0.2517/pcs with MOQ of 5 on LCSC. I'll throw some on my next order for playing around.https://www.lcsc.com/product-detail/RF-Transceiver-ICs_Nanjing-Zhongke-Microelectronics-Ci24R1_C2909832.html2.4GHz from a SOIC-8 also tickles my funnybone, so I also want to see how it performs.Some of these compatible chips are only partly compatible with nRF24L01 libraries for example, so there might be surprises.The Si24r1 (and su24l01?) in particular has had people report that they work weirdly with nRF24L01 libraries, even if marketed as compatible.

author: tszaboo
author_rank: Super Contributor
timestamp: November 20, 2024, 03:28:21 pm
content: Quote from: ftg on November 20, 2024, 12:05:13 pmProbably exactly as bad as you think. The output matching is apparently a 0 Ohm resistor. Receiver sensitivity is -80dBm, which is about 15dB short of cutting edge. That's 30 times less range than a proper IC. Just place it in a toy, and flood the market with it, and place a China Export label on it.

author: SiliconWizard
author_rank: Super Contributor
timestamp: November 20, 2024, 09:54:41 pm
content: I didn't know about these cheap clones, the original nRF24L01+ being pretty cheap already, and while now obsolete, is still relatively easily available, so unless you are looking to design a product that's going to be produced unchanged for many years, this can still be a reasonable option. This clone (Ci24R1) doesn't look too good in terms of RF performance. Knowing that the nRF24L01+ was already not all that good in terms of range, at least naked (so without an external LNA and PA).As I mentioned, whichever you choose, you should definitely add a LNA+PA if you want to cover anything past 20-30m (at best).One good alternative would be the SX1280/1281. It's a current product, it has excellent performance, comes from a leader in this field (Semtech), and supports LoRA (yes, 2.4GHz LoRA), LFRC and GFSK. I'd suggest using the LFRC modulation for a walkie-talkie. It has no inherent duty cycle restriction and much higher throughput, while covering longer distances than GFSK (which is what the nRF24L01 uses.) The SX1280 has a range estimation feature, which can be handy, but if you don't care about that, the 1281 is a bit cheaper. Those are significantly more expensive than the former chips though, if that's a criterion. But they will kick the pants of almost anything else @2.4GHz currently. I am actually planning to evaluate the SX1280.

author: Georgy.Moshkin
author_rank: Frequent Contributor
timestamp: July 16, 2025, 03:26:57 pm
content: Continued work on the project - now building a component testbed PCB with three MEMS microphones, a CI24R1 transceiver, an SMD speaker, and a Schottky diode to test the 2.4GHz radar sensing idea (in addition to walkie talkie part). Attached image is Ci24R1 connected to a printed circular monopole antenna.

author: brucehoult
author_rank: Super Contributor
timestamp: July 16, 2025, 03:45:26 pm
content: In the time this post has been idle, WCH have released a chip that could be perfect for this, the CH570D which has a 100 MHz 32 bit CPU similar to STM32 with 16k RAM and 256k flash but RISC-V not Arm, and also has a 2.4 GHz packet radio (which is used for BLE in more expensive versions of the chip). The chip is supposed to be $0.10 in mass-production for the 8 pin version, around $0.20 for 20 pin. Those don't seem to be available yet, but dev boards are, including 3rd party ones:https://www.tindie.com/products/johnnywu/nanoch57x-development-boardhttps://www.aliexpress.com/item/1005009123215735.html

author: jnk0le
author_rank: Regular Contributor
timestamp: July 16, 2025, 07:54:07 pm
content: Quote from: ftg on November 20, 2024, 12:05:13 pmWhat is expected as 0dBm config (on nrf) is actually +4dBm on SI24R01. Which is, of course, unstable on those modules.It will also overload external PAs, typically used with those chips.Adding large caps usually solves the issue. You can also set a proper 0/-4dBm (for SI) config.There is also a thing with NOACK bit which is inverted on SI24 (and configurable on beken clones).

author: Georgy.Moshkin
author_rank: Frequent Contributor
timestamp: July 18, 2025, 05:14:46 pm
content: Quote from: jnk0le on July 16, 2025, 07:54:07 pmI start to worry a little bit. I've found some source code on baidu. I think it will help.Code:/***==============================================================================** CI24R1.C: -- by Dr. ZhuoQing, 2024-10-20****==============================================================================*///------------------------------------------------------------------------------//------------------------------------------------------------------------------unsigned char TR_ADDRESS = {0x0A,0x01,0x07,0x0E,0x01};//------------------------------------------------------------------------------unsigned char SPI_RD() {unsigned char bit_ctr,byte;OFF(SCK);IN(MOSI);ON(MOSI);for(bit_ctr=0; bit_ctr<8; bit_ctr++) {byte = byte << 1;ON(SCK);if(VAL(MOSI) == 1) {byte |= 0x01;}else {byte &= 0xfe;}OFF(SCK);}OFF(SCK);return byte;}void SPI_WT(unsigned char byte) {unsigned char bit_ctr;OUT(MOSI);OFF(SCK);for(bit_ctr=0; bit_ctr<8; bit_ctr++) {OFF(SCK);if(byte&0x80){ON(MOSI);} else {OFF(MOSI);}ON(SCK);byte=byte<<1;}OFF(SCK);}//------------------------------------------------------------------------------void CI24R1_Init(void) {OFF(CSN);ON(CSN);OFF(SCK);OFF(CSN);SPI_WT(SELSPI);ON(CSN);}unsigned char CI24R1_Write_Reg(unsigned char reg, unsigned char value){OFF(CSN);SPI_WT(reg);SPI_WT(value);ON(CSN);return 0;}//------------------------------------------------------------------------------unsigned char CI24R1_Write_Buf(unsigned char reg, unsigned char *pBuf, unsigned char bytes) {unsigned char byte_ctr;OFF(CSN);SPI_WT(reg);for(byte_ctr=0; byte_ctr<bytes; byte_ctr++) {SPI_WT(*pBuf++);}ON(CSN);return 0;}unsigned char CI24R1_Read_Reg(unsigned char reg) {unsigned char value;OFF(CSN);SPI_WT(reg);value = SPI_RD();ON(CSN);return value;}unsigned char CI24R1_Read_Buf(unsigned char reg, unsigned char *pBuf, unsigned char bytes) {unsigned char byte_ctr;OFF(CSN);SPI_WT(reg);for(byte_ctr=0;byte_ctr<bytes;byte_ctr++) {pBuf = SPI_RD();}ON(CSN);return 0;}void CI24R1_RX_Mode(void) {CI24R1_Write_Reg(CE_OFF,0xff);CI24R1_Write_Buf(WRITE_REG_CMD + RX_ADDR_P0, TR_ADDRESS, TR_ADR_WIDTH);CI24R1_Write_Reg(WRITE_REG_CMD + SETUP_AW, 0x02);CI24R1_Write_Reg(WRITE_REG_CMD + EN_AA, 0x01);CI24R1_Write_Reg(WRITE_REG_CMD + EN_RXADDR, 0x01);CI24R1_Write_Reg(WRITE_REG_CMD + FEATURE, 0x01);CI24R1_Write_Reg(WRITE_REG_CMD + RF_CH, 40);CI24R1_Write_Reg(WRITE_REG_CMD + RX_PW_P0, TR_PLOAD_WIDTH);CI24R1_Write_Reg(WRITE_REG_CMD + RF_SETUP, 0x0f); // 0x0fCI24R1_Write_Reg(WRITE_REG_CMD + CONFIG, 0x0f);CI24R1_Write_Reg(WRITE_REG_CMD + 0x02,0x01);CI24R1_Write_Reg(WRITE_REG_CMD + 0x01,0x81);CI24R1_Write_Reg(WRITE_REG_CMD + 0x0f,0xA0);CI24R1_Write_Reg(CE_ON,0xff);}void CI24R1_TX_Mode(void) {CI24R1_Write_Reg(CE_OFF,0xff);CI24R1_Write_Reg(WRITE_REG_CMD + SETUP_AW, 0x02);CI24R1_Write_Buf(WRITE_REG_CMD + TX_ADDR, (unsigned char *)TR_ADDRESS, TR_ADR_WIDTH);CI24R1_Write_Buf(WRITE_REG_CMD + RX_ADDR_P0, TR_ADDRESS, TR_ADR_WIDTH);CI24R1_Write_Reg(WRITE_REG_CMD + EN_AA, 0x01);CI24R1_Write_Reg(WRITE_REG_CMD + EN_RXADDR, 0x01);CI24R1_Write_Reg(WRITE_REG_CMD + FEATURE, 0x01);//CI24R1_Write_Reg(WRITE_REG_CMD + SETUP_RETR, 0x0a);CI24R1_Write_Reg(WRITE_REG_CMD + 0x02,0X01);CI24R1_Write_Reg(WRITE_REG_CMD + 0x01,0X81);CI24R1_Write_Reg(WRITE_REG_CMD + 0x0f,0XA0);CI24R1_Write_Reg(WRITE_REG_CMD + RF_CH, 40);CI24R1_Write_Reg(WRITE_REG_CMD + RF_SETUP, 0x0f);CI24R1_Write_Reg(WRITE_REG_CMD + CONFIG, 0x5e);}//------------------------------------------------------------------------------unsigned char CI24R1_RxPacket(unsigned char *rxbuf) {unsigned char state;OFF(CSN);SPI_WT(SELSPI);ON(CSN);state = CI24R1_Read_Reg(STATUS);CI24R1_Write_Reg(WRITE_REG_CMD+STATUS,state);if(state & RX_DR) {while((state&RX_P_NO)!=0x0e) {CI24R1_Read_Buf(RD_RX_PLOAD,rxbuf,TR_PLOAD_WIDTH);state=CI24R1_Read_Reg(WRITE_REG_CMD+STATUS);}CI24R1_Write_Reg(FLUSH_RX,0xff);return 0;}return 1;}unsigned char CI24R1_TxPacket(unsigned char *txbuf) {unsigned char state;CI24R1_Write_Reg(CE_OFF,0xff);CI24R1_Write_Buf(W_TX_PAYLOAD_NOACK,txbuf,TR_PLOAD_WIDTH);CI24R1_Write_Reg(CE_ON,0xff);WaitTime(20);OFF(CSN);SPI_WT(SELIRQ);ON(CSN);CI24R1_Read_Reg(READ_REG_CMD+STATUS);// while(IRQ != 0);OFF(CSN);SPI_WT(SELSPI);ON(CSN);state = CI24R1_Read_Reg(READ_REG_CMD+STATUS);CI24R1_Write_Reg(WRITE_REG_CMD+STATUS, state);if(state&MAX_RT) {CI24R1_Write_Reg(FLUSH_TX,0xff);return MAX_RT;}if(state&TX_DS) {return TX_DS;}return 0xFF; //¡¤¡é?¨ª¨º¡ì¡ã¨¹}//==============================================================================// END OF FILE : CI24R1.C//------------------------------------------------------------------------------Could not find full version of this project though. But there is more on CSDN.Today I've realized that CI24R1 has half-duplex SPI which I don't like. But I think it will work

author: Georgy.Moshkin
author_rank: Frequent Contributor
timestamp: August 01, 2025, 11:05:13 am
content: Boards arrived last week, and I've already tested the microphones and SMD speaker!1. The speaker doesn’t sound as loud as my smartphone. I expected a little more output. I’m thinking of measuring the driving waveform range with the scope2. Was able to stream 3 MEMS microphone sounds at 15.87kHz to the computer through STM32F103C8T6 UART port. At 921600bps 921600/3/2=15.36kHz the throughput was not enough. After changing to 1.000.000bps I finally saw three waveforms with no distortions. Interestingly, one of the microphones is extremely sensitive to moving fingers - perhaps indicating a good low frequency response? Going to record a video on this.3. Next step is to test 2.4GHz transceiver and configure it in "test tone" mode, and record output from diode mixer.Here is a video of SMD speaker preliminary test:https://youtu.be/Yit-br4a6Hg?si=h6HeFxLdYbH8z2DW&t=84EDIT:Microphone testing video:https://youtu.be/xjfe_f64ccM