Raspberry Pi Internet Radio Over FM Radio via i2c fm adafruit

View previous topic View next topic Go down

Raspberry Pi Internet Radio Over FM Radio via i2c fm adafruit

Post by jamied_uk on 4th August 2015, 18:57

https://youtu.be/XXMf7mScJtc




http://makezine.com/projects/rebroadcast-internet-radio-raspberry-pi


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Now SSH back into the Pi, and run: sudo git clone git://github.com/electrodog10/Internet-Radio-Rebroadcaster



When you find an open frequency, write it down.
Now on the Raspberry Pi we need to edit the Radio python file so it will broadcast on our new frequency.
Type cd Internet-Radio-Rebroadcaster to open the directory for this project.
Now type sudo nano radio.py to edit the Python file.
In that file find the line that says FMSTATION = 10230
Change 10230 to the open frequency you wrote down earlier. Remember that 10230 is in 10KHz. For example, 101.1 MHz is written as 10110.
Now (cntrl) X and then type "Y" to save the document.

Cut at least three jumper wires in half (more if you color code your wires like me) and strip the end off of the wire end.
Solder a wire to the RST, SCL, SDA, GND, and Vin pins on the FM transmitter.
Solder a long piece of 18 gauge wire to the ANT pin on the transmitter. This wire will act as our antenna.
Now connect the RST pin on the FM transmitter board to Pin 7 (GPIO 4) on the Raspberry Pi.
Connect the SCL pin on the FM transmitter board to pin 5 (GPIO 3) on the Raspberry Pi.
Connect the SDA pin on the transmitter to pin 3 (GPIO 2) on the Raspberry Pi.
Connect the Vin pin on the transmitter to one of the 5V pins on the Raspberry Pi such as pin 2.
Connect the GND pin on the transmitter to one of the GND pins on the Raspberry Pi such as pin 6.
Finally connect a 3.5mm audio cable between the audio out jack on the Raspberry Pi and the audio in jack on the FM transmitter.
You can find a helpful pinout for the Raspberry Pi GPIO_Pi2.png



Now we need to enable I2C on the Raspberry Pi.
To start off, we need to install the required I2C libraries. sudo apt-get install python-smbus and when that is done installing sudo apt-get install i2c-tools
Now type:sudo raspi-config and select Advanced Options.
Then select I2C and answer "Yes" to all the questions.
Now select "Finish" on the bottom and answer "Yes" to the reboot question.
When the Pi reboots use nano to edit the following file: sudo nano /etc/modules
If the lines don't already exist, add the following lines to the end of the code: i2c-bcm2708 i2c-dev
Save that file with Control-X Y and then open sudo nano /etc/modprobe.d/raspi-blacklist.conf
If that file is blank, then do nothing with it. If it does, comment out (put a # in front of the line) blacklist spi-bcm2708 blacklist i2c-bcm2708
Now edit boot configuration file: sudo nano /boot/config.txt and add the following lines: dtparam=i2c1=on dtparam=i2c_arm=on
Finally reboot the Pi with sudo reboot


It's easy to find an internet radio stream.

http://www.iheart.com/live/1040-who-925/?autoplay=true&pname=1165&campid=play_bar&cid=main.html



Now right click on the page and view the page source.
In the HTML code for the website, you should find the stream url. It should be in shoutcast format or .m3u8. The stream should be in this format hls_stream":"http://playlists.ihrhls.com/c1/925/playlist.m3u8"}
You can find out more about finding internet radio streams here.
To check and see if a radio station stream works, you can check it with VLC on your computer (or on the Raspberry Pi in desktop mode).


Now we need to edit the Crontab and make our project start at boot and add our internet radio stream.
First type sudo crontab -e
Then go to the bottom of the document and add the following line @reboot sleep 10 && sudo omxplayer STREAMURL
Replace STREAMURL with the stream URL of your internet radio station you want to rebroadcast. This is the line you need to change if you ever want to change the internet radio stream you are rebroadcasting. In my experience, I found that Shoutcast streams worked best.
Now add the following line after the line we just created: @reboot sudo python2 /home/pi/Internet-Radio-Rebroadcaster/radio.py
Now Control-X to save and answer Y to save the document.



allĀ  done just tune into that freq and test!
Attachments
Internet_to_Radio_using_i2c_and_adafruit_fm.zip You don't have permission to download attachments.(99 Kb) Downloaded 0 times
avatar
jamied_uk
Admin

Posts : 1986
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum