FM receiver with RDA5807 (RRD-102)

Place code snippets and demo code here
Post Reply
User avatar
Fernando Perez
Posts: 378
Joined: Mon Feb 15, 2021 10:09 pm
Location: Santander (Spain)
Has thanked: 195 times
Been thanked: 267 times

FM receiver with RDA5807 (RRD-102)

Post by Fernando Perez »

I have managed to control a very small module that years ago I kept in the workshop, without daring to use it, given the baroque Arduino libraries about it.

Image

This program is the most basic to tune in and start a station with a known frequency and at a fixed volume (but programmable when configuring).
May the purists excuse me for my inelegant use of logical operators, but the truth is that I have not mastered them.
I think I'm going around too much: Can someone simplify my code?

Code: [Local Link Removed for Guests]

' RDA5807 FM Radio tuner
i2c.setup 4, 5
address = &H11  ' I2C device address
ioBuff.dim(0,4) = &HD0, &H01, &H08, &H86

' init RDA5807
i2c.write_ioBuff(0, 0, 2), address, &H02
i2c.write_ioBuff(0, 2, 2), address, &H05

' ************  DEMO  ******************
while 1
  tuneIn  93.00
  wlog "RNE 2 Clasica"
  pause 15000

  tuneIn 102.90
  wlog "RNE 3"
  pause 15000

  tuneIn 96.90
  wlog "RNE 1"
  pause 15000

  tuneIn 105.00
  wlog "Radio 5 Todo Noticias"
  pause 15000
wend
  
END

' --------------------------------------------
SUB tuneIn(frequency)
LOCAL channel, hightByte, lowByte
  channel = ((frequency * 100) - 8700) / 10
  hightByte = channel >> 2
  lowByte = (channel << 6) OR &H10
  lowByte = lowByte AND &HFF
  
  ioBuff.dim(1, 2) = hightByte, lowByte
  i2c.write_ioBuff(1), address, &H03
END SUB
https://youtu.be/USu6ShdkLx4

Documentation:
https://myrapidq.it/public/RDA5807 Register.pdf
https://myrapidq.it/public/RDA5807MP datasheet.pdf

I edit to tell you an anecdote: When I was recording the video, when I changed the station a song came on. Upon uploading it to YouTube, in a matter of seconds I received an email from them, informing me that due to copyright protection, my video has been blocked in Belarus and Russia.
Last edited by Fernando Perez on Wed Dec 07, 2022 9:20 pm, edited 1 time in total.
User avatar
cicciocb
Site Admin
Posts: 1899
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 407 times
Been thanked: 1269 times
Contact:

Re: FM receiver with RDA5807 (RRD-102)

Post by cicciocb »

Thanks Fernando,
I remember that bugs did something similar some years ago
User avatar
Fernando Perez
Posts: 378
Joined: Mon Feb 15, 2021 10:09 pm
Location: Santander (Spain)
Has thanked: 195 times
Been thanked: 267 times

Re: FM receiver with RDA5807 (RRD-102)

Post by Fernando Perez »

In the old forum?

Located. I see that I am reinventing the wheel, but I have had a good time doing it.

https://groups.google.com/g/annex_wifi_ ... Jx-dcYAwAJ
https://groups.google.com/g/annex_wifi_ ... P_T1gqBAAJ
Last edited by Fernando Perez on Wed Dec 07, 2022 12:51 pm, edited 1 time in total.
User avatar
cicciocb
Site Admin
Posts: 1899
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 407 times
Been thanked: 1269 times
Contact:

Re: FM receiver with RDA5807 (RRD-102)

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Wed Dec 07, 2022 12:45 pm In the old forum?
I don't remember, yes, probably
Post Reply